From 02b2b98fff42f45f2028cd8c0a1e67ab2d08f478 Mon Sep 17 00:00:00 2001 From: Ryan Yanulites Date: Thu, 10 Jul 2025 16:43:45 -0600 Subject: [PATCH 001/137] initial sql queries and client and test stubs --- service/integration/obligations_test.go | 123 ++++++++++++++++++++++ service/policy/db/obligations.go | 30 ++++++ service/policy/db/queries/obligations.sql | 66 ++++++++++++ 3 files changed, 219 insertions(+) create mode 100644 service/integration/obligations_test.go create mode 100644 service/policy/db/obligations.go create mode 100644 service/policy/db/queries/obligations.sql diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go new file mode 100644 index 0000000000..24fbfedb41 --- /dev/null +++ b/service/integration/obligations_test.go @@ -0,0 +1,123 @@ +package integration + +import ( + "context" + "log/slog" + "testing" + + "github.com/opentdf/platform/service/internal/fixtures" + "github.com/stretchr/testify/suite" +) + +type ObligationsSuite struct { + suite.Suite + f fixtures.Fixtures + db fixtures.DBInterface + ctx context.Context +} + +func (s *ObligationsSuite) SetupSuite() { + slog.Info("setting up db.Obligations test suite") + s.ctx = context.Background() + c := *Config + c.DB.Schema = "test_opentdf_obligations" + s.db = fixtures.NewDBInterface(c) + s.f = fixtures.NewFixture(s.db) + s.f.Provision() +} + +func (s *ObligationsSuite) TearDownSuite() { + slog.Info("tearing down db.Obligations test suite") + s.f.TearDown() +} + +func TestObligationsSuite(t *testing.T) { + if testing.Short() { + t.Skip("skipping obligations integration test") + } + suite.Run(t, new(ObligationsSuite)) +} + +/// +/// Obligation Definitions +/// + +// Create + +func (s *ObligationsSuite) Test_CreateObligationDefinition_Succeeds() { + // tcs: + // - create obligation definition with valid namespace_id and name + // - create with values and possibly triggers and fulfillers? + + s.T().Skip("obligation_definitions table not implemented yet") +} + +func (s *ObligationsSuite) Test_CreateObligationDefinition_Fails() { + // tcs: + // - create obligation definition with invalid namespace_id + // - create obligation definition with non-unique namespace_id/name pair + + s.T().Skip("obligation_definitions table not implemented yet") +} + +// Get + +func (s *ObligationsSuite) Test_GetObligationDefinition_Succeeds() { + // tcs: + // - get obligation definition by valid id + // - get obligation definition by valid name + + s.T().Skip("obligation_definitions table not implemented yet") +} + +func (s *ObligationsSuite) Test_GetObligationDefinition_Fails() { + // tcs: + // - get obligation definition by invalid id + // - get obligation definition by invalid name + + s.T().Skip("obligation_definitions table not implemented yet") +} + +// List + +func (s *ObligationsSuite) Test_ListObligationDefinitions_Succeeds() { + // tcs: see registered resources + + s.T().Skip("obligation_definitions table not implemented yet") +} + +func (s *ObligationsSuite) Test_ListObligationDefinitions_Fails() { + // tcs: see registered resources + + s.T().Skip("obligation_definitions table not implemented yet") +} + +// Update + +func (s *ObligationsSuite) Test_UpdateObligationDefinitions_Succeeds() { + // tcs: see registered resources + + s.T().Skip("obligation_definitions table not implemented yet") +} + +func (s *ObligationsSuite) Test_UpdateObligationDefinitions_Fails() { + // tcs: see registered resources + + s.T().Skip("obligation_definitions table not implemented yet") +} + +// Delete + +func (s *ObligationsSuite) Test_DeleteObligationDefinition_Succeeds() { + // tcs: + // - delete by id and ensure cascade removes children relationships + + s.T().Skip("obligation_definitions table not implemented yet") +} + +func (s *ObligationsSuite) Test_DeleteObligationDefinition_Fails() { + // tcs: + // - delete by invalid id + + s.T().Skip("obligation_definitions table not implemented yet") +} diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go new file mode 100644 index 0000000000..f85689c1ec --- /dev/null +++ b/service/policy/db/obligations.go @@ -0,0 +1,30 @@ +package db + +import ( + "context" + "errors" +) + +/// +/// Obligation Definitions +/// + +func (c PolicyDBClient) CreateObligation(ctx context.Context, r any) (any, error) { + return nil, errors.New("CreateObligation is not implemented in PolicyDBClient") +} + +func (c PolicyDBClient) GetObligationDefinition(ctx context.Context) (any, error) { + return nil, errors.New("GetObligationDefinition is not implemented in PolicyDBClient") +} + +func (c PolicyDBClient) ListObligationDefinitions(ctx context.Context) (any, error) { + return nil, errors.New("ListObligationDefinitions is not implemented in PolicyDBClient") +} + +func (c PolicyDBClient) UpdateObligationDefinitions(ctx context.Context) (any, error) { + return nil, errors.New("UpdateObligationDefinitions is not implemented in PolicyDBClient") +} + +func (c PolicyDBClient) DeleteObligationDefinition(ctx context.Context, id string) (any, error) { + return nil, errors.New("DeleteObligationDefinition is not implemented in PolicyDBClient") +} diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql new file mode 100644 index 0000000000..dbf16b3afa --- /dev/null +++ b/service/policy/db/queries/obligations.sql @@ -0,0 +1,66 @@ +---------------------------------------------------------------- +-- OBLIGATIONS +---------------------------------------------------------------- + +-- name: createObligationDefinition :one +INSERT INTO obligation_definitions (namespace_id, name) +VALUES ($1, $2) +RETURNING id; + +-- name: getObligationDefinition :one +SELECT + od.id, + od.name, + -- todo: prob return this as a JSON object + od.namespace_id, + JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', od.metadata -> 'labels', 'created_at', od.created_at,'updated_at', od.updated_at)) as metadata, + JSON_AGG( + JSON_BUILD_OBJECT( + 'id', ov.id, + 'value', ov.value + ) + ) FILTER (WHERE ov.id IS NOT NULL) as values + -- todo: add triggers and fulfillers +FROM obligation_definitions od +LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id +WHERE + (NULLIF(@id, '') IS NULL OR id = @id::UUID) AND + (NULLIF(@name, '') IS NULL OR name = @name::VARCHAR); + +-- name: listObligationDefinitions :many +WITH counted AS ( + SELECT COUNT(id) AS total + FROM obligation_definitions +) +SELECT + od.id, + od.name, + -- todo: prob return this as a JSON object + od.namespace_id, + JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', od.metadata -> 'labels', 'created_at', od.created_at,'updated_at', od.updated_at)) as metadata, + JSON_AGG( + JSON_BUILD_OBJECT( + 'id', ov.id, + 'value', ov.value + ) + ) FILTER (WHERE ov.id IS NOT NULL) as values + -- todo: add triggers and fulfillers + counted.total +FROM obligation_definitions od +CROSS JOIN counted +LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id +WHERE + (NULLIF(@namespace_id, '') IS NULL OR od.namespace_id = @namespace_id::UUID) +GROUP BY od.id, counted.total +LIMIT @limit_ +OFFSET @offset_; + +-- name: updateObligationDefinition :execrows +UPDATE obligation_definitions +SET + name = COALESCE(sqlc.narg('name'), name), + metadata = COALESCE(sqlc.narg('metadata'), metadata) +WHERE id = $1; + +-- name: deleteObligationDefinition :execrows +DELETE FROM obligation_definitions WHERE id = $1; From 804651da8cf6422cdbd2e2391f241a3227b62038 Mon Sep 17 00:00:00 2001 From: Ryan Yanulites Date: Mon, 21 Jul 2025 11:04:59 -0600 Subject: [PATCH 002/137] fix bugs in sql queries --- service/policy/db/models.go | 37 ++++ service/policy/db/obligations.sql.go | 249 ++++++++++++++++++++++ service/policy/db/queries/obligations.sql | 6 +- 3 files changed, 289 insertions(+), 3 deletions(-) create mode 100644 service/policy/db/obligations.sql.go diff --git a/service/policy/db/models.go b/service/policy/db/models.go index d3342262cd..031d1c984a 100644 --- a/service/policy/db/models.go +++ b/service/policy/db/models.go @@ -275,6 +275,43 @@ type KeyAccessServerKey struct { KeyAccessServerID string `json:"key_access_server_id"` } +type ObligationDefinition struct { + ID string `json:"id"` + NamespaceID string `json:"namespace_id"` + Name string `json:"name"` + Metadata []byte `json:"metadata"` + CreatedAt pgtype.Timestamptz `json:"created_at"` + UpdatedAt pgtype.Timestamptz `json:"updated_at"` +} + +type ObligationFulfiller struct { + ID string `json:"id"` + ObligationValueID string `json:"obligation_value_id"` + Conditionals []byte `json:"conditionals"` + Metadata []byte `json:"metadata"` + CreatedAt pgtype.Timestamptz `json:"created_at"` + UpdatedAt pgtype.Timestamptz `json:"updated_at"` +} + +type ObligationTrigger struct { + ID string `json:"id"` + ObligationValueID string `json:"obligation_value_id"` + ActionID string `json:"action_id"` + AttributeValueID string `json:"attribute_value_id"` + Metadata []byte `json:"metadata"` + CreatedAt pgtype.Timestamptz `json:"created_at"` + UpdatedAt pgtype.Timestamptz `json:"updated_at"` +} + +type ObligationValuesStandard struct { + ID string `json:"id"` + ObligationDefinitionID string `json:"obligation_definition_id"` + Value string `json:"value"` + Metadata []byte `json:"metadata"` + CreatedAt pgtype.Timestamptz `json:"created_at"` + UpdatedAt pgtype.Timestamptz `json:"updated_at"` +} + // Table to store key provider configurations type ProviderConfig struct { // Unique identifier for the provider configuration diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go new file mode 100644 index 0000000000..b78f176536 --- /dev/null +++ b/service/policy/db/obligations.sql.go @@ -0,0 +1,249 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: obligations.sql + +package db + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const createObligationDefinition = `-- name: createObligationDefinition :one + +INSERT INTO obligation_definitions (namespace_id, name, metadata) +VALUES ($1, $2, $3) +RETURNING id +` + +type createObligationDefinitionParams struct { + NamespaceID string `json:"namespace_id"` + Name string `json:"name"` + Metadata []byte `json:"metadata"` +} + +// -------------------------------------------------------------- +// OBLIGATIONS +// -------------------------------------------------------------- +// +// INSERT INTO obligation_definitions (namespace_id, name, metadata) +// VALUES ($1, $2, $3) +// RETURNING id +func (q *Queries) createObligationDefinition(ctx context.Context, arg createObligationDefinitionParams) (string, error) { + row := q.db.QueryRow(ctx, createObligationDefinition, arg.NamespaceID, arg.Name, arg.Metadata) + var id string + err := row.Scan(&id) + return id, err +} + +const deleteObligationDefinition = `-- name: deleteObligationDefinition :execrows +DELETE FROM obligation_definitions WHERE id = $1 +` + +// deleteObligationDefinition +// +// DELETE FROM obligation_definitions WHERE id = $1 +func (q *Queries) deleteObligationDefinition(ctx context.Context, id string) (int64, error) { + result, err := q.db.Exec(ctx, deleteObligationDefinition, id) + if err != nil { + return 0, err + } + return result.RowsAffected(), nil +} + +const getObligationDefinition = `-- name: getObligationDefinition :one +SELECT + od.id, + od.name, + -- todo: prob return this as a JSON object + od.namespace_id, + JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', od.metadata -> 'labels', 'created_at', od.created_at,'updated_at', od.updated_at)) as metadata, + JSON_AGG( + JSON_BUILD_OBJECT( + 'id', ov.id, + 'value', ov.value + ) + ) FILTER (WHERE ov.id IS NOT NULL) as values + -- todo: add triggers and fulfillers +FROM obligation_definitions od +LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id +WHERE + (NULLIF($1, '') IS NULL OR id = $1::UUID) AND + (NULLIF($2, '') IS NULL OR name = $2::VARCHAR) +` + +type getObligationDefinitionParams struct { + ID interface{} `json:"id"` + Name interface{} `json:"name"` +} + +type getObligationDefinitionRow struct { + ID string `json:"id"` + Name string `json:"name"` + NamespaceID string `json:"namespace_id"` + Metadata []byte `json:"metadata"` + Values []byte `json:"values"` +} + +// getObligationDefinition +// +// SELECT +// od.id, +// od.name, +// -- todo: prob return this as a JSON object +// od.namespace_id, +// JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', od.metadata -> 'labels', 'created_at', od.created_at,'updated_at', od.updated_at)) as metadata, +// JSON_AGG( +// JSON_BUILD_OBJECT( +// 'id', ov.id, +// 'value', ov.value +// ) +// ) FILTER (WHERE ov.id IS NOT NULL) as values +// -- todo: add triggers and fulfillers +// FROM obligation_definitions od +// LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id +// WHERE +// (NULLIF($1, '') IS NULL OR id = $1::UUID) AND +// (NULLIF($2, '') IS NULL OR name = $2::VARCHAR) +func (q *Queries) getObligationDefinition(ctx context.Context, arg getObligationDefinitionParams) (getObligationDefinitionRow, error) { + row := q.db.QueryRow(ctx, getObligationDefinition, arg.ID, arg.Name) + var i getObligationDefinitionRow + err := row.Scan( + &i.ID, + &i.Name, + &i.NamespaceID, + &i.Metadata, + &i.Values, + ) + return i, err +} + +const listObligationDefinitions = `-- name: listObligationDefinitions :many +WITH counted AS ( + SELECT COUNT(id) AS total + FROM obligation_definitions +) +SELECT + od.id, + od.name, + -- todo: prob return this as a JSON object + od.namespace_id, + JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', od.metadata -> 'labels', 'created_at', od.created_at,'updated_at', od.updated_at)) as metadata, + JSON_AGG( + JSON_BUILD_OBJECT( + 'id', ov.id, + 'value', ov.value + ) + ) FILTER (WHERE ov.id IS NOT NULL) as values, + -- todo: add triggers and fulfillers + counted.total +FROM obligation_definitions od +CROSS JOIN counted +LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id +WHERE + (NULLIF($1, '') IS NULL OR od.namespace_id = $1::UUID) +GROUP BY od.id, counted.total +LIMIT $3 +OFFSET $2 +` + +type listObligationDefinitionsParams struct { + NamespaceID interface{} `json:"namespace_id"` + Offset int32 `json:"offset_"` + Limit int32 `json:"limit_"` +} + +type listObligationDefinitionsRow struct { + ID string `json:"id"` + Name string `json:"name"` + NamespaceID string `json:"namespace_id"` + Metadata []byte `json:"metadata"` + Values []byte `json:"values"` + Total int64 `json:"total"` +} + +// listObligationDefinitions +// +// WITH counted AS ( +// SELECT COUNT(id) AS total +// FROM obligation_definitions +// ) +// SELECT +// od.id, +// od.name, +// -- todo: prob return this as a JSON object +// od.namespace_id, +// JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', od.metadata -> 'labels', 'created_at', od.created_at,'updated_at', od.updated_at)) as metadata, +// JSON_AGG( +// JSON_BUILD_OBJECT( +// 'id', ov.id, +// 'value', ov.value +// ) +// ) FILTER (WHERE ov.id IS NOT NULL) as values, +// -- todo: add triggers and fulfillers +// counted.total +// FROM obligation_definitions od +// CROSS JOIN counted +// LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id +// WHERE +// (NULLIF($1, '') IS NULL OR od.namespace_id = $1::UUID) +// GROUP BY od.id, counted.total +// LIMIT $3 +// OFFSET $2 +func (q *Queries) listObligationDefinitions(ctx context.Context, arg listObligationDefinitionsParams) ([]listObligationDefinitionsRow, error) { + rows, err := q.db.Query(ctx, listObligationDefinitions, arg.NamespaceID, arg.Offset, arg.Limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []listObligationDefinitionsRow + for rows.Next() { + var i listObligationDefinitionsRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.NamespaceID, + &i.Metadata, + &i.Values, + &i.Total, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const updateObligationDefinition = `-- name: updateObligationDefinition :execrows +UPDATE obligation_definitions +SET + name = COALESCE($2, name), + metadata = COALESCE($3, metadata) +WHERE id = $1 +` + +type updateObligationDefinitionParams struct { + ID string `json:"id"` + Name pgtype.Text `json:"name"` + Metadata []byte `json:"metadata"` +} + +// updateObligationDefinition +// +// UPDATE obligation_definitions +// SET +// name = COALESCE($2, name), +// metadata = COALESCE($3, metadata) +// WHERE id = $1 +func (q *Queries) updateObligationDefinition(ctx context.Context, arg updateObligationDefinitionParams) (int64, error) { + result, err := q.db.Exec(ctx, updateObligationDefinition, arg.ID, arg.Name, arg.Metadata) + if err != nil { + return 0, err + } + return result.RowsAffected(), nil +} diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index dbf16b3afa..e0a9902ffd 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -3,8 +3,8 @@ ---------------------------------------------------------------- -- name: createObligationDefinition :one -INSERT INTO obligation_definitions (namespace_id, name) -VALUES ($1, $2) +INSERT INTO obligation_definitions (namespace_id, name, metadata) +VALUES ($1, $2, $3) RETURNING id; -- name: getObligationDefinition :one @@ -43,7 +43,7 @@ SELECT 'id', ov.id, 'value', ov.value ) - ) FILTER (WHERE ov.id IS NOT NULL) as values + ) FILTER (WHERE ov.id IS NOT NULL) as values, -- todo: add triggers and fulfillers counted.total FROM obligation_definitions od From ad0fc20dbb9573cc686817500b36bb8870adfc62 Mon Sep 17 00:00:00 2001 From: Ryan Yanulites Date: Mon, 21 Jul 2025 11:09:21 -0600 Subject: [PATCH 003/137] add missing group by --- service/policy/db/obligations.sql.go | 2 ++ service/policy/db/queries/obligations.sql | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index b78f176536..8dd8213f58 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -72,6 +72,7 @@ LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id WHERE (NULLIF($1, '') IS NULL OR id = $1::UUID) AND (NULLIF($2, '') IS NULL OR name = $2::VARCHAR) +GROUP BY od.id ` type getObligationDefinitionParams struct { @@ -107,6 +108,7 @@ type getObligationDefinitionRow struct { // WHERE // (NULLIF($1, '') IS NULL OR id = $1::UUID) AND // (NULLIF($2, '') IS NULL OR name = $2::VARCHAR) +// GROUP BY od.id func (q *Queries) getObligationDefinition(ctx context.Context, arg getObligationDefinitionParams) (getObligationDefinitionRow, error) { row := q.db.QueryRow(ctx, getObligationDefinition, arg.ID, arg.Name) var i getObligationDefinitionRow diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index e0a9902ffd..cee779e39c 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -25,7 +25,8 @@ FROM obligation_definitions od LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id WHERE (NULLIF(@id, '') IS NULL OR id = @id::UUID) AND - (NULLIF(@name, '') IS NULL OR name = @name::VARCHAR); + (NULLIF(@name, '') IS NULL OR name = @name::VARCHAR) +GROUP BY od.id; -- name: listObligationDefinitions :many WITH counted AS ( From db8dcb85cf99c68ed2af54176ca1153bc056eda2 Mon Sep 17 00:00:00 2001 From: Ryan Yanulites Date: Mon, 21 Jul 2025 11:59:20 -0600 Subject: [PATCH 004/137] more query updates --- service/policy/db/obligations.sql.go | 109 +++++++++++++--------- service/policy/db/queries/obligations.sql | 36 ++++--- 2 files changed, 85 insertions(+), 60 deletions(-) diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 8dd8213f58..8553df4e03 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -57,35 +57,41 @@ const getObligationDefinition = `-- name: getObligationDefinition :one SELECT od.id, od.name, - -- todo: prob return this as a JSON object - od.namespace_id, + JSON_BUILD_OBJECT( + 'id', n.id, + 'name', n.name + ) as namespace, JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', od.metadata -> 'labels', 'created_at', od.created_at,'updated_at', od.updated_at)) as metadata, JSON_AGG( - JSON_BUILD_OBJECT( - 'id', ov.id, - 'value', ov.value - ) + JSON_BUILD_OBJECT( + 'id', ov.id, + 'value', ov.value + ) ) FILTER (WHERE ov.id IS NOT NULL) as values -- todo: add triggers and fulfillers FROM obligation_definitions od +JOIN attribute_namespaces n on od.namespace_id = n.id LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id WHERE + -- handles by id or fqn queries (NULLIF($1, '') IS NULL OR id = $1::UUID) AND - (NULLIF($2, '') IS NULL OR name = $2::VARCHAR) -GROUP BY od.id + (NULLIF($2, '') IS NULL OR od.namespace_id = $2::UUID) AND + (NULLIF($3, '') IS NULL OR name = $3::VARCHAR) +GROUP BY od.id, n.id ` type getObligationDefinitionParams struct { - ID interface{} `json:"id"` - Name interface{} `json:"name"` + ID interface{} `json:"id"` + NamespaceID interface{} `json:"namespace_id"` + Name interface{} `json:"name"` } type getObligationDefinitionRow struct { - ID string `json:"id"` - Name string `json:"name"` - NamespaceID string `json:"namespace_id"` - Metadata []byte `json:"metadata"` - Values []byte `json:"values"` + ID string `json:"id"` + Name string `json:"name"` + Namespace []byte `json:"namespace"` + Metadata []byte `json:"metadata"` + Values []byte `json:"values"` } // getObligationDefinition @@ -93,29 +99,34 @@ type getObligationDefinitionRow struct { // SELECT // od.id, // od.name, -// -- todo: prob return this as a JSON object -// od.namespace_id, +// JSON_BUILD_OBJECT( +// 'id', n.id, +// 'name', n.name +// ) as namespace, // JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', od.metadata -> 'labels', 'created_at', od.created_at,'updated_at', od.updated_at)) as metadata, // JSON_AGG( -// JSON_BUILD_OBJECT( -// 'id', ov.id, -// 'value', ov.value -// ) +// JSON_BUILD_OBJECT( +// 'id', ov.id, +// 'value', ov.value +// ) // ) FILTER (WHERE ov.id IS NOT NULL) as values // -- todo: add triggers and fulfillers // FROM obligation_definitions od +// JOIN attribute_namespaces n on od.namespace_id = n.id // LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id // WHERE +// -- handles by id or fqn queries // (NULLIF($1, '') IS NULL OR id = $1::UUID) AND -// (NULLIF($2, '') IS NULL OR name = $2::VARCHAR) -// GROUP BY od.id +// (NULLIF($2, '') IS NULL OR od.namespace_id = $2::UUID) AND +// (NULLIF($3, '') IS NULL OR name = $3::VARCHAR) +// GROUP BY od.id, n.id func (q *Queries) getObligationDefinition(ctx context.Context, arg getObligationDefinitionParams) (getObligationDefinitionRow, error) { - row := q.db.QueryRow(ctx, getObligationDefinition, arg.ID, arg.Name) + row := q.db.QueryRow(ctx, getObligationDefinition, arg.ID, arg.NamespaceID, arg.Name) var i getObligationDefinitionRow err := row.Scan( &i.ID, &i.Name, - &i.NamespaceID, + &i.Namespace, &i.Metadata, &i.Values, ) @@ -130,23 +141,26 @@ WITH counted AS ( SELECT od.id, od.name, - -- todo: prob return this as a JSON object - od.namespace_id, + JSON_BUILD_OBJECT( + 'id', n.id, + 'name', n.name + ) as namespace, JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', od.metadata -> 'labels', 'created_at', od.created_at,'updated_at', od.updated_at)) as metadata, JSON_AGG( - JSON_BUILD_OBJECT( - 'id', ov.id, - 'value', ov.value - ) + JSON_BUILD_OBJECT( + 'id', ov.id, + 'value', ov.value + ) ) FILTER (WHERE ov.id IS NOT NULL) as values, -- todo: add triggers and fulfillers counted.total FROM obligation_definitions od +JOIN attribute_namespaces n on od.namespace_id = n.id CROSS JOIN counted LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id WHERE (NULLIF($1, '') IS NULL OR od.namespace_id = $1::UUID) -GROUP BY od.id, counted.total +GROUP BY od.id, n.id, counted.total LIMIT $3 OFFSET $2 ` @@ -158,12 +172,12 @@ type listObligationDefinitionsParams struct { } type listObligationDefinitionsRow struct { - ID string `json:"id"` - Name string `json:"name"` - NamespaceID string `json:"namespace_id"` - Metadata []byte `json:"metadata"` - Values []byte `json:"values"` - Total int64 `json:"total"` + ID string `json:"id"` + Name string `json:"name"` + Namespace []byte `json:"namespace"` + Metadata []byte `json:"metadata"` + Values []byte `json:"values"` + Total int64 `json:"total"` } // listObligationDefinitions @@ -175,23 +189,26 @@ type listObligationDefinitionsRow struct { // SELECT // od.id, // od.name, -// -- todo: prob return this as a JSON object -// od.namespace_id, +// JSON_BUILD_OBJECT( +// 'id', n.id, +// 'name', n.name +// ) as namespace, // JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', od.metadata -> 'labels', 'created_at', od.created_at,'updated_at', od.updated_at)) as metadata, // JSON_AGG( -// JSON_BUILD_OBJECT( -// 'id', ov.id, -// 'value', ov.value -// ) +// JSON_BUILD_OBJECT( +// 'id', ov.id, +// 'value', ov.value +// ) // ) FILTER (WHERE ov.id IS NOT NULL) as values, // -- todo: add triggers and fulfillers // counted.total // FROM obligation_definitions od +// JOIN attribute_namespaces n on od.namespace_id = n.id // CROSS JOIN counted // LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id // WHERE // (NULLIF($1, '') IS NULL OR od.namespace_id = $1::UUID) -// GROUP BY od.id, counted.total +// GROUP BY od.id, n.id, counted.total // LIMIT $3 // OFFSET $2 func (q *Queries) listObligationDefinitions(ctx context.Context, arg listObligationDefinitionsParams) ([]listObligationDefinitionsRow, error) { @@ -206,7 +223,7 @@ func (q *Queries) listObligationDefinitions(ctx context.Context, arg listObligat if err := rows.Scan( &i.ID, &i.Name, - &i.NamespaceID, + &i.Namespace, &i.Metadata, &i.Values, &i.Total, diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index cee779e39c..9530e480e9 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -11,22 +11,27 @@ RETURNING id; SELECT od.id, od.name, - -- todo: prob return this as a JSON object - od.namespace_id, + JSON_BUILD_OBJECT( + 'id', n.id, + 'name', n.name + ) as namespace, JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', od.metadata -> 'labels', 'created_at', od.created_at,'updated_at', od.updated_at)) as metadata, JSON_AGG( - JSON_BUILD_OBJECT( - 'id', ov.id, - 'value', ov.value - ) + JSON_BUILD_OBJECT( + 'id', ov.id, + 'value', ov.value + ) ) FILTER (WHERE ov.id IS NOT NULL) as values -- todo: add triggers and fulfillers FROM obligation_definitions od +JOIN attribute_namespaces n on od.namespace_id = n.id LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id WHERE + -- handles by id or fqn queries (NULLIF(@id, '') IS NULL OR id = @id::UUID) AND + (NULLIF(@namespace_id, '') IS NULL OR od.namespace_id = @namespace_id::UUID) AND (NULLIF(@name, '') IS NULL OR name = @name::VARCHAR) -GROUP BY od.id; +GROUP BY od.id, n.id; -- name: listObligationDefinitions :many WITH counted AS ( @@ -36,23 +41,26 @@ WITH counted AS ( SELECT od.id, od.name, - -- todo: prob return this as a JSON object - od.namespace_id, + JSON_BUILD_OBJECT( + 'id', n.id, + 'name', n.name + ) as namespace, JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', od.metadata -> 'labels', 'created_at', od.created_at,'updated_at', od.updated_at)) as metadata, JSON_AGG( - JSON_BUILD_OBJECT( - 'id', ov.id, - 'value', ov.value - ) + JSON_BUILD_OBJECT( + 'id', ov.id, + 'value', ov.value + ) ) FILTER (WHERE ov.id IS NOT NULL) as values, -- todo: add triggers and fulfillers counted.total FROM obligation_definitions od +JOIN attribute_namespaces n on od.namespace_id = n.id CROSS JOIN counted LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id WHERE (NULLIF(@namespace_id, '') IS NULL OR od.namespace_id = @namespace_id::UUID) -GROUP BY od.id, counted.total +GROUP BY od.id, n.id, counted.total LIMIT @limit_ OFFSET @offset_; From 46d99c8fc867691ef5dbbb36d7b46f4cdcd8b918 Mon Sep 17 00:00:00 2001 From: Ryan Yanulites Date: Mon, 21 Jul 2025 14:20:57 -0600 Subject: [PATCH 005/137] apply gemini feedback --- service/policy/db/obligations.go | 14 +++++++------- service/policy/db/obligations.sql.go | 4 ++++ service/policy/db/queries/obligations.sql | 2 ++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index f85689c1ec..3733773e5c 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -9,22 +9,22 @@ import ( /// Obligation Definitions /// -func (c PolicyDBClient) CreateObligation(ctx context.Context, r any) (any, error) { - return nil, errors.New("CreateObligation is not implemented in PolicyDBClient") +func (c PolicyDBClient) CreateObligationDefinition(_ context.Context, r any) (any, error) { + return nil, errors.New("CreateObligationDefinition is not implemented in PolicyDBClient") } -func (c PolicyDBClient) GetObligationDefinition(ctx context.Context) (any, error) { +func (c PolicyDBClient) GetObligationDefinition(_ context.Context) (any, error) { return nil, errors.New("GetObligationDefinition is not implemented in PolicyDBClient") } -func (c PolicyDBClient) ListObligationDefinitions(ctx context.Context) (any, error) { +func (c PolicyDBClient) ListObligationDefinitions(_ context.Context) (any, error) { return nil, errors.New("ListObligationDefinitions is not implemented in PolicyDBClient") } -func (c PolicyDBClient) UpdateObligationDefinitions(ctx context.Context) (any, error) { - return nil, errors.New("UpdateObligationDefinitions is not implemented in PolicyDBClient") +func (c PolicyDBClient) UpdateObligationDefinition(_ context.Context) (any, error) { + return nil, errors.New("UpdateObligationDefinition is not implemented in PolicyDBClient") } -func (c PolicyDBClient) DeleteObligationDefinition(ctx context.Context, id string) (any, error) { +func (c PolicyDBClient) DeleteObligationDefinition(_ context.Context, id string) (any, error) { return nil, errors.New("DeleteObligationDefinition is not implemented in PolicyDBClient") } diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 8553df4e03..296bb9ee57 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -137,6 +137,8 @@ const listObligationDefinitions = `-- name: listObligationDefinitions :many WITH counted AS ( SELECT COUNT(id) AS total FROM obligation_definitions + WHERE + (NULLIF($1, '') IS NULL OR od.namespace_id = $1::UUID) ) SELECT od.id, @@ -185,6 +187,8 @@ type listObligationDefinitionsRow struct { // WITH counted AS ( // SELECT COUNT(id) AS total // FROM obligation_definitions +// WHERE +// (NULLIF($1, '') IS NULL OR od.namespace_id = $1::UUID) // ) // SELECT // od.id, diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 9530e480e9..2f76cb4fc3 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -37,6 +37,8 @@ GROUP BY od.id, n.id; WITH counted AS ( SELECT COUNT(id) AS total FROM obligation_definitions + WHERE + (NULLIF(@namespace_id, '') IS NULL OR od.namespace_id = @namespace_id::UUID) ) SELECT od.id, From 5167a03361a11a76544ccde8975db7895f810b1d Mon Sep 17 00:00:00 2001 From: Ryan Yanulites Date: Mon, 21 Jul 2025 14:25:55 -0600 Subject: [PATCH 006/137] lint fixes --- service/integration/obligations_test.go | 2 +- service/policy/db/obligations.go | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 24fbfedb41..d4c48ae91e 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -13,7 +13,7 @@ type ObligationsSuite struct { suite.Suite f fixtures.Fixtures db fixtures.DBInterface - ctx context.Context + ctx context.Context //nolint:containedctx // context is used in the test suite } func (s *ObligationsSuite) SetupSuite() { diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 3733773e5c..dcf764d298 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -1,7 +1,6 @@ package db import ( - "context" "errors" ) @@ -9,22 +8,22 @@ import ( /// Obligation Definitions /// -func (c PolicyDBClient) CreateObligationDefinition(_ context.Context, r any) (any, error) { +func (c PolicyDBClient) CreateObligationDefinition() (any, error) { return nil, errors.New("CreateObligationDefinition is not implemented in PolicyDBClient") } -func (c PolicyDBClient) GetObligationDefinition(_ context.Context) (any, error) { +func (c PolicyDBClient) GetObligationDefinition() (any, error) { return nil, errors.New("GetObligationDefinition is not implemented in PolicyDBClient") } -func (c PolicyDBClient) ListObligationDefinitions(_ context.Context) (any, error) { +func (c PolicyDBClient) ListObligationDefinitions() (any, error) { return nil, errors.New("ListObligationDefinitions is not implemented in PolicyDBClient") } -func (c PolicyDBClient) UpdateObligationDefinition(_ context.Context) (any, error) { +func (c PolicyDBClient) UpdateObligationDefinition() (any, error) { return nil, errors.New("UpdateObligationDefinition is not implemented in PolicyDBClient") } -func (c PolicyDBClient) DeleteObligationDefinition(_ context.Context, id string) (any, error) { +func (c PolicyDBClient) DeleteObligationDefinition() (any, error) { return nil, errors.New("DeleteObligationDefinition is not implemented in PolicyDBClient") } From 66634759259bb75946a737afc9d1739ae7b98d3f Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 28 Jul 2025 16:48:32 -0400 Subject: [PATCH 007/137] updating type signatures --- service/policy/db/obligations.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index dcf764d298..bdb8811146 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -2,28 +2,30 @@ package db import ( "errors" + + "github.com/opentdf/platform/protocol/go/policy" ) /// /// Obligation Definitions /// -func (c PolicyDBClient) CreateObligationDefinition() (any, error) { - return nil, errors.New("CreateObligationDefinition is not implemented in PolicyDBClient") +func (c PolicyDBClient) CreateObligationDefinition() (*policy.Obligation, error) { + return &policy.Obligation{}, errors.New("CreateObligationDefinition is not implemented in PolicyDBClient") } -func (c PolicyDBClient) GetObligationDefinition() (any, error) { +func (c PolicyDBClient) GetObligationDefinition() (*policy.Obligation, error) { return nil, errors.New("GetObligationDefinition is not implemented in PolicyDBClient") } -func (c PolicyDBClient) ListObligationDefinitions() (any, error) { +func (c PolicyDBClient) ListObligationDefinitions() ([]*policy.Obligation, error) { return nil, errors.New("ListObligationDefinitions is not implemented in PolicyDBClient") } -func (c PolicyDBClient) UpdateObligationDefinition() (any, error) { +func (c PolicyDBClient) UpdateObligationDefinition() (*policy.Obligation, error) { return nil, errors.New("UpdateObligationDefinition is not implemented in PolicyDBClient") } -func (c PolicyDBClient) DeleteObligationDefinition() (any, error) { +func (c PolicyDBClient) DeleteObligationDefinition() (*policy.Obligation, error) { return nil, errors.New("DeleteObligationDefinition is not implemented in PolicyDBClient") } From c885126c830ae23803c1eb27e4e780df5a9d518b Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 28 Jul 2025 16:51:15 -0400 Subject: [PATCH 008/137] again --- service/policy/db/obligations.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index bdb8811146..eec129ac8a 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -1,31 +1,33 @@ package db import ( + "context" "errors" "github.com/opentdf/platform/protocol/go/policy" + "github.com/opentdf/platform/protocol/go/policy/obligations" ) /// /// Obligation Definitions /// -func (c PolicyDBClient) CreateObligationDefinition() (*policy.Obligation, error) { +func (c PolicyDBClient) CreateObligationDefinition(ctx context.Context, r *obligations.CreateObligationRequest) (*policy.Obligation, error) { return &policy.Obligation{}, errors.New("CreateObligationDefinition is not implemented in PolicyDBClient") } -func (c PolicyDBClient) GetObligationDefinition() (*policy.Obligation, error) { +func (c PolicyDBClient) GetObligationDefinition(ctx context.Context, r *obligations.GetObligationRequest) (*policy.Obligation, error) { return nil, errors.New("GetObligationDefinition is not implemented in PolicyDBClient") } -func (c PolicyDBClient) ListObligationDefinitions() ([]*policy.Obligation, error) { +func (c PolicyDBClient) ListObligationDefinitions(ctx context.Context, r *obligations.ListObligationsRequest) ([]*policy.Obligation, error) { return nil, errors.New("ListObligationDefinitions is not implemented in PolicyDBClient") } -func (c PolicyDBClient) UpdateObligationDefinition() (*policy.Obligation, error) { +func (c PolicyDBClient) UpdateObligationDefinition(ctx context.Context, r *obligations.UpdateObligationRequest) (*policy.Obligation, error) { return nil, errors.New("UpdateObligationDefinition is not implemented in PolicyDBClient") } -func (c PolicyDBClient) DeleteObligationDefinition() (*policy.Obligation, error) { +func (c PolicyDBClient) DeleteObligationDefinition(ctx context.Context, r *obligations.DeleteObligationRequest) (*policy.Obligation, error) { return nil, errors.New("DeleteObligationDefinition is not implemented in PolicyDBClient") } From c42246b3721980877c2400c3de29146c6c5a1795 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 28 Jul 2025 19:40:57 -0400 Subject: [PATCH 009/137] create obligation working --- service/integration/obligations_test.go | 14 ++++++++++++-- service/policy/db/obligations.go | 24 ++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index d4c48ae91e..b973faff03 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -5,6 +5,7 @@ import ( "log/slog" "testing" + "github.com/opentdf/platform/protocol/go/policy/obligations" "github.com/opentdf/platform/service/internal/fixtures" "github.com/stretchr/testify/suite" ) @@ -48,8 +49,17 @@ func (s *ObligationsSuite) Test_CreateObligationDefinition_Succeeds() { // tcs: // - create obligation definition with valid namespace_id and name // - create with values and possibly triggers and fulfillers? - - s.T().Skip("obligation_definitions table not implemented yet") + fixtureNamespaceID = s.f.GetNamespaceKey("example.com").ID + oblName := "example-obligation" + obl, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ + NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ + Id: fixtureNamespaceID, + }, + Name: oblName, + }) + s.Require().NoError(err) + s.NotNil(obl) + s.Equal(obl.Name, oblName) } func (s *ObligationsSuite) Test_CreateObligationDefinition_Fails() { diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index eec129ac8a..fbebc2ff47 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -6,14 +6,34 @@ import ( "github.com/opentdf/platform/protocol/go/policy" "github.com/opentdf/platform/protocol/go/policy/obligations" + "github.com/opentdf/platform/service/pkg/db" ) /// /// Obligation Definitions /// -func (c PolicyDBClient) CreateObligationDefinition(ctx context.Context, r *obligations.CreateObligationRequest) (*policy.Obligation, error) { - return &policy.Obligation{}, errors.New("CreateObligationDefinition is not implemented in PolicyDBClient") +func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.CreateObligationRequest) (*policy.Obligation, error) { + if r.GetFqn() != "" { + return nil, errors.New("namespace identifier by FQN is not supported yet") + } + metadataJSON, _, err := db.MarshalCreateMetadata(r.GetMetadata()) + if err != nil { + return nil, err + } + queryParams := createObligationDefinitionParams{ + NamespaceID: r.GetId(), + Name: r.GetName(), + Metadata: metadataJSON, + } + id, err := c.queries.createObligationDefinition(ctx, queryParams) + if err != nil { + return nil, err + } + return &policy.Obligation{ + Id: id, + Name: r.GetName(), + }, nil } func (c PolicyDBClient) GetObligationDefinition(ctx context.Context, r *obligations.GetObligationRequest) (*policy.Obligation, error) { From 63c74304a95b04cba5f7c3e74d50c89cd9abb3bf Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 28 Jul 2025 23:33:24 -0400 Subject: [PATCH 010/137] create by id or fqn --- service/integration/obligations_test.go | 19 +++++++++-- service/policy/db/obligations.go | 40 +++++++++++++++++------ service/policy/db/obligations.sql.go | 36 +++++++++++++++++--- service/policy/db/queries/obligations.sql | 9 ++++- 4 files changed, 87 insertions(+), 17 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index b973faff03..bfdb4140fa 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -49,17 +49,32 @@ func (s *ObligationsSuite) Test_CreateObligationDefinition_Succeeds() { // tcs: // - create obligation definition with valid namespace_id and name // - create with values and possibly triggers and fulfillers? - fixtureNamespaceID = s.f.GetNamespaceKey("example.com").ID + namespace := s.f.GetNamespaceKey("example.com") + namespaceID := namespace.ID oblName := "example-obligation" obl, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ - Id: fixtureNamespaceID, + Id: namespaceID, }, Name: oblName, }) s.Require().NoError(err) s.NotNil(obl) s.Equal(obl.Name, oblName) + + namespace = s.f.GetNamespaceKey("example.net") + namespaceName := namespace.Name + namespaceFQN := "https://" + namespaceName + obl, err = s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ + NamespaceIdentifier: &obligations.CreateObligationRequest_Fqn{ + Fqn: namespaceFQN, + }, + Name: oblName, + }) + s.Require().NoError(err) + s.NotNil(obl) + s.Equal(obl.Name, oblName) + } func (s *ObligationsSuite) Test_CreateObligationDefinition_Fails() { diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index fbebc2ff47..78e3c4aa53 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -13,29 +13,49 @@ import ( /// Obligation Definitions /// -func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.CreateObligationRequest) (*policy.Obligation, error) { - if r.GetFqn() != "" { - return nil, errors.New("namespace identifier by FQN is not supported yet") +func (c PolicyDBClient) CreateObligationByNamespaceID(ctx context.Context, namespaceID, name string, metadata []byte) (*policy.Obligation, error) { + queryParams := createObligationByNamespaceIdParams{ + NamespaceID: namespaceID, + Name: name, + Metadata: metadata, } - metadataJSON, _, err := db.MarshalCreateMetadata(r.GetMetadata()) + id, err := c.queries.createObligationByNamespaceId(ctx, queryParams) if err != nil { return nil, err } - queryParams := createObligationDefinitionParams{ - NamespaceID: r.GetId(), - Name: r.GetName(), - Metadata: metadataJSON, + return &policy.Obligation{ + Id: id, + Name: name, + }, nil +} + +func (c PolicyDBClient) CreateObligationByNamespaceFQN(ctx context.Context, fqn, name string, metadata []byte) (*policy.Obligation, error) { + queryParams := createObligationByNamespaceFQNParams{ + Fqn: fqn, + Name: name, + Metadata: metadata, } - id, err := c.queries.createObligationDefinition(ctx, queryParams) + id, err := c.queries.createObligationByNamespaceFQN(ctx, queryParams) if err != nil { return nil, err } return &policy.Obligation{ Id: id, - Name: r.GetName(), + Name: name, }, nil } +func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.CreateObligationRequest) (*policy.Obligation, error) { + metadataJSON, _, err := db.MarshalCreateMetadata(r.GetMetadata()) + if err != nil { + return nil, err + } + if r.GetId() != "" { + return c.CreateObligationByNamespaceID(ctx, r.GetId(), r.GetName(), metadataJSON) + } + return c.CreateObligationByNamespaceFQN(ctx, r.GetFqn(), r.GetName(), metadataJSON) +} + func (c PolicyDBClient) GetObligationDefinition(ctx context.Context, r *obligations.GetObligationRequest) (*policy.Obligation, error) { return nil, errors.New("GetObligationDefinition is not implemented in PolicyDBClient") } diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 296bb9ee57..c4b0d5b578 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -11,14 +11,42 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const createObligationDefinition = `-- name: createObligationDefinition :one +const createObligationByNamespaceFQN = `-- name: createObligationByNamespaceFQN :one +INSERT INTO obligation_definitions (namespace_id, name, metadata) +SELECT fqns.namespace_id, $2, $3 +FROM attribute_fqns fqns +WHERE fqns.fqn = $1 +RETURNING id +` + +type createObligationByNamespaceFQNParams struct { + Fqn string `json:"fqn"` + Name string `json:"name"` + Metadata []byte `json:"metadata"` +} + +// createObligationByNamespaceFQN +// +// INSERT INTO obligation_definitions (namespace_id, name, metadata) +// SELECT fqns.namespace_id, $2, $3 +// FROM attribute_fqns fqns +// WHERE fqns.fqn = $1 +// RETURNING id +func (q *Queries) createObligationByNamespaceFQN(ctx context.Context, arg createObligationByNamespaceFQNParams) (string, error) { + row := q.db.QueryRow(ctx, createObligationByNamespaceFQN, arg.Fqn, arg.Name, arg.Metadata) + var id string + err := row.Scan(&id) + return id, err +} + +const createObligationByNamespaceId = `-- name: createObligationByNamespaceId :one INSERT INTO obligation_definitions (namespace_id, name, metadata) VALUES ($1, $2, $3) RETURNING id ` -type createObligationDefinitionParams struct { +type createObligationByNamespaceIdParams struct { NamespaceID string `json:"namespace_id"` Name string `json:"name"` Metadata []byte `json:"metadata"` @@ -31,8 +59,8 @@ type createObligationDefinitionParams struct { // INSERT INTO obligation_definitions (namespace_id, name, metadata) // VALUES ($1, $2, $3) // RETURNING id -func (q *Queries) createObligationDefinition(ctx context.Context, arg createObligationDefinitionParams) (string, error) { - row := q.db.QueryRow(ctx, createObligationDefinition, arg.NamespaceID, arg.Name, arg.Metadata) +func (q *Queries) createObligationByNamespaceId(ctx context.Context, arg createObligationByNamespaceIdParams) (string, error) { + row := q.db.QueryRow(ctx, createObligationByNamespaceId, arg.NamespaceID, arg.Name, arg.Metadata) var id string err := row.Scan(&id) return id, err diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 2f76cb4fc3..902e9697a6 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -2,11 +2,18 @@ -- OBLIGATIONS ---------------------------------------------------------------- --- name: createObligationDefinition :one +-- name: createObligationByNamespaceId :one INSERT INTO obligation_definitions (namespace_id, name, metadata) VALUES ($1, $2, $3) RETURNING id; +-- name: createObligationByNamespaceFQN :one +INSERT INTO obligation_definitions (namespace_id, name, metadata) +SELECT fqns.namespace_id, $2, $3 +FROM attribute_fqns fqns +WHERE fqns.fqn = $1 +RETURNING id; + -- name: getObligationDefinition :one SELECT od.id, From c142cbf09b35c9284871856c0afc9079b53a8490 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 29 Jul 2025 17:12:06 -0400 Subject: [PATCH 011/137] refactor --- service/policy/db/obligations.go | 31 +++++++++++++++-------- service/policy/db/queries/obligations.sql | 1 + 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 78e3c4aa53..5ee29a8f4e 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -4,6 +4,7 @@ import ( "context" "errors" + "github.com/opentdf/platform/protocol/go/common" "github.com/opentdf/platform/protocol/go/policy" "github.com/opentdf/platform/protocol/go/policy/obligations" "github.com/opentdf/platform/service/pkg/db" @@ -13,11 +14,15 @@ import ( /// Obligation Definitions /// -func (c PolicyDBClient) CreateObligationByNamespaceID(ctx context.Context, namespaceID, name string, metadata []byte) (*policy.Obligation, error) { +func (c PolicyDBClient) CreateObligationByNamespaceID(ctx context.Context, namespaceID, name string, metadata *common.MetadataMutable) (*policy.Obligation, error) { + metadataJSON, _, err := db.MarshalCreateMetadata(metadata) + if err != nil { + return nil, err + } queryParams := createObligationByNamespaceIdParams{ NamespaceID: namespaceID, Name: name, - Metadata: metadata, + Metadata: metadataJSON, } id, err := c.queries.createObligationByNamespaceId(ctx, queryParams) if err != nil { @@ -26,14 +31,21 @@ func (c PolicyDBClient) CreateObligationByNamespaceID(ctx context.Context, names return &policy.Obligation{ Id: id, Name: name, + Metadata: &common.Metadata{ + Labels: metadata.GetLabels(), + }, }, nil } -func (c PolicyDBClient) CreateObligationByNamespaceFQN(ctx context.Context, fqn, name string, metadata []byte) (*policy.Obligation, error) { +func (c PolicyDBClient) CreateObligationByNamespaceFQN(ctx context.Context, fqn, name string, metadata *common.MetadataMutable) (*policy.Obligation, error) { + metadataJSON, _, err := db.MarshalCreateMetadata(metadata) + if err != nil { + return nil, err + } queryParams := createObligationByNamespaceFQNParams{ Fqn: fqn, Name: name, - Metadata: metadata, + Metadata: metadataJSON, } id, err := c.queries.createObligationByNamespaceFQN(ctx, queryParams) if err != nil { @@ -42,18 +54,17 @@ func (c PolicyDBClient) CreateObligationByNamespaceFQN(ctx context.Context, fqn, return &policy.Obligation{ Id: id, Name: name, + Metadata: &common.Metadata{ + Labels: metadata.GetLabels(), + }, }, nil } func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.CreateObligationRequest) (*policy.Obligation, error) { - metadataJSON, _, err := db.MarshalCreateMetadata(r.GetMetadata()) - if err != nil { - return nil, err - } if r.GetId() != "" { - return c.CreateObligationByNamespaceID(ctx, r.GetId(), r.GetName(), metadataJSON) + return c.CreateObligationByNamespaceID(ctx, r.GetId(), r.GetName(), r.GetMetadata()) } - return c.CreateObligationByNamespaceFQN(ctx, r.GetFqn(), r.GetName(), metadataJSON) + return c.CreateObligationByNamespaceFQN(ctx, r.GetFqn(), r.GetName(), r.GetMetadata()) } func (c PolicyDBClient) GetObligationDefinition(ctx context.Context, r *obligations.GetObligationRequest) (*policy.Obligation, error) { diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 902e9697a6..f14d066935 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -3,6 +3,7 @@ ---------------------------------------------------------------- -- name: createObligationByNamespaceId :one +-- also return namespace and obligation values INSERT INTO obligation_definitions (namespace_id, name, metadata) VALUES ($1, $2, $3) RETURNING id; From 14ef26395e8fb67d7d9d70bb427009c32b94f564 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 29 Jul 2025 20:28:52 -0400 Subject: [PATCH 012/137] w namespace --- service/policy/db/queries/obligations.sql | 109 ++++++++++++++++++++-- 1 file changed, 100 insertions(+), 9 deletions(-) diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index f14d066935..bc7fd547dd 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -3,17 +3,108 @@ ---------------------------------------------------------------- -- name: createObligationByNamespaceId :one --- also return namespace and obligation values -INSERT INTO obligation_definitions (namespace_id, name, metadata) -VALUES ($1, $2, $3) -RETURNING id; +WITH inserted_obligation AS ( + INSERT INTO obligation_definitions (namespace_id, name, metadata) + VALUES ($1, $2, $3) + RETURNING id, namespace_id, name, metadata +) +SELECT + io.id, + io.name, + io.metadata, + JSON_BUILD_OBJECT( + 'id', ns.id, + 'name', ns.name, + 'active', ns.active, + 'fqn', fqns.fqn, + 'metadata', JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ns.metadata -> 'labels', 'created_at', ns.created_at, 'updated_at', ns.updated_at)), + 'grants', JSONB_AGG(DISTINCT JSONB_BUILD_OBJECT( + 'id', kas.id, + 'uri', kas.uri, + 'name', kas.name, + 'public_key', kas.public_key + )) FILTER (WHERE kas_ns_grants.namespace_id IS NOT NULL), + 'keys', nmp_keys.keys + ) as namespace +FROM inserted_obligation io +JOIN attribute_namespaces ns ON io.namespace_id = ns.id +LEFT JOIN attribute_namespace_key_access_grants kas_ns_grants ON kas_ns_grants.namespace_id = ns.id +LEFT JOIN key_access_servers kas ON kas.id = kas_ns_grants.key_access_server_id +LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = ns.id +LEFT JOIN ( + SELECT + k.namespace_id, + JSONB_AGG( + DISTINCT JSONB_BUILD_OBJECT( + 'kas_uri', kas.uri, + 'kas_id', kas.id, + 'public_key', JSONB_BUILD_OBJECT( + 'algorithm', kask.key_algorithm::INTEGER, + 'kid', kask.key_id, + 'pem', CONVERT_FROM(DECODE(kask.public_key_ctx ->> 'pem', 'base64'), 'UTF8') + ) + ) + ) FILTER (WHERE kask.id IS NOT NULL) AS keys + FROM attribute_namespace_public_key_map k + INNER JOIN key_access_server_keys kask ON k.key_access_server_key_id = kask.id + INNER JOIN key_access_servers kas ON kask.key_access_server_id = kas.id + GROUP BY k.namespace_id +) nmp_keys ON ns.id = nmp_keys.namespace_id +WHERE fqns.attribute_id IS NULL AND fqns.value_id IS NULL +GROUP BY io.id, io.name, io.metadata, ns.id, ns.name, ns.active, ns.metadata, ns.created_at, ns.updated_at, fqns.fqn, nmp_keys.keys; -- name: createObligationByNamespaceFQN :one -INSERT INTO obligation_definitions (namespace_id, name, metadata) -SELECT fqns.namespace_id, $2, $3 -FROM attribute_fqns fqns -WHERE fqns.fqn = $1 -RETURNING id; +WITH inserted_obligation AS ( + INSERT INTO obligation_definitions (namespace_id, name, metadata) + SELECT fqns.namespace_id, $2, $3 + FROM attribute_fqns fqns + WHERE fqns.fqn = $1 + RETURNING id, namespace_id, name, metadata +) +SELECT + io.id, + io.name, + io.metadata, + JSON_BUILD_OBJECT( + 'id', ns.id, + 'name', ns.name, + 'active', ns.active, + 'fqn', fqns.fqn, + 'metadata', JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ns.metadata -> 'labels', 'created_at', ns.created_at, 'updated_at', ns.updated_at)), + 'grants', JSONB_AGG(DISTINCT JSONB_BUILD_OBJECT( + 'id', kas.id, + 'uri', kas.uri, + 'name', kas.name, + 'public_key', kas.public_key + )) FILTER (WHERE kas_ns_grants.namespace_id IS NOT NULL), + 'keys', nmp_keys.keys + ) as namespace +FROM inserted_obligation io +JOIN attribute_namespaces ns ON io.namespace_id = ns.id +LEFT JOIN attribute_namespace_key_access_grants kas_ns_grants ON kas_ns_grants.namespace_id = ns.id +LEFT JOIN key_access_servers kas ON kas.id = kas_ns_grants.key_access_server_id +LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = ns.id +LEFT JOIN ( + SELECT + k.namespace_id, + JSONB_AGG( + DISTINCT JSONB_BUILD_OBJECT( + 'kas_uri', kas.uri, + 'kas_id', kas.id, + 'public_key', JSONB_BUILD_OBJECT( + 'algorithm', kask.key_algorithm::INTEGER, + 'kid', kask.key_id, + 'pem', CONVERT_FROM(DECODE(kask.public_key_ctx ->> 'pem', 'base64'), 'UTF8') + ) + ) + ) FILTER (WHERE kask.id IS NOT NULL) AS keys + FROM attribute_namespace_public_key_map k + INNER JOIN key_access_server_keys kask ON k.key_access_server_key_id = kask.id + INNER JOIN key_access_servers kas ON kask.key_access_server_id = kas.id + GROUP BY k.namespace_id +) nmp_keys ON ns.id = nmp_keys.namespace_id +WHERE fqns.attribute_id IS NULL AND fqns.value_id IS NULL +GROUP BY io.id, io.name, io.metadata, ns.id, ns.name, ns.active, ns.metadata, ns.created_at, ns.updated_at, fqns.fqn, nmp_keys.keys; -- name: getObligationDefinition :one SELECT From f765f4aa2fb31dcb8f5465eecf10b31831f44afe Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 29 Jul 2025 20:29:31 -0400 Subject: [PATCH 013/137] revert --- service/policy/db/queries/obligations.sql | 108 ++-------------------- 1 file changed, 8 insertions(+), 100 deletions(-) diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index bc7fd547dd..902e9697a6 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -3,108 +3,16 @@ ---------------------------------------------------------------- -- name: createObligationByNamespaceId :one -WITH inserted_obligation AS ( - INSERT INTO obligation_definitions (namespace_id, name, metadata) - VALUES ($1, $2, $3) - RETURNING id, namespace_id, name, metadata -) -SELECT - io.id, - io.name, - io.metadata, - JSON_BUILD_OBJECT( - 'id', ns.id, - 'name', ns.name, - 'active', ns.active, - 'fqn', fqns.fqn, - 'metadata', JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ns.metadata -> 'labels', 'created_at', ns.created_at, 'updated_at', ns.updated_at)), - 'grants', JSONB_AGG(DISTINCT JSONB_BUILD_OBJECT( - 'id', kas.id, - 'uri', kas.uri, - 'name', kas.name, - 'public_key', kas.public_key - )) FILTER (WHERE kas_ns_grants.namespace_id IS NOT NULL), - 'keys', nmp_keys.keys - ) as namespace -FROM inserted_obligation io -JOIN attribute_namespaces ns ON io.namespace_id = ns.id -LEFT JOIN attribute_namespace_key_access_grants kas_ns_grants ON kas_ns_grants.namespace_id = ns.id -LEFT JOIN key_access_servers kas ON kas.id = kas_ns_grants.key_access_server_id -LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = ns.id -LEFT JOIN ( - SELECT - k.namespace_id, - JSONB_AGG( - DISTINCT JSONB_BUILD_OBJECT( - 'kas_uri', kas.uri, - 'kas_id', kas.id, - 'public_key', JSONB_BUILD_OBJECT( - 'algorithm', kask.key_algorithm::INTEGER, - 'kid', kask.key_id, - 'pem', CONVERT_FROM(DECODE(kask.public_key_ctx ->> 'pem', 'base64'), 'UTF8') - ) - ) - ) FILTER (WHERE kask.id IS NOT NULL) AS keys - FROM attribute_namespace_public_key_map k - INNER JOIN key_access_server_keys kask ON k.key_access_server_key_id = kask.id - INNER JOIN key_access_servers kas ON kask.key_access_server_id = kas.id - GROUP BY k.namespace_id -) nmp_keys ON ns.id = nmp_keys.namespace_id -WHERE fqns.attribute_id IS NULL AND fqns.value_id IS NULL -GROUP BY io.id, io.name, io.metadata, ns.id, ns.name, ns.active, ns.metadata, ns.created_at, ns.updated_at, fqns.fqn, nmp_keys.keys; +INSERT INTO obligation_definitions (namespace_id, name, metadata) +VALUES ($1, $2, $3) +RETURNING id; -- name: createObligationByNamespaceFQN :one -WITH inserted_obligation AS ( - INSERT INTO obligation_definitions (namespace_id, name, metadata) - SELECT fqns.namespace_id, $2, $3 - FROM attribute_fqns fqns - WHERE fqns.fqn = $1 - RETURNING id, namespace_id, name, metadata -) -SELECT - io.id, - io.name, - io.metadata, - JSON_BUILD_OBJECT( - 'id', ns.id, - 'name', ns.name, - 'active', ns.active, - 'fqn', fqns.fqn, - 'metadata', JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ns.metadata -> 'labels', 'created_at', ns.created_at, 'updated_at', ns.updated_at)), - 'grants', JSONB_AGG(DISTINCT JSONB_BUILD_OBJECT( - 'id', kas.id, - 'uri', kas.uri, - 'name', kas.name, - 'public_key', kas.public_key - )) FILTER (WHERE kas_ns_grants.namespace_id IS NOT NULL), - 'keys', nmp_keys.keys - ) as namespace -FROM inserted_obligation io -JOIN attribute_namespaces ns ON io.namespace_id = ns.id -LEFT JOIN attribute_namespace_key_access_grants kas_ns_grants ON kas_ns_grants.namespace_id = ns.id -LEFT JOIN key_access_servers kas ON kas.id = kas_ns_grants.key_access_server_id -LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = ns.id -LEFT JOIN ( - SELECT - k.namespace_id, - JSONB_AGG( - DISTINCT JSONB_BUILD_OBJECT( - 'kas_uri', kas.uri, - 'kas_id', kas.id, - 'public_key', JSONB_BUILD_OBJECT( - 'algorithm', kask.key_algorithm::INTEGER, - 'kid', kask.key_id, - 'pem', CONVERT_FROM(DECODE(kask.public_key_ctx ->> 'pem', 'base64'), 'UTF8') - ) - ) - ) FILTER (WHERE kask.id IS NOT NULL) AS keys - FROM attribute_namespace_public_key_map k - INNER JOIN key_access_server_keys kask ON k.key_access_server_key_id = kask.id - INNER JOIN key_access_servers kas ON kask.key_access_server_id = kas.id - GROUP BY k.namespace_id -) nmp_keys ON ns.id = nmp_keys.namespace_id -WHERE fqns.attribute_id IS NULL AND fqns.value_id IS NULL -GROUP BY io.id, io.name, io.metadata, ns.id, ns.name, ns.active, ns.metadata, ns.created_at, ns.updated_at, fqns.fqn, nmp_keys.keys; +INSERT INTO obligation_definitions (namespace_id, name, metadata) +SELECT fqns.namespace_id, $2, $3 +FROM attribute_fqns fqns +WHERE fqns.fqn = $1 +RETURNING id; -- name: getObligationDefinition :one SELECT From b7893470565cdbb10bf9792ac701dd24b9060640 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 29 Jul 2025 20:31:35 -0400 Subject: [PATCH 014/137] add namespace --- service/policy/db/obligations.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 5ee29a8f4e..b2569712e3 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -34,6 +34,9 @@ func (c PolicyDBClient) CreateObligationByNamespaceID(ctx context.Context, names Metadata: &common.Metadata{ Labels: metadata.GetLabels(), }, + Namespace: &policy.Namespace{ + Id: namespaceID, + }, }, nil } @@ -57,6 +60,9 @@ func (c PolicyDBClient) CreateObligationByNamespaceFQN(ctx context.Context, fqn, Metadata: &common.Metadata{ Labels: metadata.GetLabels(), }, + Namespace: &policy.Namespace{ + Fqn: fqn, + }, }, nil } From c89ed9dbf418fedf62cba1e696f7b6c2d813e7d3 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 29 Jul 2025 20:46:42 -0400 Subject: [PATCH 015/137] values --- docs/grpc/index.html | 7 + .../obligations/obligations.openapi.yaml | 6 + .../go/policy/obligations/obligations.pb.go | 527 +++++++++--------- service/policy/obligations/obligations.proto | 3 + 4 files changed, 285 insertions(+), 258 deletions(-) diff --git a/docs/grpc/index.html b/docs/grpc/index.html index 6a6ca26557..4270ed1fd7 100644 --- a/docs/grpc/index.html +++ b/docs/grpc/index.html @@ -12256,6 +12256,13 @@

CreateObligationRequest

+ + values + string + repeated +

Optional

+ + metadata common.MetadataMutable diff --git a/docs/openapi/policy/obligations/obligations.openapi.yaml b/docs/openapi/policy/obligations/obligations.openapi.yaml index f8eb4a0ba5..d59ab784cc 100644 --- a/docs/openapi/policy/obligations/obligations.openapi.yaml +++ b/docs/openapi/policy/obligations/obligations.openapi.yaml @@ -1320,6 +1320,12 @@ components: name: type: string title: name + values: + type: array + items: + type: string + title: values + description: Optional metadata: title: metadata description: |- diff --git a/protocol/go/policy/obligations/obligations.pb.go b/protocol/go/policy/obligations/obligations.pb.go index a5f8813ed1..2d18bf755d 100644 --- a/protocol/go/policy/obligations/obligations.pb.go +++ b/protocol/go/policy/obligations/obligations.pb.go @@ -259,6 +259,8 @@ type CreateObligationRequest struct { NamespaceIdentifier isCreateObligationRequest_NamespaceIdentifier `protobuf_oneof:"namespace_identifier"` Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` // Optional + Values []string `protobuf:"bytes,4,rep,name=values,proto3" json:"values,omitempty"` + // Optional // Common metadata Metadata *common.MetadataMutable `protobuf:"bytes,100,opt,name=metadata,proto3" json:"metadata,omitempty"` } @@ -323,6 +325,13 @@ func (x *CreateObligationRequest) GetName() string { return "" } +func (x *CreateObligationRequest) GetValues() []string { + if x != nil { + return x.Values + } + return nil +} + func (x *CreateObligationRequest) GetMetadata() *common.MetadataMutable { if x != nil { return x.Metadata @@ -1662,280 +1671,282 @@ var file_policy_obligations_obligations_proto_rawDesc = []byte{ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xa0, 0x01, 0x0a, 0x17, 0x43, 0x72, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xb8, 0x01, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x42, 0x16, 0x0a, 0x14, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, - 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, 0x18, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xc8, 0x01, 0x0a, - 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x33, 0x0a, 0x08, - 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x12, 0x54, 0x0a, 0x18, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x75, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x18, 0x65, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, - 0x16, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, - 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x22, 0x4e, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4d, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, - 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x8b, 0x01, 0x0a, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x12, 0x33, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x16, 0x0a, 0x14, + 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x16, 0x0a, 0x14, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x66, 0x69, 0x65, 0x72, 0x22, 0x85, 0x01, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x34, 0x0a, 0x0b, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x6f, 0x62, 0x6c, 0x69, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x34, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4f, 0x0a, 0x19, - 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, - 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x42, - 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4b, 0x0a, - 0x1a, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x36, 0x0a, 0x20, 0x47, 0x65, - 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, - 0x0a, 0x04, 0x66, 0x71, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x66, 0x71, - 0x6e, 0x73, 0x22, 0xe8, 0x01, 0x0a, 0x21, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6a, 0x0a, 0x0d, 0x66, 0x71, 0x6e, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x46, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x46, 0x71, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, - 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x66, 0x71, 0x6e, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x4d, 0x61, 0x70, 0x1a, 0x57, 0x0a, 0x10, 0x46, 0x71, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xa8, 0x01, - 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, - 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x03, 0x66, 0x71, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, - 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, - 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, - 0x17, 0x0a, 0x15, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, 0x1d, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xcf, 0x01, 0x0a, 0x1c, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, - 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x12, 0x54, 0x0a, 0x18, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, - 0x18, 0x65, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x6e, - 0x75, 0x6d, 0x52, 0x16, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x22, 0x4e, 0x0a, 0x1d, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x52, 0x0a, 0x1c, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, + 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, 0x18, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xc8, 0x01, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x54, 0x0a, 0x18, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x65, 0x68, + 0x61, 0x76, 0x69, 0x6f, 0x72, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x16, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x22, + 0x4e, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0a, 0x6f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, + 0x4d, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, - 0x0a, 0x1d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xcd, - 0x01, 0x0a, 0x1b, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2e, - 0x0a, 0x13, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x6f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x64, 0x12, 0x1b, - 0x0a, 0x09, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x61, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x69, - 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x64, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, - 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x53, - 0x0a, 0x1c, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, - 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, - 0x0a, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x07, 0x74, 0x72, 0x69, 0x67, - 0x67, 0x65, 0x72, 0x22, 0x30, 0x0a, 0x1e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, + 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x8b, + 0x01, 0x0a, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, + 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x12, + 0x33, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x61, 0x67, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x16, 0x0a, 0x14, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x85, 0x01, 0x0a, + 0x17, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x6f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, + 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x0b, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x34, + 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x61, 0x67, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4f, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4b, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x22, 0x36, 0x0a, 0x20, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71, 0x6e, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x66, 0x71, 0x6e, 0x73, 0x22, 0xe8, 0x01, 0x0a, 0x21, 0x47, + 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x6a, 0x0a, 0x0d, 0x66, 0x71, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x6d, 0x61, + 0x70, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, + 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x46, + 0x71, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x0b, 0x66, 0x71, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x70, 0x1a, 0x57, 0x0a, 0x10, + 0x46, 0x71, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xa8, 0x01, 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x17, 0x0a, 0x15, 0x6f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, + 0x22, 0x4e, 0x0a, 0x1d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x22, 0xcf, 0x01, 0x0a, 0x1c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x54, 0x0a, 0x18, + 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, + 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x16, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, + 0x6f, 0x72, 0x22, 0x4e, 0x0a, 0x1d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x22, 0x52, 0x0a, 0x1c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, 0x1d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, + 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xcd, 0x01, 0x0a, 0x1b, 0x41, 0x64, 0x64, 0x4f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x13, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x11, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x10, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, + 0x64, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x53, 0x0a, 0x1c, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x56, 0x0a, 0x1f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x72, 0x69, 0x67, - 0x67, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, - 0x67, 0x67, 0x65, 0x72, 0x52, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x32, 0xc6, 0x0c, - 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6f, 0x0a, 0x0f, 0x4c, 0x69, 0x73, - 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2a, 0x2e, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x69, 0x0a, 0x0d, 0x47, 0x65, - 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x7e, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x12, 0x2f, 0x2e, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, + 0x65, 0x72, 0x52, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x22, 0x30, 0x0a, 0x1e, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, + 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x56, 0x0a, + 0x1f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x33, 0x0a, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x07, 0x74, 0x72, + 0x69, 0x67, 0x67, 0x65, 0x72, 0x32, 0xc6, 0x0c, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x6f, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, + 0x02, 0x01, 0x12, 0x69, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x7e, 0x0a, + 0x14, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, + 0x79, 0x46, 0x51, 0x4e, 0x73, 0x12, 0x2f, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, + 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x6f, 0x0a, + 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x6f, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, - 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6f, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6f, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x78, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2d, + 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6f, + 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x2c, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x6f, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x78, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, + 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x8d, 0x01, 0x0a, 0x19, 0x47, + 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x12, 0x34, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, + 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, - 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, - 0x02, 0x01, 0x12, 0x8d, 0x01, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, - 0x12, 0x34, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, - 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, - 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, - 0x02, 0x01, 0x12, 0x7e, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x30, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, - 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x7e, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x30, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, - 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x7e, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x30, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, - 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x7b, 0x0a, 0x14, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12, 0x2f, 0x2e, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, - 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, - 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x84, 0x01, 0x0a, 0x17, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12, 0x32, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x33, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0xcf, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x42, 0x10, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x64, 0x66, 0x2f, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, - 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x67, 0x6f, 0x2f, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2f, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0xa2, 0x02, 0x03, 0x50, 0x4f, 0x58, 0xaa, 0x02, 0x12, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xca, 0x02, 0x12, 0x50, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0xe2, 0x02, 0x1e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x4f, 0x62, 0x6c, 0x69, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x13, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x3a, 0x3a, 0x4f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x7e, 0x0a, 0x15, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x12, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x7e, 0x0a, 0x15, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x12, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x7e, 0x0a, 0x15, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x12, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x7b, 0x0a, 0x14, 0x41, 0x64, + 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, + 0x65, 0x72, 0x12, 0x2f, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x84, 0x01, 0x0a, 0x17, 0x52, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, + 0x67, 0x65, 0x72, 0x12, 0x32, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x6d, + 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, + 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0xcf, + 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x10, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3a, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x64, + 0x66, 0x2f, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x6f, 0x6c, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2f, 0x6f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x4f, 0x58, 0xaa, + 0x02, 0x12, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0xca, 0x02, 0x12, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x4f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xe2, 0x02, 0x1e, 0x50, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x5c, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x50, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x3a, 0x3a, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/service/policy/obligations/obligations.proto b/service/policy/obligations/obligations.proto index 2a610502b6..8926127ef5 100644 --- a/service/policy/obligations/obligations.proto +++ b/service/policy/obligations/obligations.proto @@ -38,6 +38,9 @@ message CreateObligationRequest { string fqn = 2; } string name = 3; + + // Optional + repeated string values = 4; // Optional // Common metadata common.MetadataMutable metadata = 100; From 2b1f2bcc3bb0b4b740dc43a06b650d801efb0510 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 29 Jul 2025 23:54:32 -0400 Subject: [PATCH 016/137] values sql --- service/policy/db/obligations.go | 8 +-- service/policy/db/queries/obligations.sql | 68 ++++++++++++++++++++--- 2 files changed, 63 insertions(+), 13 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index b2569712e3..432b8aee0d 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -14,7 +14,7 @@ import ( /// Obligation Definitions /// -func (c PolicyDBClient) CreateObligationByNamespaceID(ctx context.Context, namespaceID, name string, metadata *common.MetadataMutable) (*policy.Obligation, error) { +func (c PolicyDBClient) CreateObligationByNamespaceID(ctx context.Context, namespaceID, name string, values []string, metadata *common.MetadataMutable) (*policy.Obligation, error) { metadataJSON, _, err := db.MarshalCreateMetadata(metadata) if err != nil { return nil, err @@ -40,7 +40,7 @@ func (c PolicyDBClient) CreateObligationByNamespaceID(ctx context.Context, names }, nil } -func (c PolicyDBClient) CreateObligationByNamespaceFQN(ctx context.Context, fqn, name string, metadata *common.MetadataMutable) (*policy.Obligation, error) { +func (c PolicyDBClient) CreateObligationByNamespaceFQN(ctx context.Context, fqn, name string, values []string, metadata *common.MetadataMutable) (*policy.Obligation, error) { metadataJSON, _, err := db.MarshalCreateMetadata(metadata) if err != nil { return nil, err @@ -68,9 +68,9 @@ func (c PolicyDBClient) CreateObligationByNamespaceFQN(ctx context.Context, fqn, func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.CreateObligationRequest) (*policy.Obligation, error) { if r.GetId() != "" { - return c.CreateObligationByNamespaceID(ctx, r.GetId(), r.GetName(), r.GetMetadata()) + return c.CreateObligationByNamespaceID(ctx, r.GetId(), r.GetName(), r.GetValues(), r.GetMetadata()) } - return c.CreateObligationByNamespaceFQN(ctx, r.GetFqn(), r.GetName(), r.GetMetadata()) + return c.CreateObligationByNamespaceFQN(ctx, r.GetFqn(), r.GetName(), r.GetValues(), r.GetMetadata()) } func (c PolicyDBClient) GetObligationDefinition(ctx context.Context, r *obligations.GetObligationRequest) (*policy.Obligation, error) { diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 902e9697a6..a9fd9671c4 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -2,17 +2,67 @@ -- OBLIGATIONS ---------------------------------------------------------------- --- name: createObligationByNamespaceId :one -INSERT INTO obligation_definitions (namespace_id, name, metadata) -VALUES ($1, $2, $3) -RETURNING id; +-- name: createObligationByNamespaceID :one +WITH inserted_obligation AS ( + INSERT INTO obligation_definitions (namespace_id, name, metadata) + VALUES ($1, $2, $3) + RETURNING id, namespace_id, name, metadata +), +inserted_values AS ( + INSERT INTO obligation_values_standard (obligation_definition_id, value) + SELECT io.id, UNNEST($4::VARCHAR[]) + FROM inserted_obligation io + WHERE $4::VARCHAR[] IS NOT NULL AND array_length($4::VARCHAR[], 1) > 0 + RETURNING id, obligation_definition_id, value +) +SELECT + io.id, + io.name, + io.metadata, + COALESCE( + JSON_AGG( + JSON_BUILD_OBJECT( + 'id', iv.id, + 'value', iv.value + ) + ) FILTER (WHERE iv.id IS NOT NULL), + '[]'::JSON + ) as values +FROM inserted_obligation io +LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id +GROUP BY io.id, io.name, io.metadata; -- name: createObligationByNamespaceFQN :one -INSERT INTO obligation_definitions (namespace_id, name, metadata) -SELECT fqns.namespace_id, $2, $3 -FROM attribute_fqns fqns -WHERE fqns.fqn = $1 -RETURNING id; +WITH inserted_obligation AS ( + INSERT INTO obligation_definitions (namespace_id, name, metadata) + SELECT fqns.namespace_id, $2, $3 + FROM attribute_fqns fqns + WHERE fqns.fqn = $1 + RETURNING id, namespace_id, name, metadata +), +inserted_values AS ( + INSERT INTO obligation_values_standard (obligation_definition_id, value) + SELECT io.id, UNNEST($4::VARCHAR[]) + FROM inserted_obligation io + WHERE $4::VARCHAR[] IS NOT NULL AND array_length($4::VARCHAR[], 1) > 0 + RETURNING id, obligation_definition_id, value +) +SELECT + io.id, + io.name, + io.metadata, + COALESCE( + JSON_AGG( + JSON_BUILD_OBJECT( + 'id', iv.id, + 'value', iv.value + ) + ) FILTER (WHERE iv.id IS NOT NULL), + '[]'::JSON + ) as values +FROM inserted_obligation io +LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id +GROUP BY io.id, io.name, io.metadata; -- name: getObligationDefinition :one SELECT From 379bfd419801cf4cbb3c367e7ceebebc04387af2 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 29 Jul 2025 23:56:49 -0400 Subject: [PATCH 017/137] w namespace --- service/policy/db/queries/obligations.sql | 80 ++++++++++++++++++++++- 1 file changed, 78 insertions(+), 2 deletions(-) diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index a9fd9671c4..e5dab43342 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -19,6 +19,20 @@ SELECT io.id, io.name, io.metadata, + JSON_BUILD_OBJECT( + 'id', ns.id, + 'name', ns.name, + 'active', ns.active, + 'fqn', fqns.fqn, + 'metadata', JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ns.metadata -> 'labels', 'created_at', ns.created_at, 'updated_at', ns.updated_at)), + 'grants', JSONB_AGG(DISTINCT JSONB_BUILD_OBJECT( + 'id', kas.id, + 'uri', kas.uri, + 'name', kas.name, + 'public_key', kas.public_key + )) FILTER (WHERE kas_ns_grants.namespace_id IS NOT NULL), + 'keys', nmp_keys.keys + ) as namespace, COALESCE( JSON_AGG( JSON_BUILD_OBJECT( @@ -29,8 +43,32 @@ SELECT '[]'::JSON ) as values FROM inserted_obligation io +JOIN attribute_namespaces ns ON io.namespace_id = ns.id +LEFT JOIN attribute_namespace_key_access_grants kas_ns_grants ON kas_ns_grants.namespace_id = ns.id +LEFT JOIN key_access_servers kas ON kas.id = kas_ns_grants.key_access_server_id +LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = ns.id LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id -GROUP BY io.id, io.name, io.metadata; +LEFT JOIN ( + SELECT + k.namespace_id, + JSONB_AGG( + DISTINCT JSONB_BUILD_OBJECT( + 'kas_uri', kas.uri, + 'kas_id', kas.id, + 'public_key', JSONB_BUILD_OBJECT( + 'algorithm', kask.key_algorithm::INTEGER, + 'kid', kask.key_id, + 'pem', CONVERT_FROM(DECODE(kask.public_key_ctx ->> 'pem', 'base64'), 'UTF8') + ) + ) + ) FILTER (WHERE kask.id IS NOT NULL) AS keys + FROM attribute_namespace_public_key_map k + INNER JOIN key_access_server_keys kask ON k.key_access_server_key_id = kask.id + INNER JOIN key_access_servers kas ON kask.key_access_server_id = kas.id + GROUP BY k.namespace_id +) nmp_keys ON ns.id = nmp_keys.namespace_id +WHERE fqns.attribute_id IS NULL AND fqns.value_id IS NULL +GROUP BY io.id, io.name, io.metadata, ns.id, ns.name, ns.active, ns.metadata, ns.created_at, ns.updated_at, fqns.fqn, nmp_keys.keys; -- name: createObligationByNamespaceFQN :one WITH inserted_obligation AS ( @@ -51,6 +89,20 @@ SELECT io.id, io.name, io.metadata, + JSON_BUILD_OBJECT( + 'id', ns.id, + 'name', ns.name, + 'active', ns.active, + 'fqn', fqns.fqn, + 'metadata', JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ns.metadata -> 'labels', 'created_at', ns.created_at, 'updated_at', ns.updated_at)), + 'grants', JSONB_AGG(DISTINCT JSONB_BUILD_OBJECT( + 'id', kas.id, + 'uri', kas.uri, + 'name', kas.name, + 'public_key', kas.public_key + )) FILTER (WHERE kas_ns_grants.namespace_id IS NOT NULL), + 'keys', nmp_keys.keys + ) as namespace, COALESCE( JSON_AGG( JSON_BUILD_OBJECT( @@ -61,8 +113,32 @@ SELECT '[]'::JSON ) as values FROM inserted_obligation io +JOIN attribute_namespaces ns ON io.namespace_id = ns.id +LEFT JOIN attribute_namespace_key_access_grants kas_ns_grants ON kas_ns_grants.namespace_id = ns.id +LEFT JOIN key_access_servers kas ON kas.id = kas_ns_grants.key_access_server_id +LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = ns.id LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id -GROUP BY io.id, io.name, io.metadata; +LEFT JOIN ( + SELECT + k.namespace_id, + JSONB_AGG( + DISTINCT JSONB_BUILD_OBJECT( + 'kas_uri', kas.uri, + 'kas_id', kas.id, + 'public_key', JSONB_BUILD_OBJECT( + 'algorithm', kask.key_algorithm::INTEGER, + 'kid', kask.key_id, + 'pem', CONVERT_FROM(DECODE(kask.public_key_ctx ->> 'pem', 'base64'), 'UTF8') + ) + ) + ) FILTER (WHERE kask.id IS NOT NULL) AS keys + FROM attribute_namespace_public_key_map k + INNER JOIN key_access_server_keys kask ON k.key_access_server_key_id = kask.id + INNER JOIN key_access_servers kas ON kask.key_access_server_id = kas.id + GROUP BY k.namespace_id +) nmp_keys ON ns.id = nmp_keys.namespace_id +WHERE fqns.attribute_id IS NULL AND fqns.value_id IS NULL +GROUP BY io.id, io.name, io.metadata, ns.id, ns.name, ns.active, ns.metadata, ns.created_at, ns.updated_at, fqns.fqn, nmp_keys.keys; -- name: getObligationDefinition :one SELECT From 7b0959699277ac30b10c8b152452a093e806f49e Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 30 Jul 2025 00:02:39 -0400 Subject: [PATCH 018/137] gen sql --- service/policy/db/obligations.go | 10 +- service/policy/db/obligations.sql.go | 360 ++++++++++++++++++++++++--- 2 files changed, 331 insertions(+), 39 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 432b8aee0d..cc30710cee 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -19,17 +19,17 @@ func (c PolicyDBClient) CreateObligationByNamespaceID(ctx context.Context, names if err != nil { return nil, err } - queryParams := createObligationByNamespaceIdParams{ + queryParams := createObligationByNamespaceIDParams{ NamespaceID: namespaceID, Name: name, Metadata: metadataJSON, } - id, err := c.queries.createObligationByNamespaceId(ctx, queryParams) + row, err := c.queries.createObligationByNamespaceID(ctx, queryParams) if err != nil { return nil, err } return &policy.Obligation{ - Id: id, + Id: row.ID, Name: name, Metadata: &common.Metadata{ Labels: metadata.GetLabels(), @@ -50,12 +50,12 @@ func (c PolicyDBClient) CreateObligationByNamespaceFQN(ctx context.Context, fqn, Name: name, Metadata: metadataJSON, } - id, err := c.queries.createObligationByNamespaceFQN(ctx, queryParams) + row, err := c.queries.createObligationByNamespaceFQN(ctx, queryParams) if err != nil { return nil, err } return &policy.Obligation{ - Id: id, + Id: row.ID, Name: name, Metadata: &common.Metadata{ Labels: metadata.GetLabels(), diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index c4b0d5b578..fcbc2bcd0a 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -12,58 +12,350 @@ import ( ) const createObligationByNamespaceFQN = `-- name: createObligationByNamespaceFQN :one -INSERT INTO obligation_definitions (namespace_id, name, metadata) -SELECT fqns.namespace_id, $2, $3 -FROM attribute_fqns fqns -WHERE fqns.fqn = $1 -RETURNING id +WITH inserted_obligation AS ( + INSERT INTO obligation_definitions (namespace_id, name, metadata) + SELECT fqns.namespace_id, $2, $3 + FROM attribute_fqns fqns + WHERE fqns.fqn = $1 + RETURNING id, namespace_id, name, metadata +), +inserted_values AS ( + INSERT INTO obligation_values_standard (obligation_definition_id, value) + SELECT io.id, UNNEST($4::VARCHAR[]) + FROM inserted_obligation io + WHERE $4::VARCHAR[] IS NOT NULL AND array_length($4::VARCHAR[], 1) > 0 + RETURNING id, obligation_definition_id, value +) +SELECT + io.id, + io.name, + io.metadata, + JSON_BUILD_OBJECT( + 'id', ns.id, + 'name', ns.name, + 'active', ns.active, + 'fqn', fqns.fqn, + 'metadata', JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ns.metadata -> 'labels', 'created_at', ns.created_at, 'updated_at', ns.updated_at)), + 'grants', JSONB_AGG(DISTINCT JSONB_BUILD_OBJECT( + 'id', kas.id, + 'uri', kas.uri, + 'name', kas.name, + 'public_key', kas.public_key + )) FILTER (WHERE kas_ns_grants.namespace_id IS NOT NULL), + 'keys', nmp_keys.keys + ) as namespace, + COALESCE( + JSON_AGG( + JSON_BUILD_OBJECT( + 'id', iv.id, + 'value', iv.value + ) + ) FILTER (WHERE iv.id IS NOT NULL), + '[]'::JSON + ) as values +FROM inserted_obligation io +JOIN attribute_namespaces ns ON io.namespace_id = ns.id +LEFT JOIN attribute_namespace_key_access_grants kas_ns_grants ON kas_ns_grants.namespace_id = ns.id +LEFT JOIN key_access_servers kas ON kas.id = kas_ns_grants.key_access_server_id +LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = ns.id +LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id +LEFT JOIN ( + SELECT + k.namespace_id, + JSONB_AGG( + DISTINCT JSONB_BUILD_OBJECT( + 'kas_uri', kas.uri, + 'kas_id', kas.id, + 'public_key', JSONB_BUILD_OBJECT( + 'algorithm', kask.key_algorithm::INTEGER, + 'kid', kask.key_id, + 'pem', CONVERT_FROM(DECODE(kask.public_key_ctx ->> 'pem', 'base64'), 'UTF8') + ) + ) + ) FILTER (WHERE kask.id IS NOT NULL) AS keys + FROM attribute_namespace_public_key_map k + INNER JOIN key_access_server_keys kask ON k.key_access_server_key_id = kask.id + INNER JOIN key_access_servers kas ON kask.key_access_server_id = kas.id + GROUP BY k.namespace_id +) nmp_keys ON ns.id = nmp_keys.namespace_id +WHERE fqns.attribute_id IS NULL AND fqns.value_id IS NULL +GROUP BY io.id, io.name, io.metadata, ns.id, ns.name, ns.active, ns.metadata, ns.created_at, ns.updated_at, fqns.fqn, nmp_keys.keys ` type createObligationByNamespaceFQNParams struct { - Fqn string `json:"fqn"` - Name string `json:"name"` - Metadata []byte `json:"metadata"` + Fqn string `json:"fqn"` + Name string `json:"name"` + Metadata []byte `json:"metadata"` + Column4 []string `json:"column_4"` +} + +type createObligationByNamespaceFQNRow struct { + ID string `json:"id"` + Name string `json:"name"` + Metadata []byte `json:"metadata"` + Namespace []byte `json:"namespace"` + Values interface{} `json:"values"` } // createObligationByNamespaceFQN // -// INSERT INTO obligation_definitions (namespace_id, name, metadata) -// SELECT fqns.namespace_id, $2, $3 -// FROM attribute_fqns fqns -// WHERE fqns.fqn = $1 -// RETURNING id -func (q *Queries) createObligationByNamespaceFQN(ctx context.Context, arg createObligationByNamespaceFQNParams) (string, error) { - row := q.db.QueryRow(ctx, createObligationByNamespaceFQN, arg.Fqn, arg.Name, arg.Metadata) - var id string - err := row.Scan(&id) - return id, err +// WITH inserted_obligation AS ( +// INSERT INTO obligation_definitions (namespace_id, name, metadata) +// SELECT fqns.namespace_id, $2, $3 +// FROM attribute_fqns fqns +// WHERE fqns.fqn = $1 +// RETURNING id, namespace_id, name, metadata +// ), +// inserted_values AS ( +// INSERT INTO obligation_values_standard (obligation_definition_id, value) +// SELECT io.id, UNNEST($4::VARCHAR[]) +// FROM inserted_obligation io +// WHERE $4::VARCHAR[] IS NOT NULL AND array_length($4::VARCHAR[], 1) > 0 +// RETURNING id, obligation_definition_id, value +// ) +// SELECT +// io.id, +// io.name, +// io.metadata, +// JSON_BUILD_OBJECT( +// 'id', ns.id, +// 'name', ns.name, +// 'active', ns.active, +// 'fqn', fqns.fqn, +// 'metadata', JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ns.metadata -> 'labels', 'created_at', ns.created_at, 'updated_at', ns.updated_at)), +// 'grants', JSONB_AGG(DISTINCT JSONB_BUILD_OBJECT( +// 'id', kas.id, +// 'uri', kas.uri, +// 'name', kas.name, +// 'public_key', kas.public_key +// )) FILTER (WHERE kas_ns_grants.namespace_id IS NOT NULL), +// 'keys', nmp_keys.keys +// ) as namespace, +// COALESCE( +// JSON_AGG( +// JSON_BUILD_OBJECT( +// 'id', iv.id, +// 'value', iv.value +// ) +// ) FILTER (WHERE iv.id IS NOT NULL), +// '[]'::JSON +// ) as values +// FROM inserted_obligation io +// JOIN attribute_namespaces ns ON io.namespace_id = ns.id +// LEFT JOIN attribute_namespace_key_access_grants kas_ns_grants ON kas_ns_grants.namespace_id = ns.id +// LEFT JOIN key_access_servers kas ON kas.id = kas_ns_grants.key_access_server_id +// LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = ns.id +// LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id +// LEFT JOIN ( +// SELECT +// k.namespace_id, +// JSONB_AGG( +// DISTINCT JSONB_BUILD_OBJECT( +// 'kas_uri', kas.uri, +// 'kas_id', kas.id, +// 'public_key', JSONB_BUILD_OBJECT( +// 'algorithm', kask.key_algorithm::INTEGER, +// 'kid', kask.key_id, +// 'pem', CONVERT_FROM(DECODE(kask.public_key_ctx ->> 'pem', 'base64'), 'UTF8') +// ) +// ) +// ) FILTER (WHERE kask.id IS NOT NULL) AS keys +// FROM attribute_namespace_public_key_map k +// INNER JOIN key_access_server_keys kask ON k.key_access_server_key_id = kask.id +// INNER JOIN key_access_servers kas ON kask.key_access_server_id = kas.id +// GROUP BY k.namespace_id +// ) nmp_keys ON ns.id = nmp_keys.namespace_id +// WHERE fqns.attribute_id IS NULL AND fqns.value_id IS NULL +// GROUP BY io.id, io.name, io.metadata, ns.id, ns.name, ns.active, ns.metadata, ns.created_at, ns.updated_at, fqns.fqn, nmp_keys.keys +func (q *Queries) createObligationByNamespaceFQN(ctx context.Context, arg createObligationByNamespaceFQNParams) (createObligationByNamespaceFQNRow, error) { + row := q.db.QueryRow(ctx, createObligationByNamespaceFQN, + arg.Fqn, + arg.Name, + arg.Metadata, + arg.Column4, + ) + var i createObligationByNamespaceFQNRow + err := row.Scan( + &i.ID, + &i.Name, + &i.Metadata, + &i.Namespace, + &i.Values, + ) + return i, err } -const createObligationByNamespaceId = `-- name: createObligationByNamespaceId :one +const createObligationByNamespaceID = `-- name: createObligationByNamespaceID :one -INSERT INTO obligation_definitions (namespace_id, name, metadata) -VALUES ($1, $2, $3) -RETURNING id +WITH inserted_obligation AS ( + INSERT INTO obligation_definitions (namespace_id, name, metadata) + VALUES ($1, $2, $3) + RETURNING id, namespace_id, name, metadata +), +inserted_values AS ( + INSERT INTO obligation_values_standard (obligation_definition_id, value) + SELECT io.id, UNNEST($4::VARCHAR[]) + FROM inserted_obligation io + WHERE $4::VARCHAR[] IS NOT NULL AND array_length($4::VARCHAR[], 1) > 0 + RETURNING id, obligation_definition_id, value +) +SELECT + io.id, + io.name, + io.metadata, + JSON_BUILD_OBJECT( + 'id', ns.id, + 'name', ns.name, + 'active', ns.active, + 'fqn', fqns.fqn, + 'metadata', JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ns.metadata -> 'labels', 'created_at', ns.created_at, 'updated_at', ns.updated_at)), + 'grants', JSONB_AGG(DISTINCT JSONB_BUILD_OBJECT( + 'id', kas.id, + 'uri', kas.uri, + 'name', kas.name, + 'public_key', kas.public_key + )) FILTER (WHERE kas_ns_grants.namespace_id IS NOT NULL), + 'keys', nmp_keys.keys + ) as namespace, + COALESCE( + JSON_AGG( + JSON_BUILD_OBJECT( + 'id', iv.id, + 'value', iv.value + ) + ) FILTER (WHERE iv.id IS NOT NULL), + '[]'::JSON + ) as values +FROM inserted_obligation io +JOIN attribute_namespaces ns ON io.namespace_id = ns.id +LEFT JOIN attribute_namespace_key_access_grants kas_ns_grants ON kas_ns_grants.namespace_id = ns.id +LEFT JOIN key_access_servers kas ON kas.id = kas_ns_grants.key_access_server_id +LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = ns.id +LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id +LEFT JOIN ( + SELECT + k.namespace_id, + JSONB_AGG( + DISTINCT JSONB_BUILD_OBJECT( + 'kas_uri', kas.uri, + 'kas_id', kas.id, + 'public_key', JSONB_BUILD_OBJECT( + 'algorithm', kask.key_algorithm::INTEGER, + 'kid', kask.key_id, + 'pem', CONVERT_FROM(DECODE(kask.public_key_ctx ->> 'pem', 'base64'), 'UTF8') + ) + ) + ) FILTER (WHERE kask.id IS NOT NULL) AS keys + FROM attribute_namespace_public_key_map k + INNER JOIN key_access_server_keys kask ON k.key_access_server_key_id = kask.id + INNER JOIN key_access_servers kas ON kask.key_access_server_id = kas.id + GROUP BY k.namespace_id +) nmp_keys ON ns.id = nmp_keys.namespace_id +WHERE fqns.attribute_id IS NULL AND fqns.value_id IS NULL +GROUP BY io.id, io.name, io.metadata, ns.id, ns.name, ns.active, ns.metadata, ns.created_at, ns.updated_at, fqns.fqn, nmp_keys.keys ` -type createObligationByNamespaceIdParams struct { - NamespaceID string `json:"namespace_id"` - Name string `json:"name"` - Metadata []byte `json:"metadata"` +type createObligationByNamespaceIDParams struct { + NamespaceID string `json:"namespace_id"` + Name string `json:"name"` + Metadata []byte `json:"metadata"` + Column4 []string `json:"column_4"` +} + +type createObligationByNamespaceIDRow struct { + ID string `json:"id"` + Name string `json:"name"` + Metadata []byte `json:"metadata"` + Namespace []byte `json:"namespace"` + Values interface{} `json:"values"` } // -------------------------------------------------------------- // OBLIGATIONS // -------------------------------------------------------------- // -// INSERT INTO obligation_definitions (namespace_id, name, metadata) -// VALUES ($1, $2, $3) -// RETURNING id -func (q *Queries) createObligationByNamespaceId(ctx context.Context, arg createObligationByNamespaceIdParams) (string, error) { - row := q.db.QueryRow(ctx, createObligationByNamespaceId, arg.NamespaceID, arg.Name, arg.Metadata) - var id string - err := row.Scan(&id) - return id, err +// WITH inserted_obligation AS ( +// INSERT INTO obligation_definitions (namespace_id, name, metadata) +// VALUES ($1, $2, $3) +// RETURNING id, namespace_id, name, metadata +// ), +// inserted_values AS ( +// INSERT INTO obligation_values_standard (obligation_definition_id, value) +// SELECT io.id, UNNEST($4::VARCHAR[]) +// FROM inserted_obligation io +// WHERE $4::VARCHAR[] IS NOT NULL AND array_length($4::VARCHAR[], 1) > 0 +// RETURNING id, obligation_definition_id, value +// ) +// SELECT +// io.id, +// io.name, +// io.metadata, +// JSON_BUILD_OBJECT( +// 'id', ns.id, +// 'name', ns.name, +// 'active', ns.active, +// 'fqn', fqns.fqn, +// 'metadata', JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ns.metadata -> 'labels', 'created_at', ns.created_at, 'updated_at', ns.updated_at)), +// 'grants', JSONB_AGG(DISTINCT JSONB_BUILD_OBJECT( +// 'id', kas.id, +// 'uri', kas.uri, +// 'name', kas.name, +// 'public_key', kas.public_key +// )) FILTER (WHERE kas_ns_grants.namespace_id IS NOT NULL), +// 'keys', nmp_keys.keys +// ) as namespace, +// COALESCE( +// JSON_AGG( +// JSON_BUILD_OBJECT( +// 'id', iv.id, +// 'value', iv.value +// ) +// ) FILTER (WHERE iv.id IS NOT NULL), +// '[]'::JSON +// ) as values +// FROM inserted_obligation io +// JOIN attribute_namespaces ns ON io.namespace_id = ns.id +// LEFT JOIN attribute_namespace_key_access_grants kas_ns_grants ON kas_ns_grants.namespace_id = ns.id +// LEFT JOIN key_access_servers kas ON kas.id = kas_ns_grants.key_access_server_id +// LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = ns.id +// LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id +// LEFT JOIN ( +// SELECT +// k.namespace_id, +// JSONB_AGG( +// DISTINCT JSONB_BUILD_OBJECT( +// 'kas_uri', kas.uri, +// 'kas_id', kas.id, +// 'public_key', JSONB_BUILD_OBJECT( +// 'algorithm', kask.key_algorithm::INTEGER, +// 'kid', kask.key_id, +// 'pem', CONVERT_FROM(DECODE(kask.public_key_ctx ->> 'pem', 'base64'), 'UTF8') +// ) +// ) +// ) FILTER (WHERE kask.id IS NOT NULL) AS keys +// FROM attribute_namespace_public_key_map k +// INNER JOIN key_access_server_keys kask ON k.key_access_server_key_id = kask.id +// INNER JOIN key_access_servers kas ON kask.key_access_server_id = kas.id +// GROUP BY k.namespace_id +// ) nmp_keys ON ns.id = nmp_keys.namespace_id +// WHERE fqns.attribute_id IS NULL AND fqns.value_id IS NULL +// GROUP BY io.id, io.name, io.metadata, ns.id, ns.name, ns.active, ns.metadata, ns.created_at, ns.updated_at, fqns.fqn, nmp_keys.keys +func (q *Queries) createObligationByNamespaceID(ctx context.Context, arg createObligationByNamespaceIDParams) (createObligationByNamespaceIDRow, error) { + row := q.db.QueryRow(ctx, createObligationByNamespaceID, + arg.NamespaceID, + arg.Name, + arg.Metadata, + arg.Column4, + ) + var i createObligationByNamespaceIDRow + err := row.Scan( + &i.ID, + &i.Name, + &i.Metadata, + &i.Namespace, + &i.Values, + ) + return i, err } const deleteObligationDefinition = `-- name: deleteObligationDefinition :execrows From aa53db3875ff7d15b2b3f442db7438a620b11440 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 30 Jul 2025 01:18:35 -0400 Subject: [PATCH 019/137] seems okay --- service/policy/db/obligations.go | 23 +++ service/policy/db/obligations.sql.go | 200 ++++------------------ service/policy/db/queries/obligations.sql | 94 ++-------- 3 files changed, 71 insertions(+), 246 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index cc30710cee..6bca8ba06c 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -3,13 +3,24 @@ package db import ( "context" "errors" + "fmt" "github.com/opentdf/platform/protocol/go/common" "github.com/opentdf/platform/protocol/go/policy" "github.com/opentdf/platform/protocol/go/policy/obligations" "github.com/opentdf/platform/service/pkg/db" + "google.golang.org/protobuf/encoding/protojson" ) +func unmarshalValue(values []byte, v *policy.ObligationValue) error { + if values != nil { + if err := protojson.Unmarshal(values, v); err != nil { + return fmt.Errorf("failed to unmarshal values [%s]: %w", string(values), err) + } + } + return errors.New("failed to unmarshal obligation values") +} + /// /// Obligation Definitions /// @@ -23,11 +34,21 @@ func (c PolicyDBClient) CreateObligationByNamespaceID(ctx context.Context, names NamespaceID: namespaceID, Name: name, Metadata: metadataJSON, + Values: values, } row, err := c.queries.createObligationByNamespaceID(ctx, queryParams) if err != nil { return nil, err } + oblVals := make([]*policy.ObligationValue, 0, len(values)) + for _, value := range values { + oblVal := &policy.ObligationValue{} + if err := unmarshalValue([]byte(value), oblVal); err != nil { + return nil, fmt.Errorf("failed to unmarshal obligation value: %w", err) + } + oblVals = append(oblVals, oblVal) + } + return &policy.Obligation{ Id: row.ID, Name: name, @@ -37,6 +58,7 @@ func (c PolicyDBClient) CreateObligationByNamespaceID(ctx context.Context, names Namespace: &policy.Namespace{ Id: namespaceID, }, + Values: oblVals, }, nil } @@ -49,6 +71,7 @@ func (c PolicyDBClient) CreateObligationByNamespaceFQN(ctx context.Context, fqn, Fqn: fqn, Name: name, Metadata: metadataJSON, + Values: values, } row, err := c.queries.createObligationByNamespaceFQN(ctx, queryParams) if err != nil { diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index fcbc2bcd0a..4d7349932e 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -31,18 +31,8 @@ SELECT io.name, io.metadata, JSON_BUILD_OBJECT( - 'id', ns.id, - 'name', ns.name, - 'active', ns.active, - 'fqn', fqns.fqn, - 'metadata', JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ns.metadata -> 'labels', 'created_at', ns.created_at, 'updated_at', ns.updated_at)), - 'grants', JSONB_AGG(DISTINCT JSONB_BUILD_OBJECT( - 'id', kas.id, - 'uri', kas.uri, - 'name', kas.name, - 'public_key', kas.public_key - )) FILTER (WHERE kas_ns_grants.namespace_id IS NOT NULL), - 'keys', nmp_keys.keys + 'id', n.id, + 'name', n.name ) as namespace, COALESCE( JSON_AGG( @@ -52,49 +42,26 @@ SELECT ) ) FILTER (WHERE iv.id IS NOT NULL), '[]'::JSON - ) as values + )::JSONB as values FROM inserted_obligation io -JOIN attribute_namespaces ns ON io.namespace_id = ns.id -LEFT JOIN attribute_namespace_key_access_grants kas_ns_grants ON kas_ns_grants.namespace_id = ns.id -LEFT JOIN key_access_servers kas ON kas.id = kas_ns_grants.key_access_server_id -LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = ns.id +JOIN attribute_namespaces n ON io.namespace_id = n.id LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id -LEFT JOIN ( - SELECT - k.namespace_id, - JSONB_AGG( - DISTINCT JSONB_BUILD_OBJECT( - 'kas_uri', kas.uri, - 'kas_id', kas.id, - 'public_key', JSONB_BUILD_OBJECT( - 'algorithm', kask.key_algorithm::INTEGER, - 'kid', kask.key_id, - 'pem', CONVERT_FROM(DECODE(kask.public_key_ctx ->> 'pem', 'base64'), 'UTF8') - ) - ) - ) FILTER (WHERE kask.id IS NOT NULL) AS keys - FROM attribute_namespace_public_key_map k - INNER JOIN key_access_server_keys kask ON k.key_access_server_key_id = kask.id - INNER JOIN key_access_servers kas ON kask.key_access_server_id = kas.id - GROUP BY k.namespace_id -) nmp_keys ON ns.id = nmp_keys.namespace_id -WHERE fqns.attribute_id IS NULL AND fqns.value_id IS NULL -GROUP BY io.id, io.name, io.metadata, ns.id, ns.name, ns.active, ns.metadata, ns.created_at, ns.updated_at, fqns.fqn, nmp_keys.keys +GROUP BY io.id, io.name, io.metadata, n.id, n.name ` type createObligationByNamespaceFQNParams struct { Fqn string `json:"fqn"` Name string `json:"name"` Metadata []byte `json:"metadata"` - Column4 []string `json:"column_4"` + Values []string `json:"values"` } type createObligationByNamespaceFQNRow struct { - ID string `json:"id"` - Name string `json:"name"` - Metadata []byte `json:"metadata"` - Namespace []byte `json:"namespace"` - Values interface{} `json:"values"` + ID string `json:"id"` + Name string `json:"name"` + Metadata []byte `json:"metadata"` + Namespace []byte `json:"namespace"` + Values []byte `json:"values"` } // createObligationByNamespaceFQN @@ -118,18 +85,8 @@ type createObligationByNamespaceFQNRow struct { // io.name, // io.metadata, // JSON_BUILD_OBJECT( -// 'id', ns.id, -// 'name', ns.name, -// 'active', ns.active, -// 'fqn', fqns.fqn, -// 'metadata', JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ns.metadata -> 'labels', 'created_at', ns.created_at, 'updated_at', ns.updated_at)), -// 'grants', JSONB_AGG(DISTINCT JSONB_BUILD_OBJECT( -// 'id', kas.id, -// 'uri', kas.uri, -// 'name', kas.name, -// 'public_key', kas.public_key -// )) FILTER (WHERE kas_ns_grants.namespace_id IS NOT NULL), -// 'keys', nmp_keys.keys +// 'id', n.id, +// 'name', n.name // ) as namespace, // COALESCE( // JSON_AGG( @@ -139,40 +96,17 @@ type createObligationByNamespaceFQNRow struct { // ) // ) FILTER (WHERE iv.id IS NOT NULL), // '[]'::JSON -// ) as values +// )::JSONB as values // FROM inserted_obligation io -// JOIN attribute_namespaces ns ON io.namespace_id = ns.id -// LEFT JOIN attribute_namespace_key_access_grants kas_ns_grants ON kas_ns_grants.namespace_id = ns.id -// LEFT JOIN key_access_servers kas ON kas.id = kas_ns_grants.key_access_server_id -// LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = ns.id +// JOIN attribute_namespaces n ON io.namespace_id = n.id // LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id -// LEFT JOIN ( -// SELECT -// k.namespace_id, -// JSONB_AGG( -// DISTINCT JSONB_BUILD_OBJECT( -// 'kas_uri', kas.uri, -// 'kas_id', kas.id, -// 'public_key', JSONB_BUILD_OBJECT( -// 'algorithm', kask.key_algorithm::INTEGER, -// 'kid', kask.key_id, -// 'pem', CONVERT_FROM(DECODE(kask.public_key_ctx ->> 'pem', 'base64'), 'UTF8') -// ) -// ) -// ) FILTER (WHERE kask.id IS NOT NULL) AS keys -// FROM attribute_namespace_public_key_map k -// INNER JOIN key_access_server_keys kask ON k.key_access_server_key_id = kask.id -// INNER JOIN key_access_servers kas ON kask.key_access_server_id = kas.id -// GROUP BY k.namespace_id -// ) nmp_keys ON ns.id = nmp_keys.namespace_id -// WHERE fqns.attribute_id IS NULL AND fqns.value_id IS NULL -// GROUP BY io.id, io.name, io.metadata, ns.id, ns.name, ns.active, ns.metadata, ns.created_at, ns.updated_at, fqns.fqn, nmp_keys.keys +// GROUP BY io.id, io.name, io.metadata, n.id, n.name func (q *Queries) createObligationByNamespaceFQN(ctx context.Context, arg createObligationByNamespaceFQNParams) (createObligationByNamespaceFQNRow, error) { row := q.db.QueryRow(ctx, createObligationByNamespaceFQN, arg.Fqn, arg.Name, arg.Metadata, - arg.Column4, + arg.Values, ) var i createObligationByNamespaceFQNRow err := row.Scan( @@ -204,18 +138,8 @@ SELECT io.name, io.metadata, JSON_BUILD_OBJECT( - 'id', ns.id, - 'name', ns.name, - 'active', ns.active, - 'fqn', fqns.fqn, - 'metadata', JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ns.metadata -> 'labels', 'created_at', ns.created_at, 'updated_at', ns.updated_at)), - 'grants', JSONB_AGG(DISTINCT JSONB_BUILD_OBJECT( - 'id', kas.id, - 'uri', kas.uri, - 'name', kas.name, - 'public_key', kas.public_key - )) FILTER (WHERE kas_ns_grants.namespace_id IS NOT NULL), - 'keys', nmp_keys.keys + 'id', n.id, + 'name', n.name ) as namespace, COALESCE( JSON_AGG( @@ -225,49 +149,26 @@ SELECT ) ) FILTER (WHERE iv.id IS NOT NULL), '[]'::JSON - ) as values + )::JSONB as values FROM inserted_obligation io -JOIN attribute_namespaces ns ON io.namespace_id = ns.id -LEFT JOIN attribute_namespace_key_access_grants kas_ns_grants ON kas_ns_grants.namespace_id = ns.id -LEFT JOIN key_access_servers kas ON kas.id = kas_ns_grants.key_access_server_id -LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = ns.id +JOIN attribute_namespaces n ON io.namespace_id = n.id LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id -LEFT JOIN ( - SELECT - k.namespace_id, - JSONB_AGG( - DISTINCT JSONB_BUILD_OBJECT( - 'kas_uri', kas.uri, - 'kas_id', kas.id, - 'public_key', JSONB_BUILD_OBJECT( - 'algorithm', kask.key_algorithm::INTEGER, - 'kid', kask.key_id, - 'pem', CONVERT_FROM(DECODE(kask.public_key_ctx ->> 'pem', 'base64'), 'UTF8') - ) - ) - ) FILTER (WHERE kask.id IS NOT NULL) AS keys - FROM attribute_namespace_public_key_map k - INNER JOIN key_access_server_keys kask ON k.key_access_server_key_id = kask.id - INNER JOIN key_access_servers kas ON kask.key_access_server_id = kas.id - GROUP BY k.namespace_id -) nmp_keys ON ns.id = nmp_keys.namespace_id -WHERE fqns.attribute_id IS NULL AND fqns.value_id IS NULL -GROUP BY io.id, io.name, io.metadata, ns.id, ns.name, ns.active, ns.metadata, ns.created_at, ns.updated_at, fqns.fqn, nmp_keys.keys +GROUP BY io.id, io.name, io.metadata, n.id, n.name ` type createObligationByNamespaceIDParams struct { NamespaceID string `json:"namespace_id"` Name string `json:"name"` Metadata []byte `json:"metadata"` - Column4 []string `json:"column_4"` + Values []string `json:"values"` } type createObligationByNamespaceIDRow struct { - ID string `json:"id"` - Name string `json:"name"` - Metadata []byte `json:"metadata"` - Namespace []byte `json:"namespace"` - Values interface{} `json:"values"` + ID string `json:"id"` + Name string `json:"name"` + Metadata []byte `json:"metadata"` + Namespace []byte `json:"namespace"` + Values []byte `json:"values"` } // -------------------------------------------------------------- @@ -291,18 +192,8 @@ type createObligationByNamespaceIDRow struct { // io.name, // io.metadata, // JSON_BUILD_OBJECT( -// 'id', ns.id, -// 'name', ns.name, -// 'active', ns.active, -// 'fqn', fqns.fqn, -// 'metadata', JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ns.metadata -> 'labels', 'created_at', ns.created_at, 'updated_at', ns.updated_at)), -// 'grants', JSONB_AGG(DISTINCT JSONB_BUILD_OBJECT( -// 'id', kas.id, -// 'uri', kas.uri, -// 'name', kas.name, -// 'public_key', kas.public_key -// )) FILTER (WHERE kas_ns_grants.namespace_id IS NOT NULL), -// 'keys', nmp_keys.keys +// 'id', n.id, +// 'name', n.name // ) as namespace, // COALESCE( // JSON_AGG( @@ -312,40 +203,17 @@ type createObligationByNamespaceIDRow struct { // ) // ) FILTER (WHERE iv.id IS NOT NULL), // '[]'::JSON -// ) as values +// )::JSONB as values // FROM inserted_obligation io -// JOIN attribute_namespaces ns ON io.namespace_id = ns.id -// LEFT JOIN attribute_namespace_key_access_grants kas_ns_grants ON kas_ns_grants.namespace_id = ns.id -// LEFT JOIN key_access_servers kas ON kas.id = kas_ns_grants.key_access_server_id -// LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = ns.id +// JOIN attribute_namespaces n ON io.namespace_id = n.id // LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id -// LEFT JOIN ( -// SELECT -// k.namespace_id, -// JSONB_AGG( -// DISTINCT JSONB_BUILD_OBJECT( -// 'kas_uri', kas.uri, -// 'kas_id', kas.id, -// 'public_key', JSONB_BUILD_OBJECT( -// 'algorithm', kask.key_algorithm::INTEGER, -// 'kid', kask.key_id, -// 'pem', CONVERT_FROM(DECODE(kask.public_key_ctx ->> 'pem', 'base64'), 'UTF8') -// ) -// ) -// ) FILTER (WHERE kask.id IS NOT NULL) AS keys -// FROM attribute_namespace_public_key_map k -// INNER JOIN key_access_server_keys kask ON k.key_access_server_key_id = kask.id -// INNER JOIN key_access_servers kas ON kask.key_access_server_id = kas.id -// GROUP BY k.namespace_id -// ) nmp_keys ON ns.id = nmp_keys.namespace_id -// WHERE fqns.attribute_id IS NULL AND fqns.value_id IS NULL -// GROUP BY io.id, io.name, io.metadata, ns.id, ns.name, ns.active, ns.metadata, ns.created_at, ns.updated_at, fqns.fqn, nmp_keys.keys +// GROUP BY io.id, io.name, io.metadata, n.id, n.name func (q *Queries) createObligationByNamespaceID(ctx context.Context, arg createObligationByNamespaceIDParams) (createObligationByNamespaceIDRow, error) { row := q.db.QueryRow(ctx, createObligationByNamespaceID, arg.NamespaceID, arg.Name, arg.Metadata, - arg.Column4, + arg.Values, ) var i createObligationByNamespaceIDRow err := row.Scan( diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index e5dab43342..f520a48a66 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -10,9 +10,9 @@ WITH inserted_obligation AS ( ), inserted_values AS ( INSERT INTO obligation_values_standard (obligation_definition_id, value) - SELECT io.id, UNNEST($4::VARCHAR[]) + SELECT io.id, UNNEST(sqlc.arg('values')::VARCHAR[]) FROM inserted_obligation io - WHERE $4::VARCHAR[] IS NOT NULL AND array_length($4::VARCHAR[], 1) > 0 + WHERE sqlc.arg('values')::VARCHAR[] IS NOT NULL AND array_length(sqlc.arg('values')::VARCHAR[], 1) > 0 RETURNING id, obligation_definition_id, value ) SELECT @@ -20,18 +20,8 @@ SELECT io.name, io.metadata, JSON_BUILD_OBJECT( - 'id', ns.id, - 'name', ns.name, - 'active', ns.active, - 'fqn', fqns.fqn, - 'metadata', JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ns.metadata -> 'labels', 'created_at', ns.created_at, 'updated_at', ns.updated_at)), - 'grants', JSONB_AGG(DISTINCT JSONB_BUILD_OBJECT( - 'id', kas.id, - 'uri', kas.uri, - 'name', kas.name, - 'public_key', kas.public_key - )) FILTER (WHERE kas_ns_grants.namespace_id IS NOT NULL), - 'keys', nmp_keys.keys + 'id', n.id, + 'name', n.name ) as namespace, COALESCE( JSON_AGG( @@ -41,34 +31,11 @@ SELECT ) ) FILTER (WHERE iv.id IS NOT NULL), '[]'::JSON - ) as values + )::JSONB as values FROM inserted_obligation io -JOIN attribute_namespaces ns ON io.namespace_id = ns.id -LEFT JOIN attribute_namespace_key_access_grants kas_ns_grants ON kas_ns_grants.namespace_id = ns.id -LEFT JOIN key_access_servers kas ON kas.id = kas_ns_grants.key_access_server_id -LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = ns.id +JOIN attribute_namespaces n ON io.namespace_id = n.id LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id -LEFT JOIN ( - SELECT - k.namespace_id, - JSONB_AGG( - DISTINCT JSONB_BUILD_OBJECT( - 'kas_uri', kas.uri, - 'kas_id', kas.id, - 'public_key', JSONB_BUILD_OBJECT( - 'algorithm', kask.key_algorithm::INTEGER, - 'kid', kask.key_id, - 'pem', CONVERT_FROM(DECODE(kask.public_key_ctx ->> 'pem', 'base64'), 'UTF8') - ) - ) - ) FILTER (WHERE kask.id IS NOT NULL) AS keys - FROM attribute_namespace_public_key_map k - INNER JOIN key_access_server_keys kask ON k.key_access_server_key_id = kask.id - INNER JOIN key_access_servers kas ON kask.key_access_server_id = kas.id - GROUP BY k.namespace_id -) nmp_keys ON ns.id = nmp_keys.namespace_id -WHERE fqns.attribute_id IS NULL AND fqns.value_id IS NULL -GROUP BY io.id, io.name, io.metadata, ns.id, ns.name, ns.active, ns.metadata, ns.created_at, ns.updated_at, fqns.fqn, nmp_keys.keys; +GROUP BY io.id, io.name, io.metadata, n.id, n.name; -- name: createObligationByNamespaceFQN :one WITH inserted_obligation AS ( @@ -80,9 +47,9 @@ WITH inserted_obligation AS ( ), inserted_values AS ( INSERT INTO obligation_values_standard (obligation_definition_id, value) - SELECT io.id, UNNEST($4::VARCHAR[]) + SELECT io.id, UNNEST(sqlc.arg('values')::VARCHAR[]) FROM inserted_obligation io - WHERE $4::VARCHAR[] IS NOT NULL AND array_length($4::VARCHAR[], 1) > 0 + WHERE sqlc.arg('values')::VARCHAR[] IS NOT NULL AND array_length(sqlc.arg('values')::VARCHAR[], 1) > 0 RETURNING id, obligation_definition_id, value ) SELECT @@ -90,18 +57,8 @@ SELECT io.name, io.metadata, JSON_BUILD_OBJECT( - 'id', ns.id, - 'name', ns.name, - 'active', ns.active, - 'fqn', fqns.fqn, - 'metadata', JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ns.metadata -> 'labels', 'created_at', ns.created_at, 'updated_at', ns.updated_at)), - 'grants', JSONB_AGG(DISTINCT JSONB_BUILD_OBJECT( - 'id', kas.id, - 'uri', kas.uri, - 'name', kas.name, - 'public_key', kas.public_key - )) FILTER (WHERE kas_ns_grants.namespace_id IS NOT NULL), - 'keys', nmp_keys.keys + 'id', n.id, + 'name', n.name ) as namespace, COALESCE( JSON_AGG( @@ -111,34 +68,11 @@ SELECT ) ) FILTER (WHERE iv.id IS NOT NULL), '[]'::JSON - ) as values + )::JSONB as values FROM inserted_obligation io -JOIN attribute_namespaces ns ON io.namespace_id = ns.id -LEFT JOIN attribute_namespace_key_access_grants kas_ns_grants ON kas_ns_grants.namespace_id = ns.id -LEFT JOIN key_access_servers kas ON kas.id = kas_ns_grants.key_access_server_id -LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = ns.id +JOIN attribute_namespaces n ON io.namespace_id = n.id LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id -LEFT JOIN ( - SELECT - k.namespace_id, - JSONB_AGG( - DISTINCT JSONB_BUILD_OBJECT( - 'kas_uri', kas.uri, - 'kas_id', kas.id, - 'public_key', JSONB_BUILD_OBJECT( - 'algorithm', kask.key_algorithm::INTEGER, - 'kid', kask.key_id, - 'pem', CONVERT_FROM(DECODE(kask.public_key_ctx ->> 'pem', 'base64'), 'UTF8') - ) - ) - ) FILTER (WHERE kask.id IS NOT NULL) AS keys - FROM attribute_namespace_public_key_map k - INNER JOIN key_access_server_keys kask ON k.key_access_server_key_id = kask.id - INNER JOIN key_access_servers kas ON kask.key_access_server_id = kas.id - GROUP BY k.namespace_id -) nmp_keys ON ns.id = nmp_keys.namespace_id -WHERE fqns.attribute_id IS NULL AND fqns.value_id IS NULL -GROUP BY io.id, io.name, io.metadata, ns.id, ns.name, ns.active, ns.metadata, ns.created_at, ns.updated_at, fqns.fqn, nmp_keys.keys; +GROUP BY io.id, io.name, io.metadata, n.id, n.name; -- name: getObligationDefinition :one SELECT From b0805f6f99cb3caae6a31913697adc71977f4865 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 30 Jul 2025 01:48:56 -0400 Subject: [PATCH 020/137] values actually working --- service/integration/obligations_test.go | 12 ++++++++-- service/policy/db/obligations.go | 31 ++++++++++++++++--------- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index bfdb4140fa..471be33aa5 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -52,15 +52,24 @@ func (s *ObligationsSuite) Test_CreateObligationDefinition_Succeeds() { namespace := s.f.GetNamespaceKey("example.com") namespaceID := namespace.ID oblName := "example-obligation" + oblValPrefix := "obligation_value_" + oblVals := []string{ + oblValPrefix + "1", + oblValPrefix + "2", + } obl, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ Id: namespaceID, }, - Name: oblName, + Name: oblName, + Values: oblVals, }) s.Require().NoError(err) s.NotNil(obl) s.Equal(obl.Name, oblName) + for _, value := range obl.Values { + s.Contains(value.GetValue(), oblValPrefix) + } namespace = s.f.GetNamespaceKey("example.net") namespaceName := namespace.Name @@ -74,7 +83,6 @@ func (s *ObligationsSuite) Test_CreateObligationDefinition_Succeeds() { s.Require().NoError(err) s.NotNil(obl) s.Equal(obl.Name, oblName) - } func (s *ObligationsSuite) Test_CreateObligationDefinition_Fails() { diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 6bca8ba06c..51c14468e6 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -2,6 +2,7 @@ package db import ( "context" + "encoding/json" "errors" "fmt" @@ -12,13 +13,25 @@ import ( "google.golang.org/protobuf/encoding/protojson" ) -func unmarshalValue(values []byte, v *policy.ObligationValue) error { - if values != nil { - if err := protojson.Unmarshal(values, v); err != nil { - return fmt.Errorf("failed to unmarshal values [%s]: %w", string(values), err) +func unmarshalObligationValuesProto(valuesJSON []byte, values []*policy.ObligationValue) error { + if valuesJSON == nil { + return nil + } + + raw := []json.RawMessage{} + if err := json.Unmarshal(valuesJSON, &raw); err != nil { + return fmt.Errorf("failed to unmarshal values array [%s]: %w", string(valuesJSON), err) + } + + for _, r := range raw { + v := &policy.ObligationValue{} + if err := protojson.Unmarshal(r, v); err != nil { + return fmt.Errorf("failed to unmarshal value [%s]: %w", string(r), err) } + values = append(values, v) } - return errors.New("failed to unmarshal obligation values") + + return nil } /// @@ -41,12 +54,8 @@ func (c PolicyDBClient) CreateObligationByNamespaceID(ctx context.Context, names return nil, err } oblVals := make([]*policy.ObligationValue, 0, len(values)) - for _, value := range values { - oblVal := &policy.ObligationValue{} - if err := unmarshalValue([]byte(value), oblVal); err != nil { - return nil, fmt.Errorf("failed to unmarshal obligation value: %w", err) - } - oblVals = append(oblVals, oblVal) + if err := unmarshalObligationValuesProto(row.Values, oblVals); err != nil { + return nil, fmt.Errorf("failed to unmarshal obligation values: %w", err) } return &policy.Obligation{ From 35b55bbc09ff5eb4fd78eac8c31f4d897f2cf7b8 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 30 Jul 2025 02:32:58 -0400 Subject: [PATCH 021/137] combined query seems to be working --- service/policy/db/obligations.go | 126 ++++++++++------ service/policy/db/obligations.sql.go | 176 +++++++--------------- service/policy/db/queries/obligations.sql | 62 +++----- 3 files changed, 156 insertions(+), 208 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 51c14468e6..8902a875e1 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -38,20 +38,93 @@ func unmarshalObligationValuesProto(valuesJSON []byte, values []*policy.Obligati /// Obligation Definitions /// -func (c PolicyDBClient) CreateObligationByNamespaceID(ctx context.Context, namespaceID, name string, values []string, metadata *common.MetadataMutable) (*policy.Obligation, error) { +// func (c PolicyDBClient) CreateObligationByNamespaceID(ctx context.Context, namespaceID, name string, values []string, metadataJSON []byte) (*policy.Obligation, error) { +// queryParams := createObligationByNamespaceIDParams{ +// NamespaceID: namespaceID, +// Name: name, +// Metadata: metadataJSON, +// Values: values, +// } +// row, err := c.queries.createObligationByNamespaceID(ctx, queryParams) +// if err != nil { +// return nil, err +// } +// oblVals := make([]*policy.ObligationValue, 0, len(values)) +// if err := unmarshalObligationValuesProto(row.Values, oblVals); err != nil { +// return nil, fmt.Errorf("failed to unmarshal obligation values: %w", err) +// } + +// return &policy.Obligation{ +// Id: row.ID, +// Name: name, +// Metadata: &common.Metadata{ +// Labels: metadata.GetLabels(), +// }, +// Namespace: &policy.Namespace{ +// Id: namespaceID, +// }, +// Values: oblVals, +// }, nil +// } + +// func (c PolicyDBClient) CreateObligationByNamespaceFQN(ctx context.Context, fqn, name string, values []string, metadataJSON []byte) (createObligationByNamespaceFQNRow, error) { +// queryParams := createObligationByNamespaceFQNParams{ +// Fqn: fqn, +// Name: name, +// Metadata: metadataJSON, +// Values: values, +// } +// return c.queries.createObligationByNamespaceFQN(ctx, queryParams) +// // return &policy.Obligation{ +// // Id: row.ID, +// // Name: name, +// // Metadata: &common.Metadata{ +// // Labels: metadata.GetLabels(), +// // }, +// // Namespace: &policy.Namespace{ +// // Fqn: fqn, +// // }, +// // }, nil +// } + +func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.CreateObligationRequest) (*policy.Obligation, error) { + metadata := r.GetMetadata() metadataJSON, _, err := db.MarshalCreateMetadata(metadata) if err != nil { return nil, err } - queryParams := createObligationByNamespaceIDParams{ - NamespaceID: namespaceID, - Name: name, - Metadata: metadataJSON, - Values: values, + // if r.GetId() != "" { + // queryParams := createObligationByNamespaceIDParams{ + // NamespaceID: namespaceID, + // Name: name, + // Metadata: metadataJSON, + // Values: values, + // } + // row, err := c.queries.createObligationByNamespaceID(ctx, queryParams) + // } else { + // queryParams := createObligationByNamespaceFQNParams{ + // Fqn: fqn, + // Name: name, + // Metadata: metadataJSON, + // Values: values, + // } + // row, err := c.queries.createObligationByNamespaceFQN(ctx, queryParams) + // } + name := r.GetName() + values := r.GetValues() + namespaceID := r.GetId() + namespaceFQN := r.GetFqn() + queryParams := createObligationParams{ + NamespaceID: r.GetId(), + NamespaceFqn: r.GetFqn(), + Name: name, + Metadata: metadataJSON, + Values: values, } - row, err := c.queries.createObligationByNamespaceID(ctx, queryParams) + row, err := c.queries.createObligation(ctx, queryParams) + if err != nil { - return nil, err + return nil, fmt.Errorf("failed to create obligation: %w", err) } oblVals := make([]*policy.ObligationValue, 0, len(values)) if err := unmarshalObligationValuesProto(row.Values, oblVals); err != nil { @@ -65,46 +138,13 @@ func (c PolicyDBClient) CreateObligationByNamespaceID(ctx context.Context, names Labels: metadata.GetLabels(), }, Namespace: &policy.Namespace{ - Id: namespaceID, + Id: namespaceID, + Fqn: namespaceFQN, }, Values: oblVals, }, nil } -func (c PolicyDBClient) CreateObligationByNamespaceFQN(ctx context.Context, fqn, name string, values []string, metadata *common.MetadataMutable) (*policy.Obligation, error) { - metadataJSON, _, err := db.MarshalCreateMetadata(metadata) - if err != nil { - return nil, err - } - queryParams := createObligationByNamespaceFQNParams{ - Fqn: fqn, - Name: name, - Metadata: metadataJSON, - Values: values, - } - row, err := c.queries.createObligationByNamespaceFQN(ctx, queryParams) - if err != nil { - return nil, err - } - return &policy.Obligation{ - Id: row.ID, - Name: name, - Metadata: &common.Metadata{ - Labels: metadata.GetLabels(), - }, - Namespace: &policy.Namespace{ - Fqn: fqn, - }, - }, nil -} - -func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.CreateObligationRequest) (*policy.Obligation, error) { - if r.GetId() != "" { - return c.CreateObligationByNamespaceID(ctx, r.GetId(), r.GetName(), r.GetValues(), r.GetMetadata()) - } - return c.CreateObligationByNamespaceFQN(ctx, r.GetFqn(), r.GetName(), r.GetValues(), r.GetMetadata()) -} - func (c PolicyDBClient) GetObligationDefinition(ctx context.Context, r *obligations.GetObligationRequest) (*policy.Obligation, error) { return nil, errors.New("GetObligationDefinition is not implemented in PolicyDBClient") } diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 4d7349932e..fb2d3b7f3c 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -11,126 +11,35 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const createObligationByNamespaceFQN = `-- name: createObligationByNamespaceFQN :one -WITH inserted_obligation AS ( - INSERT INTO obligation_definitions (namespace_id, name, metadata) - SELECT fqns.namespace_id, $2, $3 - FROM attribute_fqns fqns - WHERE fqns.fqn = $1 - RETURNING id, namespace_id, name, metadata -), -inserted_values AS ( - INSERT INTO obligation_values_standard (obligation_definition_id, value) - SELECT io.id, UNNEST($4::VARCHAR[]) - FROM inserted_obligation io - WHERE $4::VARCHAR[] IS NOT NULL AND array_length($4::VARCHAR[], 1) > 0 - RETURNING id, obligation_definition_id, value -) -SELECT - io.id, - io.name, - io.metadata, - JSON_BUILD_OBJECT( - 'id', n.id, - 'name', n.name - ) as namespace, - COALESCE( - JSON_AGG( - JSON_BUILD_OBJECT( - 'id', iv.id, - 'value', iv.value - ) - ) FILTER (WHERE iv.id IS NOT NULL), - '[]'::JSON - )::JSONB as values -FROM inserted_obligation io -JOIN attribute_namespaces n ON io.namespace_id = n.id -LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id -GROUP BY io.id, io.name, io.metadata, n.id, n.name -` - -type createObligationByNamespaceFQNParams struct { - Fqn string `json:"fqn"` - Name string `json:"name"` - Metadata []byte `json:"metadata"` - Values []string `json:"values"` -} - -type createObligationByNamespaceFQNRow struct { - ID string `json:"id"` - Name string `json:"name"` - Metadata []byte `json:"metadata"` - Namespace []byte `json:"namespace"` - Values []byte `json:"values"` -} - -// createObligationByNamespaceFQN -// -// WITH inserted_obligation AS ( -// INSERT INTO obligation_definitions (namespace_id, name, metadata) -// SELECT fqns.namespace_id, $2, $3 -// FROM attribute_fqns fqns -// WHERE fqns.fqn = $1 -// RETURNING id, namespace_id, name, metadata -// ), -// inserted_values AS ( -// INSERT INTO obligation_values_standard (obligation_definition_id, value) -// SELECT io.id, UNNEST($4::VARCHAR[]) -// FROM inserted_obligation io -// WHERE $4::VARCHAR[] IS NOT NULL AND array_length($4::VARCHAR[], 1) > 0 -// RETURNING id, obligation_definition_id, value -// ) -// SELECT -// io.id, -// io.name, -// io.metadata, -// JSON_BUILD_OBJECT( -// 'id', n.id, -// 'name', n.name -// ) as namespace, -// COALESCE( -// JSON_AGG( -// JSON_BUILD_OBJECT( -// 'id', iv.id, -// 'value', iv.value -// ) -// ) FILTER (WHERE iv.id IS NOT NULL), -// '[]'::JSON -// )::JSONB as values -// FROM inserted_obligation io -// JOIN attribute_namespaces n ON io.namespace_id = n.id -// LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id -// GROUP BY io.id, io.name, io.metadata, n.id, n.name -func (q *Queries) createObligationByNamespaceFQN(ctx context.Context, arg createObligationByNamespaceFQNParams) (createObligationByNamespaceFQNRow, error) { - row := q.db.QueryRow(ctx, createObligationByNamespaceFQN, - arg.Fqn, - arg.Name, - arg.Metadata, - arg.Values, - ) - var i createObligationByNamespaceFQNRow - err := row.Scan( - &i.ID, - &i.Name, - &i.Metadata, - &i.Namespace, - &i.Values, - ) - return i, err -} - -const createObligationByNamespaceID = `-- name: createObligationByNamespaceID :one +const createObligation = `-- name: createObligation :one WITH inserted_obligation AS ( INSERT INTO obligation_definitions (namespace_id, name, metadata) - VALUES ($1, $2, $3) + SELECT + CASE + WHEN $1::TEXT != '' THEN $1::UUID + ELSE fqns.namespace_id + END, + $2, + $3 + FROM ( + SELECT + CASE + WHEN $1::TEXT != '' THEN $1::UUID + ELSE NULL + END as direct_namespace_id + ) direct + LEFT JOIN attribute_fqns fqns ON fqns.fqn = $4 AND $1::TEXT = '' + WHERE + ($1::TEXT != '' AND direct.direct_namespace_id IS NOT NULL) OR + ($4::TEXT != '' AND fqns.namespace_id IS NOT NULL) RETURNING id, namespace_id, name, metadata ), inserted_values AS ( INSERT INTO obligation_values_standard (obligation_definition_id, value) - SELECT io.id, UNNEST($4::VARCHAR[]) + SELECT io.id, UNNEST($5::VARCHAR[]) FROM inserted_obligation io - WHERE $4::VARCHAR[] IS NOT NULL AND array_length($4::VARCHAR[], 1) > 0 + WHERE $5::VARCHAR[] IS NOT NULL AND array_length($5::VARCHAR[], 1) > 0 RETURNING id, obligation_definition_id, value ) SELECT @@ -156,14 +65,15 @@ LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id GROUP BY io.id, io.name, io.metadata, n.id, n.name ` -type createObligationByNamespaceIDParams struct { - NamespaceID string `json:"namespace_id"` - Name string `json:"name"` - Metadata []byte `json:"metadata"` - Values []string `json:"values"` +type createObligationParams struct { + NamespaceID string `json:"namespace_id"` + Name string `json:"name"` + Metadata []byte `json:"metadata"` + NamespaceFqn string `json:"namespace_fqn"` + Values []string `json:"values"` } -type createObligationByNamespaceIDRow struct { +type createObligationRow struct { ID string `json:"id"` Name string `json:"name"` Metadata []byte `json:"metadata"` @@ -177,14 +87,31 @@ type createObligationByNamespaceIDRow struct { // // WITH inserted_obligation AS ( // INSERT INTO obligation_definitions (namespace_id, name, metadata) -// VALUES ($1, $2, $3) +// SELECT +// CASE +// WHEN $1::TEXT != '' THEN $1::UUID +// ELSE fqns.namespace_id +// END, +// $2, +// $3 +// FROM ( +// SELECT +// CASE +// WHEN $1::TEXT != '' THEN $1::UUID +// ELSE NULL +// END as direct_namespace_id +// ) direct +// LEFT JOIN attribute_fqns fqns ON fqns.fqn = $4 AND $1::TEXT = '' +// WHERE +// ($1::TEXT != '' AND direct.direct_namespace_id IS NOT NULL) OR +// ($4::TEXT != '' AND fqns.namespace_id IS NOT NULL) // RETURNING id, namespace_id, name, metadata // ), // inserted_values AS ( // INSERT INTO obligation_values_standard (obligation_definition_id, value) -// SELECT io.id, UNNEST($4::VARCHAR[]) +// SELECT io.id, UNNEST($5::VARCHAR[]) // FROM inserted_obligation io -// WHERE $4::VARCHAR[] IS NOT NULL AND array_length($4::VARCHAR[], 1) > 0 +// WHERE $5::VARCHAR[] IS NOT NULL AND array_length($5::VARCHAR[], 1) > 0 // RETURNING id, obligation_definition_id, value // ) // SELECT @@ -208,14 +135,15 @@ type createObligationByNamespaceIDRow struct { // JOIN attribute_namespaces n ON io.namespace_id = n.id // LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id // GROUP BY io.id, io.name, io.metadata, n.id, n.name -func (q *Queries) createObligationByNamespaceID(ctx context.Context, arg createObligationByNamespaceIDParams) (createObligationByNamespaceIDRow, error) { - row := q.db.QueryRow(ctx, createObligationByNamespaceID, +func (q *Queries) createObligation(ctx context.Context, arg createObligationParams) (createObligationRow, error) { + row := q.db.QueryRow(ctx, createObligation, arg.NamespaceID, arg.Name, arg.Metadata, + arg.NamespaceFqn, arg.Values, ) - var i createObligationByNamespaceIDRow + var i createObligationRow err := row.Scan( &i.ID, &i.Name, diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index f520a48a66..b99fd9d720 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -2,54 +2,34 @@ -- OBLIGATIONS ---------------------------------------------------------------- --- name: createObligationByNamespaceID :one +-- name: createObligation :one WITH inserted_obligation AS ( INSERT INTO obligation_definitions (namespace_id, name, metadata) - VALUES ($1, $2, $3) + SELECT + CASE + WHEN @namespace_id::TEXT != '' THEN @namespace_id::UUID + ELSE fqns.namespace_id + END, + @name, + @metadata + FROM ( + SELECT + CASE + WHEN @namespace_id::TEXT != '' THEN @namespace_id::UUID + ELSE NULL + END as direct_namespace_id + ) direct + LEFT JOIN attribute_fqns fqns ON fqns.fqn = @namespace_fqn AND @namespace_id::TEXT = '' + WHERE + (@namespace_id::TEXT != '' AND direct.direct_namespace_id IS NOT NULL) OR + (@namespace_fqn::TEXT != '' AND fqns.namespace_id IS NOT NULL) RETURNING id, namespace_id, name, metadata ), inserted_values AS ( INSERT INTO obligation_values_standard (obligation_definition_id, value) - SELECT io.id, UNNEST(sqlc.arg('values')::VARCHAR[]) + SELECT io.id, UNNEST(@values::VARCHAR[]) FROM inserted_obligation io - WHERE sqlc.arg('values')::VARCHAR[] IS NOT NULL AND array_length(sqlc.arg('values')::VARCHAR[], 1) > 0 - RETURNING id, obligation_definition_id, value -) -SELECT - io.id, - io.name, - io.metadata, - JSON_BUILD_OBJECT( - 'id', n.id, - 'name', n.name - ) as namespace, - COALESCE( - JSON_AGG( - JSON_BUILD_OBJECT( - 'id', iv.id, - 'value', iv.value - ) - ) FILTER (WHERE iv.id IS NOT NULL), - '[]'::JSON - )::JSONB as values -FROM inserted_obligation io -JOIN attribute_namespaces n ON io.namespace_id = n.id -LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id -GROUP BY io.id, io.name, io.metadata, n.id, n.name; - --- name: createObligationByNamespaceFQN :one -WITH inserted_obligation AS ( - INSERT INTO obligation_definitions (namespace_id, name, metadata) - SELECT fqns.namespace_id, $2, $3 - FROM attribute_fqns fqns - WHERE fqns.fqn = $1 - RETURNING id, namespace_id, name, metadata -), -inserted_values AS ( - INSERT INTO obligation_values_standard (obligation_definition_id, value) - SELECT io.id, UNNEST(sqlc.arg('values')::VARCHAR[]) - FROM inserted_obligation io - WHERE sqlc.arg('values')::VARCHAR[] IS NOT NULL AND array_length(sqlc.arg('values')::VARCHAR[], 1) > 0 + WHERE @values::VARCHAR[] IS NOT NULL AND array_length(@values::VARCHAR[], 1) > 0 RETURNING id, obligation_definition_id, value ) SELECT From 8159f7952f2c94f72b0962999dbb336112fe2e46 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 30 Jul 2025 17:52:36 -0400 Subject: [PATCH 022/137] still need fqn --- service/integration/obligations_test.go | 22 ++++++++++++++-------- service/policy/db/obligations.go | 25 ++++++++++++++++++------- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 471be33aa5..0463bf7751 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -45,12 +45,11 @@ func TestObligationsSuite(t *testing.T) { // Create -func (s *ObligationsSuite) Test_CreateObligationDefinition_Succeeds() { - // tcs: - // - create obligation definition with valid namespace_id and name - // - create with values and possibly triggers and fulfillers? +func (s *ObligationsSuite) Test_CreateObligation_Succeeds() { + // By namespace ID namespace := s.f.GetNamespaceKey("example.com") namespaceID := namespace.ID + namespaceFQN := "https://" + namespace.Name oblName := "example-obligation" oblValPrefix := "obligation_value_" oblVals := []string{ @@ -66,14 +65,18 @@ func (s *ObligationsSuite) Test_CreateObligationDefinition_Succeeds() { }) s.Require().NoError(err) s.NotNil(obl) - s.Equal(obl.Name, oblName) + s.Equal(oblName, obl.Name) + s.Equal(namespaceID, obl.Namespace.Id) + s.Equal(namespace.Name, obl.Namespace.Name) + s.Equal(namespaceFQN, obl.Namespace.Fqn) for _, value := range obl.Values { s.Contains(value.GetValue(), oblValPrefix) } + // By namespace FQN namespace = s.f.GetNamespaceKey("example.net") - namespaceName := namespace.Name - namespaceFQN := "https://" + namespaceName + namespaceID = namespace.ID + namespaceFQN = "https://" + namespace.Name obl, err = s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ NamespaceIdentifier: &obligations.CreateObligationRequest_Fqn{ Fqn: namespaceFQN, @@ -82,7 +85,10 @@ func (s *ObligationsSuite) Test_CreateObligationDefinition_Succeeds() { }) s.Require().NoError(err) s.NotNil(obl) - s.Equal(obl.Name, oblName) + s.Equal(oblName, obl.Name) + s.Equal(namespaceID, obl.Namespace.Id) + s.Equal(namespace.Name, obl.Namespace.Name) + s.Equal(namespaceFQN, obl.Namespace.Fqn) } func (s *ObligationsSuite) Test_CreateObligationDefinition_Fails() { diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 8902a875e1..670b16d5d7 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -34,6 +34,15 @@ func unmarshalObligationValuesProto(valuesJSON []byte, values []*policy.Obligati return nil } +func unmarshalNamespace(namespaceJSON []byte, namespace *policy.Namespace) error { + if namespaceJSON != nil { + if err := protojson.Unmarshal(namespaceJSON, namespace); err != nil { + return fmt.Errorf("failed to unmarshal namespaceJSON [%s]: %w", string(namespaceJSON), err) + } + } + return nil +} + /// /// Obligation Definitions /// @@ -112,8 +121,8 @@ func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.Cre // } name := r.GetName() values := r.GetValues() - namespaceID := r.GetId() - namespaceFQN := r.GetFqn() + // namespaceID := r.GetId() + // namespaceFQN := r.GetFqn() queryParams := createObligationParams{ NamespaceID: r.GetId(), NamespaceFqn: r.GetFqn(), @@ -131,17 +140,19 @@ func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.Cre return nil, fmt.Errorf("failed to unmarshal obligation values: %w", err) } + var namespace policy.Namespace + if err := unmarshalNamespace(row.Namespace, &namespace); err != nil { + return nil, fmt.Errorf("failed to unmarshal obligation namespace: %w", err) + } + return &policy.Obligation{ Id: row.ID, Name: name, Metadata: &common.Metadata{ Labels: metadata.GetLabels(), }, - Namespace: &policy.Namespace{ - Id: namespaceID, - Fqn: namespaceFQN, - }, - Values: oblVals, + Namespace: &namespace, + Values: oblVals, }, nil } From c1d17c58974897d2def27de5cd8b3c7421015a33 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 30 Jul 2025 17:57:24 -0400 Subject: [PATCH 023/137] create obligation done --- service/policy/db/obligations.sql.go | 12 ++++++++---- service/policy/db/queries/obligations.sql | 6 ++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index fb2d3b7f3c..44d643ed83 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -48,7 +48,8 @@ SELECT io.metadata, JSON_BUILD_OBJECT( 'id', n.id, - 'name', n.name + 'name', n.name, + 'fqn', fqns.fqn ) as namespace, COALESCE( JSON_AGG( @@ -61,8 +62,9 @@ SELECT )::JSONB as values FROM inserted_obligation io JOIN attribute_namespaces n ON io.namespace_id = n.id +LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id -GROUP BY io.id, io.name, io.metadata, n.id, n.name +GROUP BY io.id, io.name, io.metadata, n.id, n.name, fqns.fqn ` type createObligationParams struct { @@ -120,7 +122,8 @@ type createObligationRow struct { // io.metadata, // JSON_BUILD_OBJECT( // 'id', n.id, -// 'name', n.name +// 'name', n.name, +// 'fqn', fqns.fqn // ) as namespace, // COALESCE( // JSON_AGG( @@ -133,8 +136,9 @@ type createObligationRow struct { // )::JSONB as values // FROM inserted_obligation io // JOIN attribute_namespaces n ON io.namespace_id = n.id +// LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL // LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id -// GROUP BY io.id, io.name, io.metadata, n.id, n.name +// GROUP BY io.id, io.name, io.metadata, n.id, n.name, fqns.fqn func (q *Queries) createObligation(ctx context.Context, arg createObligationParams) (createObligationRow, error) { row := q.db.QueryRow(ctx, createObligation, arg.NamespaceID, diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index b99fd9d720..507372652b 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -38,7 +38,8 @@ SELECT io.metadata, JSON_BUILD_OBJECT( 'id', n.id, - 'name', n.name + 'name', n.name, + 'fqn', fqns.fqn ) as namespace, COALESCE( JSON_AGG( @@ -51,8 +52,9 @@ SELECT )::JSONB as values FROM inserted_obligation io JOIN attribute_namespaces n ON io.namespace_id = n.id +LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id -GROUP BY io.id, io.name, io.metadata, n.id, n.name; +GROUP BY io.id, io.name, io.metadata, n.id, n.name, fqns.fqn; -- name: getObligationDefinition :one SELECT From 09f143c60f27291f4070af7e32c0ea360109c994 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 30 Jul 2025 17:58:49 -0400 Subject: [PATCH 024/137] clean up --- service/policy/db/obligations.go | 68 -------------------------------- 1 file changed, 68 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 670b16d5d7..db37b3f9ed 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -47,82 +47,14 @@ func unmarshalNamespace(namespaceJSON []byte, namespace *policy.Namespace) error /// Obligation Definitions /// -// func (c PolicyDBClient) CreateObligationByNamespaceID(ctx context.Context, namespaceID, name string, values []string, metadataJSON []byte) (*policy.Obligation, error) { -// queryParams := createObligationByNamespaceIDParams{ -// NamespaceID: namespaceID, -// Name: name, -// Metadata: metadataJSON, -// Values: values, -// } -// row, err := c.queries.createObligationByNamespaceID(ctx, queryParams) -// if err != nil { -// return nil, err -// } -// oblVals := make([]*policy.ObligationValue, 0, len(values)) -// if err := unmarshalObligationValuesProto(row.Values, oblVals); err != nil { -// return nil, fmt.Errorf("failed to unmarshal obligation values: %w", err) -// } - -// return &policy.Obligation{ -// Id: row.ID, -// Name: name, -// Metadata: &common.Metadata{ -// Labels: metadata.GetLabels(), -// }, -// Namespace: &policy.Namespace{ -// Id: namespaceID, -// }, -// Values: oblVals, -// }, nil -// } - -// func (c PolicyDBClient) CreateObligationByNamespaceFQN(ctx context.Context, fqn, name string, values []string, metadataJSON []byte) (createObligationByNamespaceFQNRow, error) { -// queryParams := createObligationByNamespaceFQNParams{ -// Fqn: fqn, -// Name: name, -// Metadata: metadataJSON, -// Values: values, -// } -// return c.queries.createObligationByNamespaceFQN(ctx, queryParams) -// // return &policy.Obligation{ -// // Id: row.ID, -// // Name: name, -// // Metadata: &common.Metadata{ -// // Labels: metadata.GetLabels(), -// // }, -// // Namespace: &policy.Namespace{ -// // Fqn: fqn, -// // }, -// // }, nil -// } - func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.CreateObligationRequest) (*policy.Obligation, error) { metadata := r.GetMetadata() metadataJSON, _, err := db.MarshalCreateMetadata(metadata) if err != nil { return nil, err } - // if r.GetId() != "" { - // queryParams := createObligationByNamespaceIDParams{ - // NamespaceID: namespaceID, - // Name: name, - // Metadata: metadataJSON, - // Values: values, - // } - // row, err := c.queries.createObligationByNamespaceID(ctx, queryParams) - // } else { - // queryParams := createObligationByNamespaceFQNParams{ - // Fqn: fqn, - // Name: name, - // Metadata: metadataJSON, - // Values: values, - // } - // row, err := c.queries.createObligationByNamespaceFQN(ctx, queryParams) - // } name := r.GetName() values := r.GetValues() - // namespaceID := r.GetId() - // namespaceFQN := r.GetFqn() queryParams := createObligationParams{ NamespaceID: r.GetId(), NamespaceFqn: r.GetFqn(), From 4888f7e76c661886ab98381edcb82249f6f633df Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Thu, 31 Jul 2025 18:54:53 -0400 Subject: [PATCH 025/137] test create obligation failures --- service/integration/obligations_test.go | 40 ++++++++++++++--- service/policy/db/obligations.go | 6 ++- service/policy/db/obligations.sql.go | 52 ++++++++++++++--------- service/policy/db/queries/obligations.sql | 15 ++++--- 4 files changed, 80 insertions(+), 33 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 0463bf7751..fb39dc4eb9 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -7,6 +7,7 @@ import ( "github.com/opentdf/platform/protocol/go/policy/obligations" "github.com/opentdf/platform/service/internal/fixtures" + "github.com/opentdf/platform/service/pkg/db" "github.com/stretchr/testify/suite" ) @@ -46,7 +47,7 @@ func TestObligationsSuite(t *testing.T) { // Create func (s *ObligationsSuite) Test_CreateObligation_Succeeds() { - // By namespace ID + // By namespace ID and with values namespace := s.f.GetNamespaceKey("example.com") namespaceID := namespace.ID namespaceFQN := "https://" + namespace.Name @@ -91,12 +92,39 @@ func (s *ObligationsSuite) Test_CreateObligation_Succeeds() { s.Equal(namespaceFQN, obl.Namespace.Fqn) } -func (s *ObligationsSuite) Test_CreateObligationDefinition_Fails() { - // tcs: - // - create obligation definition with invalid namespace_id - // - create obligation definition with non-unique namespace_id/name pair +func (s *ObligationsSuite) Test_CreateObligation_Fails() { + // Invalid namespace ID + fakeNamespaceID := "fake-namespace-id" + oblName := "example-obligation" + obl, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ + NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ + Id: fakeNamespaceID, + }, + Name: oblName, + }) + s.Require().ErrorIs(err, db.ErrUUIDInvalid) + s.Nil(obl) - s.T().Skip("obligation_definitions table not implemented yet") + // Non-unique namespace_id/name pair + namespace := s.f.GetNamespaceKey("example.org") + namespaceID := namespace.ID + obl, err = s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ + NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ + Id: namespaceID, + }, + Name: oblName, + }) + s.Require().NoError(err) + s.NotNil(obl) + + obl, err = s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ + NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ + Id: namespaceID, + }, + Name: oblName, + }) + s.Require().ErrorIs(err, db.ErrUniqueConstraintViolation) + s.Nil(obl) } // Get diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index db37b3f9ed..4d5b8c1775 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -65,7 +65,7 @@ func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.Cre row, err := c.queries.createObligation(ctx, queryParams) if err != nil { - return nil, fmt.Errorf("failed to create obligation: %w", err) + return nil, db.WrapIfKnownInvalidQueryErr(err) } oblVals := make([]*policy.ObligationValue, 0, len(values)) if err := unmarshalObligationValuesProto(row.Values, oblVals); err != nil { @@ -89,6 +89,10 @@ func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.Cre } func (c PolicyDBClient) GetObligationDefinition(ctx context.Context, r *obligations.GetObligationRequest) (*policy.Obligation, error) { + // queryParams := getObligationParams{ + // ID: r.GetId(), + // Fqn: r.GetFqn(), + // } return nil, errors.New("GetObligationDefinition is not implemented in PolicyDBClient") } diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 44d643ed83..555d11247e 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -173,13 +173,14 @@ func (q *Queries) deleteObligationDefinition(ctx context.Context, id string) (in return result.RowsAffected(), nil } -const getObligationDefinition = `-- name: getObligationDefinition :one +const getObligation = `-- name: getObligation :one SELECT od.id, od.name, JSON_BUILD_OBJECT( 'id', n.id, - 'name', n.name + 'name', n.name, + 'fqn', fqns.fqn ) as namespace, JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', od.metadata -> 'labels', 'created_at', od.created_at,'updated_at', od.updated_at)) as metadata, JSON_AGG( @@ -191,22 +192,25 @@ SELECT -- todo: add triggers and fulfillers FROM obligation_definitions od JOIN attribute_namespaces n on od.namespace_id = n.id +LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id WHERE - -- handles by id or fqn queries - (NULLIF($1, '') IS NULL OR id = $1::UUID) AND + -- handles by id or fqn+name queries + (NULLIF($1, '') IS NULL OR od.id = $1::UUID) AND (NULLIF($2, '') IS NULL OR od.namespace_id = $2::UUID) AND - (NULLIF($3, '') IS NULL OR name = $3::VARCHAR) -GROUP BY od.id, n.id + (NULLIF($3, '') IS NULL OR od.name = $3::VARCHAR) AND + (NULLIF($4, '') IS NULL OR fqns.fqn = $4::VARCHAR) +GROUP BY od.id, n.id, n.name, fqns.fqn ` -type getObligationDefinitionParams struct { - ID interface{} `json:"id"` - NamespaceID interface{} `json:"namespace_id"` - Name interface{} `json:"name"` +type getObligationParams struct { + ID interface{} `json:"id"` + NamespaceID interface{} `json:"namespace_id"` + Name interface{} `json:"name"` + NamespaceFqn interface{} `json:"namespace_fqn"` } -type getObligationDefinitionRow struct { +type getObligationRow struct { ID string `json:"id"` Name string `json:"name"` Namespace []byte `json:"namespace"` @@ -214,14 +218,15 @@ type getObligationDefinitionRow struct { Values []byte `json:"values"` } -// getObligationDefinition +// getObligation // // SELECT // od.id, // od.name, // JSON_BUILD_OBJECT( // 'id', n.id, -// 'name', n.name +// 'name', n.name, +// 'fqn', fqns.fqn // ) as namespace, // JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', od.metadata -> 'labels', 'created_at', od.created_at,'updated_at', od.updated_at)) as metadata, // JSON_AGG( @@ -233,16 +238,23 @@ type getObligationDefinitionRow struct { // -- todo: add triggers and fulfillers // FROM obligation_definitions od // JOIN attribute_namespaces n on od.namespace_id = n.id +// LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL // LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id // WHERE -// -- handles by id or fqn queries -// (NULLIF($1, '') IS NULL OR id = $1::UUID) AND +// -- handles by id or fqn+name queries +// (NULLIF($1, '') IS NULL OR od.id = $1::UUID) AND // (NULLIF($2, '') IS NULL OR od.namespace_id = $2::UUID) AND -// (NULLIF($3, '') IS NULL OR name = $3::VARCHAR) -// GROUP BY od.id, n.id -func (q *Queries) getObligationDefinition(ctx context.Context, arg getObligationDefinitionParams) (getObligationDefinitionRow, error) { - row := q.db.QueryRow(ctx, getObligationDefinition, arg.ID, arg.NamespaceID, arg.Name) - var i getObligationDefinitionRow +// (NULLIF($3, '') IS NULL OR od.name = $3::VARCHAR) AND +// (NULLIF($4, '') IS NULL OR fqns.fqn = $4::VARCHAR) +// GROUP BY od.id, n.id, n.name, fqns.fqn +func (q *Queries) getObligation(ctx context.Context, arg getObligationParams) (getObligationRow, error) { + row := q.db.QueryRow(ctx, getObligation, + arg.ID, + arg.NamespaceID, + arg.Name, + arg.NamespaceFqn, + ) + var i getObligationRow err := row.Scan( &i.ID, &i.Name, diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 507372652b..4c05e50c98 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -56,13 +56,14 @@ LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id GROUP BY io.id, io.name, io.metadata, n.id, n.name, fqns.fqn; --- name: getObligationDefinition :one +-- name: getObligation :one SELECT od.id, od.name, JSON_BUILD_OBJECT( 'id', n.id, - 'name', n.name + 'name', n.name, + 'fqn', fqns.fqn ) as namespace, JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', od.metadata -> 'labels', 'created_at', od.created_at,'updated_at', od.updated_at)) as metadata, JSON_AGG( @@ -74,13 +75,15 @@ SELECT -- todo: add triggers and fulfillers FROM obligation_definitions od JOIN attribute_namespaces n on od.namespace_id = n.id +LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id WHERE - -- handles by id or fqn queries - (NULLIF(@id, '') IS NULL OR id = @id::UUID) AND + -- handles by id or fqn+name queries + (NULLIF(@id, '') IS NULL OR od.id = @id::UUID) AND (NULLIF(@namespace_id, '') IS NULL OR od.namespace_id = @namespace_id::UUID) AND - (NULLIF(@name, '') IS NULL OR name = @name::VARCHAR) -GROUP BY od.id, n.id; + (NULLIF(@name, '') IS NULL OR od.name = @name::VARCHAR) AND + (NULLIF(@namespace_fqn, '') IS NULL OR fqns.fqn = @namespace_fqn::VARCHAR) +GROUP BY od.id, n.id, n.name, fqns.fqn; -- name: listObligationDefinitions :many WITH counted AS ( From aebff06e81f43fc274fd0052a3729b68cb51e80b Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Sun, 3 Aug 2025 01:06:29 -0400 Subject: [PATCH 026/137] splitOblFQN --- service/policy/db/obligations.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 4d5b8c1775..fbfb99667d 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -5,6 +5,7 @@ import ( "encoding/json" "errors" "fmt" + "strings" "github.com/opentdf/platform/protocol/go/common" "github.com/opentdf/platform/protocol/go/policy" @@ -88,11 +89,19 @@ func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.Cre }, nil } +func splitOblFQN(fqn string) (string, string) { + nsFQN := strings.Split(fqn, "/obl/")[0] + parts := strings.Split(fqn, "/") + oblName := parts[len(parts)-1] + return nsFQN, oblName +} + func (c PolicyDBClient) GetObligationDefinition(ctx context.Context, r *obligations.GetObligationRequest) (*policy.Obligation, error) { - // queryParams := getObligationParams{ - // ID: r.GetId(), - // Fqn: r.GetFqn(), - // } + nsFQN, oblName := splitOblFQN(r.GetFqn()) + queryParams := getObligationParams{ + ID: r.GetId(), + Fqn: r.GetFqn(), + } return nil, errors.New("GetObligationDefinition is not implemented in PolicyDBClient") } From b9bfa75f8395303ae504d12d7486ee9321703503 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 4 Aug 2025 02:00:54 -0400 Subject: [PATCH 027/137] get obligation --- service/policy/db/obligations.go | 35 +++++++++++++++++++-- service/policy/db/obligations.sql.go | 38 ++++++++++++----------- service/policy/db/queries/obligations.sql | 14 ++++++--- 3 files changed, 61 insertions(+), 26 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index fbfb99667d..bcd8ece810 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -99,10 +99,39 @@ func splitOblFQN(fqn string) (string, string) { func (c PolicyDBClient) GetObligationDefinition(ctx context.Context, r *obligations.GetObligationRequest) (*policy.Obligation, error) { nsFQN, oblName := splitOblFQN(r.GetFqn()) queryParams := getObligationParams{ - ID: r.GetId(), - Fqn: r.GetFqn(), + ID: r.GetId(), + Name: oblName, + NamespaceFqn: nsFQN, } - return nil, errors.New("GetObligationDefinition is not implemented in PolicyDBClient") + + row, err := c.queries.getObligation(ctx, queryParams) + + if err != nil { + return nil, db.WrapIfKnownInvalidQueryErr(err) + } + + oblVals := make([]*policy.ObligationValue, 0) + if err := unmarshalObligationValuesProto(row.Values, oblVals); err != nil { + return nil, fmt.Errorf("failed to unmarshal obligation values: %w", err) + } + + namespace := &policy.Namespace{} + if err := unmarshalNamespace(row.Namespace, namespace); err != nil { + return nil, fmt.Errorf("failed to unmarshal obligation namespace: %w", err) + } + + metadata := &common.Metadata{} + if err := unmarshalMetadata(row.Metadata, metadata); err != nil { + return nil, fmt.Errorf("failed to unmarshal obligation metadata: %w", err) + } + + return &policy.Obligation{ + Id: row.ID, + Name: row.Name, + Metadata: metadata, + Namespace: namespace, + Values: oblVals, + }, nil } func (c PolicyDBClient) ListObligationDefinitions(ctx context.Context, r *obligations.ListObligationsRequest) ([]*policy.Obligation, error) { diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 555d11247e..b496623b4c 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -195,19 +195,22 @@ JOIN attribute_namespaces n on od.namespace_id = n.id LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id WHERE - -- handles by id or fqn+name queries - (NULLIF($1, '') IS NULL OR od.id = $1::UUID) AND - (NULLIF($2, '') IS NULL OR od.namespace_id = $2::UUID) AND - (NULLIF($3, '') IS NULL OR od.name = $3::VARCHAR) AND - (NULLIF($4, '') IS NULL OR fqns.fqn = $4::VARCHAR) + -- lookup by obligation id OR by namespace fqn + obligation name + ( + -- lookup by obligation id + (NULLIF($1, '') IS NOT NULL AND od.id = $1::UUID) + OR + -- lookup by namespace fqn + obligation name + (NULLIF($2, '') IS NOT NULL AND NULLIF($3, '') IS NOT NULL + AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) + ) GROUP BY od.id, n.id, n.name, fqns.fqn ` type getObligationParams struct { ID interface{} `json:"id"` - NamespaceID interface{} `json:"namespace_id"` - Name interface{} `json:"name"` NamespaceFqn interface{} `json:"namespace_fqn"` + Name interface{} `json:"name"` } type getObligationRow struct { @@ -241,19 +244,18 @@ type getObligationRow struct { // LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL // LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id // WHERE -// -- handles by id or fqn+name queries -// (NULLIF($1, '') IS NULL OR od.id = $1::UUID) AND -// (NULLIF($2, '') IS NULL OR od.namespace_id = $2::UUID) AND -// (NULLIF($3, '') IS NULL OR od.name = $3::VARCHAR) AND -// (NULLIF($4, '') IS NULL OR fqns.fqn = $4::VARCHAR) +// -- lookup by obligation id OR by namespace fqn + obligation name +// ( +// -- lookup by obligation id +// (NULLIF($1, '') IS NOT NULL AND od.id = $1::UUID) +// OR +// -- lookup by namespace fqn + obligation name +// (NULLIF($2, '') IS NOT NULL AND NULLIF($3, '') IS NOT NULL +// AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) +// ) // GROUP BY od.id, n.id, n.name, fqns.fqn func (q *Queries) getObligation(ctx context.Context, arg getObligationParams) (getObligationRow, error) { - row := q.db.QueryRow(ctx, getObligation, - arg.ID, - arg.NamespaceID, - arg.Name, - arg.NamespaceFqn, - ) + row := q.db.QueryRow(ctx, getObligation, arg.ID, arg.NamespaceFqn, arg.Name) var i getObligationRow err := row.Scan( &i.ID, diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 4c05e50c98..e185225aec 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -78,11 +78,15 @@ JOIN attribute_namespaces n on od.namespace_id = n.id LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id WHERE - -- handles by id or fqn+name queries - (NULLIF(@id, '') IS NULL OR od.id = @id::UUID) AND - (NULLIF(@namespace_id, '') IS NULL OR od.namespace_id = @namespace_id::UUID) AND - (NULLIF(@name, '') IS NULL OR od.name = @name::VARCHAR) AND - (NULLIF(@namespace_fqn, '') IS NULL OR fqns.fqn = @namespace_fqn::VARCHAR) + -- lookup by obligation id OR by namespace fqn + obligation name + ( + -- lookup by obligation id + (NULLIF(@id, '') IS NOT NULL AND od.id = @id::UUID) + OR + -- lookup by namespace fqn + obligation name + (NULLIF(@namespace_fqn, '') IS NOT NULL AND NULLIF(@name, '') IS NOT NULL + AND fqns.fqn = @namespace_fqn::VARCHAR AND od.name = @name::VARCHAR) + ) GROUP BY od.id, n.id, n.name, fqns.fqn; -- name: listObligationDefinitions :many From 9a199d903ea7f8e2a0b5ce6394381629597a9590 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 4 Aug 2025 02:03:33 -0400 Subject: [PATCH 028/137] refactor --- service/policy/db/obligations.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index bcd8ece810..be7e644923 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -49,8 +49,7 @@ func unmarshalNamespace(namespaceJSON []byte, namespace *policy.Namespace) error /// func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.CreateObligationRequest) (*policy.Obligation, error) { - metadata := r.GetMetadata() - metadataJSON, _, err := db.MarshalCreateMetadata(metadata) + metadataJSON, _, err := db.MarshalCreateMetadata(r.GetMetadata()) if err != nil { return nil, err } @@ -73,18 +72,21 @@ func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.Cre return nil, fmt.Errorf("failed to unmarshal obligation values: %w", err) } - var namespace policy.Namespace - if err := unmarshalNamespace(row.Namespace, &namespace); err != nil { + namespace := &policy.Namespace{} + if err := unmarshalNamespace(row.Namespace, namespace); err != nil { return nil, fmt.Errorf("failed to unmarshal obligation namespace: %w", err) } + metadata := &common.Metadata{} + if err := unmarshalMetadata(row.Metadata, metadata); err != nil { + return nil, fmt.Errorf("failed to unmarshal obligation metadata: %w", err) + } + return &policy.Obligation{ - Id: row.ID, - Name: name, - Metadata: &common.Metadata{ - Labels: metadata.GetLabels(), - }, - Namespace: &namespace, + Id: row.ID, + Name: name, + Metadata: metadata, + Namespace: namespace, Values: oblVals, }, nil } From 68398ffdc3c0d0e50d916ee5375ace83cd5079e5 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 4 Aug 2025 11:32:18 -0400 Subject: [PATCH 029/137] start getobligation tests --- service/integration/obligations_test.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index fb39dc4eb9..63a207bbf0 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -44,6 +44,8 @@ func TestObligationsSuite(t *testing.T) { /// Obligation Definitions /// +const oblName = "example-obligation" + // Create func (s *ObligationsSuite) Test_CreateObligation_Succeeds() { @@ -51,7 +53,7 @@ func (s *ObligationsSuite) Test_CreateObligation_Succeeds() { namespace := s.f.GetNamespaceKey("example.com") namespaceID := namespace.ID namespaceFQN := "https://" + namespace.Name - oblName := "example-obligation" + // oblName := "example-obligation" oblValPrefix := "obligation_value_" oblVals := []string{ oblValPrefix + "1", @@ -95,7 +97,7 @@ func (s *ObligationsSuite) Test_CreateObligation_Succeeds() { func (s *ObligationsSuite) Test_CreateObligation_Fails() { // Invalid namespace ID fakeNamespaceID := "fake-namespace-id" - oblName := "example-obligation" + // oblName := "example-obligation" obl, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ Id: fakeNamespaceID, @@ -129,11 +131,10 @@ func (s *ObligationsSuite) Test_CreateObligation_Fails() { // Get -func (s *ObligationsSuite) Test_GetObligationDefinition_Succeeds() { - // tcs: - // - get obligation definition by valid id - // - get obligation definition by valid name +func (s *ObligationsSuite) Test_GetObligation_Succeeds() { + // Valid ID + // Valid FQN s.T().Skip("obligation_definitions table not implemented yet") } From 88d397f0ba0d2e7cbbe5e997b464a5af112fa028 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 4 Aug 2025 13:49:40 -0400 Subject: [PATCH 030/137] finish getobligationsucceeds --- service/integration/obligations_test.go | 35 ++++++++++++++++++++++++- service/policy/db/obligations.go | 2 +- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 63a207bbf0..36c0a70b27 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -92,6 +92,8 @@ func (s *ObligationsSuite) Test_CreateObligation_Succeeds() { s.Equal(namespaceID, obl.Namespace.Id) s.Equal(namespace.Name, obl.Namespace.Name) s.Equal(namespaceFQN, obl.Namespace.Fqn) + + // TODO: delete both obligations after tests are done } func (s *ObligationsSuite) Test_CreateObligation_Fails() { @@ -127,15 +129,46 @@ func (s *ObligationsSuite) Test_CreateObligation_Fails() { }) s.Require().ErrorIs(err, db.ErrUniqueConstraintViolation) s.Nil(obl) + + // TODO: delete obligation after tests are done } // Get func (s *ObligationsSuite) Test_GetObligation_Succeeds() { + createdObl, _ := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ + NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ + Id: s.f.GetNamespaceKey("example.com").ID, + }, + Name: oblName, + }) + // Valid ID + obl, err := s.db.PolicyClient.GetObligation(s.ctx, &obligations.GetObligationRequest{ + Identifier: &obligations.GetObligationRequest_Id{ + Id: createdObl.GetId(), + }, + }) + + s.Require().NoError(err) + s.NotNil(obl) + s.Equal(oblName, obl.Name) + s.Equal(createdObl.GetNamespace().GetId(), obl.GetNamespace().GetId()) + s.Equal(createdObl.GetNamespace().GetName(), obl.GetNamespace().GetName()) + s.Equal(createdObl.GetNamespace().GetFqn(), obl.GetNamespace().GetFqn()) // Valid FQN - s.T().Skip("obligation_definitions table not implemented yet") + obl, err = s.db.PolicyClient.GetObligation(s.ctx, &obligations.GetObligationRequest{ + Identifier: &obligations.GetObligationRequest_Fqn{ + Fqn: createdObl.GetNamespace().GetFqn() + "/obl/" + oblName, + }, + }) + s.Require().NoError(err) + s.NotNil(obl) + s.Equal(oblName, obl.Name) + s.Equal(createdObl.GetNamespace().GetId(), obl.GetNamespace().GetId()) + s.Equal(createdObl.GetNamespace().GetName(), obl.GetNamespace().GetName()) + s.Equal(createdObl.GetNamespace().GetFqn(), obl.GetNamespace().GetFqn()) } func (s *ObligationsSuite) Test_GetObligationDefinition_Fails() { diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index be7e644923..55645c3210 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -98,7 +98,7 @@ func splitOblFQN(fqn string) (string, string) { return nsFQN, oblName } -func (c PolicyDBClient) GetObligationDefinition(ctx context.Context, r *obligations.GetObligationRequest) (*policy.Obligation, error) { +func (c PolicyDBClient) GetObligation(ctx context.Context, r *obligations.GetObligationRequest) (*policy.Obligation, error) { nsFQN, oblName := splitOblFQN(r.GetFqn()) queryParams := getObligationParams{ ID: r.GetId(), From aaeb1378d50783e4b03e82c4471658e0a92a926b Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 4 Aug 2025 17:37:01 -0400 Subject: [PATCH 031/137] wrote getobligationfails test incorrectly --- service/integration/obligations_test.go | 35 +++++++++++++++++++------ 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 36c0a70b27..6af412c30f 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -98,11 +98,9 @@ func (s *ObligationsSuite) Test_CreateObligation_Succeeds() { func (s *ObligationsSuite) Test_CreateObligation_Fails() { // Invalid namespace ID - fakeNamespaceID := "fake-namespace-id" - // oblName := "example-obligation" obl, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ - Id: fakeNamespaceID, + Id: invalidUUID, }, Name: oblName, }) @@ -169,14 +167,35 @@ func (s *ObligationsSuite) Test_GetObligation_Succeeds() { s.Equal(createdObl.GetNamespace().GetId(), obl.GetNamespace().GetId()) s.Equal(createdObl.GetNamespace().GetName(), obl.GetNamespace().GetName()) s.Equal(createdObl.GetNamespace().GetFqn(), obl.GetNamespace().GetFqn()) + + // TODO: delete obligation after tests are done } -func (s *ObligationsSuite) Test_GetObligationDefinition_Fails() { - // tcs: - // - get obligation definition by invalid id - // - get obligation definition by invalid name +func (s *ObligationsSuite) Test_GetObligation_Fails() { + // Invalid ID + createdObl, _ := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ + NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ + Id: invalidUUID, + }, + Name: oblName, + }) - s.T().Skip("obligation_definitions table not implemented yet") + obl, err := s.db.PolicyClient.GetObligation(s.ctx, &obligations.GetObligationRequest{ + Identifier: &obligations.GetObligationRequest_Id{ + Id: createdObl.GetId(), + }, + }) + s.Require().ErrorIs(err, db.ErrNotFound) + s.Nil(obl) + + // Invalid FQN + obl, err = s.db.PolicyClient.GetObligation(s.ctx, &obligations.GetObligationRequest{ + Identifier: &obligations.GetObligationRequest_Fqn{ + Fqn: "https://example.com/obl/" + oblName, + }, + }) + s.Require().ErrorIs(err, db.ErrNotFound) + s.Nil(obl) } // List From 04a01818b1577bdd957613f73fd1776d3af0842d Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 4 Aug 2025 17:38:06 -0400 Subject: [PATCH 032/137] closer --- service/integration/obligations_test.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 6af412c30f..6e78d534e8 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -173,19 +173,12 @@ func (s *ObligationsSuite) Test_GetObligation_Succeeds() { func (s *ObligationsSuite) Test_GetObligation_Fails() { // Invalid ID - createdObl, _ := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ - NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ - Id: invalidUUID, - }, - Name: oblName, - }) - obl, err := s.db.PolicyClient.GetObligation(s.ctx, &obligations.GetObligationRequest{ Identifier: &obligations.GetObligationRequest_Id{ - Id: createdObl.GetId(), + Id: invalidUUID, }, }) - s.Require().ErrorIs(err, db.ErrNotFound) + s.Require().ErrorIs(err, db.ErrUUIDInvalid) s.Nil(obl) // Invalid FQN From 4dedbc7c2c3c094879002223d07c38a7d5d802f8 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 4 Aug 2025 20:03:09 -0400 Subject: [PATCH 033/137] finish getobligation tests --- service/integration/obligations_test.go | 2 +- service/policy/db/obligations.go | 18 ++++++++++++++++-- service/policy/db/obligations.sql.go | 16 ++++++++-------- service/policy/db/queries/obligations.sql | 2 +- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 6e78d534e8..a05d1a8fbe 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -184,7 +184,7 @@ func (s *ObligationsSuite) Test_GetObligation_Fails() { // Invalid FQN obl, err = s.db.PolicyClient.GetObligation(s.ctx, &obligations.GetObligationRequest{ Identifier: &obligations.GetObligationRequest_Fqn{ - Fqn: "https://example.com/obl/" + oblName, + Fqn: "invalid-fqn", }, }) s.Require().ErrorIs(err, db.ErrNotFound) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 55645c3210..b553af9ee8 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -136,8 +136,22 @@ func (c PolicyDBClient) GetObligation(ctx context.Context, r *obligations.GetObl }, nil } -func (c PolicyDBClient) ListObligationDefinitions(ctx context.Context, r *obligations.ListObligationsRequest) ([]*policy.Obligation, error) { - return nil, errors.New("ListObligationDefinitions is not implemented in PolicyDBClient") +func (c PolicyDBClient) ListObligations(ctx context.Context, r *obligations.ListObligationsRequest) ([]*policy.Obligation, error) { + limit, offset := c.getRequestedLimitOffset(r.GetPagination()) + + maxLimit := c.listCfg.limitMax + if maxLimit > 0 && limit > maxLimit { + return nil, db.ErrListLimitTooLarge + } + + list, err := c.queries.listObligations(ctx, listObligationsParams{ + Limit: limit, + Offset: offset, + }) + if err != nil { + return nil, db.WrapIfKnownInvalidQueryErr(err) + } + return nil, errors.New("ListObligations is not implemented in PolicyDBClient") } func (c PolicyDBClient) UpdateObligationDefinition(ctx context.Context, r *obligations.UpdateObligationRequest) (*policy.Obligation, error) { diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index b496623b4c..979833b410 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -267,7 +267,7 @@ func (q *Queries) getObligation(ctx context.Context, arg getObligationParams) (g return i, err } -const listObligationDefinitions = `-- name: listObligationDefinitions :many +const listObligations = `-- name: listObligations :many WITH counted AS ( SELECT COUNT(id) AS total FROM obligation_definitions @@ -301,13 +301,13 @@ LIMIT $3 OFFSET $2 ` -type listObligationDefinitionsParams struct { +type listObligationsParams struct { NamespaceID interface{} `json:"namespace_id"` Offset int32 `json:"offset_"` Limit int32 `json:"limit_"` } -type listObligationDefinitionsRow struct { +type listObligationsRow struct { ID string `json:"id"` Name string `json:"name"` Namespace []byte `json:"namespace"` @@ -316,7 +316,7 @@ type listObligationDefinitionsRow struct { Total int64 `json:"total"` } -// listObligationDefinitions +// listObligations // // WITH counted AS ( // SELECT COUNT(id) AS total @@ -349,15 +349,15 @@ type listObligationDefinitionsRow struct { // GROUP BY od.id, n.id, counted.total // LIMIT $3 // OFFSET $2 -func (q *Queries) listObligationDefinitions(ctx context.Context, arg listObligationDefinitionsParams) ([]listObligationDefinitionsRow, error) { - rows, err := q.db.Query(ctx, listObligationDefinitions, arg.NamespaceID, arg.Offset, arg.Limit) +func (q *Queries) listObligations(ctx context.Context, arg listObligationsParams) ([]listObligationsRow, error) { + rows, err := q.db.Query(ctx, listObligations, arg.NamespaceID, arg.Offset, arg.Limit) if err != nil { return nil, err } defer rows.Close() - var items []listObligationDefinitionsRow + var items []listObligationsRow for rows.Next() { - var i listObligationDefinitionsRow + var i listObligationsRow if err := rows.Scan( &i.ID, &i.Name, diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index e185225aec..2ef1bf7529 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -89,7 +89,7 @@ WHERE ) GROUP BY od.id, n.id, n.name, fqns.fqn; --- name: listObligationDefinitions :many +-- name: listObligations :many WITH counted AS ( SELECT COUNT(id) AS total FROM obligation_definitions From 87e3ea9a311e4807ea3adf178a37f19f680dd1ca Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 4 Aug 2025 20:11:11 -0400 Subject: [PATCH 034/137] improve test --- service/integration/obligations_test.go | 18 +++++++++++------- service/policy/db/obligations.go | 1 + 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index a05d1a8fbe..290b3ad2a2 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -45,6 +45,12 @@ func TestObligationsSuite(t *testing.T) { /// const oblName = "example-obligation" +const oblValPrefix = "obligation_value_" + +var oblVals = []string{ + oblValPrefix + "1", + oblValPrefix + "2", +} // Create @@ -53,12 +59,6 @@ func (s *ObligationsSuite) Test_CreateObligation_Succeeds() { namespace := s.f.GetNamespaceKey("example.com") namespaceID := namespace.ID namespaceFQN := "https://" + namespace.Name - // oblName := "example-obligation" - oblValPrefix := "obligation_value_" - oblVals := []string{ - oblValPrefix + "1", - oblValPrefix + "2", - } obl, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ Id: namespaceID, @@ -138,7 +138,8 @@ func (s *ObligationsSuite) Test_GetObligation_Succeeds() { NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ Id: s.f.GetNamespaceKey("example.com").ID, }, - Name: oblName, + Name: oblName, + Values: oblVals, }) // Valid ID @@ -154,6 +155,9 @@ func (s *ObligationsSuite) Test_GetObligation_Succeeds() { s.Equal(createdObl.GetNamespace().GetId(), obl.GetNamespace().GetId()) s.Equal(createdObl.GetNamespace().GetName(), obl.GetNamespace().GetName()) s.Equal(createdObl.GetNamespace().GetFqn(), obl.GetNamespace().GetFqn()) + for _, value := range obl.Values { + s.Contains(value.GetValue(), oblValPrefix) + } // Valid FQN obl, err = s.db.PolicyClient.GetObligation(s.ctx, &obligations.GetObligationRequest{ diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index b553af9ee8..f6f05d93a4 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -151,6 +151,7 @@ func (c PolicyDBClient) ListObligations(ctx context.Context, r *obligations.List if err != nil { return nil, db.WrapIfKnownInvalidQueryErr(err) } + println(list) return nil, errors.New("ListObligations is not implemented in PolicyDBClient") } From 2ab7482186bd2996993742ffede69fae875ca151 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 5 Aug 2025 00:43:38 -0400 Subject: [PATCH 035/137] listobligations impl --- service/policy/db/obligations.go | 46 +++++++++++++++++- service/policy/db/obligations.sql.go | 58 +++++++++++++++-------- service/policy/db/queries/obligations.sql | 18 ++++--- 3 files changed, 94 insertions(+), 28 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index f6f05d93a4..556c23eaf9 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -151,8 +151,50 @@ func (c PolicyDBClient) ListObligations(ctx context.Context, r *obligations.List if err != nil { return nil, db.WrapIfKnownInvalidQueryErr(err) } - println(list) - return nil, errors.New("ListObligations is not implemented in PolicyDBClient") + oblList := make([]*policy.Obligation, len(list)) + + for i, r := range list { + metadata := &common.Metadata{} + if err = unmarshalMetadata(r.Metadata, metadata); err != nil { + return nil, err + } + + namespace := &policy.Namespace{} + if err := unmarshalNamespace(r.Namespace, namespace); err != nil { + return nil, fmt.Errorf("failed to unmarshal obligation namespace: %w", err) + } + + values := []*policy.ObligationValue{} + if err = unmarshalObligationValuesProto(r.Values, values); err != nil { + return nil, err + } + + oblList[i] = &policy.Obligation{ + Id: r.ID, + Name: r.Name, + Metadata: metadata, + Namespace: namespace, + Values: values, + } + } + + // var total int32 + // var nextOffset int32 + // if len(list) > 0 { + // total = int32(list[0].Total) + // nextOffset = getNextOffset(offset, limit, total) + // } + + return oblList, nil + + // return &obligations.ListObligationsResponse{ + // Obligations: oblList, + // Pagination: &policy.PageResponse{ + // CurrentOffset: offset, + // Total: total, + // NextOffset: nextOffset, + // }, + // }, nil } func (c PolicyDBClient) UpdateObligationDefinition(ctx context.Context, r *obligations.UpdateObligationRequest) (*policy.Obligation, error) { diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 979833b410..e223ca1595 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -269,17 +269,21 @@ func (q *Queries) getObligation(ctx context.Context, arg getObligationParams) (g const listObligations = `-- name: listObligations :many WITH counted AS ( - SELECT COUNT(id) AS total - FROM obligation_definitions + SELECT COUNT(od.id) AS total + FROM obligation_definitions od + LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id + LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL WHERE - (NULLIF($1, '') IS NULL OR od.namespace_id = $1::UUID) + (NULLIF($1::TEXT, '') IS NULL OR od.namespace_id = $1::UUID) AND + (NULLIF($2::TEXT, '') IS NULL OR fqns.fqn = $2::VARCHAR) ) SELECT od.id, od.name, JSON_BUILD_OBJECT( 'id', n.id, - 'name', n.name + 'name', n.name, + 'fqn', fqns.fqn ) as namespace, JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', od.metadata -> 'labels', 'created_at', od.created_at,'updated_at', od.updated_at)) as metadata, JSON_AGG( @@ -292,19 +296,22 @@ SELECT counted.total FROM obligation_definitions od JOIN attribute_namespaces n on od.namespace_id = n.id +LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL CROSS JOIN counted LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id WHERE - (NULLIF($1, '') IS NULL OR od.namespace_id = $1::UUID) -GROUP BY od.id, n.id, counted.total -LIMIT $3 -OFFSET $2 + (NULLIF($1::TEXT, '') IS NULL OR od.namespace_id = $1::UUID) AND + (NULLIF($2::TEXT, '') IS NULL OR fqns.fqn = $2::VARCHAR) +GROUP BY od.id, n.id, n.name, fqns.fqn, counted.total +LIMIT $4 +OFFSET $3 ` type listObligationsParams struct { - NamespaceID interface{} `json:"namespace_id"` - Offset int32 `json:"offset_"` - Limit int32 `json:"limit_"` + NamespaceID string `json:"namespace_id"` + NamespaceFqn string `json:"namespace_fqn"` + Offset int32 `json:"offset_"` + Limit int32 `json:"limit_"` } type listObligationsRow struct { @@ -319,17 +326,21 @@ type listObligationsRow struct { // listObligations // // WITH counted AS ( -// SELECT COUNT(id) AS total -// FROM obligation_definitions +// SELECT COUNT(od.id) AS total +// FROM obligation_definitions od +// LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id +// LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL // WHERE -// (NULLIF($1, '') IS NULL OR od.namespace_id = $1::UUID) +// (NULLIF($1::TEXT, '') IS NULL OR od.namespace_id = $1::UUID) AND +// (NULLIF($2::TEXT, '') IS NULL OR fqns.fqn = $2::VARCHAR) // ) // SELECT // od.id, // od.name, // JSON_BUILD_OBJECT( // 'id', n.id, -// 'name', n.name +// 'name', n.name, +// 'fqn', fqns.fqn // ) as namespace, // JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', od.metadata -> 'labels', 'created_at', od.created_at,'updated_at', od.updated_at)) as metadata, // JSON_AGG( @@ -342,15 +353,22 @@ type listObligationsRow struct { // counted.total // FROM obligation_definitions od // JOIN attribute_namespaces n on od.namespace_id = n.id +// LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL // CROSS JOIN counted // LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id // WHERE -// (NULLIF($1, '') IS NULL OR od.namespace_id = $1::UUID) -// GROUP BY od.id, n.id, counted.total -// LIMIT $3 -// OFFSET $2 +// (NULLIF($1::TEXT, '') IS NULL OR od.namespace_id = $1::UUID) AND +// (NULLIF($2::TEXT, '') IS NULL OR fqns.fqn = $2::VARCHAR) +// GROUP BY od.id, n.id, n.name, fqns.fqn, counted.total +// LIMIT $4 +// OFFSET $3 func (q *Queries) listObligations(ctx context.Context, arg listObligationsParams) ([]listObligationsRow, error) { - rows, err := q.db.Query(ctx, listObligations, arg.NamespaceID, arg.Offset, arg.Limit) + rows, err := q.db.Query(ctx, listObligations, + arg.NamespaceID, + arg.NamespaceFqn, + arg.Offset, + arg.Limit, + ) if err != nil { return nil, err } diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 2ef1bf7529..1be47c7da4 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -91,17 +91,21 @@ GROUP BY od.id, n.id, n.name, fqns.fqn; -- name: listObligations :many WITH counted AS ( - SELECT COUNT(id) AS total - FROM obligation_definitions + SELECT COUNT(od.id) AS total + FROM obligation_definitions od + LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id + LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL WHERE - (NULLIF(@namespace_id, '') IS NULL OR od.namespace_id = @namespace_id::UUID) + (NULLIF(@namespace_id::TEXT, '') IS NULL OR od.namespace_id = @namespace_id::UUID) AND + (NULLIF(@namespace_fqn::TEXT, '') IS NULL OR fqns.fqn = @namespace_fqn::VARCHAR) ) SELECT od.id, od.name, JSON_BUILD_OBJECT( 'id', n.id, - 'name', n.name + 'name', n.name, + 'fqn', fqns.fqn ) as namespace, JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', od.metadata -> 'labels', 'created_at', od.created_at,'updated_at', od.updated_at)) as metadata, JSON_AGG( @@ -114,11 +118,13 @@ SELECT counted.total FROM obligation_definitions od JOIN attribute_namespaces n on od.namespace_id = n.id +LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL CROSS JOIN counted LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id WHERE - (NULLIF(@namespace_id, '') IS NULL OR od.namespace_id = @namespace_id::UUID) -GROUP BY od.id, n.id, counted.total + (NULLIF(@namespace_id::TEXT, '') IS NULL OR od.namespace_id = @namespace_id::UUID) AND + (NULLIF(@namespace_fqn::TEXT, '') IS NULL OR fqns.fqn = @namespace_fqn::VARCHAR) +GROUP BY od.id, n.id, n.name, fqns.fqn, counted.total LIMIT @limit_ OFFSET @offset_; From 50c507123f5f9ad4d71ee4d46882f91caa82c676 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 5 Aug 2025 10:35:09 -0400 Subject: [PATCH 036/137] start listobl tests --- service/integration/obligations_test.go | 39 ++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 290b3ad2a2..34b3cda586 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -3,6 +3,7 @@ package integration import ( "context" "log/slog" + "strconv" "testing" "github.com/opentdf/platform/protocol/go/policy/obligations" @@ -197,13 +198,43 @@ func (s *ObligationsSuite) Test_GetObligation_Fails() { // List -func (s *ObligationsSuite) Test_ListObligationDefinitions_Succeeds() { - // tcs: see registered resources +func (s *ObligationsSuite) Test_ListObligations_Succeeds() { + // Create multiple obligations + numObls := 3 + namespace := s.f.GetNamespaceKey("example.com") + for i := 0; i < numObls; i++ { + _, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ + NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ + Id: namespace.ID, + }, + Name: oblName + "-" + strconv.Itoa(i), + Values: oblVals, + }) + s.Require().NoError(err) + } + // List obligations by namespace ID + oblList, err := s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ + NamespaceIdentifier: &obligations.ListObligationsRequest_Id{ + Id: namespace.ID, + }, + }) + s.Require().NoError(err) + s.NotNil(oblList) + s.Len(oblList, numObls) + for _, obl := range oblList { + s.Contains(obl.Name, oblName) + s.Equal(namespace.ID, obl.Namespace.Id) + s.Equal(namespace.Name, obl.Namespace.Name) + s.Equal("https://"+namespace.Name, obl.Namespace.Fqn) + for _, value := range obl.Values { + s.Contains(value.GetValue(), oblValPrefix) + } + } - s.T().Skip("obligation_definitions table not implemented yet") + // TODO: delete obligations after tests are done } -func (s *ObligationsSuite) Test_ListObligationDefinitions_Fails() { +func (s *ObligationsSuite) Test_ListObligations_Fails() { // tcs: see registered resources s.T().Skip("obligation_definitions table not implemented yet") From d06bd478335ea9ceedd36182d8cfe686a517f035 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 5 Aug 2025 11:22:40 -0400 Subject: [PATCH 037/137] improve listoblsucceeds test --- service/integration/obligations_test.go | 52 ++++++++++++++++++++++++- service/policy/db/obligations.go | 6 ++- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 34b3cda586..59fd6b53c5 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -212,8 +212,39 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { }) s.Require().NoError(err) } + // Create one more obligation in a different namespace to ensure filtering works + otherNamespace := s.f.GetNamespaceKey("example.net") + _, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ + NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ + Id: otherNamespace.ID, + }, + Name: oblName + "-other-namespace", + Values: oblVals, + }) + s.Require().NoError(err) + + // List all obligations + oblList, err := s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{}) + s.Require().NoError(err) + s.NotNil(oblList) + s.GreaterOrEqual(len(oblList), numObls+1) // at least the ones we just created + found := 0 + for _, obl := range oblList { + if obl.Namespace.Id == namespace.ID { + found++ + s.Contains(obl.Name, oblName) + s.Equal(namespace.ID, obl.Namespace.Id) + s.Equal(namespace.Name, obl.Namespace.Name) + s.Equal("https://"+namespace.Name, obl.Namespace.Fqn) + for _, value := range obl.Values { + s.Contains(value.GetValue(), oblValPrefix) + } + } + } + s.Equal(numObls, found) + // List obligations by namespace ID - oblList, err := s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ + oblList, err = s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ NamespaceIdentifier: &obligations.ListObligationsRequest_Id{ Id: namespace.ID, }, @@ -231,6 +262,25 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { } } + // List obligations by namespace FQN + oblList, err = s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ + NamespaceIdentifier: &obligations.ListObligationsRequest_Fqn{ + Fqn: "https://" + namespace.Name, + }, + }) + s.Require().NoError(err) + s.NotNil(oblList) + s.Len(oblList, numObls) + for _, obl := range oblList { + s.Contains(obl.Name, oblName) + s.Equal(namespace.ID, obl.Namespace.Id) + s.Equal(namespace.Name, obl.Namespace.Name) + s.Equal("https://"+namespace.Name, obl.Namespace.Fqn) + for _, value := range obl.Values { + s.Contains(value.GetValue(), oblValPrefix) + } + } + // TODO: delete obligations after tests are done } diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 556c23eaf9..d060c4f63c 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -145,8 +145,10 @@ func (c PolicyDBClient) ListObligations(ctx context.Context, r *obligations.List } list, err := c.queries.listObligations(ctx, listObligationsParams{ - Limit: limit, - Offset: offset, + NamespaceID: r.GetId(), + NamespaceFqn: r.GetFqn(), + Limit: limit, + Offset: offset, }) if err != nil { return nil, db.WrapIfKnownInvalidQueryErr(err) From 1e8ad3739d122f54057e7e6df29b55336f859ca5 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 5 Aug 2025 11:24:23 -0400 Subject: [PATCH 038/137] more --- service/integration/obligations_test.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 59fd6b53c5..9c8b242c16 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -227,7 +227,7 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { oblList, err := s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{}) s.Require().NoError(err) s.NotNil(oblList) - s.GreaterOrEqual(len(oblList), numObls+1) // at least the ones we just created + s.Equal(len(oblList), numObls+1) found := 0 for _, obl := range oblList { if obl.Namespace.Id == namespace.ID { @@ -239,6 +239,14 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { for _, value := range obl.Values { s.Contains(value.GetValue(), oblValPrefix) } + } else { + s.Equal(otherNamespace.ID, obl.Namespace.Id) + s.Equal(otherNamespace.Name, obl.Namespace.Name) + s.Equal("https://"+otherNamespace.Name, obl.Namespace.Fqn) + s.Contains(obl.Name, "other-namespace") + for _, value := range obl.Values { + s.Contains(value.GetValue(), oblValPrefix) + } } } s.Equal(numObls, found) From e830d97489f50606a3d64c17f8768cd4c5bb199b Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 5 Aug 2025 11:40:49 -0400 Subject: [PATCH 039/137] add listoblfails test --- service/integration/obligations_test.go | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 9c8b242c16..d1abf51281 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -47,6 +47,7 @@ func TestObligationsSuite(t *testing.T) { const oblName = "example-obligation" const oblValPrefix = "obligation_value_" +const invalidFQN = "invalid-fqn" var oblVals = []string{ oblValPrefix + "1", @@ -189,7 +190,7 @@ func (s *ObligationsSuite) Test_GetObligation_Fails() { // Invalid FQN obl, err = s.db.PolicyClient.GetObligation(s.ctx, &obligations.GetObligationRequest{ Identifier: &obligations.GetObligationRequest_Fqn{ - Fqn: "invalid-fqn", + Fqn: invalidFQN, }, }) s.Require().ErrorIs(err, db.ErrNotFound) @@ -289,13 +290,28 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { } } + // Attempt to list obligations with an invalid namespace FQN + oblList, err = s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ + NamespaceIdentifier: &obligations.ListObligationsRequest_Fqn{ + Fqn: invalidFQN, + }, + }) + s.Require().NoError(err) + s.NotNil(oblList) + s.Equal(len(oblList), 0) + // TODO: delete obligations after tests are done } func (s *ObligationsSuite) Test_ListObligations_Fails() { - // tcs: see registered resources - - s.T().Skip("obligation_definitions table not implemented yet") + // Attempt to list obligations with an invalid namespace ID + oblList, err := s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ + NamespaceIdentifier: &obligations.ListObligationsRequest_Id{ + Id: invalidUUID, + }, + }) + s.Require().ErrorIs(err, db.ErrUUIDInvalid) + s.Nil(oblList) } // Update From 44f0bd83d9fcce99852090dda2dabf1a4b88eca7 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 5 Aug 2025 12:02:02 -0400 Subject: [PATCH 040/137] edit type sig for listobls --- service/integration/obligations_test.go | 18 +++++------ service/policy/db/obligations.go | 39 +++++++++++------------ service/policy/db/queries/obligations.sql | 4 +-- 3 files changed, 29 insertions(+), 32 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index d1abf51281..566497b856 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -225,7 +225,7 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { s.Require().NoError(err) // List all obligations - oblList, err := s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{}) + oblList, _, err := s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{}) s.Require().NoError(err) s.NotNil(oblList) s.Equal(len(oblList), numObls+1) @@ -253,7 +253,7 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { s.Equal(numObls, found) // List obligations by namespace ID - oblList, err = s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ + oblList, _, err = s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ NamespaceIdentifier: &obligations.ListObligationsRequest_Id{ Id: namespace.ID, }, @@ -272,7 +272,7 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { } // List obligations by namespace FQN - oblList, err = s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ + oblList, _, err = s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ NamespaceIdentifier: &obligations.ListObligationsRequest_Fqn{ Fqn: "https://" + namespace.Name, }, @@ -291,7 +291,7 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { } // Attempt to list obligations with an invalid namespace FQN - oblList, err = s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ + oblList, _, err = s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ NamespaceIdentifier: &obligations.ListObligationsRequest_Fqn{ Fqn: invalidFQN, }, @@ -305,7 +305,7 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { func (s *ObligationsSuite) Test_ListObligations_Fails() { // Attempt to list obligations with an invalid namespace ID - oblList, err := s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ + oblList, _, err := s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ NamespaceIdentifier: &obligations.ListObligationsRequest_Id{ Id: invalidUUID, }, @@ -316,13 +316,13 @@ func (s *ObligationsSuite) Test_ListObligations_Fails() { // Update -func (s *ObligationsSuite) Test_UpdateObligationDefinitions_Succeeds() { +func (s *ObligationsSuite) Test_UpdateObligation_Succeeds() { // tcs: see registered resources s.T().Skip("obligation_definitions table not implemented yet") } -func (s *ObligationsSuite) Test_UpdateObligationDefinitions_Fails() { +func (s *ObligationsSuite) Test_UpdateObligation_Fails() { // tcs: see registered resources s.T().Skip("obligation_definitions table not implemented yet") @@ -330,14 +330,14 @@ func (s *ObligationsSuite) Test_UpdateObligationDefinitions_Fails() { // Delete -func (s *ObligationsSuite) Test_DeleteObligationDefinition_Succeeds() { +func (s *ObligationsSuite) Test_DeleteObligation_Succeeds() { // tcs: // - delete by id and ensure cascade removes children relationships s.T().Skip("obligation_definitions table not implemented yet") } -func (s *ObligationsSuite) Test_DeleteObligationDefinition_Fails() { +func (s *ObligationsSuite) Test_DeleteObligation_Fails() { // tcs: // - delete by invalid id diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index d060c4f63c..973977d6a6 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -136,12 +136,12 @@ func (c PolicyDBClient) GetObligation(ctx context.Context, r *obligations.GetObl }, nil } -func (c PolicyDBClient) ListObligations(ctx context.Context, r *obligations.ListObligationsRequest) ([]*policy.Obligation, error) { +func (c PolicyDBClient) ListObligations(ctx context.Context, r *obligations.ListObligationsRequest) ([]*policy.Obligation, *policy.PageResponse, error) { limit, offset := c.getRequestedLimitOffset(r.GetPagination()) maxLimit := c.listCfg.limitMax if maxLimit > 0 && limit > maxLimit { - return nil, db.ErrListLimitTooLarge + return nil, nil, db.ErrListLimitTooLarge } list, err := c.queries.listObligations(ctx, listObligationsParams{ @@ -151,24 +151,24 @@ func (c PolicyDBClient) ListObligations(ctx context.Context, r *obligations.List Offset: offset, }) if err != nil { - return nil, db.WrapIfKnownInvalidQueryErr(err) + return nil, nil, db.WrapIfKnownInvalidQueryErr(err) } oblList := make([]*policy.Obligation, len(list)) for i, r := range list { metadata := &common.Metadata{} if err = unmarshalMetadata(r.Metadata, metadata); err != nil { - return nil, err + return nil, nil, err } namespace := &policy.Namespace{} if err := unmarshalNamespace(r.Namespace, namespace); err != nil { - return nil, fmt.Errorf("failed to unmarshal obligation namespace: %w", err) + return nil, nil, fmt.Errorf("failed to unmarshal obligation namespace: %w", err) } values := []*policy.ObligationValue{} if err = unmarshalObligationValuesProto(r.Values, values); err != nil { - return nil, err + return nil, nil, err } oblList[i] = &policy.Obligation{ @@ -180,23 +180,20 @@ func (c PolicyDBClient) ListObligations(ctx context.Context, r *obligations.List } } - // var total int32 - // var nextOffset int32 - // if len(list) > 0 { - // total = int32(list[0].Total) - // nextOffset = getNextOffset(offset, limit, total) - // } + var total int32 + var nextOffset int32 + if len(list) > 0 { + total = int32(list[0].Total) + nextOffset = getNextOffset(offset, limit, total) + } - return oblList, nil + pagination := &policy.PageResponse{ + CurrentOffset: offset, + Total: total, + NextOffset: nextOffset, + } - // return &obligations.ListObligationsResponse{ - // Obligations: oblList, - // Pagination: &policy.PageResponse{ - // CurrentOffset: offset, - // Total: total, - // NextOffset: nextOffset, - // }, - // }, nil + return oblList, pagination, nil } func (c PolicyDBClient) UpdateObligationDefinition(ctx context.Context, r *obligations.UpdateObligationRequest) (*policy.Obligation, error) { diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 1be47c7da4..3683f211a4 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -128,12 +128,12 @@ GROUP BY od.id, n.id, n.name, fqns.fqn, counted.total LIMIT @limit_ OFFSET @offset_; --- name: updateObligationDefinition :execrows +-- name: updateObligation :execrows UPDATE obligation_definitions SET name = COALESCE(sqlc.narg('name'), name), metadata = COALESCE(sqlc.narg('metadata'), metadata) WHERE id = $1; --- name: deleteObligationDefinition :execrows +-- name: deleteObligation :execrows DELETE FROM obligation_definitions WHERE id = $1; From 00a66e62ad6011204c45e2d9c9a7de634954c306 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 5 Aug 2025 16:29:26 -0400 Subject: [PATCH 041/137] start updateobl --- service/integration/obligations_test.go | 35 +++++++++++++++++++-- service/policy/db/obligations.go | 37 ++++++++++++++++++++-- service/policy/db/obligations.sql.go | 38 +++++++++++------------ service/policy/db/queries/obligations.sql | 6 ++-- 4 files changed, 89 insertions(+), 27 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 566497b856..914fb42a84 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -6,6 +6,7 @@ import ( "strconv" "testing" + "github.com/opentdf/platform/protocol/go/common" "github.com/opentdf/platform/protocol/go/policy/obligations" "github.com/opentdf/platform/service/internal/fixtures" "github.com/opentdf/platform/service/pkg/db" @@ -317,9 +318,39 @@ func (s *ObligationsSuite) Test_ListObligations_Fails() { // Update func (s *ObligationsSuite) Test_UpdateObligation_Succeeds() { - // tcs: see registered resources + // Create an obligation to update + createdObl, _ := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ + NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ + Id: s.f.GetNamespaceKey("example.com").ID, + }, + Name: oblName, + Values: oblVals, + }) - s.T().Skip("obligation_definitions table not implemented yet") + // Update the obligation + newName := oblName + "-updated" + newMetadata := &common.MetadataMutable{ + Labels: map[string]string{"key": "value"}, + } + updatedObl, err := s.db.PolicyClient.UpdateObligation(s.ctx, &obligations.UpdateObligationRequest{ + Id: createdObl.GetId(), + Name: newName, + Metadata: newMetadata, + MetadataUpdateBehavior: 1, + }) + s.Require().NoError(err) + s.NotNil(updatedObl) + s.Equal(newName, updatedObl.Name) + s.Equal(newMetadata.GetLabels(), updatedObl.Metadata.GetLabels()) + s.Equal(createdObl.GetNamespace().GetId(), updatedObl.GetNamespace().GetId()) + s.Equal(createdObl.GetNamespace().GetName(), updatedObl.GetNamespace().GetName()) + s.Equal(createdObl.GetNamespace().GetFqn(), updatedObl.GetNamespace().GetFqn()) + + // for _, value := range updatedObl.Values { + // s.Contains(value.GetValue(), oblValPrefix) + // } + + // Delete the obligation after tests are done } func (s *ObligationsSuite) Test_UpdateObligation_Fails() { diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 973977d6a6..7db6318721 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -196,8 +196,41 @@ func (c PolicyDBClient) ListObligations(ctx context.Context, r *obligations.List return oblList, pagination, nil } -func (c PolicyDBClient) UpdateObligationDefinition(ctx context.Context, r *obligations.UpdateObligationRequest) (*policy.Obligation, error) { - return nil, errors.New("UpdateObligationDefinition is not implemented in PolicyDBClient") +func (c PolicyDBClient) UpdateObligation(ctx context.Context, r *obligations.UpdateObligationRequest) (*policy.Obligation, error) { + id := r.GetId() + name := strings.ToLower(r.GetName()) + metadataJSON, metadata, err := db.MarshalUpdateMetadata(r.GetMetadata(), r.GetMetadataUpdateBehavior(), func() (*common.Metadata, error) { + v, err := c.GetObligation(ctx, &obligations.GetObligationRequest{ + Identifier: &obligations.GetObligationRequest_Id{ + Id: id, + }, + }) + if err != nil { + return nil, err + } + return v.GetMetadata(), nil + }) + if err != nil { + return nil, err + } + + count, err := c.queries.updateObligation(ctx, updateObligationParams{ + ID: id, + Name: name, + Metadata: metadataJSON, + }) + if err != nil { + return nil, db.WrapIfKnownInvalidQueryErr(err) + } + if count == 0 { + return nil, db.ErrNotFound + } + + return &policy.Obligation{ + Id: id, + Name: name, + Metadata: metadata, + }, nil } func (c PolicyDBClient) DeleteObligationDefinition(ctx context.Context, r *obligations.DeleteObligationRequest) (*policy.Obligation, error) { diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index e223ca1595..4c3e6bafe9 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -7,8 +7,6 @@ package db import ( "context" - - "github.com/jackc/pgx/v5/pgtype" ) const createObligation = `-- name: createObligation :one @@ -158,15 +156,15 @@ func (q *Queries) createObligation(ctx context.Context, arg createObligationPara return i, err } -const deleteObligationDefinition = `-- name: deleteObligationDefinition :execrows +const deleteObligation = `-- name: deleteObligation :execrows DELETE FROM obligation_definitions WHERE id = $1 ` -// deleteObligationDefinition +// deleteObligation // // DELETE FROM obligation_definitions WHERE id = $1 -func (q *Queries) deleteObligationDefinition(ctx context.Context, id string) (int64, error) { - result, err := q.db.Exec(ctx, deleteObligationDefinition, id) +func (q *Queries) deleteObligation(ctx context.Context, id string) (int64, error) { + result, err := q.db.Exec(ctx, deleteObligation, id) if err != nil { return 0, err } @@ -394,29 +392,29 @@ func (q *Queries) listObligations(ctx context.Context, arg listObligationsParams return items, nil } -const updateObligationDefinition = `-- name: updateObligationDefinition :execrows +const updateObligation = `-- name: updateObligation :execrows UPDATE obligation_definitions SET - name = COALESCE($2, name), - metadata = COALESCE($3, metadata) -WHERE id = $1 + name = COALESCE(NULLIF($1::TEXT, ''), name), + metadata = COALESCE($2, metadata) +WHERE id = $3 ` -type updateObligationDefinitionParams struct { - ID string `json:"id"` - Name pgtype.Text `json:"name"` - Metadata []byte `json:"metadata"` +type updateObligationParams struct { + Name string `json:"name"` + Metadata []byte `json:"metadata"` + ID string `json:"id"` } -// updateObligationDefinition +// updateObligation // // UPDATE obligation_definitions // SET -// name = COALESCE($2, name), -// metadata = COALESCE($3, metadata) -// WHERE id = $1 -func (q *Queries) updateObligationDefinition(ctx context.Context, arg updateObligationDefinitionParams) (int64, error) { - result, err := q.db.Exec(ctx, updateObligationDefinition, arg.ID, arg.Name, arg.Metadata) +// name = COALESCE(NULLIF($1::TEXT, ''), name), +// metadata = COALESCE($2, metadata) +// WHERE id = $3 +func (q *Queries) updateObligation(ctx context.Context, arg updateObligationParams) (int64, error) { + result, err := q.db.Exec(ctx, updateObligation, arg.Name, arg.Metadata, arg.ID) if err != nil { return 0, err } diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 3683f211a4..219a510130 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -131,9 +131,9 @@ OFFSET @offset_; -- name: updateObligation :execrows UPDATE obligation_definitions SET - name = COALESCE(sqlc.narg('name'), name), - metadata = COALESCE(sqlc.narg('metadata'), metadata) -WHERE id = $1; + name = COALESCE(NULLIF(@name::TEXT, ''), name), + metadata = COALESCE(@metadata, metadata) +WHERE id = @id; -- name: deleteObligation :execrows DELETE FROM obligation_definitions WHERE id = $1; From 3a60b83bcded6b845b16b8c200fde7a2a9be2004 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 5 Aug 2025 16:31:23 -0400 Subject: [PATCH 042/137] updateoblsucceeds test --- service/integration/obligations_test.go | 6 +++--- service/policy/db/obligations.go | 26 +++++++++++++------------ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 914fb42a84..a58d28a6f5 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -346,9 +346,9 @@ func (s *ObligationsSuite) Test_UpdateObligation_Succeeds() { s.Equal(createdObl.GetNamespace().GetName(), updatedObl.GetNamespace().GetName()) s.Equal(createdObl.GetNamespace().GetFqn(), updatedObl.GetNamespace().GetFqn()) - // for _, value := range updatedObl.Values { - // s.Contains(value.GetValue(), oblValPrefix) - // } + for _, value := range updatedObl.Values { + s.Contains(value.GetValue(), oblValPrefix) + } // Delete the obligation after tests are done } diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 7db6318721..008c0eb76e 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -199,16 +199,16 @@ func (c PolicyDBClient) ListObligations(ctx context.Context, r *obligations.List func (c PolicyDBClient) UpdateObligation(ctx context.Context, r *obligations.UpdateObligationRequest) (*policy.Obligation, error) { id := r.GetId() name := strings.ToLower(r.GetName()) + obl, err := c.GetObligation(ctx, &obligations.GetObligationRequest{ + Identifier: &obligations.GetObligationRequest_Id{ + Id: id, + }, + }) + if err != nil { + return nil, err + } metadataJSON, metadata, err := db.MarshalUpdateMetadata(r.GetMetadata(), r.GetMetadataUpdateBehavior(), func() (*common.Metadata, error) { - v, err := c.GetObligation(ctx, &obligations.GetObligationRequest{ - Identifier: &obligations.GetObligationRequest_Id{ - Id: id, - }, - }) - if err != nil { - return nil, err - } - return v.GetMetadata(), nil + return obl.GetMetadata(), nil }) if err != nil { return nil, err @@ -227,9 +227,11 @@ func (c PolicyDBClient) UpdateObligation(ctx context.Context, r *obligations.Upd } return &policy.Obligation{ - Id: id, - Name: name, - Metadata: metadata, + Id: id, + Name: name, + Metadata: metadata, + Namespace: obl.GetNamespace(), + Values: obl.GetValues(), }, nil } From ba2df6438924da7deef585f189935b41c2cc27a9 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 5 Aug 2025 16:36:10 -0400 Subject: [PATCH 043/137] updateoblfails test --- service/integration/obligations_test.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index a58d28a6f5..6adc94e3bf 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -354,9 +354,12 @@ func (s *ObligationsSuite) Test_UpdateObligation_Succeeds() { } func (s *ObligationsSuite) Test_UpdateObligation_Fails() { - // tcs: see registered resources - - s.T().Skip("obligation_definitions table not implemented yet") + // Attempt to update an obligation with an invalid ID + updatedObl, err := s.db.PolicyClient.UpdateObligation(s.ctx, &obligations.UpdateObligationRequest{ + Id: invalidUUID, + }) + s.Require().ErrorIs(err, db.ErrUUIDInvalid) + s.Nil(updatedObl) } // Delete From d03ee09df24ea9b3bbc301f83c1172d53a1a8196 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 5 Aug 2025 17:08:05 -0400 Subject: [PATCH 044/137] deleteobl and tests --- service/integration/obligations_test.go | 54 ++++++++++++++++++++----- service/policy/db/obligations.go | 14 ++++++- 2 files changed, 57 insertions(+), 11 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 6adc94e3bf..29ae00fe03 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -355,25 +355,61 @@ func (s *ObligationsSuite) Test_UpdateObligation_Succeeds() { func (s *ObligationsSuite) Test_UpdateObligation_Fails() { // Attempt to update an obligation with an invalid ID - updatedObl, err := s.db.PolicyClient.UpdateObligation(s.ctx, &obligations.UpdateObligationRequest{ + obl, err := s.db.PolicyClient.UpdateObligation(s.ctx, &obligations.UpdateObligationRequest{ Id: invalidUUID, }) s.Require().ErrorIs(err, db.ErrUUIDInvalid) - s.Nil(updatedObl) + s.Nil(obl) } // Delete func (s *ObligationsSuite) Test_DeleteObligation_Succeeds() { - // tcs: - // - delete by id and ensure cascade removes children relationships + // Create an obligation to delete + createdObl, _ := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ + NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ + Id: s.f.GetNamespaceKey("example.com").ID, + }, + Name: oblName, + Values: oblVals, + }) + + // Get the obligation to ensure it exists + obl, err := s.db.PolicyClient.GetObligation(s.ctx, &obligations.GetObligationRequest{ + Identifier: &obligations.GetObligationRequest_Id{ + Id: createdObl.GetId(), + }, + }) + s.Require().NoError(err) + s.NotNil(obl) + + // Delete the obligation + obl, err = s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ + Identifier: &obligations.DeleteObligationRequest_Id{ + Id: createdObl.GetId(), + }, + }) + s.Require().NoError(err) + s.NotNil(obl) + s.Equal(createdObl.GetId(), obl.GetId()) - s.T().Skip("obligation_definitions table not implemented yet") + // Attempt to get the obligation again to ensure it has been deleted + obl, err = s.db.PolicyClient.GetObligation(s.ctx, &obligations.GetObligationRequest{ + Identifier: &obligations.GetObligationRequest_Id{ + Id: createdObl.GetId(), + }, + }) + s.Require().ErrorIs(err, db.ErrNotFound) + s.Nil(obl) } func (s *ObligationsSuite) Test_DeleteObligation_Fails() { - // tcs: - // - delete by invalid id - - s.T().Skip("obligation_definitions table not implemented yet") + // Attempt to delete an obligation with an invalid ID + obl, err := s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ + Identifier: &obligations.DeleteObligationRequest_Id{ + Id: invalidUUID, + }, + }) + s.Require().ErrorIs(err, db.ErrUUIDInvalid) + s.Nil(obl) } diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 008c0eb76e..df9a6fef5d 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -3,7 +3,6 @@ package db import ( "context" "encoding/json" - "errors" "fmt" "strings" @@ -236,5 +235,16 @@ func (c PolicyDBClient) UpdateObligation(ctx context.Context, r *obligations.Upd } func (c PolicyDBClient) DeleteObligationDefinition(ctx context.Context, r *obligations.DeleteObligationRequest) (*policy.Obligation, error) { - return nil, errors.New("DeleteObligationDefinition is not implemented in PolicyDBClient") + id := r.GetId() + count, err := c.queries.deleteObligation(ctx, id) + if err != nil { + return nil, db.WrapIfKnownInvalidQueryErr(err) + } + if count == 0 { + return nil, db.ErrNotFound + } + + return &policy.Obligation{ + Id: id, + }, nil } From 35ae54532e30921bad914449d411307e531ef5cb Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 5 Aug 2025 17:27:31 -0400 Subject: [PATCH 045/137] make tests independent --- service/integration/obligations_test.go | 89 +++++++++++++++++++++++-- 1 file changed, 82 insertions(+), 7 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 29ae00fe03..9c940b816d 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -79,10 +79,18 @@ func (s *ObligationsSuite) Test_CreateObligation_Succeeds() { s.Contains(value.GetValue(), oblValPrefix) } + // Delete the obligation + _, err = s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ + Identifier: &obligations.DeleteObligationRequest_Id{ + Id: obl.GetId(), + }, + }) + s.Require().NoError(err) + // By namespace FQN - namespace = s.f.GetNamespaceKey("example.net") - namespaceID = namespace.ID - namespaceFQN = "https://" + namespace.Name + // namespace = s.f.GetNamespaceKey("example.net") + // namespaceID = namespace.ID + // namespaceFQN = "https://" + namespace.Name obl, err = s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ NamespaceIdentifier: &obligations.CreateObligationRequest_Fqn{ Fqn: namespaceFQN, @@ -96,7 +104,13 @@ func (s *ObligationsSuite) Test_CreateObligation_Succeeds() { s.Equal(namespace.Name, obl.Namespace.Name) s.Equal(namespaceFQN, obl.Namespace.Fqn) - // TODO: delete both obligations after tests are done + // Delete the obligation + _, err = s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ + Identifier: &obligations.DeleteObligationRequest_Id{ + Id: obl.GetId(), + }, + }) + s.Require().NoError(err) } func (s *ObligationsSuite) Test_CreateObligation_Fails() { @@ -131,7 +145,25 @@ func (s *ObligationsSuite) Test_CreateObligation_Fails() { s.Require().ErrorIs(err, db.ErrUniqueConstraintViolation) s.Nil(obl) - // TODO: delete obligation after tests are done + // Delete obligation after tests are done + // Find and delete the created obligation + oblList, _, err := s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ + NamespaceIdentifier: &obligations.ListObligationsRequest_Id{ + Id: namespaceID, + }, + }) + s.Require().NoError(err) + for _, createdObl := range oblList { + if createdObl.Name == oblName { + _, err = s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ + Identifier: &obligations.DeleteObligationRequest_Id{ + Id: createdObl.Id, + }, + }) + s.Require().NoError(err) + break + } + } } // Get @@ -175,7 +207,13 @@ func (s *ObligationsSuite) Test_GetObligation_Succeeds() { s.Equal(createdObl.GetNamespace().GetName(), obl.GetNamespace().GetName()) s.Equal(createdObl.GetNamespace().GetFqn(), obl.GetNamespace().GetFqn()) - // TODO: delete obligation after tests are done + // Delete obligation after tests are done + _, err = s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ + Identifier: &obligations.DeleteObligationRequest_Id{ + Id: createdObl.GetId(), + }, + }) + s.Require().NoError(err) } func (s *ObligationsSuite) Test_GetObligation_Fails() { @@ -301,7 +339,38 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { s.NotNil(oblList) s.Equal(len(oblList), 0) - // TODO: delete obligations after tests are done + // Delete obligations after tests are done + // Delete obligations from first namespace + firstNamespaceObls, _, err := s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ + NamespaceIdentifier: &obligations.ListObligationsRequest_Id{ + Id: namespace.ID, + }, + }) + s.Require().NoError(err) + for _, obl := range firstNamespaceObls { + _, err = s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ + Identifier: &obligations.DeleteObligationRequest_Id{ + Id: obl.Id, + }, + }) + s.Require().NoError(err) + } + + // Delete obligations from other namespace + otherNamespaceObls, _, err := s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ + NamespaceIdentifier: &obligations.ListObligationsRequest_Id{ + Id: otherNamespace.ID, + }, + }) + s.Require().NoError(err) + for _, obl := range otherNamespaceObls { + _, err = s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ + Identifier: &obligations.DeleteObligationRequest_Id{ + Id: obl.Id, + }, + }) + s.Require().NoError(err) + } } func (s *ObligationsSuite) Test_ListObligations_Fails() { @@ -351,6 +420,12 @@ func (s *ObligationsSuite) Test_UpdateObligation_Succeeds() { } // Delete the obligation after tests are done + _, err = s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ + Identifier: &obligations.DeleteObligationRequest_Id{ + Id: updatedObl.GetId(), + }, + }) + s.Require().NoError(err) } func (s *ObligationsSuite) Test_UpdateObligation_Fails() { From 6608abcf21bf0a19cd0e334c2b6aced0a6475d4c Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 5 Aug 2025 17:30:11 -0400 Subject: [PATCH 046/137] shorten test --- service/integration/obligations_test.go | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 9c940b816d..2740ca8e76 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -88,9 +88,6 @@ func (s *ObligationsSuite) Test_CreateObligation_Succeeds() { s.Require().NoError(err) // By namespace FQN - // namespace = s.f.GetNamespaceKey("example.net") - // namespaceID = namespace.ID - // namespaceFQN = "https://" + namespace.Name obl, err = s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ NamespaceIdentifier: &obligations.CreateObligationRequest_Fqn{ Fqn: namespaceFQN, @@ -136,34 +133,22 @@ func (s *ObligationsSuite) Test_CreateObligation_Fails() { s.Require().NoError(err) s.NotNil(obl) - obl, err = s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ + pending, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ Id: namespaceID, }, Name: oblName, }) s.Require().ErrorIs(err, db.ErrUniqueConstraintViolation) - s.Nil(obl) + s.Nil(pending) // Delete obligation after tests are done - // Find and delete the created obligation - oblList, _, err := s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ - NamespaceIdentifier: &obligations.ListObligationsRequest_Id{ - Id: namespaceID, + _, err = s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ + Identifier: &obligations.DeleteObligationRequest_Id{ + Id: obl.GetId(), }, }) s.Require().NoError(err) - for _, createdObl := range oblList { - if createdObl.Name == oblName { - _, err = s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ - Identifier: &obligations.DeleteObligationRequest_Id{ - Id: createdObl.Id, - }, - }) - s.Require().NoError(err) - break - } - } } // Get From d3b488b22ccd3f54d98999860f1c9776d4ac23a3 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 5 Aug 2025 17:40:51 -0400 Subject: [PATCH 047/137] clean up list obl test --- service/integration/obligations_test.go | 84 +++++++++++-------------- 1 file changed, 35 insertions(+), 49 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 2740ca8e76..e279a7feac 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -224,11 +224,19 @@ func (s *ObligationsSuite) Test_GetObligation_Fails() { // List func (s *ObligationsSuite) Test_ListObligations_Succeeds() { - // Create multiple obligations + // Setup test data numObls := 3 namespace := s.f.GetNamespaceKey("example.com") + otherNamespace := s.f.GetNamespaceKey("example.net") + namespaceFQN := "https://" + namespace.Name + otherNamespaceFQN := "https://" + otherNamespace.Name + + // Track created obligations for cleanup + var createdOblIDs []string + + // Create multiple obligations in first namespace for i := 0; i < numObls; i++ { - _, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ + obl, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ Id: namespace.ID, }, @@ -236,10 +244,11 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { Values: oblVals, }) s.Require().NoError(err) + createdOblIDs = append(createdOblIDs, obl.GetId()) } - // Create one more obligation in a different namespace to ensure filtering works - otherNamespace := s.f.GetNamespaceKey("example.net") - _, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ + + // Create one obligation in different namespace + otherObl, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ Id: otherNamespace.ID, }, @@ -247,36 +256,36 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { Values: oblVals, }) s.Require().NoError(err) + createdOblIDs = append(createdOblIDs, otherObl.GetId()) - // List all obligations + // Test 1: List all obligations oblList, _, err := s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{}) s.Require().NoError(err) s.NotNil(oblList) - s.Equal(len(oblList), numObls+1) + s.Equal(numObls+1, len(oblList)) + found := 0 for _, obl := range oblList { + s.Contains(obl.Name, oblName) + for _, value := range obl.Values { + s.Contains(value.GetValue(), oblValPrefix) + } + if obl.Namespace.Id == namespace.ID { found++ - s.Contains(obl.Name, oblName) s.Equal(namespace.ID, obl.Namespace.Id) s.Equal(namespace.Name, obl.Namespace.Name) - s.Equal("https://"+namespace.Name, obl.Namespace.Fqn) - for _, value := range obl.Values { - s.Contains(value.GetValue(), oblValPrefix) - } + s.Equal(namespaceFQN, obl.Namespace.Fqn) } else { s.Equal(otherNamespace.ID, obl.Namespace.Id) s.Equal(otherNamespace.Name, obl.Namespace.Name) - s.Equal("https://"+otherNamespace.Name, obl.Namespace.Fqn) + s.Equal(otherNamespaceFQN, obl.Namespace.Fqn) s.Contains(obl.Name, "other-namespace") - for _, value := range obl.Values { - s.Contains(value.GetValue(), oblValPrefix) - } } } s.Equal(numObls, found) - // List obligations by namespace ID + // Test 2: List obligations by namespace ID oblList, _, err = s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ NamespaceIdentifier: &obligations.ListObligationsRequest_Id{ Id: namespace.ID, @@ -289,16 +298,16 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { s.Contains(obl.Name, oblName) s.Equal(namespace.ID, obl.Namespace.Id) s.Equal(namespace.Name, obl.Namespace.Name) - s.Equal("https://"+namespace.Name, obl.Namespace.Fqn) + s.Equal(namespaceFQN, obl.Namespace.Fqn) for _, value := range obl.Values { s.Contains(value.GetValue(), oblValPrefix) } } - // List obligations by namespace FQN + // Test 3: List obligations by namespace FQN oblList, _, err = s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ NamespaceIdentifier: &obligations.ListObligationsRequest_Fqn{ - Fqn: "https://" + namespace.Name, + Fqn: namespaceFQN, }, }) s.Require().NoError(err) @@ -308,13 +317,13 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { s.Contains(obl.Name, oblName) s.Equal(namespace.ID, obl.Namespace.Id) s.Equal(namespace.Name, obl.Namespace.Name) - s.Equal("https://"+namespace.Name, obl.Namespace.Fqn) + s.Equal(namespaceFQN, obl.Namespace.Fqn) for _, value := range obl.Values { s.Contains(value.GetValue(), oblValPrefix) } } - // Attempt to list obligations with an invalid namespace FQN + // Test 4: List obligations with invalid namespace FQN (should return empty) oblList, _, err = s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ NamespaceIdentifier: &obligations.ListObligationsRequest_Fqn{ Fqn: invalidFQN, @@ -322,36 +331,13 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { }) s.Require().NoError(err) s.NotNil(oblList) - s.Equal(len(oblList), 0) - - // Delete obligations after tests are done - // Delete obligations from first namespace - firstNamespaceObls, _, err := s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ - NamespaceIdentifier: &obligations.ListObligationsRequest_Id{ - Id: namespace.ID, - }, - }) - s.Require().NoError(err) - for _, obl := range firstNamespaceObls { - _, err = s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ - Identifier: &obligations.DeleteObligationRequest_Id{ - Id: obl.Id, - }, - }) - s.Require().NoError(err) - } + s.Empty(oblList) - // Delete obligations from other namespace - otherNamespaceObls, _, err := s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ - NamespaceIdentifier: &obligations.ListObligationsRequest_Id{ - Id: otherNamespace.ID, - }, - }) - s.Require().NoError(err) - for _, obl := range otherNamespaceObls { + // Cleanup: Delete all created obligations + for _, oblID := range createdOblIDs { _, err = s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ Identifier: &obligations.DeleteObligationRequest_Id{ - Id: obl.Id, + Id: oblID, }, }) s.Require().NoError(err) From e30c46e7fcfb2d9e9e86d51decd518bae24c3f11 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 5 Aug 2025 17:51:12 -0400 Subject: [PATCH 048/137] test consolidation refactor --- service/integration/obligations_test.go | 258 +++++++++--------------- 1 file changed, 94 insertions(+), 164 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index e279a7feac..2524fa5839 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/opentdf/platform/protocol/go/common" + "github.com/opentdf/platform/protocol/go/policy" "github.com/opentdf/platform/protocol/go/policy/obligations" "github.com/opentdf/platform/service/internal/fixtures" "github.com/opentdf/platform/service/pkg/db" @@ -46,70 +47,97 @@ func TestObligationsSuite(t *testing.T) { /// Obligation Definitions /// -const oblName = "example-obligation" -const oblValPrefix = "obligation_value_" -const invalidFQN = "invalid-fqn" +const ( + oblName = "example-obligation" + oblValPrefix = "obligation_value_" + invalidFQN = "invalid-fqn" + nsExampleCom = "example.com" + nsExampleNet = "example.net" + nsExampleOrg = "example.org" + httpsPrefix = "https://" +) var oblVals = []string{ oblValPrefix + "1", oblValPrefix + "2", } -// Create +// Helper functions for common operations -func (s *ObligationsSuite) Test_CreateObligation_Succeeds() { - // By namespace ID and with values - namespace := s.f.GetNamespaceKey("example.com") - namespaceID := namespace.ID - namespaceFQN := "https://" + namespace.Name - obl, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ - NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ - Id: namespaceID, - }, - Name: oblName, - Values: oblVals, - }) - s.Require().NoError(err) - s.NotNil(obl) - s.Equal(oblName, obl.Name) +func (s *ObligationsSuite) getNamespaceData(nsName string) (id, fqn string, fixture fixtures.FixtureDataNamespace) { + fixture = s.f.GetNamespaceKey(nsName) + return fixture.ID, httpsPrefix + fixture.Name, fixture +} + +func (s *ObligationsSuite) assertObligationBasics(obl *policy.Obligation, name, namespaceID, namespaceName, namespaceFQN string) { + s.Require().NotNil(obl) + s.Equal(name, obl.Name) s.Equal(namespaceID, obl.Namespace.Id) - s.Equal(namespace.Name, obl.Namespace.Name) + s.Equal(namespaceName, obl.Namespace.Name) s.Equal(namespaceFQN, obl.Namespace.Fqn) +} + +func (s *ObligationsSuite) assertObligationValues(obl *policy.Obligation) { for _, value := range obl.Values { s.Contains(value.GetValue(), oblValPrefix) } +} - // Delete the obligation - _, err = s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ - Identifier: &obligations.DeleteObligationRequest_Id{ - Id: obl.GetId(), +func (s *ObligationsSuite) createObligation(namespaceID, name string, values []string) *policy.Obligation { + obl, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ + NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ + Id: namespaceID, }, + Name: name, + Values: values, }) s.Require().NoError(err) + return obl +} - // By namespace FQN - obl, err = s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ +func (s *ObligationsSuite) createObligationByFQN(namespaceFQN, name string, values []string) *policy.Obligation { + obl, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ NamespaceIdentifier: &obligations.CreateObligationRequest_Fqn{ Fqn: namespaceFQN, }, - Name: oblName, + Name: name, + Values: values, }) s.Require().NoError(err) - s.NotNil(obl) - s.Equal(oblName, obl.Name) - s.Equal(namespaceID, obl.Namespace.Id) - s.Equal(namespace.Name, obl.Namespace.Name) - s.Equal(namespaceFQN, obl.Namespace.Fqn) + return obl +} - // Delete the obligation - _, err = s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ +func (s *ObligationsSuite) deleteObligation(oblID string) { + _, err := s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ Identifier: &obligations.DeleteObligationRequest_Id{ - Id: obl.GetId(), + Id: oblID, }, }) s.Require().NoError(err) } +func (s *ObligationsSuite) deleteObligations(oblIDs []string) { + for _, oblID := range oblIDs { + s.deleteObligation(oblID) + } +} + +// Create + +func (s *ObligationsSuite) Test_CreateObligation_Succeeds() { + // By namespace ID and with values + namespaceID, namespaceFQN, namespace := s.getNamespaceData(nsExampleCom) + obl := s.createObligation(namespaceID, oblName, oblVals) + s.assertObligationBasics(obl, oblName, namespaceID, namespace.Name, namespaceFQN) + s.assertObligationValues(obl) + s.deleteObligation(obl.GetId()) + + // By namespace FQN + obl = s.createObligationByFQN(namespaceFQN, oblName, nil) + s.assertObligationBasics(obl, oblName, namespaceID, namespace.Name, namespaceFQN) + s.deleteObligation(obl.GetId()) +} + func (s *ObligationsSuite) Test_CreateObligation_Fails() { // Invalid namespace ID obl, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ @@ -122,16 +150,8 @@ func (s *ObligationsSuite) Test_CreateObligation_Fails() { s.Nil(obl) // Non-unique namespace_id/name pair - namespace := s.f.GetNamespaceKey("example.org") - namespaceID := namespace.ID - obl, err = s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ - NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ - Id: namespaceID, - }, - Name: oblName, - }) - s.Require().NoError(err) - s.NotNil(obl) + namespaceID, _, _ := s.getNamespaceData(nsExampleOrg) + obl = s.createObligation(namespaceID, oblName, nil) pending, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ @@ -142,25 +162,14 @@ func (s *ObligationsSuite) Test_CreateObligation_Fails() { s.Require().ErrorIs(err, db.ErrUniqueConstraintViolation) s.Nil(pending) - // Delete obligation after tests are done - _, err = s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ - Identifier: &obligations.DeleteObligationRequest_Id{ - Id: obl.GetId(), - }, - }) - s.Require().NoError(err) + s.deleteObligation(obl.GetId()) } // Get func (s *ObligationsSuite) Test_GetObligation_Succeeds() { - createdObl, _ := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ - NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ - Id: s.f.GetNamespaceKey("example.com").ID, - }, - Name: oblName, - Values: oblVals, - }) + namespaceID, namespaceFQN, namespace := s.getNamespaceData(nsExampleCom) + createdObl := s.createObligation(namespaceID, oblName, oblVals) // Valid ID obl, err := s.db.PolicyClient.GetObligation(s.ctx, &obligations.GetObligationRequest{ @@ -168,37 +177,20 @@ func (s *ObligationsSuite) Test_GetObligation_Succeeds() { Id: createdObl.GetId(), }, }) - s.Require().NoError(err) - s.NotNil(obl) - s.Equal(oblName, obl.Name) - s.Equal(createdObl.GetNamespace().GetId(), obl.GetNamespace().GetId()) - s.Equal(createdObl.GetNamespace().GetName(), obl.GetNamespace().GetName()) - s.Equal(createdObl.GetNamespace().GetFqn(), obl.GetNamespace().GetFqn()) - for _, value := range obl.Values { - s.Contains(value.GetValue(), oblValPrefix) - } + s.assertObligationBasics(obl, oblName, namespaceID, namespace.Name, namespaceFQN) + s.assertObligationValues(obl) // Valid FQN obl, err = s.db.PolicyClient.GetObligation(s.ctx, &obligations.GetObligationRequest{ Identifier: &obligations.GetObligationRequest_Fqn{ - Fqn: createdObl.GetNamespace().GetFqn() + "/obl/" + oblName, + Fqn: namespaceFQN + "/obl/" + oblName, }, }) s.Require().NoError(err) - s.NotNil(obl) - s.Equal(oblName, obl.Name) - s.Equal(createdObl.GetNamespace().GetId(), obl.GetNamespace().GetId()) - s.Equal(createdObl.GetNamespace().GetName(), obl.GetNamespace().GetName()) - s.Equal(createdObl.GetNamespace().GetFqn(), obl.GetNamespace().GetFqn()) + s.assertObligationBasics(obl, oblName, namespaceID, namespace.Name, namespaceFQN) - // Delete obligation after tests are done - _, err = s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ - Identifier: &obligations.DeleteObligationRequest_Id{ - Id: createdObl.GetId(), - }, - }) - s.Require().NoError(err) + s.deleteObligation(createdObl.GetId()) } func (s *ObligationsSuite) Test_GetObligation_Fails() { @@ -226,36 +218,20 @@ func (s *ObligationsSuite) Test_GetObligation_Fails() { func (s *ObligationsSuite) Test_ListObligations_Succeeds() { // Setup test data numObls := 3 - namespace := s.f.GetNamespaceKey("example.com") - otherNamespace := s.f.GetNamespaceKey("example.net") - namespaceFQN := "https://" + namespace.Name - otherNamespaceFQN := "https://" + otherNamespace.Name + namespaceID, namespaceFQN, namespace := s.getNamespaceData(nsExampleCom) + otherNamespaceID, otherNamespaceFQN, otherNamespace := s.getNamespaceData(nsExampleNet) // Track created obligations for cleanup var createdOblIDs []string // Create multiple obligations in first namespace for i := 0; i < numObls; i++ { - obl, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ - NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ - Id: namespace.ID, - }, - Name: oblName + "-" + strconv.Itoa(i), - Values: oblVals, - }) - s.Require().NoError(err) + obl := s.createObligation(namespaceID, oblName+"-"+strconv.Itoa(i), oblVals) createdOblIDs = append(createdOblIDs, obl.GetId()) } // Create one obligation in different namespace - otherObl, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ - NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ - Id: otherNamespace.ID, - }, - Name: oblName + "-other-namespace", - Values: oblVals, - }) - s.Require().NoError(err) + otherObl := s.createObligation(otherNamespaceID, oblName+"-other-namespace", oblVals) createdOblIDs = append(createdOblIDs, otherObl.GetId()) // Test 1: List all obligations @@ -267,19 +243,13 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { found := 0 for _, obl := range oblList { s.Contains(obl.Name, oblName) - for _, value := range obl.Values { - s.Contains(value.GetValue(), oblValPrefix) - } + s.assertObligationValues(obl) - if obl.Namespace.Id == namespace.ID { + if obl.Namespace.Id == namespaceID { found++ - s.Equal(namespace.ID, obl.Namespace.Id) - s.Equal(namespace.Name, obl.Namespace.Name) - s.Equal(namespaceFQN, obl.Namespace.Fqn) + s.assertObligationBasics(obl, obl.Name, namespaceID, namespace.Name, namespaceFQN) } else { - s.Equal(otherNamespace.ID, obl.Namespace.Id) - s.Equal(otherNamespace.Name, obl.Namespace.Name) - s.Equal(otherNamespaceFQN, obl.Namespace.Fqn) + s.assertObligationBasics(obl, obl.Name, otherNamespaceID, otherNamespace.Name, otherNamespaceFQN) s.Contains(obl.Name, "other-namespace") } } @@ -288,7 +258,7 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { // Test 2: List obligations by namespace ID oblList, _, err = s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{ NamespaceIdentifier: &obligations.ListObligationsRequest_Id{ - Id: namespace.ID, + Id: namespaceID, }, }) s.Require().NoError(err) @@ -296,12 +266,8 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { s.Len(oblList, numObls) for _, obl := range oblList { s.Contains(obl.Name, oblName) - s.Equal(namespace.ID, obl.Namespace.Id) - s.Equal(namespace.Name, obl.Namespace.Name) - s.Equal(namespaceFQN, obl.Namespace.Fqn) - for _, value := range obl.Values { - s.Contains(value.GetValue(), oblValPrefix) - } + s.assertObligationBasics(obl, obl.Name, namespaceID, namespace.Name, namespaceFQN) + s.assertObligationValues(obl) } // Test 3: List obligations by namespace FQN @@ -315,12 +281,8 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { s.Len(oblList, numObls) for _, obl := range oblList { s.Contains(obl.Name, oblName) - s.Equal(namespace.ID, obl.Namespace.Id) - s.Equal(namespace.Name, obl.Namespace.Name) - s.Equal(namespaceFQN, obl.Namespace.Fqn) - for _, value := range obl.Values { - s.Contains(value.GetValue(), oblValPrefix) - } + s.assertObligationBasics(obl, obl.Name, namespaceID, namespace.Name, namespaceFQN) + s.assertObligationValues(obl) } // Test 4: List obligations with invalid namespace FQN (should return empty) @@ -334,14 +296,7 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { s.Empty(oblList) // Cleanup: Delete all created obligations - for _, oblID := range createdOblIDs { - _, err = s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ - Identifier: &obligations.DeleteObligationRequest_Id{ - Id: oblID, - }, - }) - s.Require().NoError(err) - } + s.deleteObligations(createdOblIDs) } func (s *ObligationsSuite) Test_ListObligations_Fails() { @@ -358,14 +313,8 @@ func (s *ObligationsSuite) Test_ListObligations_Fails() { // Update func (s *ObligationsSuite) Test_UpdateObligation_Succeeds() { - // Create an obligation to update - createdObl, _ := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ - NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ - Id: s.f.GetNamespaceKey("example.com").ID, - }, - Name: oblName, - Values: oblVals, - }) + namespaceID, namespaceFQN, namespace := s.getNamespaceData(nsExampleCom) + createdObl := s.createObligation(namespaceID, oblName, oblVals) // Update the obligation newName := oblName + "-updated" @@ -379,24 +328,11 @@ func (s *ObligationsSuite) Test_UpdateObligation_Succeeds() { MetadataUpdateBehavior: 1, }) s.Require().NoError(err) - s.NotNil(updatedObl) - s.Equal(newName, updatedObl.Name) + s.assertObligationBasics(updatedObl, newName, namespaceID, namespace.Name, namespaceFQN) s.Equal(newMetadata.GetLabels(), updatedObl.Metadata.GetLabels()) - s.Equal(createdObl.GetNamespace().GetId(), updatedObl.GetNamespace().GetId()) - s.Equal(createdObl.GetNamespace().GetName(), updatedObl.GetNamespace().GetName()) - s.Equal(createdObl.GetNamespace().GetFqn(), updatedObl.GetNamespace().GetFqn()) - - for _, value := range updatedObl.Values { - s.Contains(value.GetValue(), oblValPrefix) - } + s.assertObligationValues(updatedObl) - // Delete the obligation after tests are done - _, err = s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ - Identifier: &obligations.DeleteObligationRequest_Id{ - Id: updatedObl.GetId(), - }, - }) - s.Require().NoError(err) + s.deleteObligation(updatedObl.GetId()) } func (s *ObligationsSuite) Test_UpdateObligation_Fails() { @@ -411,14 +347,8 @@ func (s *ObligationsSuite) Test_UpdateObligation_Fails() { // Delete func (s *ObligationsSuite) Test_DeleteObligation_Succeeds() { - // Create an obligation to delete - createdObl, _ := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ - NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ - Id: s.f.GetNamespaceKey("example.com").ID, - }, - Name: oblName, - Values: oblVals, - }) + namespaceID, _, _ := s.getNamespaceData(nsExampleCom) + createdObl := s.createObligation(namespaceID, oblName, oblVals) // Get the obligation to ensure it exists obl, err := s.db.PolicyClient.GetObligation(s.ctx, &obligations.GetObligationRequest{ From 11ecfb3bbd6153c447d8eab11070609e49369e50 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 5 Aug 2025 23:09:10 -0400 Subject: [PATCH 049/137] lint tests --- service/integration/obligations_test.go | 142 ++++++++++++------------ 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 2524fa5839..cd4faee7a6 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -62,66 +62,6 @@ var oblVals = []string{ oblValPrefix + "2", } -// Helper functions for common operations - -func (s *ObligationsSuite) getNamespaceData(nsName string) (id, fqn string, fixture fixtures.FixtureDataNamespace) { - fixture = s.f.GetNamespaceKey(nsName) - return fixture.ID, httpsPrefix + fixture.Name, fixture -} - -func (s *ObligationsSuite) assertObligationBasics(obl *policy.Obligation, name, namespaceID, namespaceName, namespaceFQN string) { - s.Require().NotNil(obl) - s.Equal(name, obl.Name) - s.Equal(namespaceID, obl.Namespace.Id) - s.Equal(namespaceName, obl.Namespace.Name) - s.Equal(namespaceFQN, obl.Namespace.Fqn) -} - -func (s *ObligationsSuite) assertObligationValues(obl *policy.Obligation) { - for _, value := range obl.Values { - s.Contains(value.GetValue(), oblValPrefix) - } -} - -func (s *ObligationsSuite) createObligation(namespaceID, name string, values []string) *policy.Obligation { - obl, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ - NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ - Id: namespaceID, - }, - Name: name, - Values: values, - }) - s.Require().NoError(err) - return obl -} - -func (s *ObligationsSuite) createObligationByFQN(namespaceFQN, name string, values []string) *policy.Obligation { - obl, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ - NamespaceIdentifier: &obligations.CreateObligationRequest_Fqn{ - Fqn: namespaceFQN, - }, - Name: name, - Values: values, - }) - s.Require().NoError(err) - return obl -} - -func (s *ObligationsSuite) deleteObligation(oblID string) { - _, err := s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ - Identifier: &obligations.DeleteObligationRequest_Id{ - Id: oblID, - }, - }) - s.Require().NoError(err) -} - -func (s *ObligationsSuite) deleteObligations(oblIDs []string) { - for _, oblID := range oblIDs { - s.deleteObligation(oblID) - } -} - // Create func (s *ObligationsSuite) Test_CreateObligation_Succeeds() { @@ -238,19 +178,19 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { oblList, _, err := s.db.PolicyClient.ListObligations(s.ctx, &obligations.ListObligationsRequest{}) s.Require().NoError(err) s.NotNil(oblList) - s.Equal(numObls+1, len(oblList)) + s.Len(oblList, numObls+1) found := 0 for _, obl := range oblList { - s.Contains(obl.Name, oblName) + s.Contains(obl.GetName(), oblName) s.assertObligationValues(obl) - if obl.Namespace.Id == namespaceID { + if obl.GetNamespace().GetId() == namespaceID { found++ - s.assertObligationBasics(obl, obl.Name, namespaceID, namespace.Name, namespaceFQN) + s.assertObligationBasics(obl, obl.GetName(), namespaceID, namespace.Name, namespaceFQN) } else { - s.assertObligationBasics(obl, obl.Name, otherNamespaceID, otherNamespace.Name, otherNamespaceFQN) - s.Contains(obl.Name, "other-namespace") + s.assertObligationBasics(obl, obl.GetName(), otherNamespaceID, otherNamespace.Name, otherNamespaceFQN) + s.Contains(obl.GetName(), "other-namespace") } } s.Equal(numObls, found) @@ -265,8 +205,8 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { s.NotNil(oblList) s.Len(oblList, numObls) for _, obl := range oblList { - s.Contains(obl.Name, oblName) - s.assertObligationBasics(obl, obl.Name, namespaceID, namespace.Name, namespaceFQN) + s.Contains(obl.GetName(), oblName) + s.assertObligationBasics(obl, obl.GetName(), namespaceID, namespace.Name, namespaceFQN) s.assertObligationValues(obl) } @@ -280,8 +220,8 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { s.NotNil(oblList) s.Len(oblList, numObls) for _, obl := range oblList { - s.Contains(obl.Name, oblName) - s.assertObligationBasics(obl, obl.Name, namespaceID, namespace.Name, namespaceFQN) + s.Contains(obl.GetName(), oblName) + s.assertObligationBasics(obl, obl.GetName(), namespaceID, namespace.Name, namespaceFQN) s.assertObligationValues(obl) } @@ -329,7 +269,7 @@ func (s *ObligationsSuite) Test_UpdateObligation_Succeeds() { }) s.Require().NoError(err) s.assertObligationBasics(updatedObl, newName, namespaceID, namespace.Name, namespaceFQN) - s.Equal(newMetadata.GetLabels(), updatedObl.Metadata.GetLabels()) + s.Equal(newMetadata.GetLabels(), updatedObl.GetMetadata().GetLabels()) s.assertObligationValues(updatedObl) s.deleteObligation(updatedObl.GetId()) @@ -389,3 +329,63 @@ func (s *ObligationsSuite) Test_DeleteObligation_Fails() { s.Require().ErrorIs(err, db.ErrUUIDInvalid) s.Nil(obl) } + +// Helper functions for common operations + +func (s *ObligationsSuite) getNamespaceData(nsName string) (string, string, fixtures.FixtureDataNamespace) { + fixture := s.f.GetNamespaceKey(nsName) + return fixture.ID, httpsPrefix + fixture.Name, fixture +} + +func (s *ObligationsSuite) assertObligationBasics(obl *policy.Obligation, name, namespaceID, namespaceName, namespaceFQN string) { + s.Require().NotNil(obl) + s.Equal(name, obl.GetName()) + s.Equal(namespaceID, obl.GetNamespace().GetId()) + s.Equal(namespaceName, obl.GetNamespace().GetName()) + s.Equal(namespaceFQN, obl.GetNamespace().GetFqn()) +} + +func (s *ObligationsSuite) assertObligationValues(obl *policy.Obligation) { + for _, value := range obl.GetValues() { + s.Contains(value.GetValue(), oblValPrefix) + } +} + +func (s *ObligationsSuite) createObligation(namespaceID, name string, values []string) *policy.Obligation { + obl, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ + NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ + Id: namespaceID, + }, + Name: name, + Values: values, + }) + s.Require().NoError(err) + return obl +} + +func (s *ObligationsSuite) createObligationByFQN(namespaceFQN, name string, values []string) *policy.Obligation { + obl, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ + NamespaceIdentifier: &obligations.CreateObligationRequest_Fqn{ + Fqn: namespaceFQN, + }, + Name: name, + Values: values, + }) + s.Require().NoError(err) + return obl +} + +func (s *ObligationsSuite) deleteObligation(oblID string) { + _, err := s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ + Identifier: &obligations.DeleteObligationRequest_Id{ + Id: oblID, + }, + }) + s.Require().NoError(err) +} + +func (s *ObligationsSuite) deleteObligations(oblIDs []string) { + for _, oblID := range oblIDs { + s.deleteObligation(oblID) + } +} From b785d074a5b2ea74791c5d18c3f2798e842a7965 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 5 Aug 2025 23:11:32 -0400 Subject: [PATCH 050/137] gofumpt --- service/policy/db/obligations.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index df9a6fef5d..fb08dbb607 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -62,7 +62,6 @@ func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.Cre Values: values, } row, err := c.queries.createObligation(ctx, queryParams) - if err != nil { return nil, db.WrapIfKnownInvalidQueryErr(err) } @@ -106,7 +105,6 @@ func (c PolicyDBClient) GetObligation(ctx context.Context, r *obligations.GetObl } row, err := c.queries.getObligation(ctx, queryParams) - if err != nil { return nil, db.WrapIfKnownInvalidQueryErr(err) } From ed51bd7ee00af26b7fbdeee1bdb80d1ff61086d0 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 11 Aug 2025 14:11:39 -0400 Subject: [PATCH 051/137] update protocol/go --- service/go.mod | 2 +- service/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/service/go.mod b/service/go.mod index ee0513ca8d..dca6844d4a 100644 --- a/service/go.mod +++ b/service/go.mod @@ -33,7 +33,7 @@ require ( github.com/opentdf/platform/lib/flattening v0.1.3 github.com/opentdf/platform/lib/identifier v0.0.2 github.com/opentdf/platform/lib/ocrypto v0.3.0 - github.com/opentdf/platform/protocol/go v0.6.2 + github.com/opentdf/platform/protocol/go v0.7.0 github.com/opentdf/platform/sdk v0.5.0 github.com/pressly/goose/v3 v3.24.3 github.com/spf13/cobra v1.9.1 diff --git a/service/go.sum b/service/go.sum index 11663b1289..996d61c918 100644 --- a/service/go.sum +++ b/service/go.sum @@ -251,8 +251,8 @@ github.com/opentdf/platform/lib/identifier v0.0.2 h1:h3zR+IZ/4/X5UOYUp/aTA0OcX1Q github.com/opentdf/platform/lib/identifier v0.0.2/go.mod h1:/tHnLlSVOq3qmbIYSvKrtuZchQfagenv4wG5twl4oRs= github.com/opentdf/platform/lib/ocrypto v0.3.0 h1:/nHlIj6kqZ9XT9M45vAbzoMV8USeCj7GRuhFR6JH+RA= github.com/opentdf/platform/lib/ocrypto v0.3.0/go.mod h1:VuVHTye/smLiRZ5Ls4sZ14R+PtN9Egwj8D1Hv5X9iP0= -github.com/opentdf/platform/protocol/go v0.6.2 h1:seLTEP4xBRF2BG1vbuWzQqNo58g3wtkzCV+Z4ExRXnM= -github.com/opentdf/platform/protocol/go v0.6.2/go.mod h1:FwoNd0HJaxGCZf74de/yFpVP4HEjkUMoF6Br79W0TBk= +github.com/opentdf/platform/protocol/go v0.7.0 h1:N04m0sgGR7inFVUf7HNjXAIP41XAJ85lO51pISv9nOE= +github.com/opentdf/platform/protocol/go v0.7.0/go.mod h1:GRycoDGDxaz91sOvGZFWVEKJLluZFg2wM3NJmhucDHo= github.com/opentdf/platform/sdk v0.5.0 h1:K4a8kWUtt5EJktFC55egicsp9537SI1+bmJPMIsYrKg= github.com/opentdf/platform/sdk v0.5.0/go.mod h1:Qxwq9zjUVkBZs3xZUOPls5gdX4d0y2nsoZvJ93hyWAU= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= From 156ad74b4fa78c09952c8f94e4cfa8073eed664b Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 13 Aug 2025 11:02:21 -0400 Subject: [PATCH 052/137] defer and move unmarshal fx --- service/integration/obligations_test.go | 10 +++---- service/policy/db/obligations.go | 38 ++----------------------- service/policy/db/utils.go | 30 +++++++++++++++++++ 3 files changed, 38 insertions(+), 40 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index cd4faee7a6..743fe4d6d1 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -75,7 +75,7 @@ func (s *ObligationsSuite) Test_CreateObligation_Succeeds() { // By namespace FQN obl = s.createObligationByFQN(namespaceFQN, oblName, nil) s.assertObligationBasics(obl, oblName, namespaceID, namespace.Name, namespaceFQN) - s.deleteObligation(obl.GetId()) + defer s.deleteObligation(obl.GetId()) } func (s *ObligationsSuite) Test_CreateObligation_Fails() { @@ -102,7 +102,7 @@ func (s *ObligationsSuite) Test_CreateObligation_Fails() { s.Require().ErrorIs(err, db.ErrUniqueConstraintViolation) s.Nil(pending) - s.deleteObligation(obl.GetId()) + defer s.deleteObligation(obl.GetId()) } // Get @@ -130,7 +130,7 @@ func (s *ObligationsSuite) Test_GetObligation_Succeeds() { s.Require().NoError(err) s.assertObligationBasics(obl, oblName, namespaceID, namespace.Name, namespaceFQN) - s.deleteObligation(createdObl.GetId()) + defer s.deleteObligation(createdObl.GetId()) } func (s *ObligationsSuite) Test_GetObligation_Fails() { @@ -236,7 +236,7 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { s.Empty(oblList) // Cleanup: Delete all created obligations - s.deleteObligations(createdOblIDs) + defer s.deleteObligations(createdOblIDs) } func (s *ObligationsSuite) Test_ListObligations_Fails() { @@ -272,7 +272,7 @@ func (s *ObligationsSuite) Test_UpdateObligation_Succeeds() { s.Equal(newMetadata.GetLabels(), updatedObl.GetMetadata().GetLabels()) s.assertObligationValues(updatedObl) - s.deleteObligation(updatedObl.GetId()) + defer s.deleteObligation(updatedObl.GetId()) } func (s *ObligationsSuite) Test_UpdateObligation_Fails() { diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index fb08dbb607..17a091dd36 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -2,7 +2,6 @@ package db import ( "context" - "encoding/json" "fmt" "strings" @@ -10,39 +9,8 @@ import ( "github.com/opentdf/platform/protocol/go/policy" "github.com/opentdf/platform/protocol/go/policy/obligations" "github.com/opentdf/platform/service/pkg/db" - "google.golang.org/protobuf/encoding/protojson" ) -func unmarshalObligationValuesProto(valuesJSON []byte, values []*policy.ObligationValue) error { - if valuesJSON == nil { - return nil - } - - raw := []json.RawMessage{} - if err := json.Unmarshal(valuesJSON, &raw); err != nil { - return fmt.Errorf("failed to unmarshal values array [%s]: %w", string(valuesJSON), err) - } - - for _, r := range raw { - v := &policy.ObligationValue{} - if err := protojson.Unmarshal(r, v); err != nil { - return fmt.Errorf("failed to unmarshal value [%s]: %w", string(r), err) - } - values = append(values, v) - } - - return nil -} - -func unmarshalNamespace(namespaceJSON []byte, namespace *policy.Namespace) error { - if namespaceJSON != nil { - if err := protojson.Unmarshal(namespaceJSON, namespace); err != nil { - return fmt.Errorf("failed to unmarshal namespaceJSON [%s]: %w", string(namespaceJSON), err) - } - } - return nil -} - /// /// Obligation Definitions /// @@ -66,7 +34,7 @@ func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.Cre return nil, db.WrapIfKnownInvalidQueryErr(err) } oblVals := make([]*policy.ObligationValue, 0, len(values)) - if err := unmarshalObligationValuesProto(row.Values, oblVals); err != nil { + if err := unmarshalObligationValues(row.Values, oblVals); err != nil { return nil, fmt.Errorf("failed to unmarshal obligation values: %w", err) } @@ -110,7 +78,7 @@ func (c PolicyDBClient) GetObligation(ctx context.Context, r *obligations.GetObl } oblVals := make([]*policy.ObligationValue, 0) - if err := unmarshalObligationValuesProto(row.Values, oblVals); err != nil { + if err := unmarshalObligationValues(row.Values, oblVals); err != nil { return nil, fmt.Errorf("failed to unmarshal obligation values: %w", err) } @@ -164,7 +132,7 @@ func (c PolicyDBClient) ListObligations(ctx context.Context, r *obligations.List } values := []*policy.ObligationValue{} - if err = unmarshalObligationValuesProto(r.Values, values); err != nil { + if err = unmarshalObligationValues(r.Values, values); err != nil { return nil, nil, err } diff --git a/service/policy/db/utils.go b/service/policy/db/utils.go index 8736738909..2ee503cfb7 100644 --- a/service/policy/db/utils.go +++ b/service/policy/db/utils.go @@ -125,6 +125,36 @@ func unmarshalPrivatePublicKeyContext(pubCtx, privCtx []byte) (*policy.PublicKey return pubKey, privKey, nil } +func unmarshalObligationValues(valuesJSON []byte, values []*policy.ObligationValue) error { + if valuesJSON == nil { + return nil + } + + raw := []json.RawMessage{} + if err := json.Unmarshal(valuesJSON, &raw); err != nil { + return fmt.Errorf("failed to unmarshal values array [%s]: %w", string(valuesJSON), err) + } + + for _, r := range raw { + v := &policy.ObligationValue{} + if err := protojson.Unmarshal(r, v); err != nil { + return fmt.Errorf("failed to unmarshal value [%s]: %w", string(r), err) + } + values = append(values, v) + } + + return nil +} + +func unmarshalNamespace(namespaceJSON []byte, namespace *policy.Namespace) error { + if namespaceJSON != nil { + if err := protojson.Unmarshal(namespaceJSON, namespace); err != nil { + return fmt.Errorf("failed to unmarshal namespaceJSON [%s]: %w", string(namespaceJSON), err) + } + } + return nil +} + func pgtypeUUID(s string) pgtype.UUID { u, err := uuid.Parse(s) From 869dfedb12fe59796ef31924c307bd1e16a45779 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 13 Aug 2025 11:05:10 -0400 Subject: [PATCH 053/137] refactor defer --- service/integration/obligations_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 743fe4d6d1..7bd17a593a 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -75,7 +75,7 @@ func (s *ObligationsSuite) Test_CreateObligation_Succeeds() { // By namespace FQN obl = s.createObligationByFQN(namespaceFQN, oblName, nil) s.assertObligationBasics(obl, oblName, namespaceID, namespace.Name, namespaceFQN) - defer s.deleteObligation(obl.GetId()) + s.deleteObligations([]string{obl.GetId()}) } func (s *ObligationsSuite) Test_CreateObligation_Fails() { @@ -102,7 +102,7 @@ func (s *ObligationsSuite) Test_CreateObligation_Fails() { s.Require().ErrorIs(err, db.ErrUniqueConstraintViolation) s.Nil(pending) - defer s.deleteObligation(obl.GetId()) + s.deleteObligations([]string{obl.GetId()}) } // Get @@ -130,7 +130,7 @@ func (s *ObligationsSuite) Test_GetObligation_Succeeds() { s.Require().NoError(err) s.assertObligationBasics(obl, oblName, namespaceID, namespace.Name, namespaceFQN) - defer s.deleteObligation(createdObl.GetId()) + s.deleteObligations([]string{createdObl.GetId()}) } func (s *ObligationsSuite) Test_GetObligation_Fails() { @@ -236,7 +236,7 @@ func (s *ObligationsSuite) Test_ListObligations_Succeeds() { s.Empty(oblList) // Cleanup: Delete all created obligations - defer s.deleteObligations(createdOblIDs) + s.deleteObligations(createdOblIDs) } func (s *ObligationsSuite) Test_ListObligations_Fails() { @@ -272,7 +272,7 @@ func (s *ObligationsSuite) Test_UpdateObligation_Succeeds() { s.Equal(newMetadata.GetLabels(), updatedObl.GetMetadata().GetLabels()) s.assertObligationValues(updatedObl) - defer s.deleteObligation(updatedObl.GetId()) + s.deleteObligations([]string{updatedObl.GetId()}) } func (s *ObligationsSuite) Test_UpdateObligation_Fails() { @@ -386,6 +386,6 @@ func (s *ObligationsSuite) deleteObligation(oblID string) { func (s *ObligationsSuite) deleteObligations(oblIDs []string) { for _, oblID := range oblIDs { - s.deleteObligation(oblID) + defer s.deleteObligation(oblID) } } From d2331e054e9dfdf9269642376d231c9a3e4b6cf0 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 13 Aug 2025 11:06:27 -0400 Subject: [PATCH 054/137] remove lowercase --- service/policy/db/obligations.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 17a091dd36..c7606cfc8f 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -163,7 +163,7 @@ func (c PolicyDBClient) ListObligations(ctx context.Context, r *obligations.List func (c PolicyDBClient) UpdateObligation(ctx context.Context, r *obligations.UpdateObligationRequest) (*policy.Obligation, error) { id := r.GetId() - name := strings.ToLower(r.GetName()) + name := r.GetName() obl, err := c.GetObligation(ctx, &obligations.GetObligationRequest{ Identifier: &obligations.GetObligationRequest_Id{ Id: id, From 1799f2c0fede970c57222482069bc98aabac8d52 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 13 Aug 2025 11:24:34 -0400 Subject: [PATCH 055/137] fix params types --- service/policy/db/obligations.sql.go | 14 +++++++------- service/policy/db/queries/obligations.sql | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 4c3e6bafe9..e6e716bb48 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -196,19 +196,19 @@ WHERE -- lookup by obligation id OR by namespace fqn + obligation name ( -- lookup by obligation id - (NULLIF($1, '') IS NOT NULL AND od.id = $1::UUID) + ($1::TEXT != '' AND od.id = $1::UUID) OR -- lookup by namespace fqn + obligation name - (NULLIF($2, '') IS NOT NULL AND NULLIF($3, '') IS NOT NULL + ($2::TEXT != '' AND $3::TEXT != '' AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) ) GROUP BY od.id, n.id, n.name, fqns.fqn ` type getObligationParams struct { - ID interface{} `json:"id"` - NamespaceFqn interface{} `json:"namespace_fqn"` - Name interface{} `json:"name"` + ID string `json:"id"` + NamespaceFqn string `json:"namespace_fqn"` + Name string `json:"name"` } type getObligationRow struct { @@ -245,10 +245,10 @@ type getObligationRow struct { // -- lookup by obligation id OR by namespace fqn + obligation name // ( // -- lookup by obligation id -// (NULLIF($1, '') IS NOT NULL AND od.id = $1::UUID) +// ($1::TEXT != '' AND od.id = $1::UUID) // OR // -- lookup by namespace fqn + obligation name -// (NULLIF($2, '') IS NOT NULL AND NULLIF($3, '') IS NOT NULL +// ($2::TEXT != '' AND $3::TEXT != '' // AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) // ) // GROUP BY od.id, n.id, n.name, fqns.fqn diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 219a510130..ab6f4b4f54 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -81,11 +81,11 @@ WHERE -- lookup by obligation id OR by namespace fqn + obligation name ( -- lookup by obligation id - (NULLIF(@id, '') IS NOT NULL AND od.id = @id::UUID) + (sqlc.arg(id)::TEXT != '' AND od.id = sqlc.arg(id)::UUID) OR -- lookup by namespace fqn + obligation name - (NULLIF(@namespace_fqn, '') IS NOT NULL AND NULLIF(@name, '') IS NOT NULL - AND fqns.fqn = @namespace_fqn::VARCHAR AND od.name = @name::VARCHAR) + (sqlc.arg(namespace_fqn)::TEXT != '' AND sqlc.arg(name)::TEXT != '' + AND fqns.fqn = sqlc.arg(namespace_fqn)::VARCHAR AND od.name = sqlc.arg(name)::VARCHAR) ) GROUP BY od.id, n.id, n.name, fqns.fqn; From 93b722375ddb78a479f50b0f52c669af571be518 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 13 Aug 2025 14:10:21 -0400 Subject: [PATCH 056/137] remove groupby n.name --- service/policy/db/obligations.sql.go | 4 ++-- service/policy/db/queries/obligations.sql | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index e6e716bb48..3cb48ddf0e 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -202,7 +202,7 @@ WHERE ($2::TEXT != '' AND $3::TEXT != '' AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) ) -GROUP BY od.id, n.id, n.name, fqns.fqn +GROUP BY od.id, n.id, fqns.fqn ` type getObligationParams struct { @@ -251,7 +251,7 @@ type getObligationRow struct { // ($2::TEXT != '' AND $3::TEXT != '' // AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) // ) -// GROUP BY od.id, n.id, n.name, fqns.fqn +// GROUP BY od.id, n.id, fqns.fqn func (q *Queries) getObligation(ctx context.Context, arg getObligationParams) (getObligationRow, error) { row := q.db.QueryRow(ctx, getObligation, arg.ID, arg.NamespaceFqn, arg.Name) var i getObligationRow diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index ab6f4b4f54..67db77ba19 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -87,7 +87,7 @@ WHERE (sqlc.arg(namespace_fqn)::TEXT != '' AND sqlc.arg(name)::TEXT != '' AND fqns.fqn = sqlc.arg(namespace_fqn)::VARCHAR AND od.name = sqlc.arg(name)::VARCHAR) ) -GROUP BY od.id, n.id, n.name, fqns.fqn; +GROUP BY od.id, n.id, fqns.fqn; -- name: listObligations :many WITH counted AS ( From 130dacf091aa2cdb481ab9d582c157c867e83a91 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 13 Aug 2025 14:15:38 -0400 Subject: [PATCH 057/137] remove others groupby n.name --- service/policy/db/obligations.sql.go | 8 ++++---- service/policy/db/queries/obligations.sql | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 3cb48ddf0e..740315d80e 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -62,7 +62,7 @@ FROM inserted_obligation io JOIN attribute_namespaces n ON io.namespace_id = n.id LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id -GROUP BY io.id, io.name, io.metadata, n.id, n.name, fqns.fqn +GROUP BY io.id, io.name, io.metadata, n.id, fqns.fqn ` type createObligationParams struct { @@ -136,7 +136,7 @@ type createObligationRow struct { // JOIN attribute_namespaces n ON io.namespace_id = n.id // LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL // LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id -// GROUP BY io.id, io.name, io.metadata, n.id, n.name, fqns.fqn +// GROUP BY io.id, io.name, io.metadata, n.id, fqns.fqn func (q *Queries) createObligation(ctx context.Context, arg createObligationParams) (createObligationRow, error) { row := q.db.QueryRow(ctx, createObligation, arg.NamespaceID, @@ -300,7 +300,7 @@ LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id WHERE (NULLIF($1::TEXT, '') IS NULL OR od.namespace_id = $1::UUID) AND (NULLIF($2::TEXT, '') IS NULL OR fqns.fqn = $2::VARCHAR) -GROUP BY od.id, n.id, n.name, fqns.fqn, counted.total +GROUP BY od.id, n.id, fqns.fqn, counted.total LIMIT $4 OFFSET $3 ` @@ -357,7 +357,7 @@ type listObligationsRow struct { // WHERE // (NULLIF($1::TEXT, '') IS NULL OR od.namespace_id = $1::UUID) AND // (NULLIF($2::TEXT, '') IS NULL OR fqns.fqn = $2::VARCHAR) -// GROUP BY od.id, n.id, n.name, fqns.fqn, counted.total +// GROUP BY od.id, n.id, fqns.fqn, counted.total // LIMIT $4 // OFFSET $3 func (q *Queries) listObligations(ctx context.Context, arg listObligationsParams) ([]listObligationsRow, error) { diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 67db77ba19..61b32f5ea4 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -54,7 +54,7 @@ FROM inserted_obligation io JOIN attribute_namespaces n ON io.namespace_id = n.id LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL LEFT JOIN inserted_values iv ON iv.obligation_definition_id = io.id -GROUP BY io.id, io.name, io.metadata, n.id, n.name, fqns.fqn; +GROUP BY io.id, io.name, io.metadata, n.id, fqns.fqn; -- name: getObligation :one SELECT @@ -124,7 +124,7 @@ LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id WHERE (NULLIF(@namespace_id::TEXT, '') IS NULL OR od.namespace_id = @namespace_id::UUID) AND (NULLIF(@namespace_fqn::TEXT, '') IS NULL OR fqns.fqn = @namespace_fqn::VARCHAR) -GROUP BY od.id, n.id, n.name, fqns.fqn, counted.total +GROUP BY od.id, n.id, fqns.fqn, counted.total LIMIT @limit_ OFFSET @offset_; From 45766ba8e7f4f7d6cc5d88e9df1c91fa14c07dd7 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 13 Aug 2025 14:37:30 -0400 Subject: [PATCH 058/137] sqlc.arg --- service/policy/db/obligations.sql.go | 16 +++++++------- service/policy/db/queries/obligations.sql | 26 +++++++++++------------ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 740315d80e..69075de045 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -272,8 +272,8 @@ WITH counted AS ( LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL WHERE - (NULLIF($1::TEXT, '') IS NULL OR od.namespace_id = $1::UUID) AND - (NULLIF($2::TEXT, '') IS NULL OR fqns.fqn = $2::VARCHAR) + ($1::TEXT = '' OR od.namespace_id = $1::UUID) AND + ($2::TEXT = '' OR fqns.fqn = $2::VARCHAR) ) SELECT od.id, @@ -298,8 +298,8 @@ LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id CROSS JOIN counted LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id WHERE - (NULLIF($1::TEXT, '') IS NULL OR od.namespace_id = $1::UUID) AND - (NULLIF($2::TEXT, '') IS NULL OR fqns.fqn = $2::VARCHAR) + ($1::TEXT = '' OR od.namespace_id = $1::UUID) AND + ($2::TEXT = '' OR fqns.fqn = $2::VARCHAR) GROUP BY od.id, n.id, fqns.fqn, counted.total LIMIT $4 OFFSET $3 @@ -329,8 +329,8 @@ type listObligationsRow struct { // LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id // LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL // WHERE -// (NULLIF($1::TEXT, '') IS NULL OR od.namespace_id = $1::UUID) AND -// (NULLIF($2::TEXT, '') IS NULL OR fqns.fqn = $2::VARCHAR) +// ($1::TEXT = '' OR od.namespace_id = $1::UUID) AND +// ($2::TEXT = '' OR fqns.fqn = $2::VARCHAR) // ) // SELECT // od.id, @@ -355,8 +355,8 @@ type listObligationsRow struct { // CROSS JOIN counted // LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id // WHERE -// (NULLIF($1::TEXT, '') IS NULL OR od.namespace_id = $1::UUID) AND -// (NULLIF($2::TEXT, '') IS NULL OR fqns.fqn = $2::VARCHAR) +// ($1::TEXT = '' OR od.namespace_id = $1::UUID) AND +// ($2::TEXT = '' OR fqns.fqn = $2::VARCHAR) // GROUP BY od.id, n.id, fqns.fqn, counted.total // LIMIT $4 // OFFSET $3 diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 61b32f5ea4..f882eee943 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -7,7 +7,7 @@ WITH inserted_obligation AS ( INSERT INTO obligation_definitions (namespace_id, name, metadata) SELECT CASE - WHEN @namespace_id::TEXT != '' THEN @namespace_id::UUID + WHEN sqlc.arg(namespace_id)::TEXT != '' THEN sqlc.arg(namespace_id)::UUID ELSE fqns.namespace_id END, @name, @@ -15,21 +15,21 @@ WITH inserted_obligation AS ( FROM ( SELECT CASE - WHEN @namespace_id::TEXT != '' THEN @namespace_id::UUID + WHEN sqlc.arg(namespace_id)::TEXT != '' THEN sqlc.arg(namespace_id)::UUID ELSE NULL END as direct_namespace_id ) direct - LEFT JOIN attribute_fqns fqns ON fqns.fqn = @namespace_fqn AND @namespace_id::TEXT = '' + LEFT JOIN attribute_fqns fqns ON fqns.fqn = sqlc.arg(namespace_fqn) AND sqlc.arg(namespace_id)::TEXT = '' WHERE - (@namespace_id::TEXT != '' AND direct.direct_namespace_id IS NOT NULL) OR - (@namespace_fqn::TEXT != '' AND fqns.namespace_id IS NOT NULL) + (sqlc.arg(namespace_id)::TEXT != '' AND direct.direct_namespace_id IS NOT NULL) OR + (sqlc.arg(namespace_fqn)::TEXT != '' AND fqns.namespace_id IS NOT NULL) RETURNING id, namespace_id, name, metadata ), inserted_values AS ( INSERT INTO obligation_values_standard (obligation_definition_id, value) - SELECT io.id, UNNEST(@values::VARCHAR[]) + SELECT io.id, UNNEST(sqlc.arg(values)::VARCHAR[]) FROM inserted_obligation io - WHERE @values::VARCHAR[] IS NOT NULL AND array_length(@values::VARCHAR[], 1) > 0 + WHERE sqlc.arg(values)::VARCHAR[] IS NOT NULL AND array_length(sqlc.arg(values)::VARCHAR[], 1) > 0 RETURNING id, obligation_definition_id, value ) SELECT @@ -96,8 +96,8 @@ WITH counted AS ( LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL WHERE - (NULLIF(@namespace_id::TEXT, '') IS NULL OR od.namespace_id = @namespace_id::UUID) AND - (NULLIF(@namespace_fqn::TEXT, '') IS NULL OR fqns.fqn = @namespace_fqn::VARCHAR) + (sqlc.arg(namespace_id)::TEXT = '' OR od.namespace_id = sqlc.arg(namespace_id)::UUID) AND + (sqlc.arg(namespace_fqn)::TEXT = '' OR fqns.fqn = sqlc.arg(namespace_fqn)::VARCHAR) ) SELECT od.id, @@ -122,8 +122,8 @@ LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id CROSS JOIN counted LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id WHERE - (NULLIF(@namespace_id::TEXT, '') IS NULL OR od.namespace_id = @namespace_id::UUID) AND - (NULLIF(@namespace_fqn::TEXT, '') IS NULL OR fqns.fqn = @namespace_fqn::VARCHAR) + (sqlc.arg(namespace_id)::TEXT = '' OR od.namespace_id = sqlc.arg(namespace_id)::UUID) AND + (sqlc.arg(namespace_fqn)::TEXT = '' OR fqns.fqn = sqlc.arg(namespace_fqn)::VARCHAR) GROUP BY od.id, n.id, fqns.fqn, counted.total LIMIT @limit_ OFFSET @offset_; @@ -131,8 +131,8 @@ OFFSET @offset_; -- name: updateObligation :execrows UPDATE obligation_definitions SET - name = COALESCE(NULLIF(@name::TEXT, ''), name), - metadata = COALESCE(@metadata, metadata) + name = COALESCE(NULLIF(sqlc.arg(name)::TEXT, ''), name), + metadata = COALESCE(sqlc.arg(metadata), metadata) WHERE id = @id; -- name: deleteObligation :execrows From 0f1ca6a6968fe1df4d2bd73d5f19951ac58873f0 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 13 Aug 2025 14:39:46 -0400 Subject: [PATCH 059/137] @ syntax --- service/policy/db/obligations.sql.go | 24 ++++++++--------- service/policy/db/queries/obligations.sql | 32 +++++++++++------------ 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 69075de045..8b178300e6 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -196,10 +196,10 @@ WHERE -- lookup by obligation id OR by namespace fqn + obligation name ( -- lookup by obligation id - ($1::TEXT != '' AND od.id = $1::UUID) + (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) OR -- lookup by namespace fqn + obligation name - ($2::TEXT != '' AND $3::TEXT != '' + (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) ) GROUP BY od.id, n.id, fqns.fqn @@ -245,10 +245,10 @@ type getObligationRow struct { // -- lookup by obligation id OR by namespace fqn + obligation name // ( // -- lookup by obligation id -// ($1::TEXT != '' AND od.id = $1::UUID) +// (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) // OR // -- lookup by namespace fqn + obligation name -// ($2::TEXT != '' AND $3::TEXT != '' +// (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL // AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) // ) // GROUP BY od.id, n.id, fqns.fqn @@ -272,8 +272,8 @@ WITH counted AS ( LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL WHERE - ($1::TEXT = '' OR od.namespace_id = $1::UUID) AND - ($2::TEXT = '' OR fqns.fqn = $2::VARCHAR) + (NULLIF($1::TEXT, '') IS NULL OR od.namespace_id = $1::UUID) AND + (NULLIF($2::TEXT, '') IS NULL OR fqns.fqn = $2::VARCHAR) ) SELECT od.id, @@ -298,8 +298,8 @@ LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id CROSS JOIN counted LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id WHERE - ($1::TEXT = '' OR od.namespace_id = $1::UUID) AND - ($2::TEXT = '' OR fqns.fqn = $2::VARCHAR) + (NULLIF($1::TEXT, '') IS NULL OR od.namespace_id = $1::UUID) AND + (NULLIF($2::TEXT, '') IS NULL OR fqns.fqn = $2::VARCHAR) GROUP BY od.id, n.id, fqns.fqn, counted.total LIMIT $4 OFFSET $3 @@ -329,8 +329,8 @@ type listObligationsRow struct { // LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id // LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL // WHERE -// ($1::TEXT = '' OR od.namespace_id = $1::UUID) AND -// ($2::TEXT = '' OR fqns.fqn = $2::VARCHAR) +// (NULLIF($1::TEXT, '') IS NULL OR od.namespace_id = $1::UUID) AND +// (NULLIF($2::TEXT, '') IS NULL OR fqns.fqn = $2::VARCHAR) // ) // SELECT // od.id, @@ -355,8 +355,8 @@ type listObligationsRow struct { // CROSS JOIN counted // LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id // WHERE -// ($1::TEXT = '' OR od.namespace_id = $1::UUID) AND -// ($2::TEXT = '' OR fqns.fqn = $2::VARCHAR) +// (NULLIF($1::TEXT, '') IS NULL OR od.namespace_id = $1::UUID) AND +// (NULLIF($2::TEXT, '') IS NULL OR fqns.fqn = $2::VARCHAR) // GROUP BY od.id, n.id, fqns.fqn, counted.total // LIMIT $4 // OFFSET $3 diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index f882eee943..7d7d6cedbe 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -7,7 +7,7 @@ WITH inserted_obligation AS ( INSERT INTO obligation_definitions (namespace_id, name, metadata) SELECT CASE - WHEN sqlc.arg(namespace_id)::TEXT != '' THEN sqlc.arg(namespace_id)::UUID + WHEN @namespace_id::TEXT != '' THEN @namespace_id::UUID ELSE fqns.namespace_id END, @name, @@ -15,21 +15,21 @@ WITH inserted_obligation AS ( FROM ( SELECT CASE - WHEN sqlc.arg(namespace_id)::TEXT != '' THEN sqlc.arg(namespace_id)::UUID + WHEN @namespace_id::TEXT != '' THEN @namespace_id::UUID ELSE NULL END as direct_namespace_id ) direct - LEFT JOIN attribute_fqns fqns ON fqns.fqn = sqlc.arg(namespace_fqn) AND sqlc.arg(namespace_id)::TEXT = '' + LEFT JOIN attribute_fqns fqns ON fqns.fqn = @namespace_fqn AND @namespace_id::TEXT = '' WHERE - (sqlc.arg(namespace_id)::TEXT != '' AND direct.direct_namespace_id IS NOT NULL) OR - (sqlc.arg(namespace_fqn)::TEXT != '' AND fqns.namespace_id IS NOT NULL) + (@namespace_id::TEXT != '' AND direct.direct_namespace_id IS NOT NULL) OR + (@namespace_fqn::TEXT != '' AND fqns.namespace_id IS NOT NULL) RETURNING id, namespace_id, name, metadata ), inserted_values AS ( INSERT INTO obligation_values_standard (obligation_definition_id, value) - SELECT io.id, UNNEST(sqlc.arg(values)::VARCHAR[]) + SELECT io.id, UNNEST(@values::VARCHAR[]) FROM inserted_obligation io - WHERE sqlc.arg(values)::VARCHAR[] IS NOT NULL AND array_length(sqlc.arg(values)::VARCHAR[], 1) > 0 + WHERE @values::VARCHAR[] IS NOT NULL AND array_length(@values::VARCHAR[], 1) > 0 RETURNING id, obligation_definition_id, value ) SELECT @@ -81,11 +81,11 @@ WHERE -- lookup by obligation id OR by namespace fqn + obligation name ( -- lookup by obligation id - (sqlc.arg(id)::TEXT != '' AND od.id = sqlc.arg(id)::UUID) + (NULLIF(@id::TEXT, '') IS NOT NULL AND od.id = @id::UUID) OR -- lookup by namespace fqn + obligation name - (sqlc.arg(namespace_fqn)::TEXT != '' AND sqlc.arg(name)::TEXT != '' - AND fqns.fqn = sqlc.arg(namespace_fqn)::VARCHAR AND od.name = sqlc.arg(name)::VARCHAR) + (NULLIF(@namespace_fqn::TEXT, '') IS NOT NULL AND NULLIF(@name::TEXT, '') IS NOT NULL + AND fqns.fqn = @namespace_fqn::VARCHAR AND od.name = @name::VARCHAR) ) GROUP BY od.id, n.id, fqns.fqn; @@ -96,8 +96,8 @@ WITH counted AS ( LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL WHERE - (sqlc.arg(namespace_id)::TEXT = '' OR od.namespace_id = sqlc.arg(namespace_id)::UUID) AND - (sqlc.arg(namespace_fqn)::TEXT = '' OR fqns.fqn = sqlc.arg(namespace_fqn)::VARCHAR) + (NULLIF(@namespace_id::TEXT, '') IS NULL OR od.namespace_id = @namespace_id::UUID) AND + (NULLIF(@namespace_fqn::TEXT, '') IS NULL OR fqns.fqn = @namespace_fqn::VARCHAR) ) SELECT od.id, @@ -122,8 +122,8 @@ LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id CROSS JOIN counted LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id WHERE - (sqlc.arg(namespace_id)::TEXT = '' OR od.namespace_id = sqlc.arg(namespace_id)::UUID) AND - (sqlc.arg(namespace_fqn)::TEXT = '' OR fqns.fqn = sqlc.arg(namespace_fqn)::VARCHAR) + (NULLIF(@namespace_id::TEXT, '') IS NULL OR od.namespace_id = @namespace_id::UUID) AND + (NULLIF(@namespace_fqn::TEXT, '') IS NULL OR fqns.fqn = @namespace_fqn::VARCHAR) GROUP BY od.id, n.id, fqns.fqn, counted.total LIMIT @limit_ OFFSET @offset_; @@ -131,8 +131,8 @@ OFFSET @offset_; -- name: updateObligation :execrows UPDATE obligation_definitions SET - name = COALESCE(NULLIF(sqlc.arg(name)::TEXT, ''), name), - metadata = COALESCE(sqlc.arg(metadata), metadata) + name = COALESCE(NULLIF(@name::TEXT, ''), name), + metadata = COALESCE(@metadata, metadata) WHERE id = @id; -- name: deleteObligation :execrows From c398ee161bb99de39f46b832c7b3397657efce55 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 13 Aug 2025 14:52:32 -0400 Subject: [PATCH 060/137] uncomment out service --- service/pkg/server/services_test.go | 2 +- .../policy/obligations/{obligations.go.x => obligations.go} | 0 service/policy/policy.go | 3 ++- 3 files changed, 3 insertions(+), 2 deletions(-) rename service/policy/obligations/{obligations.go.x => obligations.go} (100%) diff --git a/service/pkg/server/services_test.go b/service/pkg/server/services_test.go index 10c9a3c575..3f7e6816f8 100644 --- a/service/pkg/server/services_test.go +++ b/service/pkg/server/services_test.go @@ -28,7 +28,7 @@ type mockTestServiceOptions struct { } const ( - numExpectedPolicyServices = 9 + numExpectedPolicyServices = 10 numExpectedEntityResolutionServiceVersions = 2 numExpectedAuthorizationServiceVersions = 2 ) diff --git a/service/policy/obligations/obligations.go.x b/service/policy/obligations/obligations.go similarity index 100% rename from service/policy/obligations/obligations.go.x rename to service/policy/obligations/obligations.go diff --git a/service/policy/policy.go b/service/policy/policy.go index cc5692a907..4e1f479454 100644 --- a/service/policy/policy.go +++ b/service/policy/policy.go @@ -10,6 +10,7 @@ import ( "github.com/opentdf/platform/service/policy/kasregistry" "github.com/opentdf/platform/service/policy/keymanagement" "github.com/opentdf/platform/service/policy/namespaces" + "github.com/opentdf/platform/service/policy/obligations" "github.com/opentdf/platform/service/policy/registeredresources" "github.com/opentdf/platform/service/policy/resourcemapping" "github.com/opentdf/platform/service/policy/subjectmapping" @@ -40,7 +41,7 @@ func NewRegistrations() []serviceregistry.IService { actions.NewRegistration(namespace, dbRegister), registeredresources.NewRegistration(namespace, dbRegister), keymanagement.NewRegistration(namespace, dbRegister), - // obligations.NewRegistration(namespace, dbRegister), + obligations.NewRegistration(namespace, dbRegister), }...) return registrations } From 2cd1c6de9d9c2202357504e8aed3cf61fc9f136b Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 13 Aug 2025 15:21:57 -0400 Subject: [PATCH 061/137] listobls, getobl rpcs --- service/policy/obligations/obligations.go | 32 ++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/service/policy/obligations/obligations.go b/service/policy/obligations/obligations.go index 827475525e..5bb307fea5 100644 --- a/service/policy/obligations/obligations.go +++ b/service/policy/obligations/obligations.go @@ -10,6 +10,7 @@ import ( "github.com/opentdf/platform/protocol/go/policy/obligations/obligationsconnect" "github.com/opentdf/platform/service/logger" "github.com/opentdf/platform/service/pkg/config" + "github.com/opentdf/platform/service/pkg/db" "github.com/opentdf/platform/service/pkg/serviceregistry" policyconfig "github.com/opentdf/platform/service/policy/config" policydb "github.com/opentdf/platform/service/policy/db" @@ -82,9 +83,19 @@ func (s *Service) Close() { s.dbClient.Close() } -func (s *Service) ListObligations(_ context.Context, _ *connect.Request[obligations.ListObligationsRequest]) (*connect.Response[obligations.ListObligationsResponse], error) { - // TODO: Implement ListObligations logic - return connect.NewResponse(&obligations.ListObligationsResponse{}), nil +func (s *Service) ListObligations(ctx context.Context, req *connect.Request[obligations.ListObligationsRequest]) (*connect.Response[obligations.ListObligationsResponse], error) { + s.logger.DebugContext(ctx, "listing obligations") + + os, pr, err := s.dbClient.ListObligations(ctx, req.Msg) + if err != nil { + return nil, db.StatusifyError(ctx, s.logger, err, db.ErrTextGetRetrievalFailed, slog.Any("request", req.Msg)) + } + rsp := &obligations.ListObligationsResponse{ + Obligations: os, + Pagination: pr, + } + + return connect.NewResponse(rsp), nil } func (s *Service) CreateObligation(_ context.Context, _ *connect.Request[obligations.CreateObligationRequest]) (*connect.Response[obligations.CreateObligationResponse], error) { @@ -92,9 +103,18 @@ func (s *Service) CreateObligation(_ context.Context, _ *connect.Request[obligat return connect.NewResponse(&obligations.CreateObligationResponse{}), nil } -func (s *Service) GetObligation(_ context.Context, _ *connect.Request[obligations.GetObligationRequest]) (*connect.Response[obligations.GetObligationResponse], error) { - // TODO: Implement GetObligation logic - return connect.NewResponse(&obligations.GetObligationResponse{}), nil +func (s *Service) GetObligation(ctx context.Context, req *connect.Request[obligations.GetObligationRequest]) (*connect.Response[obligations.GetObligationResponse], error) { + rsp := &obligations.GetObligationResponse{} + + s.logger.DebugContext(ctx, "getting obligation", slog.Any("identifier", req.Msg.GetIdentifier())) + + obl, err := s.dbClient.GetObligation(ctx, req.Msg) + if err != nil { + return nil, db.StatusifyError(ctx, s.logger, err, db.ErrTextGetRetrievalFailed, slog.Any("identifier", req.Msg.GetIdentifier())) + } + rsp.Obligation = obl + + return connect.NewResponse(rsp), nil } func (s *Service) GetObligationsByFQNs(_ context.Context, _ *connect.Request[obligations.GetObligationsByFQNsRequest]) (*connect.Response[obligations.GetObligationsByFQNsResponse], error) { From 615301ede5b405e2fecf99d4b49ea541a63d07c6 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 13 Aug 2025 15:28:08 -0400 Subject: [PATCH 062/137] createobl rpc --- service/policy/obligations/obligations.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/service/policy/obligations/obligations.go b/service/policy/obligations/obligations.go index 5bb307fea5..b3fa70543d 100644 --- a/service/policy/obligations/obligations.go +++ b/service/policy/obligations/obligations.go @@ -88,7 +88,7 @@ func (s *Service) ListObligations(ctx context.Context, req *connect.Request[obli os, pr, err := s.dbClient.ListObligations(ctx, req.Msg) if err != nil { - return nil, db.StatusifyError(ctx, s.logger, err, db.ErrTextGetRetrievalFailed, slog.Any("request", req.Msg)) + return nil, db.StatusifyError(ctx, s.logger, err, db.ErrTextListRetrievalFailed) } rsp := &obligations.ListObligationsResponse{ Obligations: os, @@ -98,21 +98,24 @@ func (s *Service) ListObligations(ctx context.Context, req *connect.Request[obli return connect.NewResponse(rsp), nil } -func (s *Service) CreateObligation(_ context.Context, _ *connect.Request[obligations.CreateObligationRequest]) (*connect.Response[obligations.CreateObligationResponse], error) { - // TODO: Implement CreateObligation logic - return connect.NewResponse(&obligations.CreateObligationResponse{}), nil +func (s *Service) CreateObligation(ctx context.Context, req *connect.Request[obligations.CreateObligationRequest]) (*connect.Response[obligations.CreateObligationResponse], error) { + s.logger.DebugContext(ctx, "creating registered resource", slog.String("name", req.Msg.GetName())) + + obl, err := s.dbClient.CreateObligation(ctx, req.Msg) + if err != nil { + return nil, db.StatusifyError(ctx, s.logger, err, db.ErrTextCreationFailed, slog.String("obligation", req.Msg.String())) + } + return connect.NewResponse(&obligations.CreateObligationResponse{Obligation: obl}), nil } func (s *Service) GetObligation(ctx context.Context, req *connect.Request[obligations.GetObligationRequest]) (*connect.Response[obligations.GetObligationResponse], error) { - rsp := &obligations.GetObligationResponse{} - s.logger.DebugContext(ctx, "getting obligation", slog.Any("identifier", req.Msg.GetIdentifier())) obl, err := s.dbClient.GetObligation(ctx, req.Msg) if err != nil { return nil, db.StatusifyError(ctx, s.logger, err, db.ErrTextGetRetrievalFailed, slog.Any("identifier", req.Msg.GetIdentifier())) } - rsp.Obligation = obl + rsp := &obligations.GetObligationResponse{Obligation: obl} return connect.NewResponse(rsp), nil } From 9eed91a8ec56e5880712c63a67afd09d3ce72390 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 13 Aug 2025 15:34:53 -0400 Subject: [PATCH 063/137] delobl rpc --- service/integration/obligations_test.go | 6 +++--- service/policy/db/obligations.go | 2 +- service/policy/obligations/obligations.go | 15 +++++++++++---- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 7bd17a593a..1d8545d9ac 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -300,7 +300,7 @@ func (s *ObligationsSuite) Test_DeleteObligation_Succeeds() { s.NotNil(obl) // Delete the obligation - obl, err = s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ + obl, err = s.db.PolicyClient.DeleteObligation(s.ctx, &obligations.DeleteObligationRequest{ Identifier: &obligations.DeleteObligationRequest_Id{ Id: createdObl.GetId(), }, @@ -321,7 +321,7 @@ func (s *ObligationsSuite) Test_DeleteObligation_Succeeds() { func (s *ObligationsSuite) Test_DeleteObligation_Fails() { // Attempt to delete an obligation with an invalid ID - obl, err := s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ + obl, err := s.db.PolicyClient.DeleteObligation(s.ctx, &obligations.DeleteObligationRequest{ Identifier: &obligations.DeleteObligationRequest_Id{ Id: invalidUUID, }, @@ -376,7 +376,7 @@ func (s *ObligationsSuite) createObligationByFQN(namespaceFQN, name string, valu } func (s *ObligationsSuite) deleteObligation(oblID string) { - _, err := s.db.PolicyClient.DeleteObligationDefinition(s.ctx, &obligations.DeleteObligationRequest{ + _, err := s.db.PolicyClient.DeleteObligation(s.ctx, &obligations.DeleteObligationRequest{ Identifier: &obligations.DeleteObligationRequest_Id{ Id: oblID, }, diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index c7606cfc8f..6219038cee 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -200,7 +200,7 @@ func (c PolicyDBClient) UpdateObligation(ctx context.Context, r *obligations.Upd }, nil } -func (c PolicyDBClient) DeleteObligationDefinition(ctx context.Context, r *obligations.DeleteObligationRequest) (*policy.Obligation, error) { +func (c PolicyDBClient) DeleteObligation(ctx context.Context, r *obligations.DeleteObligationRequest) (*policy.Obligation, error) { id := r.GetId() count, err := c.queries.deleteObligation(ctx, id) if err != nil { diff --git a/service/policy/obligations/obligations.go b/service/policy/obligations/obligations.go index b3fa70543d..cab3ad9c9a 100644 --- a/service/policy/obligations/obligations.go +++ b/service/policy/obligations/obligations.go @@ -99,7 +99,7 @@ func (s *Service) ListObligations(ctx context.Context, req *connect.Request[obli } func (s *Service) CreateObligation(ctx context.Context, req *connect.Request[obligations.CreateObligationRequest]) (*connect.Response[obligations.CreateObligationResponse], error) { - s.logger.DebugContext(ctx, "creating registered resource", slog.String("name", req.Msg.GetName())) + s.logger.DebugContext(ctx, "creating obligation", slog.String("name", req.Msg.GetName())) obl, err := s.dbClient.CreateObligation(ctx, req.Msg) if err != nil { @@ -130,9 +130,16 @@ func (s *Service) UpdateObligation(_ context.Context, _ *connect.Request[obligat return connect.NewResponse(&obligations.UpdateObligationResponse{}), nil } -func (s *Service) DeleteObligation(_ context.Context, _ *connect.Request[obligations.DeleteObligationRequest]) (*connect.Response[obligations.DeleteObligationResponse], error) { - // TODO: Implement DeleteObligation logic - return connect.NewResponse(&obligations.DeleteObligationResponse{}), nil +func (s *Service) DeleteObligation(ctx context.Context, req *connect.Request[obligations.DeleteObligationRequest]) (*connect.Response[obligations.DeleteObligationResponse], error) { + id := req.Msg.GetId() + s.logger.DebugContext(ctx, "deleting obligation", slog.String("id", id)) + + obl, err := s.dbClient.DeleteObligation(ctx, req.Msg) + if err != nil { + return nil, db.StatusifyError(ctx, s.logger, err, db.ErrTextDeletionFailed, slog.String("obligation", req.Msg.String())) + } + rsp := &obligations.DeleteObligationResponse{Obligation: obl} + return connect.NewResponse(rsp), nil } func (s *Service) CreateObligationValue(_ context.Context, _ *connect.Request[obligations.CreateObligationValueRequest]) (*connect.Response[obligations.CreateObligationValueResponse], error) { From c036988ee91d7e720a623d1c3d9bb882f8728ec7 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 13 Aug 2025 15:37:39 -0400 Subject: [PATCH 064/137] updateobl rpc --- service/policy/obligations/obligations.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/service/policy/obligations/obligations.go b/service/policy/obligations/obligations.go index cab3ad9c9a..104095e7eb 100644 --- a/service/policy/obligations/obligations.go +++ b/service/policy/obligations/obligations.go @@ -94,7 +94,6 @@ func (s *Service) ListObligations(ctx context.Context, req *connect.Request[obli Obligations: os, Pagination: pr, } - return connect.NewResponse(rsp), nil } @@ -116,7 +115,6 @@ func (s *Service) GetObligation(ctx context.Context, req *connect.Request[obliga return nil, db.StatusifyError(ctx, s.logger, err, db.ErrTextGetRetrievalFailed, slog.Any("identifier", req.Msg.GetIdentifier())) } rsp := &obligations.GetObligationResponse{Obligation: obl} - return connect.NewResponse(rsp), nil } @@ -125,9 +123,15 @@ func (s *Service) GetObligationsByFQNs(_ context.Context, _ *connect.Request[obl return connect.NewResponse(&obligations.GetObligationsByFQNsResponse{}), nil } -func (s *Service) UpdateObligation(_ context.Context, _ *connect.Request[obligations.UpdateObligationRequest]) (*connect.Response[obligations.UpdateObligationResponse], error) { - // TODO: Implement UpdateObligation logic - return connect.NewResponse(&obligations.UpdateObligationResponse{}), nil +func (s *Service) UpdateObligation(ctx context.Context, req *connect.Request[obligations.UpdateObligationRequest]) (*connect.Response[obligations.UpdateObligationResponse], error) { + id := req.Msg.GetId() + s.logger.DebugContext(ctx, "updating obligation", slog.String("id", id)) + + obl, err := s.dbClient.UpdateObligation(ctx, req.Msg) + if err != nil { + return nil, db.StatusifyError(ctx, s.logger, err, db.ErrTextUpdateFailed, slog.String("obligation", req.Msg.String())) + } + return connect.NewResponse(&obligations.UpdateObligationResponse{Obligation: obl}), nil } func (s *Service) DeleteObligation(ctx context.Context, req *connect.Request[obligations.DeleteObligationRequest]) (*connect.Response[obligations.DeleteObligationResponse], error) { From 4a1e9af5e055765f71a4138ddf9b3f322d23cfde Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 13 Aug 2025 15:49:53 -0400 Subject: [PATCH 065/137] add GetObligationsByFQNs db fx --- service/policy/db/obligations.go | 62 ++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 7 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 6219038cee..839b1e57fe 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -101,6 +101,54 @@ func (c PolicyDBClient) GetObligation(ctx context.Context, r *obligations.GetObl }, nil } +func (c PolicyDBClient) GetObligationsByFQNs(ctx context.Context, r *obligations.GetObligationsByFQNsRequest) ([]*policy.Obligation, error) { + nsFQNs := make([]string, 0, len(r.GetFqns())) + oblNames := make([]string, 0, len(r.GetFqns())) + for _, fqn := range r.GetFqns() { + nsFQN, oblName := splitOblFQN(fqn) + nsFQNs = append(nsFQNs, nsFQN) + oblNames = append(oblNames, oblName) + } + + queryParams := getObligationsByFQNsParams{ + NamespaceFQNs: nsFQNs, + ObligationNames: oblNames, + } + + list, err := c.queries.getObligationsByFQNs(ctx, queryParams) + if err != nil { + return nil, db.WrapIfKnownInvalidQueryErr(err) + } + obls := make([]*policy.Obligation, len(list)) + + for i, r := range list { + metadata := &common.Metadata{} + if err = unmarshalMetadata(r.Metadata, metadata); err != nil { + return nil, nil, err + } + + namespace := &policy.Namespace{} + if err := unmarshalNamespace(r.Namespace, namespace); err != nil { + return nil, fmt.Errorf("failed to unmarshal obligation namespace: %w", err) + } + + values := []*policy.ObligationValue{} + if err = unmarshalObligationValues(r.Values, values); err != nil { + return nil, err + } + + obls[i] = &policy.Obligation{ + Id: r.ID, + Name: r.Name, + Metadata: metadata, + Namespace: namespace, + Values: values, + } + } + + return obls, nil +} + func (c PolicyDBClient) ListObligations(ctx context.Context, r *obligations.ListObligationsRequest) ([]*policy.Obligation, *policy.PageResponse, error) { limit, offset := c.getRequestedLimitOffset(r.GetPagination()) @@ -109,7 +157,7 @@ func (c PolicyDBClient) ListObligations(ctx context.Context, r *obligations.List return nil, nil, db.ErrListLimitTooLarge } - list, err := c.queries.listObligations(ctx, listObligationsParams{ + rows, err := c.queries.listObligations(ctx, listObligationsParams{ NamespaceID: r.GetId(), NamespaceFqn: r.GetFqn(), Limit: limit, @@ -118,9 +166,9 @@ func (c PolicyDBClient) ListObligations(ctx context.Context, r *obligations.List if err != nil { return nil, nil, db.WrapIfKnownInvalidQueryErr(err) } - oblList := make([]*policy.Obligation, len(list)) + obls := make([]*policy.Obligation, len(rows)) - for i, r := range list { + for i, r := range rows { metadata := &common.Metadata{} if err = unmarshalMetadata(r.Metadata, metadata); err != nil { return nil, nil, err @@ -136,7 +184,7 @@ func (c PolicyDBClient) ListObligations(ctx context.Context, r *obligations.List return nil, nil, err } - oblList[i] = &policy.Obligation{ + obls[i] = &policy.Obligation{ Id: r.ID, Name: r.Name, Metadata: metadata, @@ -147,8 +195,8 @@ func (c PolicyDBClient) ListObligations(ctx context.Context, r *obligations.List var total int32 var nextOffset int32 - if len(list) > 0 { - total = int32(list[0].Total) + if len(rows) > 0 { + total = int32(rows[0].Total) nextOffset = getNextOffset(offset, limit, total) } @@ -158,7 +206,7 @@ func (c PolicyDBClient) ListObligations(ctx context.Context, r *obligations.List NextOffset: nextOffset, } - return oblList, pagination, nil + return obls, pagination, nil } func (c PolicyDBClient) UpdateObligation(ctx context.Context, r *obligations.UpdateObligationRequest) (*policy.Obligation, error) { From bd16dfb2ec0255827c3414f7fbcb91e9ffcfdfa6 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 13 Aug 2025 16:03:35 -0400 Subject: [PATCH 066/137] GetObligationsByFQNs sql query --- service/policy/db/obligations.go | 4 +- service/policy/db/obligations.sql.go | 108 ++++++++++++++++++++++ service/policy/db/queries/obligations.sql | 34 +++++++ 3 files changed, 144 insertions(+), 2 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 839b1e57fe..c5c76d8b66 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -111,7 +111,7 @@ func (c PolicyDBClient) GetObligationsByFQNs(ctx context.Context, r *obligations } queryParams := getObligationsByFQNsParams{ - NamespaceFQNs: nsFQNs, + NamespaceFqns: nsFQNs, ObligationNames: oblNames, } @@ -124,7 +124,7 @@ func (c PolicyDBClient) GetObligationsByFQNs(ctx context.Context, r *obligations for i, r := range list { metadata := &common.Metadata{} if err = unmarshalMetadata(r.Metadata, metadata); err != nil { - return nil, nil, err + return nil, err } namespace := &policy.Namespace{} diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 8b178300e6..e0798428eb 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -265,6 +265,114 @@ func (q *Queries) getObligation(ctx context.Context, arg getObligationParams) (g return i, err } +const getObligationsByFQNs = `-- name: getObligationsByFQNs :many +SELECT + od.id, + od.name, + od.metadata, + JSON_BUILD_OBJECT( + 'id', n.id, + 'name', n.name, + 'fqn', fqns.fqn + ) as namespace, + COALESCE( + JSON_AGG( + JSON_BUILD_OBJECT( + 'id', ov.id, + 'value', ov.value + ) + ) FILTER (WHERE ov.id IS NOT NULL), + '[]'::JSON + )::JSONB as values +FROM + obligation_definitions od +JOIN + attribute_namespaces n on od.namespace_id = n.id +JOIN + attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL +JOIN + (SELECT unnest($1::text[]) as ns_fqn, unnest($2::text[]) as obl_name) as fqn_pairs +ON + fqns.fqn = fqn_pairs.ns_fqn AND od.name = fqn_pairs.obl_name +LEFT JOIN + obligation_values_standard ov on od.id = ov.obligation_definition_id +GROUP BY + od.id, n.id, fqns.fqn +` + +type getObligationsByFQNsParams struct { + NamespaceFqns []string `json:"namespace_fqns"` + ObligationNames []string `json:"obligation_names"` +} + +type getObligationsByFQNsRow struct { + ID string `json:"id"` + Name string `json:"name"` + Metadata []byte `json:"metadata"` + Namespace []byte `json:"namespace"` + Values []byte `json:"values"` +} + +// getObligationsByFQNs +// +// SELECT +// od.id, +// od.name, +// od.metadata, +// JSON_BUILD_OBJECT( +// 'id', n.id, +// 'name', n.name, +// 'fqn', fqns.fqn +// ) as namespace, +// COALESCE( +// JSON_AGG( +// JSON_BUILD_OBJECT( +// 'id', ov.id, +// 'value', ov.value +// ) +// ) FILTER (WHERE ov.id IS NOT NULL), +// '[]'::JSON +// )::JSONB as values +// FROM +// obligation_definitions od +// JOIN +// attribute_namespaces n on od.namespace_id = n.id +// JOIN +// attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL +// JOIN +// (SELECT unnest($1::text[]) as ns_fqn, unnest($2::text[]) as obl_name) as fqn_pairs +// ON +// fqns.fqn = fqn_pairs.ns_fqn AND od.name = fqn_pairs.obl_name +// LEFT JOIN +// obligation_values_standard ov on od.id = ov.obligation_definition_id +// GROUP BY +// od.id, n.id, fqns.fqn +func (q *Queries) getObligationsByFQNs(ctx context.Context, arg getObligationsByFQNsParams) ([]getObligationsByFQNsRow, error) { + rows, err := q.db.Query(ctx, getObligationsByFQNs, arg.NamespaceFqns, arg.ObligationNames) + if err != nil { + return nil, err + } + defer rows.Close() + var items []getObligationsByFQNsRow + for rows.Next() { + var i getObligationsByFQNsRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.Metadata, + &i.Namespace, + &i.Values, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const listObligations = `-- name: listObligations :many WITH counted AS ( SELECT COUNT(od.id) AS total diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 7d7d6cedbe..dce4d7f751 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -137,3 +137,37 @@ WHERE id = @id; -- name: deleteObligation :execrows DELETE FROM obligation_definitions WHERE id = $1; + +-- name: getObligationsByFQNs :many +SELECT + od.id, + od.name, + od.metadata, + JSON_BUILD_OBJECT( + 'id', n.id, + 'name', n.name, + 'fqn', fqns.fqn + ) as namespace, + COALESCE( + JSON_AGG( + JSON_BUILD_OBJECT( + 'id', ov.id, + 'value', ov.value + ) + ) FILTER (WHERE ov.id IS NOT NULL), + '[]'::JSON + )::JSONB as values +FROM + obligation_definitions od +JOIN + attribute_namespaces n on od.namespace_id = n.id +JOIN + attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL +JOIN + (SELECT unnest(@namespace_fqns::text[]) as ns_fqn, unnest(@obligation_names::text[]) as obl_name) as fqn_pairs +ON + fqns.fqn = fqn_pairs.ns_fqn AND od.name = fqn_pairs.obl_name +LEFT JOIN + obligation_values_standard ov on od.id = ov.obligation_definition_id +GROUP BY + od.id, n.id, fqns.fqn; From 10f5fd42479905e125e6e650d57ae2839a9d3961 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 13 Aug 2025 16:06:21 -0400 Subject: [PATCH 067/137] add tests --- service/integration/obligations_test.go | 109 ++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 1d8545d9ac..55391cc730 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -153,6 +153,115 @@ func (s *ObligationsSuite) Test_GetObligation_Fails() { s.Nil(obl) } +// GetObligationsByFQNs + +func (s *ObligationsSuite) Test_GetObligationsByFQNs_Succeeds() { + // Setup test data + namespaceID1, namespaceFQN1, namespace1 := s.getNamespaceData(nsExampleCom) + namespaceID2, namespaceFQN2, namespace2 := s.getNamespaceData(nsExampleNet) + namespaceID3, _, _ := s.getNamespaceData(nsExampleOrg) + + // Create obligations in different namespaces + obl1 := s.createObligation(namespaceID1, oblName+"-1", oblVals) + obl2 := s.createObligation(namespaceID2, oblName+"-2", oblVals) + obl3 := s.createObligation(namespaceID3, oblName+"-3", oblVals) + + // Test 1: Get multiple obligations by FQNs + fqns := []string{ + namespaceFQN1 + "/obl/" + oblName + "-1", + namespaceFQN2 + "/obl/" + oblName + "-2", + } + + oblList, err := s.db.PolicyClient.GetObligationsByFQNs(s.ctx, &obligations.GetObligationsByFQNsRequest{ + Fqns: fqns, + }) + s.Require().NoError(err) + s.NotNil(oblList) + s.Len(oblList, 2) + + // Verify first obligation + found1 := false + found2 := false + for _, obl := range oblList { + if obl.GetId() == obl1.GetId() { + s.assertObligationBasics(obl, oblName+"-1", namespaceID1, namespace1.Name, namespaceFQN1) + s.assertObligationValues(obl) + found1 = true + } else if obl.GetId() == obl2.GetId() { + s.assertObligationBasics(obl, oblName+"-2", namespaceID2, namespace2.Name, namespaceFQN2) + s.assertObligationValues(obl) + found2 = true + } + } + s.True(found1, "First obligation should be found") + s.True(found2, "Second obligation should be found") + + // Test 2: Get single obligation by FQN + singleFQN := []string{namespaceFQN1 + "/obl/" + oblName + "-1"} + oblList, err = s.db.PolicyClient.GetObligationsByFQNs(s.ctx, &obligations.GetObligationsByFQNsRequest{ + Fqns: singleFQN, + }) + s.Require().NoError(err) + s.NotNil(oblList) + s.Len(oblList, 1) + s.assertObligationBasics(oblList[0], oblName+"-1", namespaceID1, namespace1.Name, namespaceFQN1) + s.assertObligationValues(oblList[0]) + + // Test 3: Empty FQN list should return empty result + oblList, err = s.db.PolicyClient.GetObligationsByFQNs(s.ctx, &obligations.GetObligationsByFQNsRequest{ + Fqns: []string{}, + }) + s.Require().NoError(err) + s.NotNil(oblList) + s.Empty(oblList) + + // Cleanup + s.deleteObligations([]string{obl1.GetId(), obl2.GetId(), obl3.GetId()}) +} + +func (s *ObligationsSuite) Test_GetObligationsByFQNs_Fails() { + // Setup test data + namespaceID, namespaceFQN, _ := s.getNamespaceData(nsExampleCom) + obl := s.createObligation(namespaceID, oblName, oblVals) + + // Test 1: Invalid FQN should return empty result (not error) + invalidFQNs := []string{invalidFQN} + oblList, err := s.db.PolicyClient.GetObligationsByFQNs(s.ctx, &obligations.GetObligationsByFQNsRequest{ + Fqns: invalidFQNs, + }) + s.Require().NoError(err) + s.NotNil(oblList) + s.Empty(oblList) + + // Test 2: Mix of valid and invalid FQNs should return only valid ones + mixedFQNs := []string{ + namespaceFQN + "/obl/" + oblName, + invalidFQN, + "https://nonexistent.com/obl/nonexistent", + } + oblList, err = s.db.PolicyClient.GetObligationsByFQNs(s.ctx, &obligations.GetObligationsByFQNsRequest{ + Fqns: mixedFQNs, + }) + s.Require().NoError(err) + s.NotNil(oblList) + s.Len(oblList, 1) + s.Equal(obl.GetId(), oblList[0].GetId()) + + // Test 3: Non-existent obligation names should return empty result + nonExistentFQNs := []string{ + namespaceFQN + "/obl/nonexistent-obligation", + } + oblList, err = s.db.PolicyClient.GetObligationsByFQNs(s.ctx, &obligations.GetObligationsByFQNsRequest{ + Fqns: nonExistentFQNs, + }) + s.Require().NoError(err) + s.NotNil(oblList) + s.Empty(oblList) + + // Cleanup + s.deleteObligations([]string{obl.GetId()}) +} + // List func (s *ObligationsSuite) Test_ListObligations_Succeeds() { From 9e598359c00b594ae5bb1807c3ab3b602fbf4cce Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 13 Aug 2025 16:18:19 -0400 Subject: [PATCH 068/137] obl fqn fxs --- service/policy/db/obligations.go | 13 ++++++++++--- service/policy/obligations/obligations.go | 17 ++++++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index c5c76d8b66..9518661f19 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -57,15 +57,22 @@ func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.Cre }, nil } -func splitOblFQN(fqn string) (string, string) { +func breakOblFQN(fqn string) (string, string) { nsFQN := strings.Split(fqn, "/obl/")[0] parts := strings.Split(fqn, "/") oblName := parts[len(parts)-1] return nsFQN, oblName } +func buildOblFQN(nsFQN, oblName string) string { + if !strings.HasSuffix(nsFQN, "/") { + nsFQN += "/" + } + return nsFQN + "obl/" + oblName +} + func (c PolicyDBClient) GetObligation(ctx context.Context, r *obligations.GetObligationRequest) (*policy.Obligation, error) { - nsFQN, oblName := splitOblFQN(r.GetFqn()) + nsFQN, oblName := breakOblFQN(r.GetFqn()) queryParams := getObligationParams{ ID: r.GetId(), Name: oblName, @@ -105,7 +112,7 @@ func (c PolicyDBClient) GetObligationsByFQNs(ctx context.Context, r *obligations nsFQNs := make([]string, 0, len(r.GetFqns())) oblNames := make([]string, 0, len(r.GetFqns())) for _, fqn := range r.GetFqns() { - nsFQN, oblName := splitOblFQN(fqn) + nsFQN, oblName := breakOblFQN(fqn) nsFQNs = append(nsFQNs, nsFQN) oblNames = append(oblNames, oblName) } diff --git a/service/policy/obligations/obligations.go b/service/policy/obligations/obligations.go index 104095e7eb..aca414792e 100644 --- a/service/policy/obligations/obligations.go +++ b/service/policy/obligations/obligations.go @@ -6,6 +6,7 @@ import ( "log/slog" "connectrpc.com/connect" + "github.com/opentdf/platform/protocol/go/policy" "github.com/opentdf/platform/protocol/go/policy/obligations" "github.com/opentdf/platform/protocol/go/policy/obligations/obligationsconnect" "github.com/opentdf/platform/service/logger" @@ -118,9 +119,19 @@ func (s *Service) GetObligation(ctx context.Context, req *connect.Request[obliga return connect.NewResponse(rsp), nil } -func (s *Service) GetObligationsByFQNs(_ context.Context, _ *connect.Request[obligations.GetObligationsByFQNsRequest]) (*connect.Response[obligations.GetObligationsByFQNsResponse], error) { - // TODO: Implement GetObligationsByFQNs logic - return connect.NewResponse(&obligations.GetObligationsByFQNsResponse{}), nil +func (s *Service) GetObligationsByFQNs(ctx context.Context, req *connect.Request[obligations.GetObligationsByFQNsRequest]) (*connect.Response[obligations.GetObligationsByFQNsResponse], error) { + s.logger.DebugContext(ctx, "getting obligations") + + os, err := s.dbClient.GetObligationsByFQNs(ctx, req.Msg) + if err != nil { + return nil, db.StatusifyError(ctx, s.logger, err, db.ErrTextGetRetrievalFailed) + } + obls := make(map[string]*policy.Obligation) + for _, obl := range os { + obls[obl.GetFqn()] = obl + } + rsp := &obligations.GetObligationsByFQNsResponse{FqnObligationMap: obls} + return connect.NewResponse(rsp), nil } func (s *Service) UpdateObligation(ctx context.Context, req *connect.Request[obligations.UpdateObligationRequest]) (*connect.Response[obligations.UpdateObligationResponse], error) { From 1fc4a630c183bb5bbaff33ffa9549fd24211641a Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 13 Aug 2025 16:20:18 -0400 Subject: [PATCH 069/137] fix GetObligationsByFQNs rpc --- service/policy/db/obligations.go | 7 ++----- service/policy/obligations/obligations.go | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 9518661f19..dffabe9db1 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -64,11 +64,8 @@ func breakOblFQN(fqn string) (string, string) { return nsFQN, oblName } -func buildOblFQN(nsFQN, oblName string) string { - if !strings.HasSuffix(nsFQN, "/") { - nsFQN += "/" - } - return nsFQN + "obl/" + oblName +func BuildOblFQN(nsFQN, oblName string) string { + return nsFQN + "/obl/" + oblName } func (c PolicyDBClient) GetObligation(ctx context.Context, r *obligations.GetObligationRequest) (*policy.Obligation, error) { diff --git a/service/policy/obligations/obligations.go b/service/policy/obligations/obligations.go index aca414792e..58e763e7af 100644 --- a/service/policy/obligations/obligations.go +++ b/service/policy/obligations/obligations.go @@ -128,7 +128,7 @@ func (s *Service) GetObligationsByFQNs(ctx context.Context, req *connect.Request } obls := make(map[string]*policy.Obligation) for _, obl := range os { - obls[obl.GetFqn()] = obl + obls[policydb.BuildOblFQN(obl.GetNamespace().GetFqn(), obl.GetName())] = obl } rsp := &obligations.GetObligationsByFQNsResponse{FqnObligationMap: obls} return connect.NewResponse(rsp), nil From cea6e43f8d2e29ba245e338e27f667583b2607cc Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Thu, 14 Aug 2025 22:50:52 -0400 Subject: [PATCH 070/137] sdk client --- sdk/codegen/main.go | 4 + sdk/go.mod | 2 +- sdk/go.sum | 4 +- sdk/sdk.go | 2 + sdk/sdkconnect/obligations.go | 150 ++++++++++++++++++++++++++++++++++ 5 files changed, 159 insertions(+), 3 deletions(-) create mode 100644 sdk/sdkconnect/obligations.go diff --git a/sdk/codegen/main.go b/sdk/codegen/main.go index cecba8c7a5..f917a9e5fc 100644 --- a/sdk/codegen/main.go +++ b/sdk/codegen/main.go @@ -50,6 +50,10 @@ var clientsToGenerateList = []runner.ClientsToGenerate{ GrpcClientInterface: "NamespaceServiceClient", GrpcPackagePath: "github.com/opentdf/platform/protocol/go/policy/namespaces", }, + { + GrpcClientInterface: "ServiceClient", + GrpcPackagePath: "github.com/opentdf/platform/protocol/go/policy/obligations", + }, { GrpcClientInterface: "RegisteredResourcesServiceClient", GrpcPackagePath: "github.com/opentdf/platform/protocol/go/policy/registeredresources", diff --git a/sdk/go.mod b/sdk/go.mod index 0bef1258dd..1aa086e926 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -13,7 +13,7 @@ require ( github.com/lestrrat-go/jwx/v2 v2.1.6 github.com/opentdf/platform/lib/fixtures v0.3.0 github.com/opentdf/platform/lib/ocrypto v0.3.0 - github.com/opentdf/platform/protocol/go v0.6.2 + github.com/opentdf/platform/protocol/go v0.7.0 github.com/stretchr/testify v1.10.0 github.com/testcontainers/testcontainers-go v0.37.0 github.com/xeipuuv/gojsonschema v1.2.0 diff --git a/sdk/go.sum b/sdk/go.sum index 07d0bc788f..3bee8257c4 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -126,8 +126,8 @@ github.com/opentdf/platform/lib/fixtures v0.3.0 h1:pgEm9ynMDIFH7Wd/lre2tfvtura8L github.com/opentdf/platform/lib/fixtures v0.3.0/go.mod h1:K/r0REv5MYClnkuiCxCOT1LTXbuIDP0kqixlGmPQzXc= github.com/opentdf/platform/lib/ocrypto v0.3.0 h1:/nHlIj6kqZ9XT9M45vAbzoMV8USeCj7GRuhFR6JH+RA= github.com/opentdf/platform/lib/ocrypto v0.3.0/go.mod h1:VuVHTye/smLiRZ5Ls4sZ14R+PtN9Egwj8D1Hv5X9iP0= -github.com/opentdf/platform/protocol/go v0.6.2 h1:seLTEP4xBRF2BG1vbuWzQqNo58g3wtkzCV+Z4ExRXnM= -github.com/opentdf/platform/protocol/go v0.6.2/go.mod h1:FwoNd0HJaxGCZf74de/yFpVP4HEjkUMoF6Br79W0TBk= +github.com/opentdf/platform/protocol/go v0.7.0 h1:N04m0sgGR7inFVUf7HNjXAIP41XAJ85lO51pISv9nOE= +github.com/opentdf/platform/protocol/go v0.7.0/go.mod h1:GRycoDGDxaz91sOvGZFWVEKJLluZFg2wM3NJmhucDHo= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= diff --git a/sdk/sdk.go b/sdk/sdk.go index b3c4f47e8b..d12aa991f1 100644 --- a/sdk/sdk.go +++ b/sdk/sdk.go @@ -63,6 +63,7 @@ type SDK struct { EntityResolutionV2 sdkconnect.EntityResolutionServiceClientV2 KeyAccessServerRegistry sdkconnect.KeyAccessServerRegistryServiceClient Namespaces sdkconnect.NamespaceServiceClient + Obligations sdkconnect.ServiceClient RegisteredResources sdkconnect.RegisteredResourcesServiceClient ResourceMapping sdkconnect.ResourceMappingServiceClient SubjectMapping sdkconnect.SubjectMappingServiceClient @@ -188,6 +189,7 @@ func New(platformEndpoint string, opts ...Option) (*SDK, error) { Actions: sdkconnect.NewActionServiceClientConnectWrapper(platformConn.Client, platformConn.Endpoint, platformConn.Options...), Attributes: sdkconnect.NewAttributesServiceClientConnectWrapper(platformConn.Client, platformConn.Endpoint, platformConn.Options...), Namespaces: sdkconnect.NewNamespaceServiceClientConnectWrapper(platformConn.Client, platformConn.Endpoint, platformConn.Options...), + Obligations: sdkconnect.NewServiceClientConnectWrapper(platformConn.Client, platformConn.Endpoint, platformConn.Options...), RegisteredResources: sdkconnect.NewRegisteredResourcesServiceClientConnectWrapper(platformConn.Client, platformConn.Endpoint, platformConn.Options...), ResourceMapping: sdkconnect.NewResourceMappingServiceClientConnectWrapper(platformConn.Client, platformConn.Endpoint, platformConn.Options...), SubjectMapping: sdkconnect.NewSubjectMappingServiceClientConnectWrapper(platformConn.Client, platformConn.Endpoint, platformConn.Options...), diff --git a/sdk/sdkconnect/obligations.go b/sdk/sdkconnect/obligations.go new file mode 100644 index 0000000000..ec0c80dd45 --- /dev/null +++ b/sdk/sdkconnect/obligations.go @@ -0,0 +1,150 @@ +// Wrapper for ServiceClient (generated code) DO NOT EDIT +package sdkconnect + +import ( + "connectrpc.com/connect" + "context" + "github.com/opentdf/platform/protocol/go/policy/obligations" + "github.com/opentdf/platform/protocol/go/policy/obligations/obligationsconnect" +) + +type ServiceClientConnectWrapper struct { + obligationsconnect.ServiceClient +} + +func NewServiceClientConnectWrapper(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) *ServiceClientConnectWrapper { + return &ServiceClientConnectWrapper{ServiceClient: obligationsconnect.NewServiceClient(httpClient, baseURL, opts...)} +} + +type ServiceClient interface { + ListObligations(ctx context.Context, req *obligations.ListObligationsRequest) (*obligations.ListObligationsResponse, error) + GetObligation(ctx context.Context, req *obligations.GetObligationRequest) (*obligations.GetObligationResponse, error) + GetObligationsByFQNs(ctx context.Context, req *obligations.GetObligationsByFQNsRequest) (*obligations.GetObligationsByFQNsResponse, error) + CreateObligation(ctx context.Context, req *obligations.CreateObligationRequest) (*obligations.CreateObligationResponse, error) + UpdateObligation(ctx context.Context, req *obligations.UpdateObligationRequest) (*obligations.UpdateObligationResponse, error) + DeleteObligation(ctx context.Context, req *obligations.DeleteObligationRequest) (*obligations.DeleteObligationResponse, error) + GetObligationValue(ctx context.Context, req *obligations.GetObligationValueRequest) (*obligations.GetObligationValueResponse, error) + GetObligationValuesByFQNs(ctx context.Context, req *obligations.GetObligationValuesByFQNsRequest) (*obligations.GetObligationValuesByFQNsResponse, error) + CreateObligationValue(ctx context.Context, req *obligations.CreateObligationValueRequest) (*obligations.CreateObligationValueResponse, error) + UpdateObligationValue(ctx context.Context, req *obligations.UpdateObligationValueRequest) (*obligations.UpdateObligationValueResponse, error) + DeleteObligationValue(ctx context.Context, req *obligations.DeleteObligationValueRequest) (*obligations.DeleteObligationValueResponse, error) + AddObligationTrigger(ctx context.Context, req *obligations.AddObligationTriggerRequest) (*obligations.AddObligationTriggerResponse, error) + RemoveObligationTrigger(ctx context.Context, req *obligations.RemoveObligationTriggerRequest) (*obligations.RemoveObligationTriggerResponse, error) +} + +func (w *ServiceClientConnectWrapper) ListObligations(ctx context.Context, req *obligations.ListObligationsRequest) (*obligations.ListObligationsResponse, error) { + // Wrap Connect RPC client request + res, err := w.ServiceClient.ListObligations(ctx, connect.NewRequest(req)) + if res == nil { + return nil, err + } + return res.Msg, err +} + +func (w *ServiceClientConnectWrapper) GetObligation(ctx context.Context, req *obligations.GetObligationRequest) (*obligations.GetObligationResponse, error) { + // Wrap Connect RPC client request + res, err := w.ServiceClient.GetObligation(ctx, connect.NewRequest(req)) + if res == nil { + return nil, err + } + return res.Msg, err +} + +func (w *ServiceClientConnectWrapper) GetObligationsByFQNs(ctx context.Context, req *obligations.GetObligationsByFQNsRequest) (*obligations.GetObligationsByFQNsResponse, error) { + // Wrap Connect RPC client request + res, err := w.ServiceClient.GetObligationsByFQNs(ctx, connect.NewRequest(req)) + if res == nil { + return nil, err + } + return res.Msg, err +} + +func (w *ServiceClientConnectWrapper) CreateObligation(ctx context.Context, req *obligations.CreateObligationRequest) (*obligations.CreateObligationResponse, error) { + // Wrap Connect RPC client request + res, err := w.ServiceClient.CreateObligation(ctx, connect.NewRequest(req)) + if res == nil { + return nil, err + } + return res.Msg, err +} + +func (w *ServiceClientConnectWrapper) UpdateObligation(ctx context.Context, req *obligations.UpdateObligationRequest) (*obligations.UpdateObligationResponse, error) { + // Wrap Connect RPC client request + res, err := w.ServiceClient.UpdateObligation(ctx, connect.NewRequest(req)) + if res == nil { + return nil, err + } + return res.Msg, err +} + +func (w *ServiceClientConnectWrapper) DeleteObligation(ctx context.Context, req *obligations.DeleteObligationRequest) (*obligations.DeleteObligationResponse, error) { + // Wrap Connect RPC client request + res, err := w.ServiceClient.DeleteObligation(ctx, connect.NewRequest(req)) + if res == nil { + return nil, err + } + return res.Msg, err +} + +func (w *ServiceClientConnectWrapper) GetObligationValue(ctx context.Context, req *obligations.GetObligationValueRequest) (*obligations.GetObligationValueResponse, error) { + // Wrap Connect RPC client request + res, err := w.ServiceClient.GetObligationValue(ctx, connect.NewRequest(req)) + if res == nil { + return nil, err + } + return res.Msg, err +} + +func (w *ServiceClientConnectWrapper) GetObligationValuesByFQNs(ctx context.Context, req *obligations.GetObligationValuesByFQNsRequest) (*obligations.GetObligationValuesByFQNsResponse, error) { + // Wrap Connect RPC client request + res, err := w.ServiceClient.GetObligationValuesByFQNs(ctx, connect.NewRequest(req)) + if res == nil { + return nil, err + } + return res.Msg, err +} + +func (w *ServiceClientConnectWrapper) CreateObligationValue(ctx context.Context, req *obligations.CreateObligationValueRequest) (*obligations.CreateObligationValueResponse, error) { + // Wrap Connect RPC client request + res, err := w.ServiceClient.CreateObligationValue(ctx, connect.NewRequest(req)) + if res == nil { + return nil, err + } + return res.Msg, err +} + +func (w *ServiceClientConnectWrapper) UpdateObligationValue(ctx context.Context, req *obligations.UpdateObligationValueRequest) (*obligations.UpdateObligationValueResponse, error) { + // Wrap Connect RPC client request + res, err := w.ServiceClient.UpdateObligationValue(ctx, connect.NewRequest(req)) + if res == nil { + return nil, err + } + return res.Msg, err +} + +func (w *ServiceClientConnectWrapper) DeleteObligationValue(ctx context.Context, req *obligations.DeleteObligationValueRequest) (*obligations.DeleteObligationValueResponse, error) { + // Wrap Connect RPC client request + res, err := w.ServiceClient.DeleteObligationValue(ctx, connect.NewRequest(req)) + if res == nil { + return nil, err + } + return res.Msg, err +} + +func (w *ServiceClientConnectWrapper) AddObligationTrigger(ctx context.Context, req *obligations.AddObligationTriggerRequest) (*obligations.AddObligationTriggerResponse, error) { + // Wrap Connect RPC client request + res, err := w.ServiceClient.AddObligationTrigger(ctx, connect.NewRequest(req)) + if res == nil { + return nil, err + } + return res.Msg, err +} + +func (w *ServiceClientConnectWrapper) RemoveObligationTrigger(ctx context.Context, req *obligations.RemoveObligationTriggerRequest) (*obligations.RemoveObligationTriggerResponse, error) { + // Wrap Connect RPC client request + res, err := w.ServiceClient.RemoveObligationTrigger(ctx, connect.NewRequest(req)) + if res == nil { + return nil, err + } + return res.Msg, err +} From 92a72b957032930b273ada4ad20b3ac6078c0e39 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Fri, 15 Aug 2025 03:49:42 -0400 Subject: [PATCH 071/137] modify codegen --- sdk/codegen/runner/generate.go | 29 ++++++++++++++++----------- sdk/sdk.go | 4 ++-- sdk/sdkconnect/obligations.go | 36 +++++++++++++++++----------------- 3 files changed, 38 insertions(+), 31 deletions(-) diff --git a/sdk/codegen/runner/generate.go b/sdk/codegen/runner/generate.go index ce5cc2156a..9f70d631f2 100644 --- a/sdk/codegen/runner/generate.go +++ b/sdk/codegen/runner/generate.go @@ -8,6 +8,8 @@ import ( "path" "path/filepath" + "golang.org/x/text/cases" + "golang.org/x/text/language" "golang.org/x/tools/go/packages" ) @@ -61,7 +63,12 @@ func Generate(clientsToGenerateList []ClientsToGenerate, outputDir string) error if client.PackageNameOverride != "" { packageName = client.PackageNameOverride } - code := generateWrapper(ts.Name.Name, iface, client.GrpcPackagePath, packageName, client.Suffix) + uniqueSvcName := ts.Name.Name + if ts.Name.Name == "ServiceClient" { + prefix := cases.Title(language.English).String(packageName) + uniqueSvcName = prefix + ts.Name.Name + } + code := generateWrapper(ts.Name.Name, iface, client.GrpcPackagePath, packageName, client.Suffix, uniqueSvcName) outputPath := filepath.Join(outputDir, packageName+".go") err = os.WriteFile(outputPath, []byte(code), 0o644) //nolint:gosec // ignore G306 if err != nil { @@ -105,7 +112,7 @@ func getMethodNames(interfaceType *ast.InterfaceType) []string { } // Generate wrapper code for the Connect RPC client interface -func generateWrapper(interfaceName string, interfaceType *ast.InterfaceType, packagePath string, packageName string, suffix string) string { +func generateWrapper(interfaceName string, interfaceType *ast.InterfaceType, packagePath string, packageName string, suffix string, uniqueSvcName string) string { // Get method names dynamically from the interface methods := getMethodNames(interfaceType) connectPackageName := packageName + "connect" @@ -129,28 +136,28 @@ func New%s%sConnectWrapper(httpClient connect.HTTPClient, baseURL string, opts . return &%s%sConnectWrapper{%s: %s.New%s(httpClient, baseURL, opts...)} } `, - interfaceName, + uniqueSvcName, packagePath, packagePath+"/"+connectPackageName, - interfaceName, + uniqueSvcName, suffix, connectPackageName, interfaceName, - interfaceName, + uniqueSvcName, suffix, - interfaceName, + uniqueSvcName, suffix, - interfaceName, + uniqueSvcName, suffix, interfaceName, connectPackageName, interfaceName) // Generate the interface type definition - wrapperCode += generateInterfaceType(interfaceName, methods, packageName, suffix) + wrapperCode += generateInterfaceType(uniqueSvcName, methods, packageName, suffix) // Now generate a wrapper function for each method in the interface for _, method := range methods { - wrapperCode += generateWrapperMethod(interfaceName, method, packageName, suffix) + wrapperCode += generateWrapperMethod(interfaceName, method, packageName, suffix, uniqueSvcName) } // Output the generated wrapper code @@ -171,7 +178,7 @@ type %s%s interface { } // Generate the wrapper method for a specific method in the interface -func generateWrapperMethod(interfaceName, methodName, packageName string, suffix string) string { +func generateWrapperMethod(interfaceName, methodName, packageName string, suffix string, uniqueSvcName string) string { return fmt.Sprintf(` func (w *%s%sConnectWrapper) %s(ctx context.Context, req *%s.%sRequest) (*%s.%sResponse, error) { // Wrap Connect RPC client request @@ -181,5 +188,5 @@ func (w *%s%sConnectWrapper) %s(ctx context.Context, req *%s.%sRequest) (*%s.%sR } return res.Msg, err } -`, interfaceName, suffix, methodName, packageName, methodName, packageName, methodName, interfaceName, methodName) +`, uniqueSvcName, suffix, methodName, packageName, methodName, packageName, methodName, interfaceName, methodName) } diff --git a/sdk/sdk.go b/sdk/sdk.go index d12aa991f1..45af3b275d 100644 --- a/sdk/sdk.go +++ b/sdk/sdk.go @@ -63,7 +63,7 @@ type SDK struct { EntityResolutionV2 sdkconnect.EntityResolutionServiceClientV2 KeyAccessServerRegistry sdkconnect.KeyAccessServerRegistryServiceClient Namespaces sdkconnect.NamespaceServiceClient - Obligations sdkconnect.ServiceClient + Obligations sdkconnect.ObligationsServiceClient RegisteredResources sdkconnect.RegisteredResourcesServiceClient ResourceMapping sdkconnect.ResourceMappingServiceClient SubjectMapping sdkconnect.SubjectMappingServiceClient @@ -189,7 +189,7 @@ func New(platformEndpoint string, opts ...Option) (*SDK, error) { Actions: sdkconnect.NewActionServiceClientConnectWrapper(platformConn.Client, platformConn.Endpoint, platformConn.Options...), Attributes: sdkconnect.NewAttributesServiceClientConnectWrapper(platformConn.Client, platformConn.Endpoint, platformConn.Options...), Namespaces: sdkconnect.NewNamespaceServiceClientConnectWrapper(platformConn.Client, platformConn.Endpoint, platformConn.Options...), - Obligations: sdkconnect.NewServiceClientConnectWrapper(platformConn.Client, platformConn.Endpoint, platformConn.Options...), + Obligations: sdkconnect.NewObligationsServiceClientConnectWrapper(platformConn.Client, platformConn.Endpoint, platformConn.Options...), RegisteredResources: sdkconnect.NewRegisteredResourcesServiceClientConnectWrapper(platformConn.Client, platformConn.Endpoint, platformConn.Options...), ResourceMapping: sdkconnect.NewResourceMappingServiceClientConnectWrapper(platformConn.Client, platformConn.Endpoint, platformConn.Options...), SubjectMapping: sdkconnect.NewSubjectMappingServiceClientConnectWrapper(platformConn.Client, platformConn.Endpoint, platformConn.Options...), diff --git a/sdk/sdkconnect/obligations.go b/sdk/sdkconnect/obligations.go index ec0c80dd45..dbd54866ff 100644 --- a/sdk/sdkconnect/obligations.go +++ b/sdk/sdkconnect/obligations.go @@ -1,4 +1,4 @@ -// Wrapper for ServiceClient (generated code) DO NOT EDIT +// Wrapper for ObligationsServiceClient (generated code) DO NOT EDIT package sdkconnect import ( @@ -8,15 +8,15 @@ import ( "github.com/opentdf/platform/protocol/go/policy/obligations/obligationsconnect" ) -type ServiceClientConnectWrapper struct { +type ObligationsServiceClientConnectWrapper struct { obligationsconnect.ServiceClient } -func NewServiceClientConnectWrapper(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) *ServiceClientConnectWrapper { - return &ServiceClientConnectWrapper{ServiceClient: obligationsconnect.NewServiceClient(httpClient, baseURL, opts...)} +func NewObligationsServiceClientConnectWrapper(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) *ObligationsServiceClientConnectWrapper { + return &ObligationsServiceClientConnectWrapper{ServiceClient: obligationsconnect.NewServiceClient(httpClient, baseURL, opts...)} } -type ServiceClient interface { +type ObligationsServiceClient interface { ListObligations(ctx context.Context, req *obligations.ListObligationsRequest) (*obligations.ListObligationsResponse, error) GetObligation(ctx context.Context, req *obligations.GetObligationRequest) (*obligations.GetObligationResponse, error) GetObligationsByFQNs(ctx context.Context, req *obligations.GetObligationsByFQNsRequest) (*obligations.GetObligationsByFQNsResponse, error) @@ -32,7 +32,7 @@ type ServiceClient interface { RemoveObligationTrigger(ctx context.Context, req *obligations.RemoveObligationTriggerRequest) (*obligations.RemoveObligationTriggerResponse, error) } -func (w *ServiceClientConnectWrapper) ListObligations(ctx context.Context, req *obligations.ListObligationsRequest) (*obligations.ListObligationsResponse, error) { +func (w *ObligationsServiceClientConnectWrapper) ListObligations(ctx context.Context, req *obligations.ListObligationsRequest) (*obligations.ListObligationsResponse, error) { // Wrap Connect RPC client request res, err := w.ServiceClient.ListObligations(ctx, connect.NewRequest(req)) if res == nil { @@ -41,7 +41,7 @@ func (w *ServiceClientConnectWrapper) ListObligations(ctx context.Context, req * return res.Msg, err } -func (w *ServiceClientConnectWrapper) GetObligation(ctx context.Context, req *obligations.GetObligationRequest) (*obligations.GetObligationResponse, error) { +func (w *ObligationsServiceClientConnectWrapper) GetObligation(ctx context.Context, req *obligations.GetObligationRequest) (*obligations.GetObligationResponse, error) { // Wrap Connect RPC client request res, err := w.ServiceClient.GetObligation(ctx, connect.NewRequest(req)) if res == nil { @@ -50,7 +50,7 @@ func (w *ServiceClientConnectWrapper) GetObligation(ctx context.Context, req *ob return res.Msg, err } -func (w *ServiceClientConnectWrapper) GetObligationsByFQNs(ctx context.Context, req *obligations.GetObligationsByFQNsRequest) (*obligations.GetObligationsByFQNsResponse, error) { +func (w *ObligationsServiceClientConnectWrapper) GetObligationsByFQNs(ctx context.Context, req *obligations.GetObligationsByFQNsRequest) (*obligations.GetObligationsByFQNsResponse, error) { // Wrap Connect RPC client request res, err := w.ServiceClient.GetObligationsByFQNs(ctx, connect.NewRequest(req)) if res == nil { @@ -59,7 +59,7 @@ func (w *ServiceClientConnectWrapper) GetObligationsByFQNs(ctx context.Context, return res.Msg, err } -func (w *ServiceClientConnectWrapper) CreateObligation(ctx context.Context, req *obligations.CreateObligationRequest) (*obligations.CreateObligationResponse, error) { +func (w *ObligationsServiceClientConnectWrapper) CreateObligation(ctx context.Context, req *obligations.CreateObligationRequest) (*obligations.CreateObligationResponse, error) { // Wrap Connect RPC client request res, err := w.ServiceClient.CreateObligation(ctx, connect.NewRequest(req)) if res == nil { @@ -68,7 +68,7 @@ func (w *ServiceClientConnectWrapper) CreateObligation(ctx context.Context, req return res.Msg, err } -func (w *ServiceClientConnectWrapper) UpdateObligation(ctx context.Context, req *obligations.UpdateObligationRequest) (*obligations.UpdateObligationResponse, error) { +func (w *ObligationsServiceClientConnectWrapper) UpdateObligation(ctx context.Context, req *obligations.UpdateObligationRequest) (*obligations.UpdateObligationResponse, error) { // Wrap Connect RPC client request res, err := w.ServiceClient.UpdateObligation(ctx, connect.NewRequest(req)) if res == nil { @@ -77,7 +77,7 @@ func (w *ServiceClientConnectWrapper) UpdateObligation(ctx context.Context, req return res.Msg, err } -func (w *ServiceClientConnectWrapper) DeleteObligation(ctx context.Context, req *obligations.DeleteObligationRequest) (*obligations.DeleteObligationResponse, error) { +func (w *ObligationsServiceClientConnectWrapper) DeleteObligation(ctx context.Context, req *obligations.DeleteObligationRequest) (*obligations.DeleteObligationResponse, error) { // Wrap Connect RPC client request res, err := w.ServiceClient.DeleteObligation(ctx, connect.NewRequest(req)) if res == nil { @@ -86,7 +86,7 @@ func (w *ServiceClientConnectWrapper) DeleteObligation(ctx context.Context, req return res.Msg, err } -func (w *ServiceClientConnectWrapper) GetObligationValue(ctx context.Context, req *obligations.GetObligationValueRequest) (*obligations.GetObligationValueResponse, error) { +func (w *ObligationsServiceClientConnectWrapper) GetObligationValue(ctx context.Context, req *obligations.GetObligationValueRequest) (*obligations.GetObligationValueResponse, error) { // Wrap Connect RPC client request res, err := w.ServiceClient.GetObligationValue(ctx, connect.NewRequest(req)) if res == nil { @@ -95,7 +95,7 @@ func (w *ServiceClientConnectWrapper) GetObligationValue(ctx context.Context, re return res.Msg, err } -func (w *ServiceClientConnectWrapper) GetObligationValuesByFQNs(ctx context.Context, req *obligations.GetObligationValuesByFQNsRequest) (*obligations.GetObligationValuesByFQNsResponse, error) { +func (w *ObligationsServiceClientConnectWrapper) GetObligationValuesByFQNs(ctx context.Context, req *obligations.GetObligationValuesByFQNsRequest) (*obligations.GetObligationValuesByFQNsResponse, error) { // Wrap Connect RPC client request res, err := w.ServiceClient.GetObligationValuesByFQNs(ctx, connect.NewRequest(req)) if res == nil { @@ -104,7 +104,7 @@ func (w *ServiceClientConnectWrapper) GetObligationValuesByFQNs(ctx context.Cont return res.Msg, err } -func (w *ServiceClientConnectWrapper) CreateObligationValue(ctx context.Context, req *obligations.CreateObligationValueRequest) (*obligations.CreateObligationValueResponse, error) { +func (w *ObligationsServiceClientConnectWrapper) CreateObligationValue(ctx context.Context, req *obligations.CreateObligationValueRequest) (*obligations.CreateObligationValueResponse, error) { // Wrap Connect RPC client request res, err := w.ServiceClient.CreateObligationValue(ctx, connect.NewRequest(req)) if res == nil { @@ -113,7 +113,7 @@ func (w *ServiceClientConnectWrapper) CreateObligationValue(ctx context.Context, return res.Msg, err } -func (w *ServiceClientConnectWrapper) UpdateObligationValue(ctx context.Context, req *obligations.UpdateObligationValueRequest) (*obligations.UpdateObligationValueResponse, error) { +func (w *ObligationsServiceClientConnectWrapper) UpdateObligationValue(ctx context.Context, req *obligations.UpdateObligationValueRequest) (*obligations.UpdateObligationValueResponse, error) { // Wrap Connect RPC client request res, err := w.ServiceClient.UpdateObligationValue(ctx, connect.NewRequest(req)) if res == nil { @@ -122,7 +122,7 @@ func (w *ServiceClientConnectWrapper) UpdateObligationValue(ctx context.Context, return res.Msg, err } -func (w *ServiceClientConnectWrapper) DeleteObligationValue(ctx context.Context, req *obligations.DeleteObligationValueRequest) (*obligations.DeleteObligationValueResponse, error) { +func (w *ObligationsServiceClientConnectWrapper) DeleteObligationValue(ctx context.Context, req *obligations.DeleteObligationValueRequest) (*obligations.DeleteObligationValueResponse, error) { // Wrap Connect RPC client request res, err := w.ServiceClient.DeleteObligationValue(ctx, connect.NewRequest(req)) if res == nil { @@ -131,7 +131,7 @@ func (w *ServiceClientConnectWrapper) DeleteObligationValue(ctx context.Context, return res.Msg, err } -func (w *ServiceClientConnectWrapper) AddObligationTrigger(ctx context.Context, req *obligations.AddObligationTriggerRequest) (*obligations.AddObligationTriggerResponse, error) { +func (w *ObligationsServiceClientConnectWrapper) AddObligationTrigger(ctx context.Context, req *obligations.AddObligationTriggerRequest) (*obligations.AddObligationTriggerResponse, error) { // Wrap Connect RPC client request res, err := w.ServiceClient.AddObligationTrigger(ctx, connect.NewRequest(req)) if res == nil { @@ -140,7 +140,7 @@ func (w *ServiceClientConnectWrapper) AddObligationTrigger(ctx context.Context, return res.Msg, err } -func (w *ServiceClientConnectWrapper) RemoveObligationTrigger(ctx context.Context, req *obligations.RemoveObligationTriggerRequest) (*obligations.RemoveObligationTriggerResponse, error) { +func (w *ObligationsServiceClientConnectWrapper) RemoveObligationTrigger(ctx context.Context, req *obligations.RemoveObligationTriggerRequest) (*obligations.RemoveObligationTriggerResponse, error) { // Wrap Connect RPC client request res, err := w.ServiceClient.RemoveObligationTrigger(ctx, connect.NewRequest(req)) if res == nil { From 62fa2270a88c4e9c59750c8dc282a7f8e33e0165 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Fri, 15 Aug 2025 04:05:20 -0400 Subject: [PATCH 072/137] codegen refactor complete --- sdk/codegen/runner/generate.go | 48 ++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/sdk/codegen/runner/generate.go b/sdk/codegen/runner/generate.go index 9f70d631f2..a64ccf0843 100644 --- a/sdk/codegen/runner/generate.go +++ b/sdk/codegen/runner/generate.go @@ -63,12 +63,11 @@ func Generate(clientsToGenerateList []ClientsToGenerate, outputDir string) error if client.PackageNameOverride != "" { packageName = client.PackageNameOverride } - uniqueSvcName := ts.Name.Name + prefix := "" if ts.Name.Name == "ServiceClient" { - prefix := cases.Title(language.English).String(packageName) - uniqueSvcName = prefix + ts.Name.Name + prefix = cases.Title(language.English).String(packageName) } - code := generateWrapper(ts.Name.Name, iface, client.GrpcPackagePath, packageName, client.Suffix, uniqueSvcName) + code := generateWrapper(ts.Name.Name, iface, client.GrpcPackagePath, packageName, prefix, client.Suffix) outputPath := filepath.Join(outputDir, packageName+".go") err = os.WriteFile(outputPath, []byte(code), 0o644) //nolint:gosec // ignore G306 if err != nil { @@ -112,13 +111,13 @@ func getMethodNames(interfaceType *ast.InterfaceType) []string { } // Generate wrapper code for the Connect RPC client interface -func generateWrapper(interfaceName string, interfaceType *ast.InterfaceType, packagePath string, packageName string, suffix string, uniqueSvcName string) string { +func generateWrapper(interfaceName string, interfaceType *ast.InterfaceType, packagePath, packageName, prefix, suffix string) string { // Get method names dynamically from the interface methods := getMethodNames(interfaceType) connectPackageName := packageName + "connect" // Start generating the wrapper code - wrapperCode := fmt.Sprintf(`// Wrapper for %s (generated code) DO NOT EDIT + wrapperCode := fmt.Sprintf(`// Wrapper for %s%s (generated code) DO NOT EDIT package sdkconnect import ( @@ -128,47 +127,52 @@ import ( "%s" ) -type %s%sConnectWrapper struct { +type %s%s%sConnectWrapper struct { %s.%s } -func New%s%sConnectWrapper(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) *%s%sConnectWrapper { - return &%s%sConnectWrapper{%s: %s.New%s(httpClient, baseURL, opts...)} +func New%s%s%sConnectWrapper(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) *%s%s%sConnectWrapper { + return &%s%s%sConnectWrapper{%s: %s.New%s(httpClient, baseURL, opts...)} } `, - uniqueSvcName, + prefix, + interfaceName, packagePath, packagePath+"/"+connectPackageName, - uniqueSvcName, + prefix, + interfaceName, suffix, connectPackageName, interfaceName, - uniqueSvcName, + prefix, + interfaceName, suffix, - uniqueSvcName, + prefix, + interfaceName, suffix, - uniqueSvcName, + prefix, + interfaceName, suffix, interfaceName, connectPackageName, interfaceName) // Generate the interface type definition - wrapperCode += generateInterfaceType(uniqueSvcName, methods, packageName, suffix) + wrapperCode += generateInterfaceType(interfaceName, methods, packageName, prefix, suffix) // Now generate a wrapper function for each method in the interface for _, method := range methods { - wrapperCode += generateWrapperMethod(interfaceName, method, packageName, suffix, uniqueSvcName) + wrapperCode += generateWrapperMethod(interfaceName, method, packageName, prefix, suffix) } // Output the generated wrapper code return wrapperCode } -func generateInterfaceType(interfaceName string, methods []string, packageName string, suffix string) string { +func generateInterfaceType(interfaceName string, methods []string, packageName, prefix, suffix string) string { // Generate the interface type definition interfaceType := fmt.Sprintf(` -type %s%s interface { -`, interfaceName, suffix) +type %s%s%s interface { +`, prefix, interfaceName, suffix) for _, method := range methods { interfaceType += fmt.Sprintf(` %s(ctx context.Context, req *%s.%sRequest) (*%s.%sResponse, error) `, method, packageName, method, packageName, method) @@ -178,9 +182,9 @@ type %s%s interface { } // Generate the wrapper method for a specific method in the interface -func generateWrapperMethod(interfaceName, methodName, packageName string, suffix string, uniqueSvcName string) string { +func generateWrapperMethod(interfaceName, methodName, packageName, prefix, suffix string) string { return fmt.Sprintf(` -func (w *%s%sConnectWrapper) %s(ctx context.Context, req *%s.%sRequest) (*%s.%sResponse, error) { +func (w *%s%s%sConnectWrapper) %s(ctx context.Context, req *%s.%sRequest) (*%s.%sResponse, error) { // Wrap Connect RPC client request res, err := w.%s.%s(ctx, connect.NewRequest(req)) if res == nil { @@ -188,5 +192,5 @@ func (w *%s%sConnectWrapper) %s(ctx context.Context, req *%s.%sRequest) (*%s.%sR } return res.Msg, err } -`, uniqueSvcName, suffix, methodName, packageName, methodName, packageName, methodName, interfaceName, methodName) +`, prefix, interfaceName, suffix, methodName, packageName, methodName, packageName, methodName, interfaceName, methodName) } From 7a8a1f3a9f7e3a0e38e8799a2dfe2bba455eb57f Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Fri, 15 Aug 2025 04:09:44 -0400 Subject: [PATCH 073/137] go mod tidy --- sdk/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/go.mod b/sdk/go.mod index 1aa086e926..2ec7c8410f 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -18,6 +18,7 @@ require ( github.com/testcontainers/testcontainers-go v0.37.0 github.com/xeipuuv/gojsonschema v1.2.0 golang.org/x/oauth2 v0.30.0 + golang.org/x/text v0.26.0 golang.org/x/tools v0.34.0 google.golang.org/grpc v1.73.0 google.golang.org/protobuf v1.36.6 @@ -94,7 +95,6 @@ require ( golang.org/x/net v0.41.0 // indirect golang.org/x/sync v0.15.0 // indirect golang.org/x/sys v0.33.0 // indirect - golang.org/x/text v0.26.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect From 232a6e52d25424e927d114de9ad0aca1f6df3b47 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Fri, 15 Aug 2025 16:40:21 -0400 Subject: [PATCH 074/137] add audit to create obligation --- service/logger/audit/constants.go | 2 ++ service/policy/obligations/obligations.go | 26 +++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/service/logger/audit/constants.go b/service/logger/audit/constants.go index d420b95b5d..20fff4dbfd 100644 --- a/service/logger/audit/constants.go +++ b/service/logger/audit/constants.go @@ -11,6 +11,7 @@ const ( ObjectTypeResourceMapping ObjectTypeAttributeDefinition ObjectTypeAttributeValue + ObjectTypeObligationDefinition ObjectTypeNamespace ObjectTypeConditionSet ObjectTypeKasRegistry @@ -37,6 +38,7 @@ func (ot ObjectType) String() string { "resource_mapping", "attribute_definition", "attribute_value", + "obligation_definition", "namespace", "condition_set", "kas_registry", diff --git a/service/policy/obligations/obligations.go b/service/policy/obligations/obligations.go index 58e763e7af..3b04451e4c 100644 --- a/service/policy/obligations/obligations.go +++ b/service/policy/obligations/obligations.go @@ -10,6 +10,7 @@ import ( "github.com/opentdf/platform/protocol/go/policy/obligations" "github.com/opentdf/platform/protocol/go/policy/obligations/obligationsconnect" "github.com/opentdf/platform/service/logger" + "github.com/opentdf/platform/service/logger/audit" "github.com/opentdf/platform/service/pkg/config" "github.com/opentdf/platform/service/pkg/db" "github.com/opentdf/platform/service/pkg/serviceregistry" @@ -99,13 +100,34 @@ func (s *Service) ListObligations(ctx context.Context, req *connect.Request[obli } func (s *Service) CreateObligation(ctx context.Context, req *connect.Request[obligations.CreateObligationRequest]) (*connect.Response[obligations.CreateObligationResponse], error) { + rsp := &obligations.CreateObligationResponse{} + + auditParams := audit.PolicyEventParams{ + ActionType: audit.ActionTypeCreate, + ObjectType: audit.ObjectTypeObligationDefinition, + } + s.logger.DebugContext(ctx, "creating obligation", slog.String("name", req.Msg.GetName())) - obl, err := s.dbClient.CreateObligation(ctx, req.Msg) + err := s.dbClient.RunInTx(ctx, func(txClient *policydb.PolicyDBClient) error { + obl, err := txClient.CreateObligation(ctx, req.Msg) + if err != nil { + return err + } + + auditParams.ObjectID = obl.GetId() + auditParams.Original = obl + s.logger.Audit.PolicyCRUDSuccess(ctx, auditParams) + + rsp.Obligation = obl + return nil + }) if err != nil { + s.logger.Audit.PolicyCRUDFailure(ctx, auditParams) return nil, db.StatusifyError(ctx, s.logger, err, db.ErrTextCreationFailed, slog.String("obligation", req.Msg.String())) } - return connect.NewResponse(&obligations.CreateObligationResponse{Obligation: obl}), nil + + return connect.NewResponse(rsp), nil } func (s *Service) GetObligation(ctx context.Context, req *connect.Request[obligations.GetObligationRequest]) (*connect.Response[obligations.GetObligationResponse], error) { From 554b811c46630a69e648411ecb9392277919eab6 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Fri, 15 Aug 2025 18:03:43 -0400 Subject: [PATCH 075/137] add audit to update obligation --- service/policy/obligations/obligations.go | 35 +++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/service/policy/obligations/obligations.go b/service/policy/obligations/obligations.go index 3b04451e4c..ef7491d079 100644 --- a/service/policy/obligations/obligations.go +++ b/service/policy/obligations/obligations.go @@ -158,13 +158,44 @@ func (s *Service) GetObligationsByFQNs(ctx context.Context, req *connect.Request func (s *Service) UpdateObligation(ctx context.Context, req *connect.Request[obligations.UpdateObligationRequest]) (*connect.Response[obligations.UpdateObligationResponse], error) { id := req.Msg.GetId() + + rsp := &obligations.UpdateObligationResponse{} + + auditParams := audit.PolicyEventParams{ + ActionType: audit.ActionTypeUpdate, + ObjectType: audit.ObjectTypeRegisteredResource, + ObjectID: id, + } + s.logger.DebugContext(ctx, "updating obligation", slog.String("id", id)) - obl, err := s.dbClient.UpdateObligation(ctx, req.Msg) + err := s.dbClient.RunInTx(ctx, func(txClient *policydb.PolicyDBClient) error { + original, err := txClient.GetObligation(ctx, &obligations.GetObligationRequest{ + Identifier: &obligations.GetObligationRequest_Id{ + Id: id, + }, + }) + if err != nil { + return err + } + + updated, err := txClient.UpdateObligation(ctx, req.Msg) + if err != nil { + return err + } + + auditParams.Original = original + auditParams.Updated = updated + s.logger.Audit.PolicyCRUDSuccess(ctx, auditParams) + + rsp.Obligation = updated + return nil + }) if err != nil { + s.logger.Audit.PolicyCRUDFailure(ctx, auditParams) return nil, db.StatusifyError(ctx, s.logger, err, db.ErrTextUpdateFailed, slog.String("obligation", req.Msg.String())) } - return connect.NewResponse(&obligations.UpdateObligationResponse{Obligation: obl}), nil + return connect.NewResponse(rsp), nil } func (s *Service) DeleteObligation(ctx context.Context, req *connect.Request[obligations.DeleteObligationRequest]) (*connect.Response[obligations.DeleteObligationResponse], error) { From 08f252d61d5bc8a9e3ab6daa59f9abc6ca3ca878 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Fri, 15 Aug 2025 23:36:08 -0400 Subject: [PATCH 076/137] add audit to delete obligation --- service/policy/obligations/obligations.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/service/policy/obligations/obligations.go b/service/policy/obligations/obligations.go index ef7491d079..3bfdcefa18 100644 --- a/service/policy/obligations/obligations.go +++ b/service/policy/obligations/obligations.go @@ -163,7 +163,7 @@ func (s *Service) UpdateObligation(ctx context.Context, req *connect.Request[obl auditParams := audit.PolicyEventParams{ ActionType: audit.ActionTypeUpdate, - ObjectType: audit.ObjectTypeRegisteredResource, + ObjectType: audit.ObjectTypeObligationDefinition, ObjectID: id, } @@ -200,13 +200,24 @@ func (s *Service) UpdateObligation(ctx context.Context, req *connect.Request[obl func (s *Service) DeleteObligation(ctx context.Context, req *connect.Request[obligations.DeleteObligationRequest]) (*connect.Response[obligations.DeleteObligationResponse], error) { id := req.Msg.GetId() + + auditParams := audit.PolicyEventParams{ + ActionType: audit.ActionTypeDelete, + ObjectType: audit.ObjectTypeObligationDefinition, + ObjectID: id, + } + s.logger.DebugContext(ctx, "deleting obligation", slog.String("id", id)) - obl, err := s.dbClient.DeleteObligation(ctx, req.Msg) + deleted, err := s.dbClient.DeleteObligation(ctx, req.Msg) if err != nil { + s.logger.Audit.PolicyCRUDFailure(ctx, auditParams) return nil, db.StatusifyError(ctx, s.logger, err, db.ErrTextDeletionFailed, slog.String("obligation", req.Msg.String())) } - rsp := &obligations.DeleteObligationResponse{Obligation: obl} + + s.logger.Audit.PolicyCRUDSuccess(ctx, auditParams) + + rsp := &obligations.DeleteObligationResponse{Obligation: deleted} return connect.NewResponse(rsp), nil } From c3a30243d3970585b729d11376c50e289e89f541 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Fri, 15 Aug 2025 23:53:10 -0400 Subject: [PATCH 077/137] codegen prefix comment --- sdk/codegen/runner/generate.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sdk/codegen/runner/generate.go b/sdk/codegen/runner/generate.go index a64ccf0843..5d663cb051 100644 --- a/sdk/codegen/runner/generate.go +++ b/sdk/codegen/runner/generate.go @@ -63,6 +63,9 @@ func Generate(clientsToGenerateList []ClientsToGenerate, outputDir string) error if client.PackageNameOverride != "" { packageName = client.PackageNameOverride } + // In order to counter package name fatigue (policy.attributes.AttributesService), + // newer services are simply named "Service" (policy.obligations.Service). + // This prefix logic is necessary for newer services. prefix := "" if ts.Name.Name == "ServiceClient" { prefix = cases.Title(language.English).String(packageName) From 45975c4c49628a52cb2ee68bc5313920d68f4c3b Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Sat, 16 Aug 2025 23:52:15 -0400 Subject: [PATCH 078/137] make name change optional for UpdateObligation and write new test --- service/integration/obligations_test.go | 16 +++++++++++++++- service/policy/db/obligations.go | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 55391cc730..4ad3510de3 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -365,7 +365,7 @@ func (s *ObligationsSuite) Test_UpdateObligation_Succeeds() { namespaceID, namespaceFQN, namespace := s.getNamespaceData(nsExampleCom) createdObl := s.createObligation(namespaceID, oblName, oblVals) - // Update the obligation + // Update the obligation (with name change) newName := oblName + "-updated" newMetadata := &common.MetadataMutable{ Labels: map[string]string{"key": "value"}, @@ -381,6 +381,20 @@ func (s *ObligationsSuite) Test_UpdateObligation_Succeeds() { s.Equal(newMetadata.GetLabels(), updatedObl.GetMetadata().GetLabels()) s.assertObligationValues(updatedObl) + // Update the obligation (with no name change) + newMetadata = &common.MetadataMutable{ + Labels: map[string]string{"diffKey": "diffVal"}, + } + updatedObl, err = s.db.PolicyClient.UpdateObligation(s.ctx, &obligations.UpdateObligationRequest{ + Id: createdObl.GetId(), + Metadata: newMetadata, + MetadataUpdateBehavior: 2, + }) + s.Require().NoError(err) + s.assertObligationBasics(updatedObl, newName, namespaceID, namespace.Name, namespaceFQN) + s.Equal(newMetadata.GetLabels(), updatedObl.GetMetadata().GetLabels()) + s.assertObligationValues(updatedObl) + s.deleteObligations([]string{updatedObl.GetId()}) } diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index dffabe9db1..6384384353 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -224,6 +224,9 @@ func (c PolicyDBClient) UpdateObligation(ctx context.Context, r *obligations.Upd if err != nil { return nil, err } + if name == "" { + name = obl.GetName() + } metadataJSON, metadata, err := db.MarshalUpdateMetadata(r.GetMetadata(), r.GetMetadataUpdateBehavior(), func() (*common.Metadata, error) { return obl.GetMetadata(), nil }) From b284548c928d3f907d425354b52c637a13e63556 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Sun, 17 Aug 2025 00:43:59 -0400 Subject: [PATCH 079/137] add delete by fqn test --- service/integration/obligations_test.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 4ad3510de3..67c71a58b6 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -11,6 +11,7 @@ import ( "github.com/opentdf/platform/protocol/go/policy/obligations" "github.com/opentdf/platform/service/internal/fixtures" "github.com/opentdf/platform/service/pkg/db" + policydb "github.com/opentdf/platform/service/policy/db" "github.com/stretchr/testify/suite" ) @@ -410,7 +411,7 @@ func (s *ObligationsSuite) Test_UpdateObligation_Fails() { // Delete func (s *ObligationsSuite) Test_DeleteObligation_Succeeds() { - namespaceID, _, _ := s.getNamespaceData(nsExampleCom) + namespaceID, namespaceFQN, _ := s.getNamespaceData(nsExampleCom) createdObl := s.createObligation(namespaceID, oblName, oblVals) // Get the obligation to ensure it exists @@ -422,7 +423,7 @@ func (s *ObligationsSuite) Test_DeleteObligation_Succeeds() { s.Require().NoError(err) s.NotNil(obl) - // Delete the obligation + // Delete the obligation by ID obl, err = s.db.PolicyClient.DeleteObligation(s.ctx, &obligations.DeleteObligationRequest{ Identifier: &obligations.DeleteObligationRequest_Id{ Id: createdObl.GetId(), @@ -440,6 +441,19 @@ func (s *ObligationsSuite) Test_DeleteObligation_Succeeds() { }) s.Require().ErrorIs(err, db.ErrNotFound) s.Nil(obl) + + createdObl = s.createObligation(namespaceID, oblName, oblVals) + + // Delete the obligation by FQN + fqn := policydb.BuildOblFQN(namespaceFQN, oblName) + obl, err = s.db.PolicyClient.DeleteObligation(s.ctx, &obligations.DeleteObligationRequest{ + Identifier: &obligations.DeleteObligationRequest_Fqn{ + Fqn: fqn, + }, + }) + s.Require().NoError(err) + s.NotNil(obl) + s.Equal(createdObl.GetId(), obl.GetId()) } func (s *ObligationsSuite) Test_DeleteObligation_Fails() { From d4d2c42330fa4469f7a03970df95176431347f2e Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Sun, 17 Aug 2025 01:09:39 -0400 Subject: [PATCH 080/137] modify delete query to take id or fqn --- service/policy/db/obligations.go | 9 ++++- service/policy/db/obligations.sql.go | 46 +++++++++++++++++++++-- service/policy/db/queries/obligations.sql | 18 ++++++++- 3 files changed, 67 insertions(+), 6 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 6384384353..b3997efdf4 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -257,7 +257,14 @@ func (c PolicyDBClient) UpdateObligation(ctx context.Context, r *obligations.Upd func (c PolicyDBClient) DeleteObligation(ctx context.Context, r *obligations.DeleteObligationRequest) (*policy.Obligation, error) { id := r.GetId() - count, err := c.queries.deleteObligation(ctx, id) + nsFQN, oblName := breakOblFQN(r.GetFqn()) + queryParams := deleteObligationParams{ + ID: id, + NamespaceFqn: nsFQN, + Name: oblName, + } + + count, err := c.queries.deleteObligation(ctx, queryParams) if err != nil { return nil, db.WrapIfKnownInvalidQueryErr(err) } diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index e0798428eb..e1396c7b7e 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -157,14 +157,52 @@ func (q *Queries) createObligation(ctx context.Context, arg createObligationPara } const deleteObligation = `-- name: deleteObligation :execrows -DELETE FROM obligation_definitions WHERE id = $1 +DELETE FROM obligation_definitions +WHERE id IN ( + SELECT od.id + FROM obligation_definitions od + LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id + LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL + WHERE + -- lookup by obligation id OR by namespace fqn + obligation name + ( + -- lookup by obligation id + (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) + OR + -- lookup by namespace fqn + obligation name + (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL + AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) + ) +) ` +type deleteObligationParams struct { + ID string `json:"id"` + NamespaceFqn string `json:"namespace_fqn"` + Name string `json:"name"` +} + // deleteObligation // -// DELETE FROM obligation_definitions WHERE id = $1 -func (q *Queries) deleteObligation(ctx context.Context, id string) (int64, error) { - result, err := q.db.Exec(ctx, deleteObligation, id) +// DELETE FROM obligation_definitions +// WHERE id IN ( +// SELECT od.id +// FROM obligation_definitions od +// LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id +// LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL +// WHERE +// -- lookup by obligation id OR by namespace fqn + obligation name +// ( +// -- lookup by obligation id +// (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) +// OR +// -- lookup by namespace fqn + obligation name +// (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL +// AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) +// ) +// ) +func (q *Queries) deleteObligation(ctx context.Context, arg deleteObligationParams) (int64, error) { + result, err := q.db.Exec(ctx, deleteObligation, arg.ID, arg.NamespaceFqn, arg.Name) if err != nil { return 0, err } diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index dce4d7f751..b87605dd61 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -136,7 +136,23 @@ SET WHERE id = @id; -- name: deleteObligation :execrows -DELETE FROM obligation_definitions WHERE id = $1; +DELETE FROM obligation_definitions +WHERE id IN ( + SELECT od.id + FROM obligation_definitions od + LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id + LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL + WHERE + -- lookup by obligation id OR by namespace fqn + obligation name + ( + -- lookup by obligation id + (NULLIF(@id::TEXT, '') IS NOT NULL AND od.id = @id::UUID) + OR + -- lookup by namespace fqn + obligation name + (NULLIF(@namespace_fqn::TEXT, '') IS NOT NULL AND NULLIF(@name::TEXT, '') IS NOT NULL + AND fqns.fqn = @namespace_fqn::VARCHAR AND od.name = @name::VARCHAR) + ) +); -- name: getObligationsByFQNs :many SELECT From d7a5521a2261c8f22b9bf4009f951ec94da3d5f2 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Sun, 17 Aug 2025 01:17:12 -0400 Subject: [PATCH 081/137] fix rest of del obl --- service/policy/db/obligations.go | 7 +++---- service/policy/db/obligations.sql.go | 15 ++++++++------- service/policy/db/queries/obligations.sql | 5 +++-- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index b3997efdf4..318239ff82 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -256,19 +256,18 @@ func (c PolicyDBClient) UpdateObligation(ctx context.Context, r *obligations.Upd } func (c PolicyDBClient) DeleteObligation(ctx context.Context, r *obligations.DeleteObligationRequest) (*policy.Obligation, error) { - id := r.GetId() nsFQN, oblName := breakOblFQN(r.GetFqn()) queryParams := deleteObligationParams{ - ID: id, + ID: r.GetId(), NamespaceFqn: nsFQN, Name: oblName, } - count, err := c.queries.deleteObligation(ctx, queryParams) + id, err := c.queries.deleteObligation(ctx, queryParams) if err != nil { return nil, db.WrapIfKnownInvalidQueryErr(err) } - if count == 0 { + if id == "" { return nil, db.ErrNotFound } diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index e1396c7b7e..2513d5ef53 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -156,7 +156,7 @@ func (q *Queries) createObligation(ctx context.Context, arg createObligationPara return i, err } -const deleteObligation = `-- name: deleteObligation :execrows +const deleteObligation = `-- name: deleteObligation :one DELETE FROM obligation_definitions WHERE id IN ( SELECT od.id @@ -174,6 +174,7 @@ WHERE id IN ( AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) ) ) +RETURNING id ` type deleteObligationParams struct { @@ -201,12 +202,12 @@ type deleteObligationParams struct { // AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) // ) // ) -func (q *Queries) deleteObligation(ctx context.Context, arg deleteObligationParams) (int64, error) { - result, err := q.db.Exec(ctx, deleteObligation, arg.ID, arg.NamespaceFqn, arg.Name) - if err != nil { - return 0, err - } - return result.RowsAffected(), nil +// RETURNING id +func (q *Queries) deleteObligation(ctx context.Context, arg deleteObligationParams) (string, error) { + row := q.db.QueryRow(ctx, deleteObligation, arg.ID, arg.NamespaceFqn, arg.Name) + var id string + err := row.Scan(&id) + return id, err } const getObligation = `-- name: getObligation :one diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index b87605dd61..ee15fafc7d 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -135,7 +135,7 @@ SET metadata = COALESCE(@metadata, metadata) WHERE id = @id; --- name: deleteObligation :execrows +-- name: deleteObligation :one DELETE FROM obligation_definitions WHERE id IN ( SELECT od.id @@ -152,7 +152,8 @@ WHERE id IN ( (NULLIF(@namespace_fqn::TEXT, '') IS NOT NULL AND NULLIF(@name::TEXT, '') IS NOT NULL AND fqns.fqn = @namespace_fqn::VARCHAR AND od.name = @name::VARCHAR) ) -); +) +RETURNING id; -- name: getObligationsByFQNs :many SELECT From e9e9b5f5ef43b92426e4cb79449865c390095bdc Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 18 Aug 2025 14:35:38 -0400 Subject: [PATCH 082/137] fix values --- service/integration/obligations_test.go | 1 + service/policy/db/obligations.go | 16 ++++++++-------- service/policy/db/utils.go | 11 ++++++----- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 67c71a58b6..724e74ee46 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -483,6 +483,7 @@ func (s *ObligationsSuite) assertObligationBasics(obl *policy.Obligation, name, } func (s *ObligationsSuite) assertObligationValues(obl *policy.Obligation) { + s.NotEmpty(obl.GetValues()) for _, value := range obl.GetValues() { s.Contains(value.GetValue(), oblValPrefix) } diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 318239ff82..8569708679 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -33,8 +33,8 @@ func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.Cre if err != nil { return nil, db.WrapIfKnownInvalidQueryErr(err) } - oblVals := make([]*policy.ObligationValue, 0, len(values)) - if err := unmarshalObligationValues(row.Values, oblVals); err != nil { + oblVals, err := unmarshalObligationValues(row.Values) + if err != nil { return nil, fmt.Errorf("failed to unmarshal obligation values: %w", err) } @@ -81,8 +81,8 @@ func (c PolicyDBClient) GetObligation(ctx context.Context, r *obligations.GetObl return nil, db.WrapIfKnownInvalidQueryErr(err) } - oblVals := make([]*policy.ObligationValue, 0) - if err := unmarshalObligationValues(row.Values, oblVals); err != nil { + oblVals, err := unmarshalObligationValues(row.Values) + if err != nil { return nil, fmt.Errorf("failed to unmarshal obligation values: %w", err) } @@ -136,8 +136,8 @@ func (c PolicyDBClient) GetObligationsByFQNs(ctx context.Context, r *obligations return nil, fmt.Errorf("failed to unmarshal obligation namespace: %w", err) } - values := []*policy.ObligationValue{} - if err = unmarshalObligationValues(r.Values, values); err != nil { + values, err := unmarshalObligationValues(r.Values) + if err != nil { return nil, err } @@ -183,8 +183,8 @@ func (c PolicyDBClient) ListObligations(ctx context.Context, r *obligations.List return nil, nil, fmt.Errorf("failed to unmarshal obligation namespace: %w", err) } - values := []*policy.ObligationValue{} - if err = unmarshalObligationValues(r.Values, values); err != nil { + values, err := unmarshalObligationValues(r.Values) + if err != nil { return nil, nil, err } diff --git a/service/policy/db/utils.go b/service/policy/db/utils.go index 2ee503cfb7..790c087ed6 100644 --- a/service/policy/db/utils.go +++ b/service/policy/db/utils.go @@ -125,25 +125,26 @@ func unmarshalPrivatePublicKeyContext(pubCtx, privCtx []byte) (*policy.PublicKey return pubKey, privKey, nil } -func unmarshalObligationValues(valuesJSON []byte, values []*policy.ObligationValue) error { +func unmarshalObligationValues(valuesJSON []byte) ([]*policy.ObligationValue, error) { if valuesJSON == nil { - return nil + return nil, nil } raw := []json.RawMessage{} if err := json.Unmarshal(valuesJSON, &raw); err != nil { - return fmt.Errorf("failed to unmarshal values array [%s]: %w", string(valuesJSON), err) + return nil, fmt.Errorf("failed to unmarshal values array [%s]: %w", string(valuesJSON), err) } + values := make([]*policy.ObligationValue, 0, len(raw)) for _, r := range raw { v := &policy.ObligationValue{} if err := protojson.Unmarshal(r, v); err != nil { - return fmt.Errorf("failed to unmarshal value [%s]: %w", string(r), err) + return nil, fmt.Errorf("failed to unmarshal value [%s]: %w", string(r), err) } values = append(values, v) } - return nil + return values, nil } func unmarshalNamespace(namespaceJSON []byte, namespace *policy.Namespace) error { From a5153c11349c25d897cb27dced5b28cd795eaabb Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 18 Aug 2025 19:44:47 -0400 Subject: [PATCH 083/137] fix some metadata time issues --- service/integration/obligations_test.go | 7 +++++++ service/policy/db/obligations.go | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 724e74ee46..ba94a1ae3c 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -5,6 +5,7 @@ import ( "log/slog" "strconv" "testing" + "time" "github.com/opentdf/platform/protocol/go/common" "github.com/opentdf/platform/protocol/go/policy" @@ -480,6 +481,12 @@ func (s *ObligationsSuite) assertObligationBasics(obl *policy.Obligation, name, s.Equal(namespaceID, obl.GetNamespace().GetId()) s.Equal(namespaceName, obl.GetNamespace().GetName()) s.Equal(namespaceFQN, obl.GetNamespace().GetFqn()) + threshold := int64(5) + now := time.Now().Unix() + diff := now - obl.GetMetadata().GetUpdatedAt().GetSeconds() + s.LessOrEqual(diff, threshold) + diff = now - obl.GetMetadata().GetCreatedAt().GetSeconds() + s.LessOrEqual(diff, threshold) } func (s *ObligationsSuite) assertObligationValues(obl *policy.Obligation) { diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 8569708679..e6010f148d 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -9,6 +9,7 @@ import ( "github.com/opentdf/platform/protocol/go/policy" "github.com/opentdf/platform/protocol/go/policy/obligations" "github.com/opentdf/platform/service/pkg/db" + "google.golang.org/protobuf/types/known/timestamppb" ) /// @@ -47,6 +48,9 @@ func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.Cre if err := unmarshalMetadata(row.Metadata, metadata); err != nil { return nil, fmt.Errorf("failed to unmarshal obligation metadata: %w", err) } + now := timestamppb.Now() + metadata.CreatedAt = now + metadata.UpdatedAt = now return &policy.Obligation{ Id: row.ID, @@ -245,6 +249,8 @@ func (c PolicyDBClient) UpdateObligation(ctx context.Context, r *obligations.Upd if count == 0 { return nil, db.ErrNotFound } + metadata.CreatedAt = obl.GetMetadata().GetCreatedAt() + metadata.UpdatedAt = timestamppb.Now() return &policy.Obligation{ Id: id, From 830b03ae02225c5bc64e506dd7822b9a4a908775 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 18 Aug 2025 19:49:19 -0400 Subject: [PATCH 084/137] update sql query for correct metadata time --- service/policy/db/obligations.sql.go | 4 ++-- service/policy/db/queries/obligations.sql | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 2513d5ef53..f6ea36b350 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -308,7 +308,7 @@ const getObligationsByFQNs = `-- name: getObligationsByFQNs :many SELECT od.id, od.name, - od.metadata, + JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', od.metadata -> 'labels', 'created_at', od.created_at,'updated_at', od.updated_at)) as metadata, JSON_BUILD_OBJECT( 'id', n.id, 'name', n.name, @@ -357,7 +357,7 @@ type getObligationsByFQNsRow struct { // SELECT // od.id, // od.name, -// od.metadata, +// JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', od.metadata -> 'labels', 'created_at', od.created_at,'updated_at', od.updated_at)) as metadata, // JSON_BUILD_OBJECT( // 'id', n.id, // 'name', n.name, diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index ee15fafc7d..864f93076f 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -159,7 +159,7 @@ RETURNING id; SELECT od.id, od.name, - od.metadata, + JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', od.metadata -> 'labels', 'created_at', od.created_at,'updated_at', od.updated_at)) as metadata, JSON_BUILD_OBJECT( 'id', n.id, 'name', n.name, From 547d67f912483f8a681cedac216105cbec633330 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 19 Aug 2025 11:23:05 -0400 Subject: [PATCH 085/137] add comment to clarify assertion --- service/integration/obligations_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index ba94a1ae3c..c83ea6ba04 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -481,6 +481,7 @@ func (s *ObligationsSuite) assertObligationBasics(obl *policy.Obligation, name, s.Equal(namespaceID, obl.GetNamespace().GetId()) s.Equal(namespaceName, obl.GetNamespace().GetName()) s.Equal(namespaceFQN, obl.GetNamespace().GetFqn()) + // Assert that timestamps in metadata are recent threshold := int64(5) now := time.Now().Unix() diff := now - obl.GetMetadata().GetUpdatedAt().GetSeconds() From 30bd95f8d72e6400ec529dd945887036bb150108 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Sun, 24 Aug 2025 16:34:15 -0400 Subject: [PATCH 086/137] start create obl val --- service/policy/db/obligations.go | 65 +++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index e6010f148d..4ab7843cc3 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -31,6 +31,7 @@ func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.Cre Values: values, } row, err := c.queries.createObligation(ctx, queryParams) + now := timestamppb.Now() if err != nil { return nil, db.WrapIfKnownInvalidQueryErr(err) } @@ -48,7 +49,6 @@ func (c PolicyDBClient) CreateObligation(ctx context.Context, r *obligations.Cre if err := unmarshalMetadata(row.Metadata, metadata); err != nil { return nil, fmt.Errorf("failed to unmarshal obligation metadata: %w", err) } - now := timestamppb.Now() metadata.CreatedAt = now metadata.UpdatedAt = now @@ -243,6 +243,7 @@ func (c PolicyDBClient) UpdateObligation(ctx context.Context, r *obligations.Upd Name: name, Metadata: metadataJSON, }) + now := timestamppb.Now() if err != nil { return nil, db.WrapIfKnownInvalidQueryErr(err) } @@ -250,7 +251,7 @@ func (c PolicyDBClient) UpdateObligation(ctx context.Context, r *obligations.Upd return nil, db.ErrNotFound } metadata.CreatedAt = obl.GetMetadata().GetCreatedAt() - metadata.UpdatedAt = timestamppb.Now() + metadata.UpdatedAt = now return &policy.Obligation{ Id: id, @@ -281,3 +282,63 @@ func (c PolicyDBClient) DeleteObligation(ctx context.Context, r *obligations.Del Id: id, }, nil } + +/// +/// Obligation Values +/// + +func (c PolicyDBClient) CreateObligationValue(ctx context.Context, r *obligations.CreateObligationValueRequest) (*policy.ObligationValue, error) { + nsFQN, oblName := breakOblFQN(r.GetFqn()) + value := r.GetValue() + metadataJSON, _, err := db.MarshalCreateMetadata(r.GetMetadata()) + if err != nil { + return nil, err + } + + queryParams := createObligationValueParams{ + ID: r.GetId(), + Name: oblName, + NamespaceFqn: nsFQN, + Value: value, + Metadata: metadataJSON, + } + + row, err := c.queries.createObligationValue(ctx, queryParams) + now := timestamppb.Now() + if err != nil { + return nil, db.WrapIfKnownInvalidQueryErr(err) + } + // oblVals, err := unmarshalObligationValues(row.Values) + // if err != nil { + // return nil, fmt.Errorf("failed to unmarshal obligation values: %w", err) + // } + + // namespace := &policy.Namespace{} + // if err := unmarshalNamespace(row.Namespace, namespace); err != nil { + // return nil, fmt.Errorf("failed to unmarshal obligation namespace: %w", err) + // } + + metadata := &common.Metadata{} + if err := unmarshalMetadata(row.Metadata, metadata); err != nil { + return nil, fmt.Errorf("failed to unmarshal obligation metadata: %w", err) + } + + metadata.CreatedAt = now + metadata.UpdatedAt = now + + obl := &policy.Obligation{ + Id: row.ID, + Name: oblName, + Namespace: nsFQN, + // Values: oblVals, + // Metadata: metadata, + } + + return &policy.ObligationValue{ + Id: row.ID, + Obligation: obl, + Value: value, + Metadata: metadata, + }, nil + +} From 90e8dc0717da22bbf38f07a4e2271abed519b1a1 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Sun, 24 Aug 2025 16:51:19 -0400 Subject: [PATCH 087/137] finish service fx --- service/policy/db/obligations.go | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 4ab7843cc3..9a8ee029e8 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -308,15 +308,12 @@ func (c PolicyDBClient) CreateObligationValue(ctx context.Context, r *obligation if err != nil { return nil, db.WrapIfKnownInvalidQueryErr(err) } - // oblVals, err := unmarshalObligationValues(row.Values) - // if err != nil { - // return nil, fmt.Errorf("failed to unmarshal obligation values: %w", err) - // } + id := row.ID - // namespace := &policy.Namespace{} - // if err := unmarshalNamespace(row.Namespace, namespace); err != nil { - // return nil, fmt.Errorf("failed to unmarshal obligation namespace: %w", err) - // } + namespace := &policy.Namespace{} + if err := unmarshalNamespace(row.Namespace, namespace); err != nil { + return nil, fmt.Errorf("failed to unmarshal obligation namespace: %w", err) + } metadata := &common.Metadata{} if err := unmarshalMetadata(row.Metadata, metadata); err != nil { @@ -327,18 +324,15 @@ func (c PolicyDBClient) CreateObligationValue(ctx context.Context, r *obligation metadata.UpdatedAt = now obl := &policy.Obligation{ - Id: row.ID, - Name: oblName, - Namespace: nsFQN, - // Values: oblVals, - // Metadata: metadata, + Id: id, + Name: row.Name, + Namespace: namespace, } return &policy.ObligationValue{ - Id: row.ID, + Id: id, Obligation: obl, Value: value, Metadata: metadata, }, nil - } From 640681b235fa704aaf2605b695276e15fc7bc3c4 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Sun, 24 Aug 2025 16:59:26 -0400 Subject: [PATCH 088/137] sql --- service/policy/db/obligations.sql.go | 113 ++++++++++++++++++++++ service/policy/db/queries/obligations.sql | 42 ++++++++ 2 files changed, 155 insertions(+) diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index f6ea36b350..08d79a352e 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -156,6 +156,119 @@ func (q *Queries) createObligation(ctx context.Context, arg createObligationPara return i, err } +const createObligationValue = `-- name: createObligationValue :one + +WITH obligation_lookup AS ( + SELECT od.id, od.name, od.metadata + FROM obligation_definitions od + LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id + LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL + WHERE + -- lookup by obligation id OR by namespace fqn + obligation name + ( + -- lookup by obligation id + (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) + OR + -- lookup by namespace fqn + obligation name + (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL + AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) + ) +), +inserted_value AS ( + INSERT INTO obligation_values_standard (obligation_definition_id, value, metadata) + SELECT ol.id, $4, $5 + FROM obligation_lookup ol + RETURNING id, obligation_definition_id, value, metadata +) +SELECT + iv.id, + ol.name, + JSON_BUILD_OBJECT( + 'id', n.id, + 'name', n.name, + 'fqn', fqns.fqn + ) as namespace, + JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', iv.metadata -> 'labels', 'created_at', EXTRACT(EPOCH FROM NOW()),'updated_at', EXTRACT(EPOCH FROM NOW()))) as metadata +FROM inserted_value iv +JOIN obligation_lookup ol ON ol.id = iv.obligation_definition_id +JOIN obligation_definitions od ON od.id = ol.id +JOIN attribute_namespaces n ON od.namespace_id = n.id +LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL +` + +type createObligationValueParams struct { + ID string `json:"id"` + NamespaceFqn string `json:"namespace_fqn"` + Name string `json:"name"` + Value string `json:"value"` + Metadata []byte `json:"metadata"` +} + +type createObligationValueRow struct { + ID string `json:"id"` + Name string `json:"name"` + Namespace []byte `json:"namespace"` + Metadata []byte `json:"metadata"` +} + +// -------------------------------------------------------------- +// OBLIGATION VALUES +// -------------------------------------------------------------- +// +// WITH obligation_lookup AS ( +// SELECT od.id, od.name, od.metadata +// FROM obligation_definitions od +// LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id +// LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL +// WHERE +// -- lookup by obligation id OR by namespace fqn + obligation name +// ( +// -- lookup by obligation id +// (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) +// OR +// -- lookup by namespace fqn + obligation name +// (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL +// AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) +// ) +// ), +// inserted_value AS ( +// INSERT INTO obligation_values_standard (obligation_definition_id, value, metadata) +// SELECT ol.id, $4, $5 +// FROM obligation_lookup ol +// RETURNING id, obligation_definition_id, value, metadata +// ) +// SELECT +// iv.id, +// ol.name, +// JSON_BUILD_OBJECT( +// 'id', n.id, +// 'name', n.name, +// 'fqn', fqns.fqn +// ) as namespace, +// JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', iv.metadata -> 'labels', 'created_at', EXTRACT(EPOCH FROM NOW()),'updated_at', EXTRACT(EPOCH FROM NOW()))) as metadata +// FROM inserted_value iv +// JOIN obligation_lookup ol ON ol.id = iv.obligation_definition_id +// JOIN obligation_definitions od ON od.id = ol.id +// JOIN attribute_namespaces n ON od.namespace_id = n.id +// LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL +func (q *Queries) createObligationValue(ctx context.Context, arg createObligationValueParams) (createObligationValueRow, error) { + row := q.db.QueryRow(ctx, createObligationValue, + arg.ID, + arg.NamespaceFqn, + arg.Name, + arg.Value, + arg.Metadata, + ) + var i createObligationValueRow + err := row.Scan( + &i.ID, + &i.Name, + &i.Namespace, + &i.Metadata, + ) + return i, err +} + const deleteObligation = `-- name: deleteObligation :one DELETE FROM obligation_definitions WHERE id IN ( diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 864f93076f..eecb35b9d6 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -188,3 +188,45 @@ LEFT JOIN obligation_values_standard ov on od.id = ov.obligation_definition_id GROUP BY od.id, n.id, fqns.fqn; + +---------------------------------------------------------------- +-- OBLIGATION VALUES +---------------------------------------------------------------- + +-- name: createObligationValue :one +WITH obligation_lookup AS ( + SELECT od.id, od.name, od.metadata + FROM obligation_definitions od + LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id + LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL + WHERE + -- lookup by obligation id OR by namespace fqn + obligation name + ( + -- lookup by obligation id + (NULLIF(@id::TEXT, '') IS NOT NULL AND od.id = @id::UUID) + OR + -- lookup by namespace fqn + obligation name + (NULLIF(@namespace_fqn::TEXT, '') IS NOT NULL AND NULLIF(@name::TEXT, '') IS NOT NULL + AND fqns.fqn = @namespace_fqn::VARCHAR AND od.name = @name::VARCHAR) + ) +), +inserted_value AS ( + INSERT INTO obligation_values_standard (obligation_definition_id, value, metadata) + SELECT ol.id, @value, @metadata + FROM obligation_lookup ol + RETURNING id, obligation_definition_id, value, metadata +) +SELECT + iv.id, + ol.name, + JSON_BUILD_OBJECT( + 'id', n.id, + 'name', n.name, + 'fqn', fqns.fqn + ) as namespace, + JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', iv.metadata -> 'labels', 'created_at', EXTRACT(EPOCH FROM NOW()),'updated_at', EXTRACT(EPOCH FROM NOW()))) as metadata +FROM inserted_value iv +JOIN obligation_lookup ol ON ol.id = iv.obligation_definition_id +JOIN obligation_definitions od ON od.id = ol.id +JOIN attribute_namespaces n ON od.namespace_id = n.id +LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL; \ No newline at end of file From 6912d39ff5942428d863f268d279a13ed70a0927 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Sun, 24 Aug 2025 17:14:36 -0400 Subject: [PATCH 089/137] start test --- service/integration/obligations_test.go | 135 +++++++++++++++++++++- service/policy/db/obligations.sql.go | 4 +- service/policy/db/queries/obligations.sql | 2 +- 3 files changed, 133 insertions(+), 8 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index c83ea6ba04..552abbb4f7 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -468,6 +468,110 @@ func (s *ObligationsSuite) Test_DeleteObligation_Fails() { s.Nil(obl) } +/// +/// Obligation Values +/// + +// Create + +func (s *ObligationsSuite) Test_CreateObligationValue_Succeeds() { + namespaceID, namespaceFQN, namespace := s.getNamespaceData(nsExampleCom) + createdObl := s.createObligation(namespaceID, oblName, nil) // Create obligation without values + + // Test 1: Create obligation value by obligation ID + oblValue, err := s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ + ObligationIdentifier: &obligations.CreateObligationValueRequest_Id{ + Id: createdObl.GetId(), + }, + Value: oblValPrefix + "test-1", + Metadata: &common.MetadataMutable{ + Labels: map[string]string{"test": "value"}, + }, + }) + s.Require().NoError(err) + s.NotNil(oblValue) + s.Equal(oblValPrefix+"test-1", oblValue.GetValue()) + s.Equal("value", oblValue.GetMetadata().GetLabels()["test"]) + // Check basic obligation properties (without metadata timestamps) + s.Equal(oblName, oblValue.GetObligation().GetName()) + s.Equal(namespaceID, oblValue.GetObligation().GetNamespace().GetId()) + s.Equal(namespace.Name, oblValue.GetObligation().GetNamespace().GetName()) + s.Equal(namespaceFQN, oblValue.GetObligation().GetNamespace().GetFqn()) + // Check obligation value metadata timestamps + s.assertObligationValueMetadata(oblValue) + + // Test 2: Create obligation value by obligation FQN + oblFQN := policydb.BuildOblFQN(namespaceFQN, oblName) + oblValue2, err := s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ + ObligationIdentifier: &obligations.CreateObligationValueRequest_Fqn{ + Fqn: oblFQN, + }, + Value: oblValPrefix + "test-2", + }) + s.Require().NoError(err) + s.NotNil(oblValue2) + s.Equal(oblValPrefix+"test-2", oblValue2.GetValue()) + // Check basic obligation properties (without metadata timestamps) + s.Equal(oblName, oblValue2.GetObligation().GetName()) + s.Equal(namespaceID, oblValue2.GetObligation().GetNamespace().GetId()) + s.Equal(namespace.Name, oblValue2.GetObligation().GetNamespace().GetName()) + s.Equal(namespaceFQN, oblValue2.GetObligation().GetNamespace().GetFqn()) + // Check obligation value metadata timestamps + s.assertObligationValueMetadata(oblValue2) + + // Cleanup + s.deleteObligation(createdObl.GetId()) +} + +func (s *ObligationsSuite) Test_CreateObligationValue_Fails() { + // Test 1: Invalid obligation ID + oblValue, err := s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ + ObligationIdentifier: &obligations.CreateObligationValueRequest_Id{ + Id: invalidUUID, + }, + Value: oblValPrefix + "test", + }) + s.Require().ErrorIs(err, db.ErrUUIDInvalid) + s.Nil(oblValue) + + // Test 2: Non-existent obligation ID + oblValue, err = s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ + ObligationIdentifier: &obligations.CreateObligationValueRequest_Id{ + Id: "00000000-0000-0000-0000-000000000000", + }, + Value: oblValPrefix + "test", + }) + s.Require().ErrorIs(err, db.ErrNotFound) + s.Nil(oblValue) + + // Test 3: Invalid obligation FQN + oblValue, err = s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ + ObligationIdentifier: &obligations.CreateObligationValueRequest_Fqn{ + Fqn: invalidFQN, + }, + Value: oblValPrefix + "test", + }) + s.Require().ErrorIs(err, db.ErrNotFound) + s.Nil(oblValue) + + // Test 4: Non-existent obligation name in valid namespace + namespaceID, namespaceFQN, _ := s.getNamespaceData(nsExampleCom) + createdObl := s.createObligation(namespaceID, oblName, nil) + nonExistentFQN := policydb.BuildOblFQN(namespaceFQN, "non-existent-obligation") + + oblValue, err = s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ + ObligationIdentifier: &obligations.CreateObligationValueRequest_Fqn{ + Fqn: nonExistentFQN, + }, + Value: oblValPrefix + "test", + }) + s.Require().ErrorIs(err, db.ErrNotFound) + s.Nil(oblValue) + + // Cleanup + s.deleteObligation(createdObl.GetId()) +} + // Helper functions for common operations func (s *ObligationsSuite) getNamespaceData(nsName string) (string, string, fixtures.FixtureDataNamespace) { @@ -478,15 +582,28 @@ func (s *ObligationsSuite) getNamespaceData(nsName string) (string, string, fixt func (s *ObligationsSuite) assertObligationBasics(obl *policy.Obligation, name, namespaceID, namespaceName, namespaceFQN string) { s.Require().NotNil(obl) s.Equal(name, obl.GetName()) - s.Equal(namespaceID, obl.GetNamespace().GetId()) - s.Equal(namespaceName, obl.GetNamespace().GetName()) - s.Equal(namespaceFQN, obl.GetNamespace().GetFqn()) + // s.Equal(namespaceID, obl.GetNamespace().GetId()) + // s.Equal(namespaceName, obl.GetNamespace().GetName()) + // s.Equal(namespaceFQN, obl.GetNamespace().GetFqn()) + s.assertNamespace(obl.GetNamespace(), namespaceID, namespaceName, namespaceFQN) + s.assertMetadata(obl.GetMetadata()) +} + +func (s *ObligationsSuite) assertNamespace(ns *policy.Namespace, namespaceID, namespaceName, namespaceFQN string) { + s.Require().NotNil(ns) + s.Equal(namespaceID, ns.GetId()) + s.Equal(namespaceName, ns.GetName()) + s.Equal(namespaceFQN, ns.GetFqn()) +} + +func (s *ObligationsSuite) assertMetadata(meta *common.Metadata) { + s.Require().NotNil(meta) // Assert that timestamps in metadata are recent threshold := int64(5) now := time.Now().Unix() - diff := now - obl.GetMetadata().GetUpdatedAt().GetSeconds() + diff := now - meta.GetUpdatedAt().GetSeconds() s.LessOrEqual(diff, threshold) - diff = now - obl.GetMetadata().GetCreatedAt().GetSeconds() + diff = now - meta.GetCreatedAt().GetSeconds() s.LessOrEqual(diff, threshold) } @@ -497,6 +614,14 @@ func (s *ObligationsSuite) assertObligationValues(obl *policy.Obligation) { } } +func (s *ObligationsSuite) assertObligationValueBasics(oblValue *policy.ObligationValue, value, oblName, namespaceID, namespaceName, namespaceFQN string) { + s.Require().NotNil(oblValue) + s.Equal(value, oblValue.GetValue()) + // s.Equal(oblName, oblValue.GetObligation().GetName()) + s.assertNamespace(oblValue.GetObligation().GetNamespace(), namespaceID, namespaceName, namespaceFQN) + s.assertMetadata(oblValue.GetMetadata()) +} + func (s *ObligationsSuite) createObligation(namespaceID, name string, values []string) *policy.Obligation { obl, err := s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 08d79a352e..4c9f0a0fab 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -188,7 +188,7 @@ SELECT 'name', n.name, 'fqn', fqns.fqn ) as namespace, - JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', iv.metadata -> 'labels', 'created_at', EXTRACT(EPOCH FROM NOW()),'updated_at', EXTRACT(EPOCH FROM NOW()))) as metadata + iv.metadata as metadata FROM inserted_value iv JOIN obligation_lookup ol ON ol.id = iv.obligation_definition_id JOIN obligation_definitions od ON od.id = ol.id @@ -245,7 +245,7 @@ type createObligationValueRow struct { // 'name', n.name, // 'fqn', fqns.fqn // ) as namespace, -// JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', iv.metadata -> 'labels', 'created_at', EXTRACT(EPOCH FROM NOW()),'updated_at', EXTRACT(EPOCH FROM NOW()))) as metadata +// iv.metadata as metadata // FROM inserted_value iv // JOIN obligation_lookup ol ON ol.id = iv.obligation_definition_id // JOIN obligation_definitions od ON od.id = ol.id diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index eecb35b9d6..2b9d000cf9 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -224,7 +224,7 @@ SELECT 'name', n.name, 'fqn', fqns.fqn ) as namespace, - JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', iv.metadata -> 'labels', 'created_at', EXTRACT(EPOCH FROM NOW()),'updated_at', EXTRACT(EPOCH FROM NOW()))) as metadata + iv.metadata as metadata FROM inserted_value iv JOIN obligation_lookup ol ON ol.id = iv.obligation_definition_id JOIN obligation_definitions od ON od.id = ol.id From 6ecdacc642269a59f51040bf97cb944a25e6b316 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Sun, 24 Aug 2025 17:29:52 -0400 Subject: [PATCH 090/137] finish test --- service/integration/obligations_test.go | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 552abbb4f7..5df6103e08 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -492,13 +492,7 @@ func (s *ObligationsSuite) Test_CreateObligationValue_Succeeds() { s.NotNil(oblValue) s.Equal(oblValPrefix+"test-1", oblValue.GetValue()) s.Equal("value", oblValue.GetMetadata().GetLabels()["test"]) - // Check basic obligation properties (without metadata timestamps) - s.Equal(oblName, oblValue.GetObligation().GetName()) - s.Equal(namespaceID, oblValue.GetObligation().GetNamespace().GetId()) - s.Equal(namespace.Name, oblValue.GetObligation().GetNamespace().GetName()) - s.Equal(namespaceFQN, oblValue.GetObligation().GetNamespace().GetFqn()) - // Check obligation value metadata timestamps - s.assertObligationValueMetadata(oblValue) + s.assertObligationValueBasics(oblValue, oblValPrefix+"test-1", namespaceID, namespace.Name, namespaceFQN) // Test 2: Create obligation value by obligation FQN oblFQN := policydb.BuildOblFQN(namespaceFQN, oblName) @@ -511,13 +505,7 @@ func (s *ObligationsSuite) Test_CreateObligationValue_Succeeds() { s.Require().NoError(err) s.NotNil(oblValue2) s.Equal(oblValPrefix+"test-2", oblValue2.GetValue()) - // Check basic obligation properties (without metadata timestamps) - s.Equal(oblName, oblValue2.GetObligation().GetName()) - s.Equal(namespaceID, oblValue2.GetObligation().GetNamespace().GetId()) - s.Equal(namespace.Name, oblValue2.GetObligation().GetNamespace().GetName()) - s.Equal(namespaceFQN, oblValue2.GetObligation().GetNamespace().GetFqn()) - // Check obligation value metadata timestamps - s.assertObligationValueMetadata(oblValue2) + s.assertObligationValueBasics(oblValue2, oblValPrefix+"test-2", namespaceID, namespace.Name, namespaceFQN) // Cleanup s.deleteObligation(createdObl.GetId()) @@ -537,7 +525,7 @@ func (s *ObligationsSuite) Test_CreateObligationValue_Fails() { // Test 2: Non-existent obligation ID oblValue, err = s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ ObligationIdentifier: &obligations.CreateObligationValueRequest_Id{ - Id: "00000000-0000-0000-0000-000000000000", + Id: invalidID, }, Value: oblValPrefix + "test", }) @@ -582,9 +570,6 @@ func (s *ObligationsSuite) getNamespaceData(nsName string) (string, string, fixt func (s *ObligationsSuite) assertObligationBasics(obl *policy.Obligation, name, namespaceID, namespaceName, namespaceFQN string) { s.Require().NotNil(obl) s.Equal(name, obl.GetName()) - // s.Equal(namespaceID, obl.GetNamespace().GetId()) - // s.Equal(namespaceName, obl.GetNamespace().GetName()) - // s.Equal(namespaceFQN, obl.GetNamespace().GetFqn()) s.assertNamespace(obl.GetNamespace(), namespaceID, namespaceName, namespaceFQN) s.assertMetadata(obl.GetMetadata()) } @@ -614,10 +599,9 @@ func (s *ObligationsSuite) assertObligationValues(obl *policy.Obligation) { } } -func (s *ObligationsSuite) assertObligationValueBasics(oblValue *policy.ObligationValue, value, oblName, namespaceID, namespaceName, namespaceFQN string) { +func (s *ObligationsSuite) assertObligationValueBasics(oblValue *policy.ObligationValue, value, namespaceID, namespaceName, namespaceFQN string) { s.Require().NotNil(oblValue) s.Equal(value, oblValue.GetValue()) - // s.Equal(oblName, oblValue.GetObligation().GetName()) s.assertNamespace(oblValue.GetObligation().GetNamespace(), namespaceID, namespaceName, namespaceFQN) s.assertMetadata(oblValue.GetMetadata()) } From 24b0a9081de40ec57b6a96755fa765f80bbb449f Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 25 Aug 2025 10:19:26 -0400 Subject: [PATCH 091/137] delete obl val service fx --- service/policy/db/obligations.go | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 9a8ee029e8..c4e8512f7f 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -68,10 +68,22 @@ func breakOblFQN(fqn string) (string, string) { return nsFQN, oblName } +func breakOblValFQN(fqn string) (string, string, string) { + nsFQN := strings.Split(fqn, "/obl/")[0] + parts := strings.Split(fqn, "/") + oblName := parts[len(parts)-3] + valName := parts[len(parts)-1] + return nsFQN, oblName, valName +} + func BuildOblFQN(nsFQN, oblName string) string { return nsFQN + "/obl/" + oblName } +func BuildOblValFQN(nsFQN, oblName, valName string) string { + return nsFQN + "/obl/" + oblName + "/value/" + valName +} + func (c PolicyDBClient) GetObligation(ctx context.Context, r *obligations.GetObligationRequest) (*policy.Obligation, error) { nsFQN, oblName := breakOblFQN(r.GetFqn()) queryParams := getObligationParams{ @@ -336,3 +348,25 @@ func (c PolicyDBClient) CreateObligationValue(ctx context.Context, r *obligation Metadata: metadata, }, nil } + +func (c PolicyDBClient) DeleteObligationValue(ctx context.Context, r *obligations.DeleteObligationValueRequest) (*policy.ObligationValue, error) { + nsFQN, oblName, valName := breakOblValFQN(r.GetFqn()) + queryParams := deleteObligationValueParams{ + ID: r.GetId(), + NamespaceFqn: nsFQN, + Name: oblName, + Value: valName, + } + + id, err := c.queries.deleteObligationValue(ctx, queryParams) + if err != nil { + return nil, db.WrapIfKnownInvalidQueryErr(err) + } + if id == "" { + return nil, db.ErrNotFound + } + + return &policy.ObligationValue{ + Id: id, + }, nil +} From 9cd1950d03dad46c80c007ea33373f1e0bdd4b21 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 25 Aug 2025 10:27:17 -0400 Subject: [PATCH 092/137] sql --- service/policy/db/obligations.sql.go | 145 +++++++--------------- service/policy/db/queries/obligations.sql | 27 +++- 2 files changed, 69 insertions(+), 103 deletions(-) diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 4c9f0a0fab..611d1e16fe 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -156,10 +156,10 @@ func (q *Queries) createObligation(ctx context.Context, arg createObligationPara return i, err } -const createObligationValue = `-- name: createObligationValue :one - -WITH obligation_lookup AS ( - SELECT od.id, od.name, od.metadata +const deleteObligation = `-- name: deleteObligation :one +DELETE FROM obligation_definitions +WHERE id IN ( + SELECT od.id FROM obligation_definitions od LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL @@ -173,50 +173,21 @@ WITH obligation_lookup AS ( (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) ) -), -inserted_value AS ( - INSERT INTO obligation_values_standard (obligation_definition_id, value, metadata) - SELECT ol.id, $4, $5 - FROM obligation_lookup ol - RETURNING id, obligation_definition_id, value, metadata ) -SELECT - iv.id, - ol.name, - JSON_BUILD_OBJECT( - 'id', n.id, - 'name', n.name, - 'fqn', fqns.fqn - ) as namespace, - iv.metadata as metadata -FROM inserted_value iv -JOIN obligation_lookup ol ON ol.id = iv.obligation_definition_id -JOIN obligation_definitions od ON od.id = ol.id -JOIN attribute_namespaces n ON od.namespace_id = n.id -LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL +RETURNING id ` -type createObligationValueParams struct { +type deleteObligationParams struct { ID string `json:"id"` NamespaceFqn string `json:"namespace_fqn"` Name string `json:"name"` - Value string `json:"value"` - Metadata []byte `json:"metadata"` -} - -type createObligationValueRow struct { - ID string `json:"id"` - Name string `json:"name"` - Namespace []byte `json:"namespace"` - Metadata []byte `json:"metadata"` } -// -------------------------------------------------------------- -// OBLIGATION VALUES -// -------------------------------------------------------------- +// deleteObligation // -// WITH obligation_lookup AS ( -// SELECT od.id, od.name, od.metadata +// DELETE FROM obligation_definitions +// WHERE id IN ( +// SELECT od.id // FROM obligation_definitions od // LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id // LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL @@ -230,94 +201,72 @@ type createObligationValueRow struct { // (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL // AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) // ) -// ), -// inserted_value AS ( -// INSERT INTO obligation_values_standard (obligation_definition_id, value, metadata) -// SELECT ol.id, $4, $5 -// FROM obligation_lookup ol -// RETURNING id, obligation_definition_id, value, metadata // ) -// SELECT -// iv.id, -// ol.name, -// JSON_BUILD_OBJECT( -// 'id', n.id, -// 'name', n.name, -// 'fqn', fqns.fqn -// ) as namespace, -// iv.metadata as metadata -// FROM inserted_value iv -// JOIN obligation_lookup ol ON ol.id = iv.obligation_definition_id -// JOIN obligation_definitions od ON od.id = ol.id -// JOIN attribute_namespaces n ON od.namespace_id = n.id -// LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL -func (q *Queries) createObligationValue(ctx context.Context, arg createObligationValueParams) (createObligationValueRow, error) { - row := q.db.QueryRow(ctx, createObligationValue, - arg.ID, - arg.NamespaceFqn, - arg.Name, - arg.Value, - arg.Metadata, - ) - var i createObligationValueRow - err := row.Scan( - &i.ID, - &i.Name, - &i.Namespace, - &i.Metadata, - ) - return i, err +// RETURNING id +func (q *Queries) deleteObligation(ctx context.Context, arg deleteObligationParams) (string, error) { + row := q.db.QueryRow(ctx, deleteObligation, arg.ID, arg.NamespaceFqn, arg.Name) + var id string + err := row.Scan(&id) + return id, err } -const deleteObligation = `-- name: deleteObligation :one -DELETE FROM obligation_definitions +const deleteObligationValue = `-- name: deleteObligationValue :one +DELETE FROM obligation_values_standard WHERE id IN ( - SELECT od.id - FROM obligation_definitions od + SELECT ov.id + FROM obligation_values_standard ov + JOIN obligation_definitions od ON ov.obligation_definition_id = od.id LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL WHERE - -- lookup by obligation id OR by namespace fqn + obligation name + -- lookup by value id OR by namespace fqn + obligation name + value name ( - -- lookup by obligation id - (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) + -- lookup by value id + (NULLIF($1::TEXT, '') IS NOT NULL AND ov.id = $1::UUID) OR - -- lookup by namespace fqn + obligation name - (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL - AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) + -- lookup by namespace fqn + obligation name + value name + (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL AND NULLIF($4::TEXT, '') IS NOT NULL + AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR AND ov.value = $4::VARCHAR) ) ) RETURNING id ` -type deleteObligationParams struct { +type deleteObligationValueParams struct { ID string `json:"id"` NamespaceFqn string `json:"namespace_fqn"` Name string `json:"name"` + Value string `json:"value"` } -// deleteObligation +// deleteObligationValue // -// DELETE FROM obligation_definitions +// DELETE FROM obligation_values_standard // WHERE id IN ( -// SELECT od.id -// FROM obligation_definitions od +// SELECT ov.id +// FROM obligation_values_standard ov +// JOIN obligation_definitions od ON ov.obligation_definition_id = od.id // LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id // LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL // WHERE -// -- lookup by obligation id OR by namespace fqn + obligation name +// -- lookup by value id OR by namespace fqn + obligation name + value name // ( -// -- lookup by obligation id -// (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) +// -- lookup by value id +// (NULLIF($1::TEXT, '') IS NOT NULL AND ov.id = $1::UUID) // OR -// -- lookup by namespace fqn + obligation name -// (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL -// AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) +// -- lookup by namespace fqn + obligation name + value name +// (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL AND NULLIF($4::TEXT, '') IS NOT NULL +// AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR AND ov.value = $4::VARCHAR) // ) // ) // RETURNING id -func (q *Queries) deleteObligation(ctx context.Context, arg deleteObligationParams) (string, error) { - row := q.db.QueryRow(ctx, deleteObligation, arg.ID, arg.NamespaceFqn, arg.Name) +func (q *Queries) deleteObligationValue(ctx context.Context, arg deleteObligationValueParams) (string, error) { + row := q.db.QueryRow(ctx, deleteObligationValue, + arg.ID, + arg.NamespaceFqn, + arg.Name, + arg.Value, + ) var id string err := row.Scan(&id) return id, err diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 2b9d000cf9..f9b3ef260b 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -189,11 +189,7 @@ LEFT JOIN GROUP BY od.id, n.id, fqns.fqn; ----------------------------------------------------------------- --- OBLIGATION VALUES ----------------------------------------------------------------- --- name: createObligationValue :one WITH obligation_lookup AS ( SELECT od.id, od.name, od.metadata FROM obligation_definitions od @@ -229,4 +225,25 @@ FROM inserted_value iv JOIN obligation_lookup ol ON ol.id = iv.obligation_definition_id JOIN obligation_definitions od ON od.id = ol.id JOIN attribute_namespaces n ON od.namespace_id = n.id -LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL; \ No newline at end of file +LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL; + +-- name: deleteObligationValue :one +DELETE FROM obligation_values_standard +WHERE id IN ( + SELECT ov.id + FROM obligation_values_standard ov + JOIN obligation_definitions od ON ov.obligation_definition_id = od.id + LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id + LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL + WHERE + -- lookup by value id OR by namespace fqn + obligation name + value name + ( + -- lookup by value id + (NULLIF(@id::TEXT, '') IS NOT NULL AND ov.id = @id::UUID) + OR + -- lookup by namespace fqn + obligation name + value name + (NULLIF(@namespace_fqn::TEXT, '') IS NOT NULL AND NULLIF(@name::TEXT, '') IS NOT NULL AND NULLIF(@value::TEXT, '') IS NOT NULL + AND fqns.fqn = @namespace_fqn::VARCHAR AND od.name = @name::VARCHAR AND ov.value = @value::VARCHAR) + ) +) +RETURNING id; \ No newline at end of file From 878487b1042d525ef3912b731e2f7e7798824a07 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 25 Aug 2025 11:17:48 -0400 Subject: [PATCH 093/137] delete obl val tests --- service/integration/obligations_test.go | 96 ++++++++++++++++++ service/policy/db/obligations.go | 9 +- service/policy/db/obligations.sql.go | 113 ++++++++++++++++++++++ service/policy/db/queries/obligations.sql | 4 + 4 files changed, 217 insertions(+), 5 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 5df6103e08..a867e28fd8 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -560,6 +560,102 @@ func (s *ObligationsSuite) Test_CreateObligationValue_Fails() { s.deleteObligation(createdObl.GetId()) } +// Delete + +func (s *ObligationsSuite) Test_DeleteObligationValue_Succeeds() { + namespaceID, namespaceFQN, _ := s.getNamespaceData(nsExampleCom) + createdObl := s.createObligation(namespaceID, oblName, nil) + + // Create value by ID + oblValue, err := s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ + ObligationIdentifier: &obligations.CreateObligationValueRequest_Id{ + Id: createdObl.GetId(), + }, + Value: oblValPrefix + "delete-1", + }) + s.Require().NoError(err) + s.NotNil(oblValue) + + // Delete by value ID + deleted, err := s.db.PolicyClient.DeleteObligationValue(s.ctx, &obligations.DeleteObligationValueRequest{ + Identifier: &obligations.DeleteObligationValueRequest_Id{ + Id: oblValue.GetId(), + }, + }) + s.Require().NoError(err) + s.NotNil(deleted) + s.Equal(oblValue.GetId(), deleted.GetId()) + + // Create value by FQN + oblFQN := policydb.BuildOblFQN(namespaceFQN, oblName) + oblValue2, err := s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ + ObligationIdentifier: &obligations.CreateObligationValueRequest_Fqn{ + Fqn: oblFQN, + }, + Value: oblValPrefix + "delete-2", + }) + s.Require().NoError(err) + s.NotNil(oblValue2) + + // Delete by FQN + value name + oblValFQN := policydb.BuildOblValFQN(namespaceFQN, oblName, oblValPrefix+"delete-2") + deleted2, err := s.db.PolicyClient.DeleteObligationValue(s.ctx, &obligations.DeleteObligationValueRequest{ + Identifier: &obligations.DeleteObligationValueRequest_Fqn{ + Fqn: oblValFQN, + }, + }) + s.Require().NoError(err) + s.NotNil(deleted2) + s.Equal(oblValue2.GetId(), deleted2.GetId()) + + // Cleanup + s.deleteObligation(createdObl.GetId()) +} + +func (s *ObligationsSuite) Test_DeleteObligationValue_Fails() { + // Invalid value ID + deleted, err := s.db.PolicyClient.DeleteObligationValue(s.ctx, &obligations.DeleteObligationValueRequest{ + Identifier: &obligations.DeleteObligationValueRequest_Id{ + Id: invalidUUID, + }, + }) + s.Require().ErrorIs(err, db.ErrUUIDInvalid) + s.Nil(deleted) + + // Non-existent value ID + deleted, err = s.db.PolicyClient.DeleteObligationValue(s.ctx, &obligations.DeleteObligationValueRequest{ + Identifier: &obligations.DeleteObligationValueRequest_Id{ + Id: invalidID, + }, + }) + s.Require().ErrorIs(err, db.ErrNotFound) + s.Nil(deleted) + + // Invalid value FQN + deleted, err = s.db.PolicyClient.DeleteObligationValue(s.ctx, &obligations.DeleteObligationValueRequest{ + Identifier: &obligations.DeleteObligationValueRequest_Fqn{ + Fqn: invalidFQN, + }, + }) + s.Require().ErrorIs(err, db.ErrNotFound) + s.Nil(deleted) + + // Non-existent value name in valid obligation + namespaceID, namespaceFQN, _ := s.getNamespaceData(nsExampleCom) + createdObl := s.createObligation(namespaceID, oblName, nil) + nonExistentValFQN := policydb.BuildOblValFQN(namespaceFQN, oblName, "non-existent-value") + deleted, err = s.db.PolicyClient.DeleteObligationValue(s.ctx, &obligations.DeleteObligationValueRequest{ + Identifier: &obligations.DeleteObligationValueRequest_Fqn{ + Fqn: nonExistentValFQN, + }, + }) + s.Require().ErrorIs(err, db.ErrNotFound) + s.Nil(deleted) + + // Cleanup + s.deleteObligation(createdObl.GetId()) +} + // Helper functions for common operations func (s *ObligationsSuite) getNamespaceData(nsName string) (string, string, fixtures.FixtureDataNamespace) { diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index c4e8512f7f..9cee63f859 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -69,11 +69,10 @@ func breakOblFQN(fqn string) (string, string) { } func breakOblValFQN(fqn string) (string, string, string) { - nsFQN := strings.Split(fqn, "/obl/")[0] - parts := strings.Split(fqn, "/") - oblName := parts[len(parts)-3] - valName := parts[len(parts)-1] - return nsFQN, oblName, valName + parts := strings.Split(fqn, "/value/") + nsFQN, oblName := breakOblFQN(parts[0]) + oblVal := parts[len(parts)-1] + return nsFQN, oblName, oblVal } func BuildOblFQN(nsFQN, oblName string) string { diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 611d1e16fe..fb74b69a25 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -156,6 +156,119 @@ func (q *Queries) createObligation(ctx context.Context, arg createObligationPara return i, err } +const createObligationValue = `-- name: createObligationValue :one + +WITH obligation_lookup AS ( + SELECT od.id, od.name, od.metadata + FROM obligation_definitions od + LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id + LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL + WHERE + -- lookup by obligation id OR by namespace fqn + obligation name + ( + -- lookup by obligation id + (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) + OR + -- lookup by namespace fqn + obligation name + (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL + AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) + ) +), +inserted_value AS ( + INSERT INTO obligation_values_standard (obligation_definition_id, value, metadata) + SELECT ol.id, $4, $5 + FROM obligation_lookup ol + RETURNING id, obligation_definition_id, value, metadata +) +SELECT + iv.id, + ol.name, + JSON_BUILD_OBJECT( + 'id', n.id, + 'name', n.name, + 'fqn', fqns.fqn + ) as namespace, + iv.metadata as metadata +FROM inserted_value iv +JOIN obligation_lookup ol ON ol.id = iv.obligation_definition_id +JOIN obligation_definitions od ON od.id = ol.id +JOIN attribute_namespaces n ON od.namespace_id = n.id +LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL +` + +type createObligationValueParams struct { + ID string `json:"id"` + NamespaceFqn string `json:"namespace_fqn"` + Name string `json:"name"` + Value string `json:"value"` + Metadata []byte `json:"metadata"` +} + +type createObligationValueRow struct { + ID string `json:"id"` + Name string `json:"name"` + Namespace []byte `json:"namespace"` + Metadata []byte `json:"metadata"` +} + +// -------------------------------------------------------------- +// OBLIGATION VALUES +// -------------------------------------------------------------- +// +// WITH obligation_lookup AS ( +// SELECT od.id, od.name, od.metadata +// FROM obligation_definitions od +// LEFT JOIN attribute_namespaces n ON od.namespace_id = n.id +// LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL +// WHERE +// -- lookup by obligation id OR by namespace fqn + obligation name +// ( +// -- lookup by obligation id +// (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) +// OR +// -- lookup by namespace fqn + obligation name +// (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL +// AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) +// ) +// ), +// inserted_value AS ( +// INSERT INTO obligation_values_standard (obligation_definition_id, value, metadata) +// SELECT ol.id, $4, $5 +// FROM obligation_lookup ol +// RETURNING id, obligation_definition_id, value, metadata +// ) +// SELECT +// iv.id, +// ol.name, +// JSON_BUILD_OBJECT( +// 'id', n.id, +// 'name', n.name, +// 'fqn', fqns.fqn +// ) as namespace, +// iv.metadata as metadata +// FROM inserted_value iv +// JOIN obligation_lookup ol ON ol.id = iv.obligation_definition_id +// JOIN obligation_definitions od ON od.id = ol.id +// JOIN attribute_namespaces n ON od.namespace_id = n.id +// LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL +func (q *Queries) createObligationValue(ctx context.Context, arg createObligationValueParams) (createObligationValueRow, error) { + row := q.db.QueryRow(ctx, createObligationValue, + arg.ID, + arg.NamespaceFqn, + arg.Name, + arg.Value, + arg.Metadata, + ) + var i createObligationValueRow + err := row.Scan( + &i.ID, + &i.Name, + &i.Namespace, + &i.Metadata, + ) + return i, err +} + const deleteObligation = `-- name: deleteObligation :one DELETE FROM obligation_definitions WHERE id IN ( diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index f9b3ef260b..4f1c2d08fc 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -189,7 +189,11 @@ LEFT JOIN GROUP BY od.id, n.id, fqns.fqn; +---------------------------------------------------------------- +-- OBLIGATION VALUES +---------------------------------------------------------------- +-- name: createObligationValue :one WITH obligation_lookup AS ( SELECT od.id, od.name, od.metadata FROM obligation_definitions od From df01caf2339a31f84dfcf8e47418e9af6e499243 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 25 Aug 2025 11:21:39 -0400 Subject: [PATCH 094/137] defer deletion --- service/integration/obligations_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index a867e28fd8..a5e7cb3c46 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -508,7 +508,7 @@ func (s *ObligationsSuite) Test_CreateObligationValue_Succeeds() { s.assertObligationValueBasics(oblValue2, oblValPrefix+"test-2", namespaceID, namespace.Name, namespaceFQN) // Cleanup - s.deleteObligation(createdObl.GetId()) + s.deleteObligations([]string{createdObl.GetId()}) } func (s *ObligationsSuite) Test_CreateObligationValue_Fails() { @@ -557,7 +557,7 @@ func (s *ObligationsSuite) Test_CreateObligationValue_Fails() { s.Nil(oblValue) // Cleanup - s.deleteObligation(createdObl.GetId()) + s.deleteObligations([]string{createdObl.GetId()}) } // Delete @@ -609,7 +609,7 @@ func (s *ObligationsSuite) Test_DeleteObligationValue_Succeeds() { s.Equal(oblValue2.GetId(), deleted2.GetId()) // Cleanup - s.deleteObligation(createdObl.GetId()) + s.deleteObligations([]string{createdObl.GetId()}) } func (s *ObligationsSuite) Test_DeleteObligationValue_Fails() { @@ -653,7 +653,7 @@ func (s *ObligationsSuite) Test_DeleteObligationValue_Fails() { s.Nil(deleted) // Cleanup - s.deleteObligation(createdObl.GetId()) + s.deleteObligations([]string{createdObl.GetId()}) } // Helper functions for common operations From 0a173b07af23ed1b9a17c5d8da71fa08d09942ef Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 25 Aug 2025 13:17:56 -0400 Subject: [PATCH 095/137] fix tests --- service/integration/obligations_test.go | 47 +++++++++++++------------ service/policy/db/obligations.go | 2 ++ 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index a5e7cb3c46..dab2b03329 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -564,38 +564,39 @@ func (s *ObligationsSuite) Test_CreateObligationValue_Fails() { func (s *ObligationsSuite) Test_DeleteObligationValue_Succeeds() { namespaceID, namespaceFQN, _ := s.getNamespaceData(nsExampleCom) - createdObl := s.createObligation(namespaceID, oblName, nil) - - // Create value by ID - oblValue, err := s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ - ObligationIdentifier: &obligations.CreateObligationValueRequest_Id{ - Id: createdObl.GetId(), - }, - Value: oblValPrefix + "delete-1", - }) - s.Require().NoError(err) - s.NotNil(oblValue) + createdObl := s.createObligation(namespaceID, oblName, []string{oblValPrefix + "delete-1", oblValPrefix + "delete-2"}) + + // // Create value by ID + // oblValue, err := s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ + // ObligationIdentifier: &obligations.CreateObligationValueRequest_Id{ + // Id: createdObl.GetId(), + // }, + // Value: oblValPrefix + "delete-1", + // }) + // s.Require().NoError(err) + // s.NotNil(oblValue) + oblValues := createdObl.GetValues() // Delete by value ID deleted, err := s.db.PolicyClient.DeleteObligationValue(s.ctx, &obligations.DeleteObligationValueRequest{ Identifier: &obligations.DeleteObligationValueRequest_Id{ - Id: oblValue.GetId(), + Id: oblValues[0].GetId(), }, }) s.Require().NoError(err) s.NotNil(deleted) - s.Equal(oblValue.GetId(), deleted.GetId()) + s.Equal(oblValues[0].GetId(), deleted.GetId()) // Create value by FQN - oblFQN := policydb.BuildOblFQN(namespaceFQN, oblName) - oblValue2, err := s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ - ObligationIdentifier: &obligations.CreateObligationValueRequest_Fqn{ - Fqn: oblFQN, - }, - Value: oblValPrefix + "delete-2", - }) - s.Require().NoError(err) - s.NotNil(oblValue2) + // oblFQN := policydb.BuildOblFQN(namespaceFQN, oblName) + // oblValue2, err := s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ + // ObligationIdentifier: &obligations.CreateObligationValueRequest_Fqn{ + // Fqn: oblFQN, + // }, + // Value: oblValPrefix + "delete-2", + // }) + // s.Require().NoError(err) + // s.NotNil(oblValue2) // Delete by FQN + value name oblValFQN := policydb.BuildOblValFQN(namespaceFQN, oblName, oblValPrefix+"delete-2") @@ -606,7 +607,7 @@ func (s *ObligationsSuite) Test_DeleteObligationValue_Succeeds() { }) s.Require().NoError(err) s.NotNil(deleted2) - s.Equal(oblValue2.GetId(), deleted2.GetId()) + s.Equal(oblValues[1].GetId(), deleted2.GetId()) // Cleanup s.deleteObligations([]string{createdObl.GetId()}) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 9cee63f859..b7de0429df 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -314,6 +314,8 @@ func (c PolicyDBClient) CreateObligationValue(ctx context.Context, r *obligation Metadata: metadataJSON, } + println("createObl params: ", r.GetId(), oblName, nsFQN, value) + row, err := c.queries.createObligationValue(ctx, queryParams) now := timestamppb.Now() if err != nil { From 3ab93b4097de1f51173c733e05a8b000a63bfbad Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 25 Aug 2025 13:18:40 -0400 Subject: [PATCH 096/137] clean up --- service/integration/obligations_test.go | 21 --------------------- service/policy/db/obligations.go | 2 -- 2 files changed, 23 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index dab2b03329..c08631311c 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -565,16 +565,6 @@ func (s *ObligationsSuite) Test_CreateObligationValue_Fails() { func (s *ObligationsSuite) Test_DeleteObligationValue_Succeeds() { namespaceID, namespaceFQN, _ := s.getNamespaceData(nsExampleCom) createdObl := s.createObligation(namespaceID, oblName, []string{oblValPrefix + "delete-1", oblValPrefix + "delete-2"}) - - // // Create value by ID - // oblValue, err := s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ - // ObligationIdentifier: &obligations.CreateObligationValueRequest_Id{ - // Id: createdObl.GetId(), - // }, - // Value: oblValPrefix + "delete-1", - // }) - // s.Require().NoError(err) - // s.NotNil(oblValue) oblValues := createdObl.GetValues() // Delete by value ID @@ -587,17 +577,6 @@ func (s *ObligationsSuite) Test_DeleteObligationValue_Succeeds() { s.NotNil(deleted) s.Equal(oblValues[0].GetId(), deleted.GetId()) - // Create value by FQN - // oblFQN := policydb.BuildOblFQN(namespaceFQN, oblName) - // oblValue2, err := s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ - // ObligationIdentifier: &obligations.CreateObligationValueRequest_Fqn{ - // Fqn: oblFQN, - // }, - // Value: oblValPrefix + "delete-2", - // }) - // s.Require().NoError(err) - // s.NotNil(oblValue2) - // Delete by FQN + value name oblValFQN := policydb.BuildOblValFQN(namespaceFQN, oblName, oblValPrefix+"delete-2") deleted2, err := s.db.PolicyClient.DeleteObligationValue(s.ctx, &obligations.DeleteObligationValueRequest{ diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index b7de0429df..9cee63f859 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -314,8 +314,6 @@ func (c PolicyDBClient) CreateObligationValue(ctx context.Context, r *obligation Metadata: metadataJSON, } - println("createObl params: ", r.GetId(), oblName, nsFQN, value) - row, err := c.queries.createObligationValue(ctx, queryParams) now := timestamppb.Now() if err != nil { From 204df4e75c8ed9076bef8a86f91dcf049736a7a4 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 25 Aug 2025 13:19:44 -0400 Subject: [PATCH 097/137] clean up complete --- service/integration/obligations_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index c08631311c..8dab9a053d 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -564,7 +564,8 @@ func (s *ObligationsSuite) Test_CreateObligationValue_Fails() { func (s *ObligationsSuite) Test_DeleteObligationValue_Succeeds() { namespaceID, namespaceFQN, _ := s.getNamespaceData(nsExampleCom) - createdObl := s.createObligation(namespaceID, oblName, []string{oblValPrefix + "delete-1", oblValPrefix + "delete-2"}) + values := []string{oblValPrefix + "delete-1", oblValPrefix + "delete-2"} + createdObl := s.createObligation(namespaceID, oblName, values) oblValues := createdObl.GetValues() // Delete by value ID @@ -578,7 +579,7 @@ func (s *ObligationsSuite) Test_DeleteObligationValue_Succeeds() { s.Equal(oblValues[0].GetId(), deleted.GetId()) // Delete by FQN + value name - oblValFQN := policydb.BuildOblValFQN(namespaceFQN, oblName, oblValPrefix+"delete-2") + oblValFQN := policydb.BuildOblValFQN(namespaceFQN, oblName, values[1]) deleted2, err := s.db.PolicyClient.DeleteObligationValue(s.ctx, &obligations.DeleteObligationValueRequest{ Identifier: &obligations.DeleteObligationValueRequest_Fqn{ Fqn: oblValFQN, From 7c644b132ef6aed7bf03ac18f1961e05fd9724e3 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 25 Aug 2025 14:56:32 -0400 Subject: [PATCH 098/137] get obl service fx --- service/policy/db/obligations.go | 142 +++++++++++++++++++++- service/policy/db/obligations.sql.go | 102 +++++++++++++++- service/policy/db/queries/obligations.sql | 28 +++++ 3 files changed, 263 insertions(+), 9 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 9cee63f859..98ce808711 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -79,8 +79,8 @@ func BuildOblFQN(nsFQN, oblName string) string { return nsFQN + "/obl/" + oblName } -func BuildOblValFQN(nsFQN, oblName, valName string) string { - return nsFQN + "/obl/" + oblName + "/value/" + valName +func BuildOblValFQN(nsFQN, oblName, oblVal string) string { + return nsFQN + "/obl/" + oblName + "/value/" + oblVal } func (c PolicyDBClient) GetObligation(ctx context.Context, r *obligations.GetObligationRequest) (*policy.Obligation, error) { @@ -319,7 +319,6 @@ func (c PolicyDBClient) CreateObligationValue(ctx context.Context, r *obligation if err != nil { return nil, db.WrapIfKnownInvalidQueryErr(err) } - id := row.ID namespace := &policy.Namespace{} if err := unmarshalNamespace(row.Namespace, namespace); err != nil { @@ -335,19 +334,152 @@ func (c PolicyDBClient) CreateObligationValue(ctx context.Context, r *obligation metadata.UpdatedAt = now obl := &policy.Obligation{ - Id: id, + Id: row.ObligationID, Name: row.Name, Namespace: namespace, } return &policy.ObligationValue{ - Id: id, + Id: row.ID, Obligation: obl, Value: value, Metadata: metadata, }, nil } +func (c PolicyDBClient) GetObligationValue(ctx context.Context, r *obligations.GetObligationValueRequest) (*policy.ObligationValue, error) { + nsFQN, oblName, oblVal := breakOblValFQN(r.GetFqn()) + queryParams := getObligationValueParams{ + ID: r.GetId(), + Name: oblName, + Value: oblVal, + NamespaceFqn: nsFQN, + } + + row, err := c.queries.getObligationValue(ctx, queryParams) + if err != nil { + return nil, db.WrapIfKnownInvalidQueryErr(err) + } + + namespace := &policy.Namespace{} + if err := unmarshalNamespace(row.Namespace, namespace); err != nil { + return nil, fmt.Errorf("failed to unmarshal obligation namespace: %w", err) + } + + metadata := &common.Metadata{} + if err := unmarshalMetadata(row.Metadata, metadata); err != nil { + return nil, fmt.Errorf("failed to unmarshal obligation metadata: %w", err) + } + + obl := &policy.Obligation{ + Id: row.ObligationID, + Name: row.Name, + Namespace: namespace, + } + + return &policy.ObligationValue{ + Id: row.ID, + Obligation: obl, + Value: row.Value, + Metadata: metadata, + }, nil +} + +// func (c PolicyDBClient) GetObligationValuesByFQNs(ctx context.Context, r *obligations.GetObligationValuesByFQNsRequest) ([]*policy.ObligationValue, error) { +// nsFQNs := make([]string, 0, len(r.GetFqns())) +// oblNames := make([]string, 0, len(r.GetFqns())) +// oblVals := make([]string, 0, len(r.GetFqns())) +// for _, fqn := range r.GetFqns() { +// nsFQN, oblName, oblVal := breakOblValFQN(fqn) +// nsFQNs = append(nsFQNs, nsFQN) +// oblNames = append(oblNames, oblName) +// oblVals = append(oblVals, oblVal) +// } + +// queryParams := getObligationValuesByFQNsParams{ +// NamespaceFqns: nsFQNs, +// ObligationNames: oblNames, +// ValueNames: oblVals, +// } + +// list, err := c.queries.getObligationValuesByFQNs(ctx, queryParams) +// if err != nil { +// return nil, db.WrapIfKnownInvalidQueryErr(err) +// } +// oblVals := make([]*policy.ObligationValue, len(list)) + +// for i, r := range list { +// metadata := &common.Metadata{} +// if err = unmarshalMetadata(r.Metadata, metadata); err != nil { +// return nil, err +// } + +// namespace := &policy.Namespace{} +// if err := unmarshalNamespace(r.Namespace, namespace); err != nil { +// return nil, fmt.Errorf("failed to unmarshal obligation namespace: %w", err) +// } + +// obl := &policy.Obligation{ +// Id: r.ObligationID, +// Name: r.ObligationName, +// Namespace: namespace, +// } + +// oblVals[i] = &policy.ObligationValue{ +// Id: r.ID, +// Value: r.Value, +// Metadata: metadata, +// Obligation: obl, +// } +// } + +// return oblVals, nil +// } + +// func (c PolicyDBClient) UpdateObligationValue(ctx context.Context, r *obligations.UpdateObligationValueRequest) (*policy.ObligationValue, error) { +// id := r.GetId() +// value := r.GetValue() +// oblVal, err := c.GetObligationValue(ctx, &obligations.GetObligationValueRequest{ +// Identifier: &obligations.GetObligationValueRequest_Id{ +// Id: id, +// }, +// }) +// if err != nil { +// return nil, err +// } +// if value == "" { +// value = oblVal.GetValue() +// } +// metadataJSON, metadata, err := db.MarshalUpdateMetadata(r.GetMetadata(), r.GetMetadataUpdateBehavior(), func() (*common.Metadata, error) { +// return oblVal.GetMetadata(), nil +// }) +// if err != nil { +// return nil, err +// } + +// count, err := c.queries.updateObligationValue(ctx, updateObligationValueParams{ +// ID: id, +// Value: value, +// Metadata: metadataJSON, +// }) +// now := timestamppb.Now() +// if err != nil { +// return nil, db.WrapIfKnownInvalidQueryErr(err) +// } +// if count == 0 { +// return nil, db.ErrNotFound +// } +// metadata.CreatedAt = oblVal.GetMetadata().GetCreatedAt() +// metadata.UpdatedAt = now + +// return &policy.ObligationValue{ +// Id: id, +// Value: value, +// Metadata: metadata, +// Obligation: oblVal.GetObligation(), +// }, nil +// } + func (c PolicyDBClient) DeleteObligationValue(ctx context.Context, r *obligations.DeleteObligationValueRequest) (*policy.ObligationValue, error) { nsFQN, oblName, valName := breakOblValFQN(r.GetFqn()) queryParams := deleteObligationValueParams{ diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index fb74b69a25..8a4d806596 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -183,6 +183,7 @@ inserted_value AS ( SELECT iv.id, ol.name, + ol.id as obligation_id, JSON_BUILD_OBJECT( 'id', n.id, 'name', n.name, @@ -205,10 +206,11 @@ type createObligationValueParams struct { } type createObligationValueRow struct { - ID string `json:"id"` - Name string `json:"name"` - Namespace []byte `json:"namespace"` - Metadata []byte `json:"metadata"` + ID string `json:"id"` + Name string `json:"name"` + ObligationID string `json:"obligation_id"` + Namespace []byte `json:"namespace"` + Metadata []byte `json:"metadata"` } // -------------------------------------------------------------- @@ -240,6 +242,7 @@ type createObligationValueRow struct { // SELECT // iv.id, // ol.name, +// ol.id as obligation_id, // JSON_BUILD_OBJECT( // 'id', n.id, // 'name', n.name, @@ -263,6 +266,7 @@ func (q *Queries) createObligationValue(ctx context.Context, arg createObligatio err := row.Scan( &i.ID, &i.Name, + &i.ObligationID, &i.Namespace, &i.Metadata, ) @@ -479,6 +483,96 @@ func (q *Queries) getObligation(ctx context.Context, arg getObligationParams) (g return i, err } +const getObligationValue = `-- name: getObligationValue :one +SELECT + ov.id, + ov.value, + od.id as obligation_id, + od.name, + JSON_BUILD_OBJECT( + 'id', n.id, + 'name', n.name, + 'fqn', fqns.fqn + ) as namespace, + JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ov.metadata -> 'labels', 'created_at', ov.created_at,'updated_at', ov.updated_at)) as metadata +FROM obligation_values_standard ov +JOIN obligation_definitions od ON ov.obligation_definition_id = od.id +JOIN attribute_namespaces n ON od.namespace_id = n.id +LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL +WHERE + -- lookup by value id OR by namespace fqn + obligation name + value name + ( + -- lookup by value id + ($1::TEXT != '' AND ov.id = $1::UUID) + OR + -- lookup by namespace fqn + obligation name + value name + ($2::TEXT != '' AND $3::TEXT != '' AND $4::TEXT != '' + AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR AND ov.value = $4::VARCHAR) + ) +` + +type getObligationValueParams struct { + ID string `json:"id"` + NamespaceFqn string `json:"namespace_fqn"` + Name string `json:"name"` + Value string `json:"value"` +} + +type getObligationValueRow struct { + ID string `json:"id"` + Value string `json:"value"` + ObligationID string `json:"obligation_id"` + Name string `json:"name"` + Namespace []byte `json:"namespace"` + Metadata []byte `json:"metadata"` +} + +// getObligationValue +// +// SELECT +// ov.id, +// ov.value, +// od.id as obligation_id, +// od.name, +// JSON_BUILD_OBJECT( +// 'id', n.id, +// 'name', n.name, +// 'fqn', fqns.fqn +// ) as namespace, +// JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ov.metadata -> 'labels', 'created_at', ov.created_at,'updated_at', ov.updated_at)) as metadata +// FROM obligation_values_standard ov +// JOIN obligation_definitions od ON ov.obligation_definition_id = od.id +// JOIN attribute_namespaces n ON od.namespace_id = n.id +// LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL +// WHERE +// -- lookup by value id OR by namespace fqn + obligation name + value name +// ( +// -- lookup by value id +// ($1::TEXT != '' AND ov.id = $1::UUID) +// OR +// -- lookup by namespace fqn + obligation name + value name +// ($2::TEXT != '' AND $3::TEXT != '' AND $4::TEXT != '' +// AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR AND ov.value = $4::VARCHAR) +// ) +func (q *Queries) getObligationValue(ctx context.Context, arg getObligationValueParams) (getObligationValueRow, error) { + row := q.db.QueryRow(ctx, getObligationValue, + arg.ID, + arg.NamespaceFqn, + arg.Name, + arg.Value, + ) + var i getObligationValueRow + err := row.Scan( + &i.ID, + &i.Value, + &i.ObligationID, + &i.Name, + &i.Namespace, + &i.Metadata, + ) + return i, err +} + const getObligationsByFQNs = `-- name: getObligationsByFQNs :many SELECT od.id, diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 4f1c2d08fc..2cdf4c5689 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -219,6 +219,7 @@ inserted_value AS ( SELECT iv.id, ol.name, + ol.id as obligation_id, JSON_BUILD_OBJECT( 'id', n.id, 'name', n.name, @@ -231,6 +232,33 @@ JOIN obligation_definitions od ON od.id = ol.id JOIN attribute_namespaces n ON od.namespace_id = n.id LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL; +-- name: getObligationValue :one +SELECT + ov.id, + ov.value, + od.id as obligation_id, + od.name, + JSON_BUILD_OBJECT( + 'id', n.id, + 'name', n.name, + 'fqn', fqns.fqn + ) as namespace, + JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ov.metadata -> 'labels', 'created_at', ov.created_at,'updated_at', ov.updated_at)) as metadata +FROM obligation_values_standard ov +JOIN obligation_definitions od ON ov.obligation_definition_id = od.id +JOIN attribute_namespaces n ON od.namespace_id = n.id +LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL +WHERE + -- lookup by value id OR by namespace fqn + obligation name + value name + ( + -- lookup by value id + (@id::TEXT != '' AND ov.id = @id::UUID) + OR + -- lookup by namespace fqn + obligation name + value name + (@namespace_fqn::TEXT != '' AND @name::TEXT != '' AND @value::TEXT != '' + AND fqns.fqn = @namespace_fqn::VARCHAR AND od.name = @name::VARCHAR AND ov.value = @value::VARCHAR) + ); + -- name: deleteObligationValue :one DELETE FROM obligation_values_standard WHERE id IN ( From 9ae2b2fdd592d3daf8b813c8f2fe0a153cba51a4 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 25 Aug 2025 15:02:20 -0400 Subject: [PATCH 099/137] add tests --- service/integration/obligations_test.go | 104 ++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 8dab9a053d..6ad96c3173 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -560,6 +560,110 @@ func (s *ObligationsSuite) Test_CreateObligationValue_Fails() { s.deleteObligations([]string{createdObl.GetId()}) } +// Get + +func (s *ObligationsSuite) Test_GetObligationValue_Succeeds() { + namespaceID, namespaceFQN, namespace := s.getNamespaceData(nsExampleCom) + createdObl := s.createObligation(namespaceID, oblName, nil) // Create obligation without values + + // Create obligation value first + oblValue, err := s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ + ObligationIdentifier: &obligations.CreateObligationValueRequest_Id{ + Id: createdObl.GetId(), + }, + Value: oblValPrefix + "get-test", + Metadata: &common.MetadataMutable{ + Labels: map[string]string{"test": "get-value"}, + }, + }) + s.Require().NoError(err) + s.NotNil(oblValue) + + // Test 1: Get obligation value by ID + retrievedValue, err := s.db.PolicyClient.GetObligationValue(s.ctx, &obligations.GetObligationValueRequest{ + Identifier: &obligations.GetObligationValueRequest_Id{ + Id: oblValue.GetId(), + }, + }) + s.Require().NoError(err) + s.NotNil(retrievedValue) + s.Equal(oblValue.GetId(), retrievedValue.GetId()) + s.Equal(oblValPrefix+"get-test", retrievedValue.GetValue()) + s.Equal("get-value", retrievedValue.GetMetadata().GetLabels()["test"]) + s.assertObligationValueBasics(retrievedValue, oblValPrefix+"get-test", namespaceID, namespace.Name, namespaceFQN) + + // Test 2: Get obligation value by FQN + oblValFQN := policydb.BuildOblValFQN(namespaceFQN, oblName, oblValPrefix+"get-test") + retrievedValue2, err := s.db.PolicyClient.GetObligationValue(s.ctx, &obligations.GetObligationValueRequest{ + Identifier: &obligations.GetObligationValueRequest_Fqn{ + Fqn: oblValFQN, + }, + }) + s.Require().NoError(err) + s.NotNil(retrievedValue2) + s.Equal(oblValue.GetId(), retrievedValue2.GetId()) + s.Equal(oblValPrefix+"get-test", retrievedValue2.GetValue()) + s.assertObligationValueBasics(retrievedValue2, oblValPrefix+"get-test", namespaceID, namespace.Name, namespaceFQN) + + // Cleanup + s.deleteObligations([]string{createdObl.GetId()}) +} + +func (s *ObligationsSuite) Test_GetObligationValue_Fails() { + // Test 1: Invalid value ID + retrievedValue, err := s.db.PolicyClient.GetObligationValue(s.ctx, &obligations.GetObligationValueRequest{ + Identifier: &obligations.GetObligationValueRequest_Id{ + Id: invalidUUID, + }, + }) + s.Require().ErrorIs(err, db.ErrUUIDInvalid) + s.Nil(retrievedValue) + + // Test 2: Non-existent value ID + retrievedValue, err = s.db.PolicyClient.GetObligationValue(s.ctx, &obligations.GetObligationValueRequest{ + Identifier: &obligations.GetObligationValueRequest_Id{ + Id: invalidID, + }, + }) + s.Require().ErrorIs(err, db.ErrNotFound) + s.Nil(retrievedValue) + + // Test 3: Invalid value FQN + retrievedValue, err = s.db.PolicyClient.GetObligationValue(s.ctx, &obligations.GetObligationValueRequest{ + Identifier: &obligations.GetObligationValueRequest_Fqn{ + Fqn: invalidFQN, + }, + }) + s.Require().ErrorIs(err, db.ErrNotFound) + s.Nil(retrievedValue) + + // Test 4: Non-existent value name in valid obligation + namespaceID, namespaceFQN, _ := s.getNamespaceData(nsExampleCom) + createdObl := s.createObligation(namespaceID, oblName, nil) + nonExistentValFQN := policydb.BuildOblValFQN(namespaceFQN, oblName, "non-existent-value") + + retrievedValue, err = s.db.PolicyClient.GetObligationValue(s.ctx, &obligations.GetObligationValueRequest{ + Identifier: &obligations.GetObligationValueRequest_Fqn{ + Fqn: nonExistentValFQN, + }, + }) + s.Require().ErrorIs(err, db.ErrNotFound) + s.Nil(retrievedValue) + + // Test 5: Non-existent obligation name in valid namespace + nonExistentOblFQN := policydb.BuildOblValFQN(namespaceFQN, "non-existent-obligation", oblValPrefix+"test") + retrievedValue, err = s.db.PolicyClient.GetObligationValue(s.ctx, &obligations.GetObligationValueRequest{ + Identifier: &obligations.GetObligationValueRequest_Fqn{ + Fqn: nonExistentOblFQN, + }, + }) + s.Require().ErrorIs(err, db.ErrNotFound) + s.Nil(retrievedValue) + + // Cleanup + s.deleteObligations([]string{createdObl.GetId()}) +} + // Delete func (s *ObligationsSuite) Test_DeleteObligationValue_Succeeds() { From c7bf4f201abd446e25970cbcc315bec8494865f6 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 25 Aug 2025 15:19:26 -0400 Subject: [PATCH 100/137] claude changes --- service/integration/obligations_test.go | 10 +++---- service/policy/db/obligations.go | 7 +++++ service/policy/db/obligations.sql.go | 36 +++++++++++------------ service/policy/db/queries/obligations.sql | 18 ++++++------ 4 files changed, 38 insertions(+), 33 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 6ad96c3173..e9ff01ccee 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -564,7 +564,8 @@ func (s *ObligationsSuite) Test_CreateObligationValue_Fails() { func (s *ObligationsSuite) Test_GetObligationValue_Succeeds() { namespaceID, namespaceFQN, namespace := s.getNamespaceData(nsExampleCom) - createdObl := s.createObligation(namespaceID, oblName, nil) // Create obligation without values + createdObl := s.createObligation(namespaceID, oblName+"-get-test", nil) // Create obligation without values + defer s.deleteObligations([]string{createdObl.GetId()}) // Create obligation value first oblValue, err := s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ @@ -593,7 +594,7 @@ func (s *ObligationsSuite) Test_GetObligationValue_Succeeds() { s.assertObligationValueBasics(retrievedValue, oblValPrefix+"get-test", namespaceID, namespace.Name, namespaceFQN) // Test 2: Get obligation value by FQN - oblValFQN := policydb.BuildOblValFQN(namespaceFQN, oblName, oblValPrefix+"get-test") + oblValFQN := policydb.BuildOblValFQN(namespaceFQN, oblName+"-get-test", oblValPrefix+"get-test") retrievedValue2, err := s.db.PolicyClient.GetObligationValue(s.ctx, &obligations.GetObligationValueRequest{ Identifier: &obligations.GetObligationValueRequest_Fqn{ Fqn: oblValFQN, @@ -604,9 +605,6 @@ func (s *ObligationsSuite) Test_GetObligationValue_Succeeds() { s.Equal(oblValue.GetId(), retrievedValue2.GetId()) s.Equal(oblValPrefix+"get-test", retrievedValue2.GetValue()) s.assertObligationValueBasics(retrievedValue2, oblValPrefix+"get-test", namespaceID, namespace.Name, namespaceFQN) - - // Cleanup - s.deleteObligations([]string{createdObl.GetId()}) } func (s *ObligationsSuite) Test_GetObligationValue_Fails() { @@ -822,6 +820,6 @@ func (s *ObligationsSuite) deleteObligation(oblID string) { func (s *ObligationsSuite) deleteObligations(oblIDs []string) { for _, oblID := range oblIDs { - defer s.deleteObligation(oblID) + s.deleteObligation(oblID) } } diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 98ce808711..5015abf2d8 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -348,6 +348,13 @@ func (c PolicyDBClient) CreateObligationValue(ctx context.Context, r *obligation } func (c PolicyDBClient) GetObligationValue(ctx context.Context, r *obligations.GetObligationValueRequest) (*policy.ObligationValue, error) { + // Validate UUID if provided + if id := r.GetId(); id != "" { + if err := ValidateUUID(id); err != nil { + return nil, db.ErrUUIDInvalid + } + } + nsFQN, oblName, oblVal := breakOblValFQN(r.GetFqn()) queryParams := getObligationValueParams{ ID: r.GetId(), diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 8a4d806596..c5271c9363 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -167,10 +167,10 @@ WITH obligation_lookup AS ( -- lookup by obligation id OR by namespace fqn + obligation name ( -- lookup by obligation id - (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) + ($1::TEXT != '' AND od.id = $1::UUID) OR -- lookup by namespace fqn + obligation name - (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL + ($2::TEXT != '' AND $3::TEXT != '' AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) ) ), @@ -226,10 +226,10 @@ type createObligationValueRow struct { // -- lookup by obligation id OR by namespace fqn + obligation name // ( // -- lookup by obligation id -// (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) +// ($1::TEXT != '' AND od.id = $1::UUID) // OR // -- lookup by namespace fqn + obligation name -// (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL +// ($2::TEXT != '' AND $3::TEXT != '' // AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) // ) // ), @@ -284,10 +284,10 @@ WHERE id IN ( -- lookup by obligation id OR by namespace fqn + obligation name ( -- lookup by obligation id - (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) + ($1::TEXT != '' AND od.id = $1::UUID) OR -- lookup by namespace fqn + obligation name - (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL + ($2::TEXT != '' AND $3::TEXT != '' AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) ) ) @@ -312,10 +312,10 @@ type deleteObligationParams struct { // -- lookup by obligation id OR by namespace fqn + obligation name // ( // -- lookup by obligation id -// (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) +// ($1::TEXT != '' AND od.id = $1::UUID) // OR // -- lookup by namespace fqn + obligation name -// (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL +// ($2::TEXT != '' AND $3::TEXT != '' // AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) // ) // ) @@ -339,10 +339,10 @@ WHERE id IN ( -- lookup by value id OR by namespace fqn + obligation name + value name ( -- lookup by value id - (NULLIF($1::TEXT, '') IS NOT NULL AND ov.id = $1::UUID) + ($1::TEXT != '' AND ov.id = $1::UUID) OR -- lookup by namespace fqn + obligation name + value name - (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL AND NULLIF($4::TEXT, '') IS NOT NULL + ($2::TEXT != '' AND $3::TEXT != '' AND $4::TEXT != '' AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR AND ov.value = $4::VARCHAR) ) ) @@ -369,10 +369,10 @@ type deleteObligationValueParams struct { // -- lookup by value id OR by namespace fqn + obligation name + value name // ( // -- lookup by value id -// (NULLIF($1::TEXT, '') IS NOT NULL AND ov.id = $1::UUID) +// ($1::TEXT != '' AND ov.id = $1::UUID) // OR // -- lookup by namespace fqn + obligation name + value name -// (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL AND NULLIF($4::TEXT, '') IS NOT NULL +// ($2::TEXT != '' AND $3::TEXT != '' AND $4::TEXT != '' // AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR AND ov.value = $4::VARCHAR) // ) // ) @@ -414,10 +414,10 @@ WHERE -- lookup by obligation id OR by namespace fqn + obligation name ( -- lookup by obligation id - (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) + ($1::TEXT != '' AND od.id = $1::UUID) OR -- lookup by namespace fqn + obligation name - (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL + ($2::TEXT != '' AND $3::TEXT != '' AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) ) GROUP BY od.id, n.id, fqns.fqn @@ -463,10 +463,10 @@ type getObligationRow struct { // -- lookup by obligation id OR by namespace fqn + obligation name // ( // -- lookup by obligation id -// (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) +// ($1::TEXT != '' AND od.id = $1::UUID) // OR // -- lookup by namespace fqn + obligation name -// (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL +// ($2::TEXT != '' AND $3::TEXT != '' // AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) // ) // GROUP BY od.id, n.id, fqns.fqn @@ -503,7 +503,7 @@ WHERE -- lookup by value id OR by namespace fqn + obligation name + value name ( -- lookup by value id - ($1::TEXT != '' AND ov.id = $1::UUID) + ($1::TEXT != '' AND ov.id::TEXT = $1::TEXT) OR -- lookup by namespace fqn + obligation name + value name ($2::TEXT != '' AND $3::TEXT != '' AND $4::TEXT != '' @@ -548,7 +548,7 @@ type getObligationValueRow struct { // -- lookup by value id OR by namespace fqn + obligation name + value name // ( // -- lookup by value id -// ($1::TEXT != '' AND ov.id = $1::UUID) +// ($1::TEXT != '' AND ov.id::TEXT = $1::TEXT) // OR // -- lookup by namespace fqn + obligation name + value name // ($2::TEXT != '' AND $3::TEXT != '' AND $4::TEXT != '' diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 2cdf4c5689..d54c7a1dee 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -81,10 +81,10 @@ WHERE -- lookup by obligation id OR by namespace fqn + obligation name ( -- lookup by obligation id - (NULLIF(@id::TEXT, '') IS NOT NULL AND od.id = @id::UUID) + (@id::TEXT != '' AND od.id = @id::UUID) OR -- lookup by namespace fqn + obligation name - (NULLIF(@namespace_fqn::TEXT, '') IS NOT NULL AND NULLIF(@name::TEXT, '') IS NOT NULL + (@namespace_fqn::TEXT != '' AND @name::TEXT != '' AND fqns.fqn = @namespace_fqn::VARCHAR AND od.name = @name::VARCHAR) ) GROUP BY od.id, n.id, fqns.fqn; @@ -146,10 +146,10 @@ WHERE id IN ( -- lookup by obligation id OR by namespace fqn + obligation name ( -- lookup by obligation id - (NULLIF(@id::TEXT, '') IS NOT NULL AND od.id = @id::UUID) + (@id::TEXT != '' AND od.id = @id::UUID) OR -- lookup by namespace fqn + obligation name - (NULLIF(@namespace_fqn::TEXT, '') IS NOT NULL AND NULLIF(@name::TEXT, '') IS NOT NULL + (@namespace_fqn::TEXT != '' AND @name::TEXT != '' AND fqns.fqn = @namespace_fqn::VARCHAR AND od.name = @name::VARCHAR) ) ) @@ -203,10 +203,10 @@ WITH obligation_lookup AS ( -- lookup by obligation id OR by namespace fqn + obligation name ( -- lookup by obligation id - (NULLIF(@id::TEXT, '') IS NOT NULL AND od.id = @id::UUID) + (@id::TEXT != '' AND od.id = @id::UUID) OR -- lookup by namespace fqn + obligation name - (NULLIF(@namespace_fqn::TEXT, '') IS NOT NULL AND NULLIF(@name::TEXT, '') IS NOT NULL + (@namespace_fqn::TEXT != '' AND @name::TEXT != '' AND fqns.fqn = @namespace_fqn::VARCHAR AND od.name = @name::VARCHAR) ) ), @@ -252,7 +252,7 @@ WHERE -- lookup by value id OR by namespace fqn + obligation name + value name ( -- lookup by value id - (@id::TEXT != '' AND ov.id = @id::UUID) + (@id::TEXT != '' AND ov.id::TEXT = @id::TEXT) OR -- lookup by namespace fqn + obligation name + value name (@namespace_fqn::TEXT != '' AND @name::TEXT != '' AND @value::TEXT != '' @@ -271,10 +271,10 @@ WHERE id IN ( -- lookup by value id OR by namespace fqn + obligation name + value name ( -- lookup by value id - (NULLIF(@id::TEXT, '') IS NOT NULL AND ov.id = @id::UUID) + (@id::TEXT != '' AND ov.id = @id::UUID) OR -- lookup by namespace fqn + obligation name + value name - (NULLIF(@namespace_fqn::TEXT, '') IS NOT NULL AND NULLIF(@name::TEXT, '') IS NOT NULL AND NULLIF(@value::TEXT, '') IS NOT NULL + (@namespace_fqn::TEXT != '' AND @name::TEXT != '' AND @value::TEXT != '' AND fqns.fqn = @namespace_fqn::VARCHAR AND od.name = @name::VARCHAR AND ov.value = @value::VARCHAR) ) ) From 4b3a83a2058e7efa72cec6f798c3e140d8ca1eb1 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 25 Aug 2025 15:20:10 -0400 Subject: [PATCH 101/137] Revert "claude changes" This reverts commit c7bf4f201abd446e25970cbcc315bec8494865f6. --- service/integration/obligations_test.go | 10 ++++--- service/policy/db/obligations.go | 7 ----- service/policy/db/obligations.sql.go | 36 +++++++++++------------ service/policy/db/queries/obligations.sql | 18 ++++++------ 4 files changed, 33 insertions(+), 38 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index e9ff01ccee..6ad96c3173 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -564,8 +564,7 @@ func (s *ObligationsSuite) Test_CreateObligationValue_Fails() { func (s *ObligationsSuite) Test_GetObligationValue_Succeeds() { namespaceID, namespaceFQN, namespace := s.getNamespaceData(nsExampleCom) - createdObl := s.createObligation(namespaceID, oblName+"-get-test", nil) // Create obligation without values - defer s.deleteObligations([]string{createdObl.GetId()}) + createdObl := s.createObligation(namespaceID, oblName, nil) // Create obligation without values // Create obligation value first oblValue, err := s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ @@ -594,7 +593,7 @@ func (s *ObligationsSuite) Test_GetObligationValue_Succeeds() { s.assertObligationValueBasics(retrievedValue, oblValPrefix+"get-test", namespaceID, namespace.Name, namespaceFQN) // Test 2: Get obligation value by FQN - oblValFQN := policydb.BuildOblValFQN(namespaceFQN, oblName+"-get-test", oblValPrefix+"get-test") + oblValFQN := policydb.BuildOblValFQN(namespaceFQN, oblName, oblValPrefix+"get-test") retrievedValue2, err := s.db.PolicyClient.GetObligationValue(s.ctx, &obligations.GetObligationValueRequest{ Identifier: &obligations.GetObligationValueRequest_Fqn{ Fqn: oblValFQN, @@ -605,6 +604,9 @@ func (s *ObligationsSuite) Test_GetObligationValue_Succeeds() { s.Equal(oblValue.GetId(), retrievedValue2.GetId()) s.Equal(oblValPrefix+"get-test", retrievedValue2.GetValue()) s.assertObligationValueBasics(retrievedValue2, oblValPrefix+"get-test", namespaceID, namespace.Name, namespaceFQN) + + // Cleanup + s.deleteObligations([]string{createdObl.GetId()}) } func (s *ObligationsSuite) Test_GetObligationValue_Fails() { @@ -820,6 +822,6 @@ func (s *ObligationsSuite) deleteObligation(oblID string) { func (s *ObligationsSuite) deleteObligations(oblIDs []string) { for _, oblID := range oblIDs { - s.deleteObligation(oblID) + defer s.deleteObligation(oblID) } } diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 5015abf2d8..98ce808711 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -348,13 +348,6 @@ func (c PolicyDBClient) CreateObligationValue(ctx context.Context, r *obligation } func (c PolicyDBClient) GetObligationValue(ctx context.Context, r *obligations.GetObligationValueRequest) (*policy.ObligationValue, error) { - // Validate UUID if provided - if id := r.GetId(); id != "" { - if err := ValidateUUID(id); err != nil { - return nil, db.ErrUUIDInvalid - } - } - nsFQN, oblName, oblVal := breakOblValFQN(r.GetFqn()) queryParams := getObligationValueParams{ ID: r.GetId(), diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index c5271c9363..8a4d806596 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -167,10 +167,10 @@ WITH obligation_lookup AS ( -- lookup by obligation id OR by namespace fqn + obligation name ( -- lookup by obligation id - ($1::TEXT != '' AND od.id = $1::UUID) + (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) OR -- lookup by namespace fqn + obligation name - ($2::TEXT != '' AND $3::TEXT != '' + (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) ) ), @@ -226,10 +226,10 @@ type createObligationValueRow struct { // -- lookup by obligation id OR by namespace fqn + obligation name // ( // -- lookup by obligation id -// ($1::TEXT != '' AND od.id = $1::UUID) +// (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) // OR // -- lookup by namespace fqn + obligation name -// ($2::TEXT != '' AND $3::TEXT != '' +// (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL // AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) // ) // ), @@ -284,10 +284,10 @@ WHERE id IN ( -- lookup by obligation id OR by namespace fqn + obligation name ( -- lookup by obligation id - ($1::TEXT != '' AND od.id = $1::UUID) + (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) OR -- lookup by namespace fqn + obligation name - ($2::TEXT != '' AND $3::TEXT != '' + (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) ) ) @@ -312,10 +312,10 @@ type deleteObligationParams struct { // -- lookup by obligation id OR by namespace fqn + obligation name // ( // -- lookup by obligation id -// ($1::TEXT != '' AND od.id = $1::UUID) +// (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) // OR // -- lookup by namespace fqn + obligation name -// ($2::TEXT != '' AND $3::TEXT != '' +// (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL // AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) // ) // ) @@ -339,10 +339,10 @@ WHERE id IN ( -- lookup by value id OR by namespace fqn + obligation name + value name ( -- lookup by value id - ($1::TEXT != '' AND ov.id = $1::UUID) + (NULLIF($1::TEXT, '') IS NOT NULL AND ov.id = $1::UUID) OR -- lookup by namespace fqn + obligation name + value name - ($2::TEXT != '' AND $3::TEXT != '' AND $4::TEXT != '' + (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL AND NULLIF($4::TEXT, '') IS NOT NULL AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR AND ov.value = $4::VARCHAR) ) ) @@ -369,10 +369,10 @@ type deleteObligationValueParams struct { // -- lookup by value id OR by namespace fqn + obligation name + value name // ( // -- lookup by value id -// ($1::TEXT != '' AND ov.id = $1::UUID) +// (NULLIF($1::TEXT, '') IS NOT NULL AND ov.id = $1::UUID) // OR // -- lookup by namespace fqn + obligation name + value name -// ($2::TEXT != '' AND $3::TEXT != '' AND $4::TEXT != '' +// (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL AND NULLIF($4::TEXT, '') IS NOT NULL // AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR AND ov.value = $4::VARCHAR) // ) // ) @@ -414,10 +414,10 @@ WHERE -- lookup by obligation id OR by namespace fqn + obligation name ( -- lookup by obligation id - ($1::TEXT != '' AND od.id = $1::UUID) + (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) OR -- lookup by namespace fqn + obligation name - ($2::TEXT != '' AND $3::TEXT != '' + (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) ) GROUP BY od.id, n.id, fqns.fqn @@ -463,10 +463,10 @@ type getObligationRow struct { // -- lookup by obligation id OR by namespace fqn + obligation name // ( // -- lookup by obligation id -// ($1::TEXT != '' AND od.id = $1::UUID) +// (NULLIF($1::TEXT, '') IS NOT NULL AND od.id = $1::UUID) // OR // -- lookup by namespace fqn + obligation name -// ($2::TEXT != '' AND $3::TEXT != '' +// (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL // AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR) // ) // GROUP BY od.id, n.id, fqns.fqn @@ -503,7 +503,7 @@ WHERE -- lookup by value id OR by namespace fqn + obligation name + value name ( -- lookup by value id - ($1::TEXT != '' AND ov.id::TEXT = $1::TEXT) + ($1::TEXT != '' AND ov.id = $1::UUID) OR -- lookup by namespace fqn + obligation name + value name ($2::TEXT != '' AND $3::TEXT != '' AND $4::TEXT != '' @@ -548,7 +548,7 @@ type getObligationValueRow struct { // -- lookup by value id OR by namespace fqn + obligation name + value name // ( // -- lookup by value id -// ($1::TEXT != '' AND ov.id::TEXT = $1::TEXT) +// ($1::TEXT != '' AND ov.id = $1::UUID) // OR // -- lookup by namespace fqn + obligation name + value name // ($2::TEXT != '' AND $3::TEXT != '' AND $4::TEXT != '' diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index d54c7a1dee..2cdf4c5689 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -81,10 +81,10 @@ WHERE -- lookup by obligation id OR by namespace fqn + obligation name ( -- lookup by obligation id - (@id::TEXT != '' AND od.id = @id::UUID) + (NULLIF(@id::TEXT, '') IS NOT NULL AND od.id = @id::UUID) OR -- lookup by namespace fqn + obligation name - (@namespace_fqn::TEXT != '' AND @name::TEXT != '' + (NULLIF(@namespace_fqn::TEXT, '') IS NOT NULL AND NULLIF(@name::TEXT, '') IS NOT NULL AND fqns.fqn = @namespace_fqn::VARCHAR AND od.name = @name::VARCHAR) ) GROUP BY od.id, n.id, fqns.fqn; @@ -146,10 +146,10 @@ WHERE id IN ( -- lookup by obligation id OR by namespace fqn + obligation name ( -- lookup by obligation id - (@id::TEXT != '' AND od.id = @id::UUID) + (NULLIF(@id::TEXT, '') IS NOT NULL AND od.id = @id::UUID) OR -- lookup by namespace fqn + obligation name - (@namespace_fqn::TEXT != '' AND @name::TEXT != '' + (NULLIF(@namespace_fqn::TEXT, '') IS NOT NULL AND NULLIF(@name::TEXT, '') IS NOT NULL AND fqns.fqn = @namespace_fqn::VARCHAR AND od.name = @name::VARCHAR) ) ) @@ -203,10 +203,10 @@ WITH obligation_lookup AS ( -- lookup by obligation id OR by namespace fqn + obligation name ( -- lookup by obligation id - (@id::TEXT != '' AND od.id = @id::UUID) + (NULLIF(@id::TEXT, '') IS NOT NULL AND od.id = @id::UUID) OR -- lookup by namespace fqn + obligation name - (@namespace_fqn::TEXT != '' AND @name::TEXT != '' + (NULLIF(@namespace_fqn::TEXT, '') IS NOT NULL AND NULLIF(@name::TEXT, '') IS NOT NULL AND fqns.fqn = @namespace_fqn::VARCHAR AND od.name = @name::VARCHAR) ) ), @@ -252,7 +252,7 @@ WHERE -- lookup by value id OR by namespace fqn + obligation name + value name ( -- lookup by value id - (@id::TEXT != '' AND ov.id::TEXT = @id::TEXT) + (@id::TEXT != '' AND ov.id = @id::UUID) OR -- lookup by namespace fqn + obligation name + value name (@namespace_fqn::TEXT != '' AND @name::TEXT != '' AND @value::TEXT != '' @@ -271,10 +271,10 @@ WHERE id IN ( -- lookup by value id OR by namespace fqn + obligation name + value name ( -- lookup by value id - (@id::TEXT != '' AND ov.id = @id::UUID) + (NULLIF(@id::TEXT, '') IS NOT NULL AND ov.id = @id::UUID) OR -- lookup by namespace fqn + obligation name + value name - (@namespace_fqn::TEXT != '' AND @name::TEXT != '' AND @value::TEXT != '' + (NULLIF(@namespace_fqn::TEXT, '') IS NOT NULL AND NULLIF(@name::TEXT, '') IS NOT NULL AND NULLIF(@value::TEXT, '') IS NOT NULL AND fqns.fqn = @namespace_fqn::VARCHAR AND od.name = @name::VARCHAR AND ov.value = @value::VARCHAR) ) ) From a858c9b534fac1e28a9abe6a9e4bce58e30da830 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 25 Aug 2025 15:34:51 -0400 Subject: [PATCH 102/137] comment out unnecessary code --- service/integration/obligations_test.go | 37 ++++++++++++------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 6ad96c3173..753f5ab9db 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -490,7 +490,6 @@ func (s *ObligationsSuite) Test_CreateObligationValue_Succeeds() { }) s.Require().NoError(err) s.NotNil(oblValue) - s.Equal(oblValPrefix+"test-1", oblValue.GetValue()) s.Equal("value", oblValue.GetMetadata().GetLabels()["test"]) s.assertObligationValueBasics(oblValue, oblValPrefix+"test-1", namespaceID, namespace.Name, namespaceFQN) @@ -504,7 +503,6 @@ func (s *ObligationsSuite) Test_CreateObligationValue_Succeeds() { }) s.Require().NoError(err) s.NotNil(oblValue2) - s.Equal(oblValPrefix+"test-2", oblValue2.GetValue()) s.assertObligationValueBasics(oblValue2, oblValPrefix+"test-2", namespaceID, namespace.Name, namespaceFQN) // Cleanup @@ -564,20 +562,22 @@ func (s *ObligationsSuite) Test_CreateObligationValue_Fails() { func (s *ObligationsSuite) Test_GetObligationValue_Succeeds() { namespaceID, namespaceFQN, namespace := s.getNamespaceData(nsExampleCom) - createdObl := s.createObligation(namespaceID, oblName, nil) // Create obligation without values - - // Create obligation value first - oblValue, err := s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ - ObligationIdentifier: &obligations.CreateObligationValueRequest_Id{ - Id: createdObl.GetId(), - }, - Value: oblValPrefix + "get-test", - Metadata: &common.MetadataMutable{ - Labels: map[string]string{"test": "get-value"}, - }, - }) - s.Require().NoError(err) - s.NotNil(oblValue) + value := oblValPrefix + "get-test" + createdObl := s.createObligation(namespaceID, oblName, []string{value}) // Create obligation without values + + // // Create obligation value first + // oblValue, err := s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ + // ObligationIdentifier: &obligations.CreateObligationValueRequest_Id{ + // Id: createdObl.GetId(), + // }, + // Value: oblValPrefix + "get-test", + // Metadata: &common.MetadataMutable{ + // Labels: map[string]string{"test": "get-value"}, + // }, + // }) + // s.Require().NoError(err) + // s.NotNil(oblValue) + oblValue := createdObl.GetValues()[0] // Test 1: Get obligation value by ID retrievedValue, err := s.db.PolicyClient.GetObligationValue(s.ctx, &obligations.GetObligationValueRequest{ @@ -588,8 +588,7 @@ func (s *ObligationsSuite) Test_GetObligationValue_Succeeds() { s.Require().NoError(err) s.NotNil(retrievedValue) s.Equal(oblValue.GetId(), retrievedValue.GetId()) - s.Equal(oblValPrefix+"get-test", retrievedValue.GetValue()) - s.Equal("get-value", retrievedValue.GetMetadata().GetLabels()["test"]) + // s.Equal(oblValPrefix+"get-test", retrievedValue.GetValue()) s.assertObligationValueBasics(retrievedValue, oblValPrefix+"get-test", namespaceID, namespace.Name, namespaceFQN) // Test 2: Get obligation value by FQN @@ -602,7 +601,7 @@ func (s *ObligationsSuite) Test_GetObligationValue_Succeeds() { s.Require().NoError(err) s.NotNil(retrievedValue2) s.Equal(oblValue.GetId(), retrievedValue2.GetId()) - s.Equal(oblValPrefix+"get-test", retrievedValue2.GetValue()) + // s.Equal(oblValPrefix+"get-test", retrievedValue2.GetValue()) s.assertObligationValueBasics(retrievedValue2, oblValPrefix+"get-test", namespaceID, namespace.Name, namespaceFQN) // Cleanup From 963592efdf2f42ebf54dac316571aaefb69502ff Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 25 Aug 2025 15:36:29 -0400 Subject: [PATCH 103/137] everything working except fqn block --- service/integration/obligations_test.go | 39 ++++++++----------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 753f5ab9db..1c01173643 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -563,20 +563,7 @@ func (s *ObligationsSuite) Test_CreateObligationValue_Fails() { func (s *ObligationsSuite) Test_GetObligationValue_Succeeds() { namespaceID, namespaceFQN, namespace := s.getNamespaceData(nsExampleCom) value := oblValPrefix + "get-test" - createdObl := s.createObligation(namespaceID, oblName, []string{value}) // Create obligation without values - - // // Create obligation value first - // oblValue, err := s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ - // ObligationIdentifier: &obligations.CreateObligationValueRequest_Id{ - // Id: createdObl.GetId(), - // }, - // Value: oblValPrefix + "get-test", - // Metadata: &common.MetadataMutable{ - // Labels: map[string]string{"test": "get-value"}, - // }, - // }) - // s.Require().NoError(err) - // s.NotNil(oblValue) + createdObl := s.createObligation(namespaceID, oblName, []string{value}) oblValue := createdObl.GetValues()[0] // Test 1: Get obligation value by ID @@ -588,21 +575,19 @@ func (s *ObligationsSuite) Test_GetObligationValue_Succeeds() { s.Require().NoError(err) s.NotNil(retrievedValue) s.Equal(oblValue.GetId(), retrievedValue.GetId()) - // s.Equal(oblValPrefix+"get-test", retrievedValue.GetValue()) s.assertObligationValueBasics(retrievedValue, oblValPrefix+"get-test", namespaceID, namespace.Name, namespaceFQN) - // Test 2: Get obligation value by FQN - oblValFQN := policydb.BuildOblValFQN(namespaceFQN, oblName, oblValPrefix+"get-test") - retrievedValue2, err := s.db.PolicyClient.GetObligationValue(s.ctx, &obligations.GetObligationValueRequest{ - Identifier: &obligations.GetObligationValueRequest_Fqn{ - Fqn: oblValFQN, - }, - }) - s.Require().NoError(err) - s.NotNil(retrievedValue2) - s.Equal(oblValue.GetId(), retrievedValue2.GetId()) - // s.Equal(oblValPrefix+"get-test", retrievedValue2.GetValue()) - s.assertObligationValueBasics(retrievedValue2, oblValPrefix+"get-test", namespaceID, namespace.Name, namespaceFQN) + // // Test 2: Get obligation value by FQN + // oblValFQN := policydb.BuildOblValFQN(namespaceFQN, oblName, oblValPrefix+"get-test") + // retrievedValue2, err := s.db.PolicyClient.GetObligationValue(s.ctx, &obligations.GetObligationValueRequest{ + // Identifier: &obligations.GetObligationValueRequest_Fqn{ + // Fqn: oblValFQN, + // }, + // }) + // s.Require().NoError(err) + // s.NotNil(retrievedValue2) + // s.Equal(oblValue.GetId(), retrievedValue2.GetId()) + // s.assertObligationValueBasics(retrievedValue2, oblValPrefix+"get-test", namespaceID, namespace.Name, namespaceFQN) // Cleanup s.deleteObligations([]string{createdObl.GetId()}) From 854a58c51d23754e4c7275edd46ab6dc9fd7f37d Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 25 Aug 2025 17:19:22 -0400 Subject: [PATCH 104/137] debug --- service/integration/obligations_test.go | 21 +++++++++++---------- service/policy/db/obligations.go | 1 + 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 1c01173643..2587500c36 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -578,16 +578,17 @@ func (s *ObligationsSuite) Test_GetObligationValue_Succeeds() { s.assertObligationValueBasics(retrievedValue, oblValPrefix+"get-test", namespaceID, namespace.Name, namespaceFQN) // // Test 2: Get obligation value by FQN - // oblValFQN := policydb.BuildOblValFQN(namespaceFQN, oblName, oblValPrefix+"get-test") - // retrievedValue2, err := s.db.PolicyClient.GetObligationValue(s.ctx, &obligations.GetObligationValueRequest{ - // Identifier: &obligations.GetObligationValueRequest_Fqn{ - // Fqn: oblValFQN, - // }, - // }) - // s.Require().NoError(err) - // s.NotNil(retrievedValue2) - // s.Equal(oblValue.GetId(), retrievedValue2.GetId()) - // s.assertObligationValueBasics(retrievedValue2, oblValPrefix+"get-test", namespaceID, namespace.Name, namespaceFQN) + oblValFQN := policydb.BuildOblValFQN(namespaceFQN, oblName, oblValPrefix+"get-test") + retrievedValue2, err := s.db.PolicyClient.GetObligationValue(s.ctx, &obligations.GetObligationValueRequest{ + Identifier: &obligations.GetObligationValueRequest_Fqn{ + Fqn: oblValFQN, + }, + }) + println("FQN:", oblValFQN) + s.Require().NoError(err) + s.NotNil(retrievedValue2) + s.Equal(oblValue.GetId(), retrievedValue2.GetId()) + s.assertObligationValueBasics(retrievedValue2, oblValPrefix+"get-test", namespaceID, namespace.Name, namespaceFQN) // Cleanup s.deleteObligations([]string{createdObl.GetId()}) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 98ce808711..8576f18457 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -349,6 +349,7 @@ func (c PolicyDBClient) CreateObligationValue(ctx context.Context, r *obligation func (c PolicyDBClient) GetObligationValue(ctx context.Context, r *obligations.GetObligationValueRequest) (*policy.ObligationValue, error) { nsFQN, oblName, oblVal := breakOblValFQN(r.GetFqn()) + println("FQN parts: ", nsFQN, oblName, oblVal) queryParams := getObligationValueParams{ ID: r.GetId(), Name: oblName, From 65c2f25c8341faaa8db45582e76424bd3063cd02 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 25 Aug 2025 17:34:00 -0400 Subject: [PATCH 105/137] tests working --- service/integration/obligations_test.go | 3 +-- service/policy/db/obligations.go | 1 - service/policy/db/obligations.sql.go | 4 ++-- service/policy/db/queries/obligations.sql | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 2587500c36..987a5e0225 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -577,14 +577,13 @@ func (s *ObligationsSuite) Test_GetObligationValue_Succeeds() { s.Equal(oblValue.GetId(), retrievedValue.GetId()) s.assertObligationValueBasics(retrievedValue, oblValPrefix+"get-test", namespaceID, namespace.Name, namespaceFQN) - // // Test 2: Get obligation value by FQN + // Test 2: Get obligation value by FQN oblValFQN := policydb.BuildOblValFQN(namespaceFQN, oblName, oblValPrefix+"get-test") retrievedValue2, err := s.db.PolicyClient.GetObligationValue(s.ctx, &obligations.GetObligationValueRequest{ Identifier: &obligations.GetObligationValueRequest_Fqn{ Fqn: oblValFQN, }, }) - println("FQN:", oblValFQN) s.Require().NoError(err) s.NotNil(retrievedValue2) s.Equal(oblValue.GetId(), retrievedValue2.GetId()) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 8576f18457..98ce808711 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -349,7 +349,6 @@ func (c PolicyDBClient) CreateObligationValue(ctx context.Context, r *obligation func (c PolicyDBClient) GetObligationValue(ctx context.Context, r *obligations.GetObligationValueRequest) (*policy.ObligationValue, error) { nsFQN, oblName, oblVal := breakOblValFQN(r.GetFqn()) - println("FQN parts: ", nsFQN, oblName, oblVal) queryParams := getObligationValueParams{ ID: r.GetId(), Name: oblName, diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 8a4d806596..7283305c09 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -503,7 +503,7 @@ WHERE -- lookup by value id OR by namespace fqn + obligation name + value name ( -- lookup by value id - ($1::TEXT != '' AND ov.id = $1::UUID) + (NULLIF($1::TEXT, '') IS NOT NULL AND ov.id = NULLIF($1::TEXT, '')::UUID) OR -- lookup by namespace fqn + obligation name + value name ($2::TEXT != '' AND $3::TEXT != '' AND $4::TEXT != '' @@ -548,7 +548,7 @@ type getObligationValueRow struct { // -- lookup by value id OR by namespace fqn + obligation name + value name // ( // -- lookup by value id -// ($1::TEXT != '' AND ov.id = $1::UUID) +// (NULLIF($1::TEXT, '') IS NOT NULL AND ov.id = NULLIF($1::TEXT, '')::UUID) // OR // -- lookup by namespace fqn + obligation name + value name // ($2::TEXT != '' AND $3::TEXT != '' AND $4::TEXT != '' diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 2cdf4c5689..c05db81576 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -252,7 +252,7 @@ WHERE -- lookup by value id OR by namespace fqn + obligation name + value name ( -- lookup by value id - (@id::TEXT != '' AND ov.id = @id::UUID) + (NULLIF(@id::TEXT, '') IS NOT NULL AND ov.id = NULLIF(@id::TEXT, '')::UUID) OR -- lookup by namespace fqn + obligation name + value name (@namespace_fqn::TEXT != '' AND @name::TEXT != '' AND @value::TEXT != '' From 2344f87d04d18617e3ab8314149193d49f88404a Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 25 Aug 2025 17:38:01 -0400 Subject: [PATCH 106/137] standardize sql --- service/policy/db/obligations.sql.go | 36 ++++++++--------------- service/policy/db/queries/obligations.sql | 18 ++++-------- 2 files changed, 18 insertions(+), 36 deletions(-) diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 7283305c09..52a9c7fda2 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -14,23 +14,17 @@ const createObligation = `-- name: createObligation :one WITH inserted_obligation AS ( INSERT INTO obligation_definitions (namespace_id, name, metadata) SELECT - CASE - WHEN $1::TEXT != '' THEN $1::UUID - ELSE fqns.namespace_id - END, + COALESCE(NULLIF($1::TEXT, '')::UUID, fqns.namespace_id), $2, $3 FROM ( SELECT - CASE - WHEN $1::TEXT != '' THEN $1::UUID - ELSE NULL - END as direct_namespace_id + NULLIF($1::TEXT, '')::UUID as direct_namespace_id ) direct - LEFT JOIN attribute_fqns fqns ON fqns.fqn = $4 AND $1::TEXT = '' + LEFT JOIN attribute_fqns fqns ON fqns.fqn = $4 AND NULLIF($1::TEXT, '') IS NULL WHERE - ($1::TEXT != '' AND direct.direct_namespace_id IS NOT NULL) OR - ($4::TEXT != '' AND fqns.namespace_id IS NOT NULL) + (NULLIF($1::TEXT, '') IS NOT NULL AND direct.direct_namespace_id IS NOT NULL) OR + (NULLIF($4::TEXT, '') IS NOT NULL AND fqns.namespace_id IS NOT NULL) RETURNING id, namespace_id, name, metadata ), inserted_values AS ( @@ -88,23 +82,17 @@ type createObligationRow struct { // WITH inserted_obligation AS ( // INSERT INTO obligation_definitions (namespace_id, name, metadata) // SELECT -// CASE -// WHEN $1::TEXT != '' THEN $1::UUID -// ELSE fqns.namespace_id -// END, +// COALESCE(NULLIF($1::TEXT, '')::UUID, fqns.namespace_id), // $2, // $3 // FROM ( // SELECT -// CASE -// WHEN $1::TEXT != '' THEN $1::UUID -// ELSE NULL -// END as direct_namespace_id +// NULLIF($1::TEXT, '')::UUID as direct_namespace_id // ) direct -// LEFT JOIN attribute_fqns fqns ON fqns.fqn = $4 AND $1::TEXT = '' +// LEFT JOIN attribute_fqns fqns ON fqns.fqn = $4 AND NULLIF($1::TEXT, '') IS NULL // WHERE -// ($1::TEXT != '' AND direct.direct_namespace_id IS NOT NULL) OR -// ($4::TEXT != '' AND fqns.namespace_id IS NOT NULL) +// (NULLIF($1::TEXT, '') IS NOT NULL AND direct.direct_namespace_id IS NOT NULL) OR +// (NULLIF($4::TEXT, '') IS NOT NULL AND fqns.namespace_id IS NOT NULL) // RETURNING id, namespace_id, name, metadata // ), // inserted_values AS ( @@ -506,7 +494,7 @@ WHERE (NULLIF($1::TEXT, '') IS NOT NULL AND ov.id = NULLIF($1::TEXT, '')::UUID) OR -- lookup by namespace fqn + obligation name + value name - ($2::TEXT != '' AND $3::TEXT != '' AND $4::TEXT != '' + (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL AND NULLIF($4::TEXT, '') IS NOT NULL AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR AND ov.value = $4::VARCHAR) ) ` @@ -551,7 +539,7 @@ type getObligationValueRow struct { // (NULLIF($1::TEXT, '') IS NOT NULL AND ov.id = NULLIF($1::TEXT, '')::UUID) // OR // -- lookup by namespace fqn + obligation name + value name -// ($2::TEXT != '' AND $3::TEXT != '' AND $4::TEXT != '' +// (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL AND NULLIF($4::TEXT, '') IS NOT NULL // AND fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR AND ov.value = $4::VARCHAR) // ) func (q *Queries) getObligationValue(ctx context.Context, arg getObligationValueParams) (getObligationValueRow, error) { diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index c05db81576..6ace83b087 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -6,23 +6,17 @@ WITH inserted_obligation AS ( INSERT INTO obligation_definitions (namespace_id, name, metadata) SELECT - CASE - WHEN @namespace_id::TEXT != '' THEN @namespace_id::UUID - ELSE fqns.namespace_id - END, + COALESCE(NULLIF(@namespace_id::TEXT, '')::UUID, fqns.namespace_id), @name, @metadata FROM ( SELECT - CASE - WHEN @namespace_id::TEXT != '' THEN @namespace_id::UUID - ELSE NULL - END as direct_namespace_id + NULLIF(@namespace_id::TEXT, '')::UUID as direct_namespace_id ) direct - LEFT JOIN attribute_fqns fqns ON fqns.fqn = @namespace_fqn AND @namespace_id::TEXT = '' + LEFT JOIN attribute_fqns fqns ON fqns.fqn = @namespace_fqn AND NULLIF(@namespace_id::TEXT, '') IS NULL WHERE - (@namespace_id::TEXT != '' AND direct.direct_namespace_id IS NOT NULL) OR - (@namespace_fqn::TEXT != '' AND fqns.namespace_id IS NOT NULL) + (NULLIF(@namespace_id::TEXT, '') IS NOT NULL AND direct.direct_namespace_id IS NOT NULL) OR + (NULLIF(@namespace_fqn::TEXT, '') IS NOT NULL AND fqns.namespace_id IS NOT NULL) RETURNING id, namespace_id, name, metadata ), inserted_values AS ( @@ -255,7 +249,7 @@ WHERE (NULLIF(@id::TEXT, '') IS NOT NULL AND ov.id = NULLIF(@id::TEXT, '')::UUID) OR -- lookup by namespace fqn + obligation name + value name - (@namespace_fqn::TEXT != '' AND @name::TEXT != '' AND @value::TEXT != '' + (NULLIF(@namespace_fqn::TEXT, '') IS NOT NULL AND NULLIF(@name::TEXT, '') IS NOT NULL AND NULLIF(@value::TEXT, '') IS NOT NULL AND fqns.fqn = @namespace_fqn::VARCHAR AND od.name = @name::VARCHAR AND ov.value = @value::VARCHAR) ); From c130f4bdd9b9252ba356f0833dd98cf0b93e93fb Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Mon, 25 Aug 2025 17:56:30 -0400 Subject: [PATCH 107/137] update obl val fx --- service/policy/db/obligations.go | 84 +++++++++++------------ service/policy/db/obligations.sql.go | 29 ++++++++ service/policy/db/queries/obligations.sql | 7 ++ 3 files changed, 78 insertions(+), 42 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 98ce808711..5a51196284 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -436,49 +436,49 @@ func (c PolicyDBClient) GetObligationValue(ctx context.Context, r *obligations.G // return oblVals, nil // } -// func (c PolicyDBClient) UpdateObligationValue(ctx context.Context, r *obligations.UpdateObligationValueRequest) (*policy.ObligationValue, error) { -// id := r.GetId() -// value := r.GetValue() -// oblVal, err := c.GetObligationValue(ctx, &obligations.GetObligationValueRequest{ -// Identifier: &obligations.GetObligationValueRequest_Id{ -// Id: id, -// }, -// }) -// if err != nil { -// return nil, err -// } -// if value == "" { -// value = oblVal.GetValue() -// } -// metadataJSON, metadata, err := db.MarshalUpdateMetadata(r.GetMetadata(), r.GetMetadataUpdateBehavior(), func() (*common.Metadata, error) { -// return oblVal.GetMetadata(), nil -// }) -// if err != nil { -// return nil, err -// } +func (c PolicyDBClient) UpdateObligationValue(ctx context.Context, r *obligations.UpdateObligationValueRequest) (*policy.ObligationValue, error) { + id := r.GetId() + value := r.GetValue() + oblVal, err := c.GetObligationValue(ctx, &obligations.GetObligationValueRequest{ + Identifier: &obligations.GetObligationValueRequest_Id{ + Id: id, + }, + }) + if err != nil { + return nil, err + } + if value == "" { + value = oblVal.GetValue() + } + metadataJSON, metadata, err := db.MarshalUpdateMetadata(r.GetMetadata(), r.GetMetadataUpdateBehavior(), func() (*common.Metadata, error) { + return oblVal.GetMetadata(), nil + }) + if err != nil { + return nil, err + } -// count, err := c.queries.updateObligationValue(ctx, updateObligationValueParams{ -// ID: id, -// Value: value, -// Metadata: metadataJSON, -// }) -// now := timestamppb.Now() -// if err != nil { -// return nil, db.WrapIfKnownInvalidQueryErr(err) -// } -// if count == 0 { -// return nil, db.ErrNotFound -// } -// metadata.CreatedAt = oblVal.GetMetadata().GetCreatedAt() -// metadata.UpdatedAt = now - -// return &policy.ObligationValue{ -// Id: id, -// Value: value, -// Metadata: metadata, -// Obligation: oblVal.GetObligation(), -// }, nil -// } + count, err := c.queries.updateObligationValue(ctx, updateObligationValueParams{ + ID: id, + Value: value, + Metadata: metadataJSON, + }) + now := timestamppb.Now() + if err != nil { + return nil, db.WrapIfKnownInvalidQueryErr(err) + } + if count == 0 { + return nil, db.ErrNotFound + } + metadata.CreatedAt = oblVal.GetMetadata().GetCreatedAt() + metadata.UpdatedAt = now + + return &policy.ObligationValue{ + Id: id, + Value: value, + Metadata: metadata, + Obligation: oblVal.GetObligation(), + }, nil +} func (c PolicyDBClient) DeleteObligationValue(ctx context.Context, r *obligations.DeleteObligationValueRequest) (*policy.ObligationValue, error) { nsFQN, oblName, valName := breakOblValFQN(r.GetFqn()) diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 52a9c7fda2..949f2eabd2 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -824,3 +824,32 @@ func (q *Queries) updateObligation(ctx context.Context, arg updateObligationPara } return result.RowsAffected(), nil } + +const updateObligationValue = `-- name: updateObligationValue :execrows +UPDATE obligation_values_standard +SET + value = COALESCE(NULLIF($1::TEXT, ''), value), + metadata = COALESCE($2, metadata) +WHERE id = $3 +` + +type updateObligationValueParams struct { + Value string `json:"value"` + Metadata []byte `json:"metadata"` + ID string `json:"id"` +} + +// updateObligationValue +// +// UPDATE obligation_values_standard +// SET +// value = COALESCE(NULLIF($1::TEXT, ''), value), +// metadata = COALESCE($2, metadata) +// WHERE id = $3 +func (q *Queries) updateObligationValue(ctx context.Context, arg updateObligationValueParams) (int64, error) { + result, err := q.db.Exec(ctx, updateObligationValue, arg.Value, arg.Metadata, arg.ID) + if err != nil { + return 0, err + } + return result.RowsAffected(), nil +} diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 6ace83b087..4a042da532 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -253,6 +253,13 @@ WHERE AND fqns.fqn = @namespace_fqn::VARCHAR AND od.name = @name::VARCHAR AND ov.value = @value::VARCHAR) ); +-- name: updateObligationValue :execrows +UPDATE obligation_values_standard +SET + value = COALESCE(NULLIF(@value::TEXT, ''), value), + metadata = COALESCE(@metadata, metadata) +WHERE id = @id; + -- name: deleteObligationValue :one DELETE FROM obligation_values_standard WHERE id IN ( From 4c3fc3212def74ae7aaeb6bbed33e0dd291eab2a Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 26 Aug 2025 17:34:38 -0400 Subject: [PATCH 108/137] update obl val almost done --- service/integration/obligations_test.go | 95 +++++++++++++++++++++++++ service/policy/db/obligations.go | 6 ++ 2 files changed, 101 insertions(+) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 987a5e0225..1c6e48ba93 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -648,6 +648,101 @@ func (s *ObligationsSuite) Test_GetObligationValue_Fails() { s.deleteObligations([]string{createdObl.GetId()}) } +// Update + +func (s *ObligationsSuite) Test_UpdateObligationValue_Succeeds() { + namespaceID, namespaceFQN, namespace := s.getNamespaceData(nsExampleCom) + value := oblValPrefix + "update-test" + createdObl := s.createObligation(namespaceID, oblName+"-update-succeeds", []string{value}) + oblValue := createdObl.GetValues()[0] + + // Test 1: Update obligation value by ID + newValue := oblValPrefix + "updated-value" + newMetadata := &common.MetadataMutable{ + Labels: map[string]string{"updated": "true", "version": "2"}, + } + updatedValue, err := s.db.PolicyClient.UpdateObligationValue(s.ctx, &obligations.UpdateObligationValueRequest{ + Id: oblValue.GetId(), + Value: newValue, + Metadata: newMetadata, + MetadataUpdateBehavior: common.MetadataUpdateEnum_METADATA_UPDATE_ENUM_EXTEND, + }) + s.Require().NoError(err) + s.NotNil(updatedValue) + s.Equal(oblValue.GetId(), updatedValue.GetId()) + s.Equal(newValue, updatedValue.GetValue()) + s.Equal("true", updatedValue.GetMetadata().GetLabels()["updated"]) + s.Equal("2", updatedValue.GetMetadata().GetLabels()["version"]) + s.assertObligationValueBasics(updatedValue, newValue, namespaceID, namespace.Name, namespaceFQN) + + // Test 2: Update only metadata (no value change) + newMetadata2 := &common.MetadataMutable{ + Labels: map[string]string{"metadata_only": "true"}, + } + updatedValue2, err := s.db.PolicyClient.UpdateObligationValue(s.ctx, &obligations.UpdateObligationValueRequest{ + Id: oblValue.GetId(), + Metadata: newMetadata2, + MetadataUpdateBehavior: common.MetadataUpdateEnum_METADATA_UPDATE_ENUM_REPLACE, + }) + s.Require().NoError(err) + s.NotNil(updatedValue2) + s.Equal(oblValue.GetId(), updatedValue2.GetId()) + s.Equal(newValue, updatedValue2.GetValue()) // Value should remain the same + s.Equal("true", updatedValue2.GetMetadata().GetLabels()["metadata_only"]) + s.NotContains(updatedValue2.GetMetadata().GetLabels(), "updated") // Should be replaced, not extended + + // Test 3: Update only value (no metadata change) + newValue2 := oblValPrefix + "value-only-update" + updatedValue3, err := s.db.PolicyClient.UpdateObligationValue(s.ctx, &obligations.UpdateObligationValueRequest{ + Id: oblValue.GetId(), + Value: newValue2, + }) + s.Require().NoError(err) + s.NotNil(updatedValue3) + s.Equal(oblValue.GetId(), updatedValue3.GetId()) + s.Equal(newValue2, updatedValue3.GetValue()) + s.assertObligationValueBasics(updatedValue3, newValue2, namespaceID, namespace.Name, namespaceFQN) + + // Cleanup + s.deleteObligations([]string{createdObl.GetId()}) +} + +func (s *ObligationsSuite) Test_UpdateObligationValue_Fails() { + oblName := oblName + "-update-fails" + // Test 1: Invalid value ID + updatedValue, err := s.db.PolicyClient.UpdateObligationValue(s.ctx, &obligations.UpdateObligationValueRequest{ + Id: invalidID, + Value: oblValPrefix + "test", + }) + s.Require().ErrorIs(err, db.ErrNotFound) + s.Nil(updatedValue) + + // Test 2: Empty value ID + updatedValue, err = s.db.PolicyClient.UpdateObligationValue(s.ctx, &obligations.UpdateObligationValueRequest{ + Id: "", + Value: oblValPrefix + "test", + }) + s.Require().Error(err) // Should fail due to empty ID + s.Nil(updatedValue) + + // Test 3: No updates provided (both value and metadata are empty/nil) + namespaceID, _, _ := s.getNamespaceData(nsExampleCom) + createdObl := s.createObligation(namespaceID, oblName+"-no-updates", []string{oblValPrefix + "test"}) + oblValue := createdObl.GetValues()[0] + + updatedValue, err = s.db.PolicyClient.UpdateObligationValue(s.ctx, &obligations.UpdateObligationValueRequest{ + Id: oblValue.GetId(), + // No value or metadata provided + }) + s.Require().NoError(err) // Should succeed but not change anything + s.NotNil(updatedValue) + s.Equal(oblValue.GetId(), updatedValue.GetId()) + s.Equal(oblValue.GetValue(), updatedValue.GetValue()) // Value should remain unchanged + + // Cleanup + s.deleteObligations([]string{createdObl.GetId()}) +} + // Delete func (s *ObligationsSuite) Test_DeleteObligationValue_Succeeds() { diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 5a51196284..e58984f585 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -470,6 +470,12 @@ func (c PolicyDBClient) UpdateObligationValue(ctx context.Context, r *obligation return nil, db.ErrNotFound } metadata.CreatedAt = oblVal.GetMetadata().GetCreatedAt() + // if metadata == nil { + // metadata = &common.Metadata{} + // } + // if oblVal.GetMetadata() != nil { + // metadata.CreatedAt = oblVal.GetMetadata().GetCreatedAt() + // } metadata.UpdatedAt = now return &policy.ObligationValue{ From 39a7d72c23fa3a5c1cfe6c486a0d79ea7145bee3 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 26 Aug 2025 17:43:00 -0400 Subject: [PATCH 109/137] fix update obl and update obl val --- service/integration/obligations_test.go | 78 ++++++++++++++++++------- service/policy/db/obligations.go | 12 ++-- 2 files changed, 64 insertions(+), 26 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index 1c6e48ba93..ab8ecbb48f 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -365,48 +365,86 @@ func (s *ObligationsSuite) Test_ListObligations_Fails() { func (s *ObligationsSuite) Test_UpdateObligation_Succeeds() { namespaceID, namespaceFQN, namespace := s.getNamespaceData(nsExampleCom) - createdObl := s.createObligation(namespaceID, oblName, oblVals) + createdObl := s.createObligation(namespaceID, oblName+"-update-succeeds", oblVals) - // Update the obligation (with name change) + // Test 1: Update obligation with name and metadata change newName := oblName + "-updated" newMetadata := &common.MetadataMutable{ - Labels: map[string]string{"key": "value"}, + Labels: map[string]string{"updated": "true", "version": "2"}, } updatedObl, err := s.db.PolicyClient.UpdateObligation(s.ctx, &obligations.UpdateObligationRequest{ Id: createdObl.GetId(), Name: newName, Metadata: newMetadata, - MetadataUpdateBehavior: 1, + MetadataUpdateBehavior: common.MetadataUpdateEnum_METADATA_UPDATE_ENUM_EXTEND, }) s.Require().NoError(err) s.assertObligationBasics(updatedObl, newName, namespaceID, namespace.Name, namespaceFQN) - s.Equal(newMetadata.GetLabels(), updatedObl.GetMetadata().GetLabels()) + s.Equal("true", updatedObl.GetMetadata().GetLabels()["updated"]) + s.Equal("2", updatedObl.GetMetadata().GetLabels()["version"]) s.assertObligationValues(updatedObl) - // Update the obligation (with no name change) - newMetadata = &common.MetadataMutable{ - Labels: map[string]string{"diffKey": "diffVal"}, + // Test 2: Update only metadata (no name change) + newMetadata2 := &common.MetadataMutable{ + Labels: map[string]string{"metadata_only": "true"}, } - updatedObl, err = s.db.PolicyClient.UpdateObligation(s.ctx, &obligations.UpdateObligationRequest{ + updatedObl2, err := s.db.PolicyClient.UpdateObligation(s.ctx, &obligations.UpdateObligationRequest{ Id: createdObl.GetId(), - Metadata: newMetadata, - MetadataUpdateBehavior: 2, + Metadata: newMetadata2, + MetadataUpdateBehavior: common.MetadataUpdateEnum_METADATA_UPDATE_ENUM_REPLACE, }) s.Require().NoError(err) - s.assertObligationBasics(updatedObl, newName, namespaceID, namespace.Name, namespaceFQN) - s.Equal(newMetadata.GetLabels(), updatedObl.GetMetadata().GetLabels()) - s.assertObligationValues(updatedObl) + s.assertObligationBasics(updatedObl2, newName, namespaceID, namespace.Name, namespaceFQN) // Name should remain the same + s.Equal("true", updatedObl2.GetMetadata().GetLabels()["metadata_only"]) + s.NotContains(updatedObl2.GetMetadata().GetLabels(), "updated") // Should be replaced, not extended + s.assertObligationValues(updatedObl2) + + // Test 3: Update only name (no metadata change) + newName2 := oblName + "-name-only-update" + updatedObl3, err := s.db.PolicyClient.UpdateObligation(s.ctx, &obligations.UpdateObligationRequest{ + Id: createdObl.GetId(), + Name: newName2, + }) + s.Require().NoError(err) + s.assertObligationBasics(updatedObl3, newName2, namespaceID, namespace.Name, namespaceFQN) + s.assertObligationValues(updatedObl3) - s.deleteObligations([]string{updatedObl.GetId()}) + s.deleteObligations([]string{updatedObl3.GetId()}) } func (s *ObligationsSuite) Test_UpdateObligation_Fails() { - // Attempt to update an obligation with an invalid ID - obl, err := s.db.PolicyClient.UpdateObligation(s.ctx, &obligations.UpdateObligationRequest{ - Id: invalidUUID, + oblName := oblName + "-update-fails" + // Test 1: Invalid obligation ID + updatedObl, err := s.db.PolicyClient.UpdateObligation(s.ctx, &obligations.UpdateObligationRequest{ + Id: invalidID, + Name: oblName + "-test", }) - s.Require().ErrorIs(err, db.ErrUUIDInvalid) - s.Nil(obl) + s.Require().ErrorIs(err, db.ErrNotFound) + s.Nil(updatedObl) + + // Test 2: Empty obligation ID + updatedObl, err = s.db.PolicyClient.UpdateObligation(s.ctx, &obligations.UpdateObligationRequest{ + Id: "", + Name: oblName + "-test", + }) + s.Require().Error(err) // Should fail due to empty ID + s.Nil(updatedObl) + + // Test 3: No updates provided (both name and metadata are empty/nil) + namespaceID, _, _ := s.getNamespaceData(nsExampleCom) + createdObl := s.createObligation(namespaceID, oblName+"-no-updates", oblVals) + + updatedObl, err = s.db.PolicyClient.UpdateObligation(s.ctx, &obligations.UpdateObligationRequest{ + Id: createdObl.GetId(), + // No name or metadata provided + }) + s.Require().NoError(err) // Should succeed but not change anything + s.NotNil(updatedObl) + s.Equal(createdObl.GetId(), updatedObl.GetId()) + s.Equal(createdObl.GetName(), updatedObl.GetName()) // Name should remain unchanged + + // Cleanup + s.deleteObligations([]string{createdObl.GetId()}) } // Delete diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index e58984f585..aaedea0038 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -261,6 +261,9 @@ func (c PolicyDBClient) UpdateObligation(ctx context.Context, r *obligations.Upd if count == 0 { return nil, db.ErrNotFound } + if metadata == nil { + metadata = &common.Metadata{} + } metadata.CreatedAt = obl.GetMetadata().GetCreatedAt() metadata.UpdatedAt = now @@ -469,13 +472,10 @@ func (c PolicyDBClient) UpdateObligationValue(ctx context.Context, r *obligation if count == 0 { return nil, db.ErrNotFound } + if metadata == nil { + metadata = &common.Metadata{} + } metadata.CreatedAt = oblVal.GetMetadata().GetCreatedAt() - // if metadata == nil { - // metadata = &common.Metadata{} - // } - // if oblVal.GetMetadata() != nil { - // metadata.CreatedAt = oblVal.GetMetadata().GetCreatedAt() - // } metadata.UpdatedAt = now return &policy.ObligationValue{ From a4ab6894d136a30a182bf4bf65e4775e5746a726 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 26 Aug 2025 18:31:51 -0400 Subject: [PATCH 110/137] get oblvals by fqns fx --- service/policy/db/obligations.go | 104 +++++++++++----------- service/policy/db/obligations.sql.go | 6 +- service/policy/db/queries/obligations.sql | 2 +- 3 files changed, 56 insertions(+), 56 deletions(-) diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index aaedea0038..7d798562ed 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -130,8 +130,8 @@ func (c PolicyDBClient) GetObligationsByFQNs(ctx context.Context, r *obligations } queryParams := getObligationsByFQNsParams{ - NamespaceFqns: nsFQNs, - ObligationNames: oblNames, + NamespaceFqns: nsFQNs, + Names: oblNames, } list, err := c.queries.getObligationsByFQNs(ctx, queryParams) @@ -388,56 +388,56 @@ func (c PolicyDBClient) GetObligationValue(ctx context.Context, r *obligations.G }, nil } -// func (c PolicyDBClient) GetObligationValuesByFQNs(ctx context.Context, r *obligations.GetObligationValuesByFQNsRequest) ([]*policy.ObligationValue, error) { -// nsFQNs := make([]string, 0, len(r.GetFqns())) -// oblNames := make([]string, 0, len(r.GetFqns())) -// oblVals := make([]string, 0, len(r.GetFqns())) -// for _, fqn := range r.GetFqns() { -// nsFQN, oblName, oblVal := breakOblValFQN(fqn) -// nsFQNs = append(nsFQNs, nsFQN) -// oblNames = append(oblNames, oblName) -// oblVals = append(oblVals, oblVal) -// } - -// queryParams := getObligationValuesByFQNsParams{ -// NamespaceFqns: nsFQNs, -// ObligationNames: oblNames, -// ValueNames: oblVals, -// } - -// list, err := c.queries.getObligationValuesByFQNs(ctx, queryParams) -// if err != nil { -// return nil, db.WrapIfKnownInvalidQueryErr(err) -// } -// oblVals := make([]*policy.ObligationValue, len(list)) - -// for i, r := range list { -// metadata := &common.Metadata{} -// if err = unmarshalMetadata(r.Metadata, metadata); err != nil { -// return nil, err -// } - -// namespace := &policy.Namespace{} -// if err := unmarshalNamespace(r.Namespace, namespace); err != nil { -// return nil, fmt.Errorf("failed to unmarshal obligation namespace: %w", err) -// } - -// obl := &policy.Obligation{ -// Id: r.ObligationID, -// Name: r.ObligationName, -// Namespace: namespace, -// } - -// oblVals[i] = &policy.ObligationValue{ -// Id: r.ID, -// Value: r.Value, -// Metadata: metadata, -// Obligation: obl, -// } -// } - -// return oblVals, nil -// } +func (c PolicyDBClient) GetObligationValuesByFQNs(ctx context.Context, r *obligations.GetObligationValuesByFQNsRequest) ([]*policy.ObligationValue, error) { + nsFQNs := make([]string, 0, len(r.GetFqns())) + oblNames := make([]string, 0, len(r.GetFqns())) + oblVals := make([]string, 0, len(r.GetFqns())) + for _, fqn := range r.GetFqns() { + nsFQN, oblName, oblVal := breakOblValFQN(fqn) + nsFQNs = append(nsFQNs, nsFQN) + oblNames = append(oblNames, oblName) + oblVals = append(oblVals, oblVal) + } + + queryParams := getObligationValuesByFQNsParams{ + NamespaceFqns: nsFQNs, + Names: oblNames, + Values: oblVals, + } + + list, err := c.queries.getObligationValuesByFQNs(ctx, queryParams) + if err != nil { + return nil, db.WrapIfKnownInvalidQueryErr(err) + } + vals := make([]*policy.ObligationValue, len(list)) + + for i, r := range list { + metadata := &common.Metadata{} + if err = unmarshalMetadata(r.Metadata, metadata); err != nil { + return nil, err + } + + namespace := &policy.Namespace{} + if err := unmarshalNamespace(r.Namespace, namespace); err != nil { + return nil, fmt.Errorf("failed to unmarshal obligation namespace: %w", err) + } + + obl := &policy.Obligation{ + Id: r.ObligationID, + Name: r.Name, + Namespace: namespace, + } + + vals[i] = &policy.ObligationValue{ + Id: r.ID, + Value: r.Value, + Metadata: metadata, + Obligation: obl, + } + } + + return vals, nil +} func (c PolicyDBClient) UpdateObligationValue(ctx context.Context, r *obligations.UpdateObligationValueRequest) (*policy.ObligationValue, error) { id := r.GetId() diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 949f2eabd2..0ffb81908c 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -597,8 +597,8 @@ GROUP BY ` type getObligationsByFQNsParams struct { - NamespaceFqns []string `json:"namespace_fqns"` - ObligationNames []string `json:"obligation_names"` + NamespaceFqns []string `json:"namespace_fqns"` + Names []string `json:"names"` } type getObligationsByFQNsRow struct { @@ -644,7 +644,7 @@ type getObligationsByFQNsRow struct { // GROUP BY // od.id, n.id, fqns.fqn func (q *Queries) getObligationsByFQNs(ctx context.Context, arg getObligationsByFQNsParams) ([]getObligationsByFQNsRow, error) { - rows, err := q.db.Query(ctx, getObligationsByFQNs, arg.NamespaceFqns, arg.ObligationNames) + rows, err := q.db.Query(ctx, getObligationsByFQNs, arg.NamespaceFqns, arg.Names) if err != nil { return nil, err } diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 4a042da532..282b036c4f 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -175,7 +175,7 @@ JOIN JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL JOIN - (SELECT unnest(@namespace_fqns::text[]) as ns_fqn, unnest(@obligation_names::text[]) as obl_name) as fqn_pairs + (SELECT unnest(@namespace_fqns::text[]) as ns_fqn, unnest(@names::text[]) as obl_name) as fqn_pairs ON fqns.fqn = fqn_pairs.ns_fqn AND od.name = fqn_pairs.obl_name LEFT JOIN From 7b61ce96e10955e549f64a0e01c3084a3013aba2 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 26 Aug 2025 18:45:24 -0400 Subject: [PATCH 111/137] sql --- service/policy/db/obligations.sql.go | 93 +++++++++++++++++++++++ service/policy/db/queries/obligations.sql | 25 ++++++ 2 files changed, 118 insertions(+) diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 0ffb81908c..b1dd08b1ee 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -561,6 +561,99 @@ func (q *Queries) getObligationValue(ctx context.Context, arg getObligationValue return i, err } +const getObligationValuesByFQNs = `-- name: getObligationValuesByFQNs :many +SELECT + ov.id, + ov.value, + JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ov.metadata -> 'labels', 'created_at', ov.created_at,'updated_at', ov.updated_at)) as metadata, + od.id as obligation_id, + od.name as name, + JSON_BUILD_OBJECT( + 'id', n.id, + 'name', n.name, + 'fqn', fqns.fqn + ) as namespace +FROM + obligation_values_standard ov +JOIN + obligation_definitions od ON ov.obligation_definition_id = od.id +JOIN + attribute_namespaces n ON od.namespace_id = n.id +JOIN + attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL +JOIN + (SELECT unnest($1::text[]) as ns_fqn, unnest($2::text[]) as obl_name, unnest($3::text[]) as value) as fqn_pairs +ON + fqns.fqn = fqn_pairs.ns_fqn AND od.name = fqn_pairs.obl_name AND ov.value = fqn_pairs.value +` + +type getObligationValuesByFQNsParams struct { + NamespaceFqns []string `json:"namespace_fqns"` + Names []string `json:"names"` + Values []string `json:"values"` +} + +type getObligationValuesByFQNsRow struct { + ID string `json:"id"` + Value string `json:"value"` + Metadata []byte `json:"metadata"` + ObligationID string `json:"obligation_id"` + Name string `json:"name"` + Namespace []byte `json:"namespace"` +} + +// getObligationValuesByFQNs +// +// SELECT +// ov.id, +// ov.value, +// JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ov.metadata -> 'labels', 'created_at', ov.created_at,'updated_at', ov.updated_at)) as metadata, +// od.id as obligation_id, +// od.name as name, +// JSON_BUILD_OBJECT( +// 'id', n.id, +// 'name', n.name, +// 'fqn', fqns.fqn +// ) as namespace +// FROM +// obligation_values_standard ov +// JOIN +// obligation_definitions od ON ov.obligation_definition_id = od.id +// JOIN +// attribute_namespaces n ON od.namespace_id = n.id +// JOIN +// attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL +// JOIN +// (SELECT unnest($1::text[]) as ns_fqn, unnest($2::text[]) as obl_name, unnest($3::text[]) as value) as fqn_pairs +// ON +// fqns.fqn = fqn_pairs.ns_fqn AND od.name = fqn_pairs.obl_name AND ov.value = fqn_pairs.value +func (q *Queries) getObligationValuesByFQNs(ctx context.Context, arg getObligationValuesByFQNsParams) ([]getObligationValuesByFQNsRow, error) { + rows, err := q.db.Query(ctx, getObligationValuesByFQNs, arg.NamespaceFqns, arg.Names, arg.Values) + if err != nil { + return nil, err + } + defer rows.Close() + var items []getObligationValuesByFQNsRow + for rows.Next() { + var i getObligationValuesByFQNsRow + if err := rows.Scan( + &i.ID, + &i.Value, + &i.Metadata, + &i.ObligationID, + &i.Name, + &i.Namespace, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const getObligationsByFQNs = `-- name: getObligationsByFQNs :many SELECT od.id, diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 282b036c4f..8fc3d79f30 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -260,6 +260,31 @@ SET metadata = COALESCE(@metadata, metadata) WHERE id = @id; +-- name: getObligationValuesByFQNs :many +SELECT + ov.id, + ov.value, + JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', ov.metadata -> 'labels', 'created_at', ov.created_at,'updated_at', ov.updated_at)) as metadata, + od.id as obligation_id, + od.name as name, + JSON_BUILD_OBJECT( + 'id', n.id, + 'name', n.name, + 'fqn', fqns.fqn + ) as namespace +FROM + obligation_values_standard ov +JOIN + obligation_definitions od ON ov.obligation_definition_id = od.id +JOIN + attribute_namespaces n ON od.namespace_id = n.id +JOIN + attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL +JOIN + (SELECT unnest(@namespace_fqns::text[]) as ns_fqn, unnest(@names::text[]) as obl_name, unnest(@values::text[]) as value) as fqn_pairs +ON + fqns.fqn = fqn_pairs.ns_fqn AND od.name = fqn_pairs.obl_name AND ov.value = fqn_pairs.value; + -- name: deleteObligationValue :one DELETE FROM obligation_values_standard WHERE id IN ( From 2c0a63517b8e782ad168442860145898e6e113c7 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 27 Aug 2025 00:53:31 -0400 Subject: [PATCH 112/137] add tests --- service/integration/obligations_test.go | 173 ++++++++++++++++++++++++ 1 file changed, 173 insertions(+) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index ab8ecbb48f..e306ad97ea 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -221,6 +221,179 @@ func (s *ObligationsSuite) Test_GetObligationsByFQNs_Succeeds() { s.deleteObligations([]string{obl1.GetId(), obl2.GetId(), obl3.GetId()}) } +// GetObligationValuesByFQNs + +func (s *ObligationsSuite) Test_GetObligationValuesByFQNs_Succeeds() { + // Setup test data + namespaceID1, namespaceFQN1, namespace1 := s.getNamespaceData(nsExampleCom) + namespaceID2, namespaceFQN2, namespace2 := s.getNamespaceData(nsExampleNet) + namespaceID3, _, _ := s.getNamespaceData(nsExampleOrg) + + // Create obligations with values in different namespaces + obl1 := s.createObligation(namespaceID1, oblName+"-1", []string{oblValPrefix + "val1", oblValPrefix + "val2"}) + obl2 := s.createObligation(namespaceID2, oblName+"-2", []string{oblValPrefix + "val3", oblValPrefix + "val4"}) + obl3 := s.createObligation(namespaceID3, oblName+"-3", []string{oblValPrefix + "val5"}) + + // Test 1: Get multiple obligation values by FQNs + fqns := []string{ + policydb.BuildOblValFQN(namespaceFQN1, oblName+"-1", oblValPrefix+"val1"), + policydb.BuildOblValFQN(namespaceFQN1, oblName+"-1", oblValPrefix+"val2"), + policydb.BuildOblValFQN(namespaceFQN2, oblName+"-2", oblValPrefix+"val3"), + } + + oblValueList, err := s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ + Fqns: fqns, + }) + s.Require().NoError(err) + s.NotNil(oblValueList) + s.Len(oblValueList, 3) + + // Create maps for easier verification + expectedValues := map[string]struct{}{ + oblValPrefix + "val1": {}, + oblValPrefix + "val2": {}, + oblValPrefix + "val3": {}, + } + foundValues := make(map[string]*policy.ObligationValue) + + for _, oblValue := range oblValueList { + s.Contains(expectedValues, oblValue.GetValue()) + foundValues[oblValue.GetValue()] = oblValue + } + s.Len(foundValues, 3) + + // Verify each obligation value + val1 := foundValues[oblValPrefix+"val1"] + s.assertObligationValueBasics(val1, oblValPrefix+"val1", namespaceID1, namespace1.Name, namespaceFQN1) + s.Equal(oblName+"-1", val1.GetObligation().GetName()) + + val2 := foundValues[oblValPrefix+"val2"] + s.assertObligationValueBasics(val2, oblValPrefix+"val2", namespaceID1, namespace1.Name, namespaceFQN1) + s.Equal(oblName+"-1", val2.GetObligation().GetName()) + + val3 := foundValues[oblValPrefix+"val3"] + s.assertObligationValueBasics(val3, oblValPrefix+"val3", namespaceID2, namespace2.Name, namespaceFQN2) + s.Equal(oblName+"-2", val3.GetObligation().GetName()) + + // Test 2: Get single obligation value by FQN + singleFQN := []string{policydb.BuildOblValFQN(namespaceFQN2, oblName+"-2", oblValPrefix+"val4")} + oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ + Fqns: singleFQN, + }) + s.Require().NoError(err) + s.NotNil(oblValueList) + s.Len(oblValueList, 1) + s.assertObligationValueBasics(oblValueList[0], oblValPrefix+"val4", namespaceID2, namespace2.Name, namespaceFQN2) + s.Equal(oblName+"-2", oblValueList[0].GetObligation().GetName()) + + // Test 3: Empty FQN list should return empty result + oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ + Fqns: []string{}, + }) + s.Require().NoError(err) + s.NotNil(oblValueList) + s.Empty(oblValueList) + + // Test 4: Get all values from a single obligation + allValuesFromObl1 := []string{ + policydb.BuildOblValFQN(namespaceFQN1, oblName+"-1", oblValPrefix+"val1"), + policydb.BuildOblValFQN(namespaceFQN1, oblName+"-1", oblValPrefix+"val2"), + } + oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ + Fqns: allValuesFromObl1, + }) + s.Require().NoError(err) + s.NotNil(oblValueList) + s.Len(oblValueList, 2) + for _, oblValue := range oblValueList { + s.Contains([]string{oblValPrefix + "val1", oblValPrefix + "val2"}, oblValue.GetValue()) + s.Equal(oblName+"-1", oblValue.GetObligation().GetName()) + s.assertObligationValueBasics(oblValue, oblValue.GetValue(), namespaceID1, namespace1.Name, namespaceFQN1) + } + + // Cleanup + s.deleteObligations([]string{obl1.GetId(), obl2.GetId(), obl3.GetId()}) +} + +func (s *ObligationsSuite) Test_GetObligationValuesByFQNs_Fails() { + // Setup test data + namespaceID, namespaceFQN, _ := s.getNamespaceData(nsExampleCom) + obl := s.createObligation(namespaceID, oblName, []string{oblValPrefix + "test-value"}) + + // Test 1: Invalid FQN should return empty result (not error) + invalidFQNs := []string{invalidFQN} + oblValueList, err := s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ + Fqns: invalidFQNs, + }) + s.Require().NoError(err) + s.NotNil(oblValueList) + s.Empty(oblValueList) + + // Test 2: Mix of valid and invalid FQNs should return only valid ones + validFQN := policydb.BuildOblValFQN(namespaceFQN, oblName, oblValPrefix+"test-value") + mixedFQNs := []string{ + validFQN, + invalidFQN, + "https://nonexistent.com/obl/nonexistent/val/nonexistent", + } + oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ + Fqns: mixedFQNs, + }) + s.Require().NoError(err) + s.NotNil(oblValueList) + s.Len(oblValueList, 1) + s.Equal(oblValPrefix+"test-value", oblValueList[0].GetValue()) + + // Test 3: Non-existent obligation value names should return empty result + nonExistentFQNs := []string{ + policydb.BuildOblValFQN(namespaceFQN, oblName, "nonexistent-value"), + } + oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ + Fqns: nonExistentFQNs, + }) + s.Require().NoError(err) + s.NotNil(oblValueList) + s.Empty(oblValueList) + + // Test 4: Non-existent obligation names should return empty result + nonExistentOblFQNs := []string{ + policydb.BuildOblValFQN(namespaceFQN, "nonexistent-obligation", oblValPrefix+"test-value"), + } + oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ + Fqns: nonExistentOblFQNs, + }) + s.Require().NoError(err) + s.NotNil(oblValueList) + s.Empty(oblValueList) + + // Test 5: Non-existent namespace should return empty result + nonExistentNsFQNs := []string{ + policydb.BuildOblValFQN("https://nonexistent.com", oblName, oblValPrefix+"test-value"), + } + oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ + Fqns: nonExistentNsFQNs, + }) + s.Require().NoError(err) + s.NotNil(oblValueList) + s.Empty(oblValueList) + + // Test 6: Malformed FQNs should return empty result + malformedFQNs := []string{ + namespaceFQN + "/obl/" + oblName, // Missing /val/ part + namespaceFQN + "/invalid/" + oblName + "/val/" + oblValPrefix + "test-value", // Invalid path + namespaceFQN + "/obl/" + oblName + "/val/", // Empty value name + } + oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ + Fqns: malformedFQNs, + }) + s.Require().NoError(err) + s.NotNil(oblValueList) + s.Empty(oblValueList) + + // Cleanup + s.deleteObligations([]string{obl.GetId()}) +} + func (s *ObligationsSuite) Test_GetObligationsByFQNs_Fails() { // Setup test data namespaceID, namespaceFQN, _ := s.getNamespaceData(nsExampleCom) From c7fc4a1338a73a3b00f99cfd14cf4af12190702e Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 27 Aug 2025 01:07:22 -0400 Subject: [PATCH 113/137] rearrange test order --- service/integration/obligations_test.go | 346 ++++++++++++------------ 1 file changed, 173 insertions(+), 173 deletions(-) diff --git a/service/integration/obligations_test.go b/service/integration/obligations_test.go index e306ad97ea..da7fe2eff1 100644 --- a/service/integration/obligations_test.go +++ b/service/integration/obligations_test.go @@ -221,179 +221,6 @@ func (s *ObligationsSuite) Test_GetObligationsByFQNs_Succeeds() { s.deleteObligations([]string{obl1.GetId(), obl2.GetId(), obl3.GetId()}) } -// GetObligationValuesByFQNs - -func (s *ObligationsSuite) Test_GetObligationValuesByFQNs_Succeeds() { - // Setup test data - namespaceID1, namespaceFQN1, namespace1 := s.getNamespaceData(nsExampleCom) - namespaceID2, namespaceFQN2, namespace2 := s.getNamespaceData(nsExampleNet) - namespaceID3, _, _ := s.getNamespaceData(nsExampleOrg) - - // Create obligations with values in different namespaces - obl1 := s.createObligation(namespaceID1, oblName+"-1", []string{oblValPrefix + "val1", oblValPrefix + "val2"}) - obl2 := s.createObligation(namespaceID2, oblName+"-2", []string{oblValPrefix + "val3", oblValPrefix + "val4"}) - obl3 := s.createObligation(namespaceID3, oblName+"-3", []string{oblValPrefix + "val5"}) - - // Test 1: Get multiple obligation values by FQNs - fqns := []string{ - policydb.BuildOblValFQN(namespaceFQN1, oblName+"-1", oblValPrefix+"val1"), - policydb.BuildOblValFQN(namespaceFQN1, oblName+"-1", oblValPrefix+"val2"), - policydb.BuildOblValFQN(namespaceFQN2, oblName+"-2", oblValPrefix+"val3"), - } - - oblValueList, err := s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ - Fqns: fqns, - }) - s.Require().NoError(err) - s.NotNil(oblValueList) - s.Len(oblValueList, 3) - - // Create maps for easier verification - expectedValues := map[string]struct{}{ - oblValPrefix + "val1": {}, - oblValPrefix + "val2": {}, - oblValPrefix + "val3": {}, - } - foundValues := make(map[string]*policy.ObligationValue) - - for _, oblValue := range oblValueList { - s.Contains(expectedValues, oblValue.GetValue()) - foundValues[oblValue.GetValue()] = oblValue - } - s.Len(foundValues, 3) - - // Verify each obligation value - val1 := foundValues[oblValPrefix+"val1"] - s.assertObligationValueBasics(val1, oblValPrefix+"val1", namespaceID1, namespace1.Name, namespaceFQN1) - s.Equal(oblName+"-1", val1.GetObligation().GetName()) - - val2 := foundValues[oblValPrefix+"val2"] - s.assertObligationValueBasics(val2, oblValPrefix+"val2", namespaceID1, namespace1.Name, namespaceFQN1) - s.Equal(oblName+"-1", val2.GetObligation().GetName()) - - val3 := foundValues[oblValPrefix+"val3"] - s.assertObligationValueBasics(val3, oblValPrefix+"val3", namespaceID2, namespace2.Name, namespaceFQN2) - s.Equal(oblName+"-2", val3.GetObligation().GetName()) - - // Test 2: Get single obligation value by FQN - singleFQN := []string{policydb.BuildOblValFQN(namespaceFQN2, oblName+"-2", oblValPrefix+"val4")} - oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ - Fqns: singleFQN, - }) - s.Require().NoError(err) - s.NotNil(oblValueList) - s.Len(oblValueList, 1) - s.assertObligationValueBasics(oblValueList[0], oblValPrefix+"val4", namespaceID2, namespace2.Name, namespaceFQN2) - s.Equal(oblName+"-2", oblValueList[0].GetObligation().GetName()) - - // Test 3: Empty FQN list should return empty result - oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ - Fqns: []string{}, - }) - s.Require().NoError(err) - s.NotNil(oblValueList) - s.Empty(oblValueList) - - // Test 4: Get all values from a single obligation - allValuesFromObl1 := []string{ - policydb.BuildOblValFQN(namespaceFQN1, oblName+"-1", oblValPrefix+"val1"), - policydb.BuildOblValFQN(namespaceFQN1, oblName+"-1", oblValPrefix+"val2"), - } - oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ - Fqns: allValuesFromObl1, - }) - s.Require().NoError(err) - s.NotNil(oblValueList) - s.Len(oblValueList, 2) - for _, oblValue := range oblValueList { - s.Contains([]string{oblValPrefix + "val1", oblValPrefix + "val2"}, oblValue.GetValue()) - s.Equal(oblName+"-1", oblValue.GetObligation().GetName()) - s.assertObligationValueBasics(oblValue, oblValue.GetValue(), namespaceID1, namespace1.Name, namespaceFQN1) - } - - // Cleanup - s.deleteObligations([]string{obl1.GetId(), obl2.GetId(), obl3.GetId()}) -} - -func (s *ObligationsSuite) Test_GetObligationValuesByFQNs_Fails() { - // Setup test data - namespaceID, namespaceFQN, _ := s.getNamespaceData(nsExampleCom) - obl := s.createObligation(namespaceID, oblName, []string{oblValPrefix + "test-value"}) - - // Test 1: Invalid FQN should return empty result (not error) - invalidFQNs := []string{invalidFQN} - oblValueList, err := s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ - Fqns: invalidFQNs, - }) - s.Require().NoError(err) - s.NotNil(oblValueList) - s.Empty(oblValueList) - - // Test 2: Mix of valid and invalid FQNs should return only valid ones - validFQN := policydb.BuildOblValFQN(namespaceFQN, oblName, oblValPrefix+"test-value") - mixedFQNs := []string{ - validFQN, - invalidFQN, - "https://nonexistent.com/obl/nonexistent/val/nonexistent", - } - oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ - Fqns: mixedFQNs, - }) - s.Require().NoError(err) - s.NotNil(oblValueList) - s.Len(oblValueList, 1) - s.Equal(oblValPrefix+"test-value", oblValueList[0].GetValue()) - - // Test 3: Non-existent obligation value names should return empty result - nonExistentFQNs := []string{ - policydb.BuildOblValFQN(namespaceFQN, oblName, "nonexistent-value"), - } - oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ - Fqns: nonExistentFQNs, - }) - s.Require().NoError(err) - s.NotNil(oblValueList) - s.Empty(oblValueList) - - // Test 4: Non-existent obligation names should return empty result - nonExistentOblFQNs := []string{ - policydb.BuildOblValFQN(namespaceFQN, "nonexistent-obligation", oblValPrefix+"test-value"), - } - oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ - Fqns: nonExistentOblFQNs, - }) - s.Require().NoError(err) - s.NotNil(oblValueList) - s.Empty(oblValueList) - - // Test 5: Non-existent namespace should return empty result - nonExistentNsFQNs := []string{ - policydb.BuildOblValFQN("https://nonexistent.com", oblName, oblValPrefix+"test-value"), - } - oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ - Fqns: nonExistentNsFQNs, - }) - s.Require().NoError(err) - s.NotNil(oblValueList) - s.Empty(oblValueList) - - // Test 6: Malformed FQNs should return empty result - malformedFQNs := []string{ - namespaceFQN + "/obl/" + oblName, // Missing /val/ part - namespaceFQN + "/invalid/" + oblName + "/val/" + oblValPrefix + "test-value", // Invalid path - namespaceFQN + "/obl/" + oblName + "/val/", // Empty value name - } - oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ - Fqns: malformedFQNs, - }) - s.Require().NoError(err) - s.NotNil(oblValueList) - s.Empty(oblValueList) - - // Cleanup - s.deleteObligations([]string{obl.GetId()}) -} - func (s *ObligationsSuite) Test_GetObligationsByFQNs_Fails() { // Setup test data namespaceID, namespaceFQN, _ := s.getNamespaceData(nsExampleCom) @@ -859,6 +686,179 @@ func (s *ObligationsSuite) Test_GetObligationValue_Fails() { s.deleteObligations([]string{createdObl.GetId()}) } +// GetObligationValuesByFQNs + +func (s *ObligationsSuite) Test_GetObligationValuesByFQNs_Succeeds() { + // Setup test data + namespaceID1, namespaceFQN1, namespace1 := s.getNamespaceData(nsExampleCom) + namespaceID2, namespaceFQN2, namespace2 := s.getNamespaceData(nsExampleNet) + namespaceID3, _, _ := s.getNamespaceData(nsExampleOrg) + + // Create obligations with values in different namespaces + obl1 := s.createObligation(namespaceID1, oblName+"-1", []string{oblValPrefix + "val1", oblValPrefix + "val2"}) + obl2 := s.createObligation(namespaceID2, oblName+"-2", []string{oblValPrefix + "val3", oblValPrefix + "val4"}) + obl3 := s.createObligation(namespaceID3, oblName+"-3", []string{oblValPrefix + "val5"}) + + // Test 1: Get multiple obligation values by FQNs + fqns := []string{ + policydb.BuildOblValFQN(namespaceFQN1, oblName+"-1", oblValPrefix+"val1"), + policydb.BuildOblValFQN(namespaceFQN1, oblName+"-1", oblValPrefix+"val2"), + policydb.BuildOblValFQN(namespaceFQN2, oblName+"-2", oblValPrefix+"val3"), + } + + oblValueList, err := s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ + Fqns: fqns, + }) + s.Require().NoError(err) + s.NotNil(oblValueList) + s.Len(oblValueList, 3) + + // Create maps for easier verification + expectedValues := map[string]struct{}{ + oblValPrefix + "val1": {}, + oblValPrefix + "val2": {}, + oblValPrefix + "val3": {}, + } + foundValues := make(map[string]*policy.ObligationValue) + + for _, oblValue := range oblValueList { + s.Contains(expectedValues, oblValue.GetValue()) + foundValues[oblValue.GetValue()] = oblValue + } + s.Len(foundValues, 3) + + // Verify each obligation value + val1 := foundValues[oblValPrefix+"val1"] + s.assertObligationValueBasics(val1, oblValPrefix+"val1", namespaceID1, namespace1.Name, namespaceFQN1) + s.Equal(oblName+"-1", val1.GetObligation().GetName()) + + val2 := foundValues[oblValPrefix+"val2"] + s.assertObligationValueBasics(val2, oblValPrefix+"val2", namespaceID1, namespace1.Name, namespaceFQN1) + s.Equal(oblName+"-1", val2.GetObligation().GetName()) + + val3 := foundValues[oblValPrefix+"val3"] + s.assertObligationValueBasics(val3, oblValPrefix+"val3", namespaceID2, namespace2.Name, namespaceFQN2) + s.Equal(oblName+"-2", val3.GetObligation().GetName()) + + // Test 2: Get single obligation value by FQN + singleFQN := []string{policydb.BuildOblValFQN(namespaceFQN2, oblName+"-2", oblValPrefix+"val4")} + oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ + Fqns: singleFQN, + }) + s.Require().NoError(err) + s.NotNil(oblValueList) + s.Len(oblValueList, 1) + s.assertObligationValueBasics(oblValueList[0], oblValPrefix+"val4", namespaceID2, namespace2.Name, namespaceFQN2) + s.Equal(oblName+"-2", oblValueList[0].GetObligation().GetName()) + + // Test 3: Empty FQN list should return empty result + oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ + Fqns: []string{}, + }) + s.Require().NoError(err) + s.NotNil(oblValueList) + s.Empty(oblValueList) + + // Test 4: Get all values from a single obligation + allValuesFromObl1 := []string{ + policydb.BuildOblValFQN(namespaceFQN1, oblName+"-1", oblValPrefix+"val1"), + policydb.BuildOblValFQN(namespaceFQN1, oblName+"-1", oblValPrefix+"val2"), + } + oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ + Fqns: allValuesFromObl1, + }) + s.Require().NoError(err) + s.NotNil(oblValueList) + s.Len(oblValueList, 2) + for _, oblValue := range oblValueList { + s.Contains([]string{oblValPrefix + "val1", oblValPrefix + "val2"}, oblValue.GetValue()) + s.Equal(oblName+"-1", oblValue.GetObligation().GetName()) + s.assertObligationValueBasics(oblValue, oblValue.GetValue(), namespaceID1, namespace1.Name, namespaceFQN1) + } + + // Cleanup + s.deleteObligations([]string{obl1.GetId(), obl2.GetId(), obl3.GetId()}) +} + +func (s *ObligationsSuite) Test_GetObligationValuesByFQNs_Fails() { + // Setup test data + namespaceID, namespaceFQN, _ := s.getNamespaceData(nsExampleCom) + obl := s.createObligation(namespaceID, oblName, []string{oblValPrefix + "test-value"}) + + // Test 1: Invalid FQN should return empty result (not error) + invalidFQNs := []string{invalidFQN} + oblValueList, err := s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ + Fqns: invalidFQNs, + }) + s.Require().NoError(err) + s.NotNil(oblValueList) + s.Empty(oblValueList) + + // Test 2: Mix of valid and invalid FQNs should return only valid ones + validFQN := policydb.BuildOblValFQN(namespaceFQN, oblName, oblValPrefix+"test-value") + mixedFQNs := []string{ + validFQN, + invalidFQN, + "https://nonexistent.com/obl/nonexistent/val/nonexistent", + } + oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ + Fqns: mixedFQNs, + }) + s.Require().NoError(err) + s.NotNil(oblValueList) + s.Len(oblValueList, 1) + s.Equal(oblValPrefix+"test-value", oblValueList[0].GetValue()) + + // Test 3: Non-existent obligation value names should return empty result + nonExistentFQNs := []string{ + policydb.BuildOblValFQN(namespaceFQN, oblName, "nonexistent-value"), + } + oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ + Fqns: nonExistentFQNs, + }) + s.Require().NoError(err) + s.NotNil(oblValueList) + s.Empty(oblValueList) + + // Test 4: Non-existent obligation names should return empty result + nonExistentOblFQNs := []string{ + policydb.BuildOblValFQN(namespaceFQN, "nonexistent-obligation", oblValPrefix+"test-value"), + } + oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ + Fqns: nonExistentOblFQNs, + }) + s.Require().NoError(err) + s.NotNil(oblValueList) + s.Empty(oblValueList) + + // Test 5: Non-existent namespace should return empty result + nonExistentNsFQNs := []string{ + policydb.BuildOblValFQN("https://nonexistent.com", oblName, oblValPrefix+"test-value"), + } + oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ + Fqns: nonExistentNsFQNs, + }) + s.Require().NoError(err) + s.NotNil(oblValueList) + s.Empty(oblValueList) + + // Test 6: Malformed FQNs should return empty result + malformedFQNs := []string{ + namespaceFQN + "/obl/" + oblName, // Missing /val/ part + namespaceFQN + "/invalid/" + oblName + "/val/" + oblValPrefix + "test-value", // Invalid path + namespaceFQN + "/obl/" + oblName + "/val/", // Empty value name + } + oblValueList, err = s.db.PolicyClient.GetObligationValuesByFQNs(s.ctx, &obligations.GetObligationValuesByFQNsRequest{ + Fqns: malformedFQNs, + }) + s.Require().NoError(err) + s.NotNil(oblValueList) + s.Empty(oblValueList) + + // Cleanup + s.deleteObligations([]string{obl.GetId()}) +} + // Update func (s *ObligationsSuite) Test_UpdateObligationValue_Succeeds() { From de9491a0cbbafe3b90bf17afaa7ad2ff3681e7bf Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 27 Aug 2025 01:14:54 -0400 Subject: [PATCH 114/137] create obl val rpc --- service/logger/audit/constants.go | 1 + service/policy/obligations/obligations.go | 34 ++++++++++++++++++++--- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/service/logger/audit/constants.go b/service/logger/audit/constants.go index 20fff4dbfd..158b884992 100644 --- a/service/logger/audit/constants.go +++ b/service/logger/audit/constants.go @@ -12,6 +12,7 @@ const ( ObjectTypeAttributeDefinition ObjectTypeAttributeValue ObjectTypeObligationDefinition + ObjectTypeObligationValue ObjectTypeNamespace ObjectTypeConditionSet ObjectTypeKasRegistry diff --git a/service/policy/obligations/obligations.go b/service/policy/obligations/obligations.go index 3bfdcefa18..e545888bb7 100644 --- a/service/policy/obligations/obligations.go +++ b/service/policy/obligations/obligations.go @@ -221,12 +221,38 @@ func (s *Service) DeleteObligation(ctx context.Context, req *connect.Request[obl return connect.NewResponse(rsp), nil } -func (s *Service) CreateObligationValue(_ context.Context, _ *connect.Request[obligations.CreateObligationValueRequest]) (*connect.Response[obligations.CreateObligationValueResponse], error) { - // TODO: Implement CreateObligationValue logic - return connect.NewResponse(&obligations.CreateObligationValueResponse{}), nil +func (s *Service) CreateObligationValue(ctx context.Context, req *connect.Request[obligations.CreateObligationValueRequest]) (*connect.Response[obligations.CreateObligationValueResponse], error) { + rsp := &obligations.CreateObligationValueResponse{} + + auditParams := audit.PolicyEventParams{ + ActionType: audit.ActionTypeCreate, + ObjectType: audit.ObjectTypeObligationValue, + } + + s.logger.DebugContext(ctx, "creating obligation value", slog.String("value", req.Msg.GetValue())) + + err := s.dbClient.RunInTx(ctx, func(txClient *policydb.PolicyDBClient) error { + val, err := txClient.CreateObligationValue(ctx, req.Msg) + if err != nil { + return err + } + + auditParams.ObjectID = val.GetId() + auditParams.Original = val + s.logger.Audit.PolicyCRUDSuccess(ctx, auditParams) + + rsp.Value = val + return nil + }) + if err != nil { + s.logger.Audit.PolicyCRUDFailure(ctx, auditParams) + return nil, db.StatusifyError(ctx, s.logger, err, db.ErrTextCreationFailed, slog.String("obligation value", req.Msg.String())) + } + + return connect.NewResponse(rsp), nil } -func (s *Service) GetObligationValue(_ context.Context, _ *connect.Request[obligations.GetObligationValueRequest]) (*connect.Response[obligations.GetObligationValueResponse], error) { +func (s *Service) GetObligationValue(ctx context.Context, req *connect.Request[obligations.GetObligationValueRequest]) (*connect.Response[obligations.GetObligationValueResponse], error) { // TODO: Implement GetObligationValue logic return connect.NewResponse(&obligations.GetObligationValueResponse{}), nil } From 2886d53b84886526958bfa6635ac3d091133d322 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 27 Aug 2025 01:17:05 -0400 Subject: [PATCH 115/137] get obl val rpc --- service/policy/obligations/obligations.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/service/policy/obligations/obligations.go b/service/policy/obligations/obligations.go index e545888bb7..179b30424e 100644 --- a/service/policy/obligations/obligations.go +++ b/service/policy/obligations/obligations.go @@ -253,8 +253,14 @@ func (s *Service) CreateObligationValue(ctx context.Context, req *connect.Reques } func (s *Service) GetObligationValue(ctx context.Context, req *connect.Request[obligations.GetObligationValueRequest]) (*connect.Response[obligations.GetObligationValueResponse], error) { - // TODO: Implement GetObligationValue logic - return connect.NewResponse(&obligations.GetObligationValueResponse{}), nil + s.logger.DebugContext(ctx, "getting obligation value", slog.Any("identifier", req.Msg.GetIdentifier())) + + val, err := s.dbClient.GetObligationValue(ctx, req.Msg) + if err != nil { + return nil, db.StatusifyError(ctx, s.logger, err, db.ErrTextGetRetrievalFailed, slog.Any("identifier", req.Msg.GetIdentifier())) + } + rsp := &obligations.GetObligationValueResponse{Value: val} + return connect.NewResponse(rsp), nil } func (s *Service) GetObligationValuesByFQNs(_ context.Context, _ *connect.Request[obligations.GetObligationValuesByFQNsRequest]) (*connect.Response[obligations.GetObligationValuesByFQNsResponse], error) { From 83149902cec2dbcd56630005d84a0baa5a1e0dda Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 27 Aug 2025 01:29:21 -0400 Subject: [PATCH 116/137] get obl val by fqns rpc --- service/policy/obligations/obligations.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/service/policy/obligations/obligations.go b/service/policy/obligations/obligations.go index 179b30424e..9339e5f5f2 100644 --- a/service/policy/obligations/obligations.go +++ b/service/policy/obligations/obligations.go @@ -263,9 +263,20 @@ func (s *Service) GetObligationValue(ctx context.Context, req *connect.Request[o return connect.NewResponse(rsp), nil } -func (s *Service) GetObligationValuesByFQNs(_ context.Context, _ *connect.Request[obligations.GetObligationValuesByFQNsRequest]) (*connect.Response[obligations.GetObligationValuesByFQNsResponse], error) { - // TODO: Implement GetObligationValuesByFQNs logic - return connect.NewResponse(&obligations.GetObligationValuesByFQNsResponse{}), nil +func (s *Service) GetObligationValuesByFQNs(ctx context.Context, req *connect.Request[obligations.GetObligationValuesByFQNsRequest]) (*connect.Response[obligations.GetObligationValuesByFQNsResponse], error) { + s.logger.DebugContext(ctx, "getting obligation values") + + vs, err := s.dbClient.GetObligationValuesByFQNs(ctx, req.Msg) + if err != nil { + return nil, db.StatusifyError(ctx, s.logger, err, db.ErrTextGetRetrievalFailed) + } + vals := make(map[string]*policy.ObligationValue) + for _, val := range vs { + obl := val.GetObligation() + vals[policydb.BuildOblValFQN(obl.GetNamespace().GetFqn(), obl.GetName(), val.GetValue())] = val + } + rsp := &obligations.GetObligationValuesByFQNsResponse{FqnValueMap: vals} + return connect.NewResponse(rsp), nil } func (s *Service) UpdateObligationValue(_ context.Context, _ *connect.Request[obligations.UpdateObligationValueRequest]) (*connect.Response[obligations.UpdateObligationValueResponse], error) { From 0f6b8773ac64913bb53fcb08d9766189275a502b Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 27 Aug 2025 01:37:54 -0400 Subject: [PATCH 117/137] update obl val rpc --- service/policy/obligations/obligations.go | 43 +++++++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/service/policy/obligations/obligations.go b/service/policy/obligations/obligations.go index 9339e5f5f2..6d18c66460 100644 --- a/service/policy/obligations/obligations.go +++ b/service/policy/obligations/obligations.go @@ -279,9 +279,46 @@ func (s *Service) GetObligationValuesByFQNs(ctx context.Context, req *connect.Re return connect.NewResponse(rsp), nil } -func (s *Service) UpdateObligationValue(_ context.Context, _ *connect.Request[obligations.UpdateObligationValueRequest]) (*connect.Response[obligations.UpdateObligationValueResponse], error) { - // TODO: Implement UpdateObligationValue logic - return connect.NewResponse(&obligations.UpdateObligationValueResponse{}), nil +func (s *Service) UpdateObligationValue(ctx context.Context, req *connect.Request[obligations.UpdateObligationValueRequest]) (*connect.Response[obligations.UpdateObligationValueResponse], error) { + id := req.Msg.GetId() + + rsp := &obligations.UpdateObligationValueResponse{} + + auditParams := audit.PolicyEventParams{ + ActionType: audit.ActionTypeUpdate, + ObjectType: audit.ObjectTypeObligationValue, + ObjectID: id, + } + + s.logger.DebugContext(ctx, "updating obligation value", slog.String("id", id)) + + err := s.dbClient.RunInTx(ctx, func(txClient *policydb.PolicyDBClient) error { + original, err := txClient.GetObligationValue(ctx, &obligations.GetObligationValueRequest{ + Identifier: &obligations.GetObligationValueRequest_Id{ + Id: id, + }, + }) + if err != nil { + return err + } + + updated, err := txClient.UpdateObligationValue(ctx, req.Msg) + if err != nil { + return err + } + + auditParams.Original = original + auditParams.Updated = updated + s.logger.Audit.PolicyCRUDSuccess(ctx, auditParams) + + rsp.Value = updated + return nil + }) + if err != nil { + s.logger.Audit.PolicyCRUDFailure(ctx, auditParams) + return nil, db.StatusifyError(ctx, s.logger, err, db.ErrTextUpdateFailed, slog.String("obligation value", req.Msg.String())) + } + return connect.NewResponse(rsp), nil } func (s *Service) DeleteObligationValue(_ context.Context, _ *connect.Request[obligations.DeleteObligationValueRequest]) (*connect.Response[obligations.DeleteObligationValueResponse], error) { From fe23b9fc6ffe79265ecbdb156ef91a413e6e8349 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 27 Aug 2025 01:39:44 -0400 Subject: [PATCH 118/137] delete obl val rpc --- service/policy/obligations/obligations.go | 24 ++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/service/policy/obligations/obligations.go b/service/policy/obligations/obligations.go index 6d18c66460..92dab79e65 100644 --- a/service/policy/obligations/obligations.go +++ b/service/policy/obligations/obligations.go @@ -321,9 +321,27 @@ func (s *Service) UpdateObligationValue(ctx context.Context, req *connect.Reques return connect.NewResponse(rsp), nil } -func (s *Service) DeleteObligationValue(_ context.Context, _ *connect.Request[obligations.DeleteObligationValueRequest]) (*connect.Response[obligations.DeleteObligationValueResponse], error) { - // TODO: Implement DeleteObligationValue logic - return connect.NewResponse(&obligations.DeleteObligationValueResponse{}), nil +func (s *Service) DeleteObligationValue(ctx context.Context, req *connect.Request[obligations.DeleteObligationValueRequest]) (*connect.Response[obligations.DeleteObligationValueResponse], error) { + id := req.Msg.GetId() + + auditParams := audit.PolicyEventParams{ + ActionType: audit.ActionTypeDelete, + ObjectType: audit.ObjectTypeObligationValue, + ObjectID: id, + } + + s.logger.DebugContext(ctx, "deleting obligation value", slog.String("id", id)) + + deleted, err := s.dbClient.DeleteObligationValue(ctx, req.Msg) + if err != nil { + s.logger.Audit.PolicyCRUDFailure(ctx, auditParams) + return nil, db.StatusifyError(ctx, s.logger, err, db.ErrTextDeletionFailed, slog.String("obligation value", req.Msg.String())) + } + + s.logger.Audit.PolicyCRUDSuccess(ctx, auditParams) + + rsp := &obligations.DeleteObligationValueResponse{Value: deleted} + return connect.NewResponse(rsp), nil } func (s *Service) AddObligationTrigger(_ context.Context, _ *connect.Request[obligations.AddObligationTriggerRequest]) (*connect.Response[obligations.AddObligationTriggerResponse], error) { From c6e7ffd009373e88921472b9a9d212e3ab59bb3c Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 27 Aug 2025 02:07:03 -0400 Subject: [PATCH 119/137] add obligation value audit type --- service/logger/audit/constants.go | 1 + 1 file changed, 1 insertion(+) diff --git a/service/logger/audit/constants.go b/service/logger/audit/constants.go index 158b884992..2b2a16f6ae 100644 --- a/service/logger/audit/constants.go +++ b/service/logger/audit/constants.go @@ -40,6 +40,7 @@ func (ot ObjectType) String() string { "attribute_definition", "attribute_value", "obligation_definition", + "obligation_value", "namespace", "condition_set", "kas_registry", From 3a6184db586cce7fd7b6d37fb8067e12a35cfc12 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 2 Sep 2025 15:57:10 -0400 Subject: [PATCH 120/137] update obl val proto --- service/policy/objects.proto | 2 ++ 1 file changed, 2 insertions(+) diff --git a/service/policy/objects.proto b/service/policy/objects.proto index d88e6f88e4..406ad8462c 100644 --- a/service/policy/objects.proto +++ b/service/policy/objects.proto @@ -479,6 +479,8 @@ message ObligationValue { string value = 3; + repeated ObligationTrigger triggers = 4; + common.Metadata metadata = 100; } From 652d33a82b6118493dca2a1646f32908fa726174 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Tue, 2 Sep 2025 16:19:46 -0400 Subject: [PATCH 121/137] make proto-generate --- docs/grpc/index.html | 7 + docs/openapi/policy/objects.openapi.yaml | 5 + .../obligations/obligations.openapi.yaml | 5 + protocol/go/policy/objects.pb.go | 402 +++++++++--------- 4 files changed, 224 insertions(+), 195 deletions(-) diff --git a/docs/grpc/index.html b/docs/grpc/index.html index c15d2df264..620eb2fa4f 100644 --- a/docs/grpc/index.html +++ b/docs/grpc/index.html @@ -2994,6 +2994,13 @@

ObligationValue

+ + triggers + ObligationTrigger + repeated +

+ + metadata common.Metadata diff --git a/docs/openapi/policy/objects.openapi.yaml b/docs/openapi/policy/objects.openapi.yaml index e0bc4d1c2e..e0ddbb6673 100644 --- a/docs/openapi/policy/objects.openapi.yaml +++ b/docs/openapi/policy/objects.openapi.yaml @@ -635,6 +635,11 @@ components: value: type: string title: value + triggers: + type: array + items: + $ref: '#/components/schemas/policy.ObligationTrigger' + title: triggers metadata: title: metadata $ref: '#/components/schemas/common.Metadata' diff --git a/docs/openapi/policy/obligations/obligations.openapi.yaml b/docs/openapi/policy/obligations/obligations.openapi.yaml index 46256da078..e0bb358663 100644 --- a/docs/openapi/policy/obligations/obligations.openapi.yaml +++ b/docs/openapi/policy/obligations/obligations.openapi.yaml @@ -999,6 +999,11 @@ components: value: type: string title: value + triggers: + type: array + items: + $ref: '#/components/schemas/policy.ObligationTrigger' + title: triggers metadata: title: metadata $ref: '#/components/schemas/common.Metadata' diff --git a/protocol/go/policy/objects.pb.go b/protocol/go/policy/objects.pb.go index abe7d8840a..309c802ef0 100644 --- a/protocol/go/policy/objects.pb.go +++ b/protocol/go/policy/objects.pb.go @@ -2367,10 +2367,11 @@ type ObligationValue struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Obligation *Obligation `protobuf:"bytes,2,opt,name=obligation,proto3" json:"obligation,omitempty"` - Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - Metadata *common.Metadata `protobuf:"bytes,100,opt,name=metadata,proto3" json:"metadata,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Obligation *Obligation `protobuf:"bytes,2,opt,name=obligation,proto3" json:"obligation,omitempty"` + Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + Triggers []*ObligationTrigger `protobuf:"bytes,4,rep,name=triggers,proto3" json:"triggers,omitempty"` + Metadata *common.Metadata `protobuf:"bytes,100,opt,name=metadata,proto3" json:"metadata,omitempty"` } func (x *ObligationValue) Reset() { @@ -2426,6 +2427,13 @@ func (x *ObligationValue) GetValue() string { return "" } +func (x *ObligationValue) GetTriggers() []*ObligationTrigger { + if x != nil { + return x.Triggers + } + return nil +} + func (x *ObligationValue) GetMetadata() *common.Metadata { if x != nil { return x.Metadata @@ -3340,183 +3348,186 @@ var file_policy_objects_proto_rawDesc = []byte{ 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x22, 0x99, 0x01, 0x0a, 0x0f, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, + 0x22, 0xd0, 0x01, 0x0a, 0x0f, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, - 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0xf5, 0x01, 0x0a, - 0x11, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, - 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, - 0x69, 0x64, 0x12, 0x42, 0x0a, 0x10, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x26, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, - 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x36, - 0x0a, 0x0f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, - 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x22, 0x61, 0x0a, 0x06, 0x4b, 0x61, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x15, - 0x0a, 0x06, 0x6b, 0x61, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x6b, 0x61, 0x73, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, 0x73, 0x79, 0x6d, - 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x17, - 0x0a, 0x07, 0x6b, 0x61, 0x73, 0x5f, 0x75, 0x72, 0x69, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x6b, 0x61, 0x73, 0x55, 0x72, 0x69, 0x22, 0x29, 0x0a, 0x0c, 0x50, 0x75, 0x62, 0x6c, 0x69, - 0x63, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x19, 0x0a, 0x03, 0x70, 0x65, 0x6d, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x70, - 0x65, 0x6d, 0x22, 0x50, 0x0a, 0x0d, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, - 0x43, 0x74, 0x78, 0x12, 0x1e, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x05, 0x6b, 0x65, - 0x79, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x6b, - 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, - 0x64, 0x4b, 0x65, 0x79, 0x22, 0xd1, 0x03, 0x0a, 0x0d, 0x41, 0x73, 0x79, 0x6d, 0x6d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x36, 0x0a, - 0x0d, 0x6b, 0x65, 0x79, 0x5f, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, 0x6c, - 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x52, 0x0c, 0x6b, 0x65, 0x79, 0x41, 0x6c, 0x67, 0x6f, - 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x30, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x6b, 0x65, - 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, 0x6d, - 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x4d, - 0x6f, 0x64, 0x65, 0x12, 0x3a, 0x0a, 0x0e, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, - 0x79, 0x5f, 0x63, 0x74, 0x78, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x43, 0x74, - 0x78, 0x52, 0x0c, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, - 0x3d, 0x0a, 0x0f, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x63, - 0x74, 0x78, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x52, - 0x0d, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x42, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x35, + 0x0a, 0x08, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x08, 0x74, 0x72, 0x69, + 0x67, 0x67, 0x65, 0x72, 0x73, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x22, 0xf5, 0x01, 0x0a, 0x11, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x42, 0x0a, 0x10, 0x6f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, 0x6f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x26, 0x0a, + 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, + 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x0f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0e, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x61, 0x0a, 0x06, 0x4b, + 0x61, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x61, 0x73, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6b, 0x61, 0x73, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x2e, 0x41, 0x73, 0x79, 0x6d, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x6b, 0x61, 0x73, 0x5f, 0x75, 0x72, 0x69, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6b, 0x61, 0x73, 0x55, 0x72, 0x69, 0x22, 0x29, + 0x0a, 0x0c, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x19, + 0x0a, 0x03, 0x70, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, + 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x70, 0x65, 0x6d, 0x22, 0x50, 0x0a, 0x0d, 0x50, 0x72, 0x69, + 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x1e, 0x0a, 0x06, 0x6b, 0x65, + 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, + 0x02, 0x10, 0x01, 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x72, + 0x61, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0a, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x22, 0xd1, 0x03, 0x0a, 0x0d, + 0x41, 0x73, 0x79, 0x6d, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x15, 0x0a, + 0x06, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6b, + 0x65, 0x79, 0x49, 0x64, 0x12, 0x36, 0x0a, 0x0d, 0x6b, 0x65, 0x79, 0x5f, 0x61, 0x6c, 0x67, 0x6f, + 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x52, 0x0c, + 0x6b, 0x65, 0x79, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x30, 0x0a, 0x0a, + 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x11, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x09, 0x6b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, + 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x0f, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x4d, 0x6f, 0x64, + 0x65, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x3a, 0x0a, 0x0e, 0x70, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x63, 0x74, 0x78, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x75, 0x62, 0x6c, + 0x69, 0x63, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x52, 0x0c, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x3d, 0x0a, 0x0f, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, + 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x63, 0x74, 0x78, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x15, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, + 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x52, 0x0d, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, + 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x42, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, + 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x67, + 0x61, 0x63, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x6c, 0x65, 0x67, 0x61, 0x63, + 0x79, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, + 0x9e, 0x02, 0x0a, 0x0c, 0x53, 0x79, 0x6d, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, + 0x6b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, 0x0a, 0x08, 0x6b, 0x65, 0x79, + 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x07, 0x6b, 0x65, + 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x6b, 0x65, 0x79, 0x5f, 0x63, 0x74, 0x78, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x42, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x06, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, - 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, - 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x9e, 0x02, 0x0a, 0x0c, 0x53, 0x79, 0x6d, - 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x65, 0x79, - 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, - 0x12, 0x30, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, - 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x6b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x12, 0x2a, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, - 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x17, - 0x0a, 0x07, 0x6b, 0x65, 0x79, 0x5f, 0x63, 0x74, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x06, 0x6b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x42, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x76, 0x69, - 0x64, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x6f, - 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0e, 0x70, 0x72, 0x6f, - 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2c, 0x0a, 0x08, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, - 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2a, 0xb3, 0x01, 0x0a, 0x15, 0x41, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x75, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x45, - 0x6e, 0x75, 0x6d, 0x12, 0x28, 0x0a, 0x24, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, - 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, + 0x69, 0x67, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x2a, 0xb3, 0x01, 0x0a, 0x15, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x75, + 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x28, 0x0a, 0x24, 0x41, 0x54, + 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x23, 0x0a, 0x1f, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, + 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, + 0x5f, 0x41, 0x4c, 0x4c, 0x5f, 0x4f, 0x46, 0x10, 0x01, 0x12, 0x23, 0x0a, 0x1f, 0x41, 0x54, 0x54, + 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, 0x4e, 0x59, 0x5f, 0x4f, 0x46, 0x10, 0x02, 0x12, 0x26, + 0x0a, 0x22, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x48, 0x49, 0x45, 0x52, 0x41, + 0x52, 0x43, 0x48, 0x59, 0x10, 0x03, 0x2a, 0xca, 0x01, 0x0a, 0x1a, 0x53, 0x75, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, + 0x72, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x2d, 0x0a, 0x29, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, + 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, + 0x52, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x24, 0x0a, 0x20, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, + 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, + 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x49, 0x4e, 0x10, 0x01, 0x12, 0x28, 0x0a, 0x24, 0x53, 0x55, + 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, + 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, + 0x49, 0x4e, 0x10, 0x02, 0x12, 0x2d, 0x0a, 0x29, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, + 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, + 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x49, 0x4e, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, + 0x53, 0x10, 0x03, 0x2a, 0x90, 0x01, 0x0a, 0x18, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x45, 0x6e, 0x75, 0x6d, + 0x12, 0x2b, 0x0a, 0x27, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x4f, + 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x23, 0x0a, - 0x1f, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, - 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, 0x4c, 0x4c, 0x5f, 0x4f, 0x46, - 0x10, 0x01, 0x12, 0x23, 0x0a, 0x1f, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, 0x5f, - 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, - 0x4e, 0x59, 0x5f, 0x4f, 0x46, 0x10, 0x02, 0x12, 0x26, 0x0a, 0x22, 0x41, 0x54, 0x54, 0x52, 0x49, - 0x42, 0x55, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, - 0x4e, 0x55, 0x4d, 0x5f, 0x48, 0x49, 0x45, 0x52, 0x41, 0x52, 0x43, 0x48, 0x59, 0x10, 0x03, 0x2a, - 0xca, 0x01, 0x0a, 0x1a, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, - 0x6e, 0x67, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x2d, - 0x0a, 0x29, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, - 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, - 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x24, 0x0a, - 0x20, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, - 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x49, - 0x4e, 0x10, 0x01, 0x12, 0x28, 0x0a, 0x24, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, - 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x5f, - 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x2d, 0x0a, - 0x29, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, - 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x49, - 0x4e, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x53, 0x10, 0x03, 0x2a, 0x90, 0x01, 0x0a, - 0x18, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, - 0x6e, 0x54, 0x79, 0x70, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x27, 0x43, 0x4f, 0x4e, - 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x5f, 0x54, - 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, - 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x23, 0x0a, 0x1f, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, - 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, - 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x22, 0x0a, 0x1e, 0x43, - 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, - 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x4f, 0x52, 0x10, 0x02, 0x2a, - 0x5d, 0x0a, 0x0a, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, - 0x17, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, - 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x4f, - 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, - 0x41, 0x4c, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, - 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x02, 0x2a, 0x88, - 0x02, 0x0a, 0x13, 0x4b, 0x61, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x41, - 0x6c, 0x67, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x27, 0x0a, 0x23, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, + 0x1f, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x45, + 0x41, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, 0x4e, 0x44, + 0x10, 0x01, 0x12, 0x22, 0x0a, 0x1e, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, + 0x4d, 0x5f, 0x4f, 0x52, 0x10, 0x02, 0x2a, 0x5d, 0x0a, 0x0a, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x53, + 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x52, + 0x4e, 0x41, 0x4c, 0x10, 0x02, 0x2a, 0x88, 0x02, 0x0a, 0x13, 0x4b, 0x61, 0x73, 0x50, 0x75, 0x62, + 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x41, 0x6c, 0x67, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x27, 0x0a, + 0x23, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, + 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, + 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x24, 0x0a, 0x20, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, + 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, + 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x32, 0x30, 0x34, 0x38, 0x10, 0x01, 0x12, 0x24, 0x0a, 0x20, + 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, + 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x34, 0x30, 0x39, 0x36, + 0x10, 0x02, 0x12, 0x28, 0x0a, 0x24, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, + 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x43, + 0x5f, 0x53, 0x45, 0x43, 0x50, 0x32, 0x35, 0x36, 0x52, 0x31, 0x10, 0x05, 0x12, 0x28, 0x0a, 0x24, + 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, + 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x53, 0x45, 0x43, 0x50, 0x33, + 0x38, 0x34, 0x52, 0x31, 0x10, 0x06, 0x12, 0x28, 0x0a, 0x24, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, - 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, - 0x24, 0x0a, 0x20, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, - 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x32, - 0x30, 0x34, 0x38, 0x10, 0x01, 0x12, 0x24, 0x0a, 0x20, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, - 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, - 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x34, 0x30, 0x39, 0x36, 0x10, 0x02, 0x12, 0x28, 0x0a, 0x24, 0x4b, - 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, - 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x53, 0x45, 0x43, 0x50, 0x32, 0x35, - 0x36, 0x52, 0x31, 0x10, 0x05, 0x12, 0x28, 0x0a, 0x24, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, - 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, - 0x5f, 0x45, 0x43, 0x5f, 0x53, 0x45, 0x43, 0x50, 0x33, 0x38, 0x34, 0x52, 0x31, 0x10, 0x06, 0x12, - 0x28, 0x0a, 0x24, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, - 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x53, 0x45, - 0x43, 0x50, 0x35, 0x32, 0x31, 0x52, 0x31, 0x10, 0x07, 0x2a, 0x9b, 0x01, 0x0a, 0x09, 0x41, 0x6c, - 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x4c, 0x47, 0x4f, 0x52, - 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, - 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, - 0x52, 0x53, 0x41, 0x5f, 0x32, 0x30, 0x34, 0x38, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x4c, - 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x34, 0x30, 0x39, 0x36, - 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, - 0x45, 0x43, 0x5f, 0x50, 0x32, 0x35, 0x36, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x4c, 0x47, - 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x50, 0x33, 0x38, 0x34, 0x10, 0x04, + 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x53, 0x45, 0x43, 0x50, 0x35, 0x32, 0x31, 0x52, 0x31, 0x10, 0x07, + 0x2a, 0x9b, 0x01, 0x0a, 0x09, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x19, + 0x0a, 0x15, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x4c, 0x47, + 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x32, 0x30, 0x34, 0x38, 0x10, + 0x01, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x52, + 0x53, 0x41, 0x5f, 0x34, 0x30, 0x39, 0x36, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x4c, 0x47, + 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x50, 0x32, 0x35, 0x36, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x45, 0x43, - 0x5f, 0x50, 0x35, 0x32, 0x31, 0x10, 0x05, 0x2a, 0x56, 0x0a, 0x09, 0x4b, 0x65, 0x79, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x16, 0x4b, 0x45, 0x59, 0x5f, 0x53, 0x54, 0x41, 0x54, - 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, - 0x12, 0x15, 0x0a, 0x11, 0x4b, 0x45, 0x59, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x41, - 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4b, 0x45, 0x59, 0x5f, 0x53, - 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x52, 0x4f, 0x54, 0x41, 0x54, 0x45, 0x44, 0x10, 0x02, 0x2a, - 0x94, 0x01, 0x0a, 0x07, 0x4b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x14, 0x4b, - 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, - 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, - 0x45, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x5f, 0x52, 0x4f, 0x4f, 0x54, 0x5f, 0x4b, 0x45, - 0x59, 0x10, 0x01, 0x12, 0x1e, 0x0a, 0x1a, 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, - 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x52, 0x5f, 0x52, 0x4f, 0x4f, 0x54, 0x5f, 0x4b, 0x45, - 0x59, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, - 0x52, 0x45, 0x4d, 0x4f, 0x54, 0x45, 0x10, 0x03, 0x12, 0x1c, 0x0a, 0x18, 0x4b, 0x45, 0x59, 0x5f, - 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, - 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x04, 0x42, 0x82, 0x01, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x42, 0x0c, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x64, 0x66, 0x2f, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, - 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x67, 0x6f, 0x2f, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0xa2, 0x02, 0x03, 0x50, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x50, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0xca, 0x02, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0xe2, 0x02, 0x12, - 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x5f, 0x50, 0x33, 0x38, 0x34, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x4c, 0x47, 0x4f, 0x52, + 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x50, 0x35, 0x32, 0x31, 0x10, 0x05, 0x2a, 0x56, + 0x0a, 0x09, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x16, 0x4b, + 0x45, 0x59, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, + 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x4b, 0x45, 0x59, 0x5f, 0x53, + 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x16, + 0x0a, 0x12, 0x4b, 0x45, 0x59, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x52, 0x4f, 0x54, + 0x41, 0x54, 0x45, 0x44, 0x10, 0x02, 0x2a, 0x94, 0x01, 0x0a, 0x07, 0x4b, 0x65, 0x79, 0x4d, 0x6f, + 0x64, 0x65, 0x12, 0x18, 0x0a, 0x14, 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x55, + 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, + 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x5f, + 0x52, 0x4f, 0x4f, 0x54, 0x5f, 0x4b, 0x45, 0x59, 0x10, 0x01, 0x12, 0x1e, 0x0a, 0x1a, 0x4b, 0x45, + 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x52, 0x5f, + 0x52, 0x4f, 0x4f, 0x54, 0x5f, 0x4b, 0x45, 0x59, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x4b, 0x45, + 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x54, 0x45, 0x10, 0x03, 0x12, + 0x1c, 0x0a, 0x18, 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x50, 0x55, 0x42, 0x4c, + 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x04, 0x42, 0x82, 0x01, + 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x42, 0x0c, 0x4f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x64, 0x66, + 0x2f, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, + 0x6f, 0x6c, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0xa2, 0x02, 0x03, 0x50, + 0x58, 0x58, 0xaa, 0x02, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0xca, 0x02, 0x06, 0x50, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0xe2, 0x02, 0x12, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x50, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3636,31 +3647,32 @@ var file_policy_objects_proto_depIdxs = []int32{ 32, // 55: policy.Obligation.values:type_name -> policy.ObligationValue 40, // 56: policy.Obligation.metadata:type_name -> common.Metadata 31, // 57: policy.ObligationValue.obligation:type_name -> policy.Obligation - 40, // 58: policy.ObligationValue.metadata:type_name -> common.Metadata - 32, // 59: policy.ObligationTrigger.obligation_value:type_name -> policy.ObligationValue - 15, // 60: policy.ObligationTrigger.action:type_name -> policy.Action - 14, // 61: policy.ObligationTrigger.attribute_value:type_name -> policy.Value - 40, // 62: policy.ObligationTrigger.metadata:type_name -> common.Metadata - 37, // 63: policy.KasKey.key:type_name -> policy.AsymmetricKey - 5, // 64: policy.AsymmetricKey.key_algorithm:type_name -> policy.Algorithm - 6, // 65: policy.AsymmetricKey.key_status:type_name -> policy.KeyStatus - 7, // 66: policy.AsymmetricKey.key_mode:type_name -> policy.KeyMode - 35, // 67: policy.AsymmetricKey.public_key_ctx:type_name -> policy.PublicKeyCtx - 36, // 68: policy.AsymmetricKey.private_key_ctx:type_name -> policy.PrivateKeyCtx - 11, // 69: policy.AsymmetricKey.provider_config:type_name -> policy.KeyProviderConfig - 40, // 70: policy.AsymmetricKey.metadata:type_name -> common.Metadata - 6, // 71: policy.SymmetricKey.key_status:type_name -> policy.KeyStatus - 7, // 72: policy.SymmetricKey.key_mode:type_name -> policy.KeyMode - 11, // 73: policy.SymmetricKey.provider_config:type_name -> policy.KeyProviderConfig - 40, // 74: policy.SymmetricKey.metadata:type_name -> common.Metadata - 15, // 75: policy.RegisteredResourceValue.ActionAttributeValue.action:type_name -> policy.Action - 14, // 76: policy.RegisteredResourceValue.ActionAttributeValue.attribute_value:type_name -> policy.Value - 40, // 77: policy.RegisteredResourceValue.ActionAttributeValue.metadata:type_name -> common.Metadata - 78, // [78:78] is the sub-list for method output_type - 78, // [78:78] is the sub-list for method input_type - 78, // [78:78] is the sub-list for extension type_name - 78, // [78:78] is the sub-list for extension extendee - 0, // [0:78] is the sub-list for field type_name + 33, // 58: policy.ObligationValue.triggers:type_name -> policy.ObligationTrigger + 40, // 59: policy.ObligationValue.metadata:type_name -> common.Metadata + 32, // 60: policy.ObligationTrigger.obligation_value:type_name -> policy.ObligationValue + 15, // 61: policy.ObligationTrigger.action:type_name -> policy.Action + 14, // 62: policy.ObligationTrigger.attribute_value:type_name -> policy.Value + 40, // 63: policy.ObligationTrigger.metadata:type_name -> common.Metadata + 37, // 64: policy.KasKey.key:type_name -> policy.AsymmetricKey + 5, // 65: policy.AsymmetricKey.key_algorithm:type_name -> policy.Algorithm + 6, // 66: policy.AsymmetricKey.key_status:type_name -> policy.KeyStatus + 7, // 67: policy.AsymmetricKey.key_mode:type_name -> policy.KeyMode + 35, // 68: policy.AsymmetricKey.public_key_ctx:type_name -> policy.PublicKeyCtx + 36, // 69: policy.AsymmetricKey.private_key_ctx:type_name -> policy.PrivateKeyCtx + 11, // 70: policy.AsymmetricKey.provider_config:type_name -> policy.KeyProviderConfig + 40, // 71: policy.AsymmetricKey.metadata:type_name -> common.Metadata + 6, // 72: policy.SymmetricKey.key_status:type_name -> policy.KeyStatus + 7, // 73: policy.SymmetricKey.key_mode:type_name -> policy.KeyMode + 11, // 74: policy.SymmetricKey.provider_config:type_name -> policy.KeyProviderConfig + 40, // 75: policy.SymmetricKey.metadata:type_name -> common.Metadata + 15, // 76: policy.RegisteredResourceValue.ActionAttributeValue.action:type_name -> policy.Action + 14, // 77: policy.RegisteredResourceValue.ActionAttributeValue.attribute_value:type_name -> policy.Value + 40, // 78: policy.RegisteredResourceValue.ActionAttributeValue.metadata:type_name -> common.Metadata + 79, // [79:79] is the sub-list for method output_type + 79, // [79:79] is the sub-list for method input_type + 79, // [79:79] is the sub-list for extension type_name + 79, // [79:79] is the sub-list for extension extendee + 0, // [0:79] is the sub-list for field type_name } func init() { file_policy_objects_proto_init() } From 7ee21093d049dcdb0d8addc68ca3ec3f7435f398 Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 3 Sep 2025 12:22:24 -0400 Subject: [PATCH 122/137] remove obl val from trigger proto --- service/policy/objects.proto | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/service/policy/objects.proto b/service/policy/objects.proto index 406ad8462c..ff815189ad 100644 --- a/service/policy/objects.proto +++ b/service/policy/objects.proto @@ -487,11 +487,9 @@ message ObligationValue { message ObligationTrigger { string id = 1; - ObligationValue obligation_value = 2; + Action action = 2; - Action action = 3; - - Value attribute_value = 4; + Value attribute_value = 3; common.Metadata metadata = 100; } From dacff5588770dec714d9e2424766fa19a98b350f Mon Sep 17 00:00:00 2001 From: Krish Suchak Date: Wed, 3 Sep 2025 12:30:53 -0400 Subject: [PATCH 123/137] make proto-generate --- docs/grpc/index.html | 7 - docs/openapi/policy/objects.openapi.yaml | 3 - .../obligations/obligations.openapi.yaml | 3 - protocol/go/policy/objects.pb.go | 383 +++++++++--------- 4 files changed, 185 insertions(+), 211 deletions(-) diff --git a/docs/grpc/index.html b/docs/grpc/index.html index 620eb2fa4f..ed8230e74e 100644 --- a/docs/grpc/index.html +++ b/docs/grpc/index.html @@ -2928,13 +2928,6 @@

ObligationTrigger

- - obligation_value - ObligationValue - -

- - action Action diff --git a/docs/openapi/policy/objects.openapi.yaml b/docs/openapi/policy/objects.openapi.yaml index e0ddbb6673..a89b0b8856 100644 --- a/docs/openapi/policy/objects.openapi.yaml +++ b/docs/openapi/policy/objects.openapi.yaml @@ -609,9 +609,6 @@ components: id: type: string title: id - obligationValue: - title: obligation_value - $ref: '#/components/schemas/policy.ObligationValue' action: title: action $ref: '#/components/schemas/policy.Action' diff --git a/docs/openapi/policy/obligations/obligations.openapi.yaml b/docs/openapi/policy/obligations/obligations.openapi.yaml index e0bb358663..f5d0f7fee7 100644 --- a/docs/openapi/policy/obligations/obligations.openapi.yaml +++ b/docs/openapi/policy/obligations/obligations.openapi.yaml @@ -973,9 +973,6 @@ components: id: type: string title: id - obligationValue: - title: obligation_value - $ref: '#/components/schemas/policy.ObligationValue' action: title: action $ref: '#/components/schemas/policy.Action' diff --git a/protocol/go/policy/objects.pb.go b/protocol/go/policy/objects.pb.go index 309c802ef0..848c7068a1 100644 --- a/protocol/go/policy/objects.pb.go +++ b/protocol/go/policy/objects.pb.go @@ -2446,11 +2446,10 @@ type ObligationTrigger struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - ObligationValue *ObligationValue `protobuf:"bytes,2,opt,name=obligation_value,json=obligationValue,proto3" json:"obligation_value,omitempty"` - Action *Action `protobuf:"bytes,3,opt,name=action,proto3" json:"action,omitempty"` - AttributeValue *Value `protobuf:"bytes,4,opt,name=attribute_value,json=attributeValue,proto3" json:"attribute_value,omitempty"` - Metadata *common.Metadata `protobuf:"bytes,100,opt,name=metadata,proto3" json:"metadata,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Action *Action `protobuf:"bytes,2,opt,name=action,proto3" json:"action,omitempty"` + AttributeValue *Value `protobuf:"bytes,3,opt,name=attribute_value,json=attributeValue,proto3" json:"attribute_value,omitempty"` + Metadata *common.Metadata `protobuf:"bytes,100,opt,name=metadata,proto3" json:"metadata,omitempty"` } func (x *ObligationTrigger) Reset() { @@ -2492,13 +2491,6 @@ func (x *ObligationTrigger) GetId() string { return "" } -func (x *ObligationTrigger) GetObligationValue() *ObligationValue { - if x != nil { - return x.ObligationValue - } - return nil -} - func (x *ObligationTrigger) GetAction() *Action { if x != nil { return x.Action @@ -3361,173 +3353,169 @@ var file_policy_objects_proto_rawDesc = []byte{ 0x67, 0x67, 0x65, 0x72, 0x73, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x22, 0xf5, 0x01, 0x0a, 0x11, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x61, 0x74, 0x61, 0x22, 0xb1, 0x01, 0x0a, 0x11, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x42, 0x0a, 0x10, 0x6f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, 0x6f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x26, 0x0a, - 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, - 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x0f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, - 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0e, 0x61, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x26, 0x0a, 0x06, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x36, 0x0a, 0x0f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0e, 0x61, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x61, 0x0a, 0x06, 0x4b, 0x61, 0x73, 0x4b, 0x65, + 0x79, 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x61, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x6b, 0x61, 0x73, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, + 0x73, 0x79, 0x6d, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x17, 0x0a, 0x07, 0x6b, 0x61, 0x73, 0x5f, 0x75, 0x72, 0x69, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x6b, 0x61, 0x73, 0x55, 0x72, 0x69, 0x22, 0x29, 0x0a, 0x0c, 0x50, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x19, 0x0a, 0x03, 0x70, 0x65, + 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, + 0x52, 0x03, 0x70, 0x65, 0x6d, 0x22, 0x50, 0x0a, 0x0d, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, + 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x1e, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, + 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, + 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x72, 0x61, + 0x70, 0x70, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x22, 0xd1, 0x03, 0x0a, 0x0d, 0x41, 0x73, 0x79, 0x6d, + 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x65, 0x79, + 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, + 0x12, 0x36, 0x0a, 0x0d, 0x6b, 0x65, 0x79, 0x5f, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, + 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x2e, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x52, 0x0c, 0x6b, 0x65, 0x79, 0x41, + 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x30, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x09, 0x6b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, 0x0a, 0x08, 0x6b, 0x65, + 0x79, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x07, 0x6b, + 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x3a, 0x0a, 0x0e, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x63, 0x74, 0x78, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, + 0x79, 0x43, 0x74, 0x78, 0x52, 0x0c, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x43, + 0x74, 0x78, 0x12, 0x3d, 0x0a, 0x0f, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, + 0x79, 0x5f, 0x63, 0x74, 0x78, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x43, + 0x74, 0x78, 0x52, 0x0d, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x43, 0x74, + 0x78, 0x12, 0x42, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x18, + 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x61, 0x0a, 0x06, 0x4b, - 0x61, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x61, 0x73, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6b, 0x61, 0x73, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x2e, 0x41, 0x73, 0x79, 0x6d, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x6b, 0x61, 0x73, 0x5f, 0x75, 0x72, 0x69, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6b, 0x61, 0x73, 0x55, 0x72, 0x69, 0x22, 0x29, - 0x0a, 0x0c, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x19, - 0x0a, 0x03, 0x70, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, - 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x70, 0x65, 0x6d, 0x22, 0x50, 0x0a, 0x0d, 0x50, 0x72, 0x69, - 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x1e, 0x0a, 0x06, 0x6b, 0x65, - 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, - 0x02, 0x10, 0x01, 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x72, - 0x61, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0a, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x22, 0xd1, 0x03, 0x0a, 0x0d, - 0x41, 0x73, 0x79, 0x6d, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x15, 0x0a, - 0x06, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6b, - 0x65, 0x79, 0x49, 0x64, 0x12, 0x36, 0x0a, 0x0d, 0x6b, 0x65, 0x79, 0x5f, 0x61, 0x6c, 0x67, 0x6f, - 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x52, 0x0c, - 0x6b, 0x65, 0x79, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x30, 0x0a, 0x0a, - 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x11, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x52, 0x09, 0x6b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, - 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x0f, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x4d, 0x6f, 0x64, - 0x65, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x3a, 0x0a, 0x0e, 0x70, 0x75, - 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x63, 0x74, 0x78, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x52, 0x0c, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, - 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x3d, 0x0a, 0x0f, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, - 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x63, 0x74, 0x78, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x15, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, - 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x52, 0x0d, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, - 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x42, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, - 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, - 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, - 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x76, 0x69, - 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x67, - 0x61, 0x63, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x6c, 0x65, 0x67, 0x61, 0x63, - 0x79, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, - 0x9e, 0x02, 0x0a, 0x0c, 0x53, 0x79, 0x6d, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, - 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, - 0x6b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, 0x0a, 0x08, 0x6b, 0x65, 0x79, - 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x07, 0x6b, 0x65, - 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x6b, 0x65, 0x79, 0x5f, 0x63, 0x74, 0x78, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x42, - 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x2e, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x2a, 0xb3, 0x01, 0x0a, 0x15, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x75, - 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x28, 0x0a, 0x24, 0x41, 0x54, + 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x9e, 0x02, 0x0a, 0x0c, + 0x53, 0x79, 0x6d, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x15, 0x0a, 0x06, + 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6b, 0x65, + 0x79, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x6b, 0x65, 0x79, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, 0x6d, 0x6f, 0x64, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x2e, 0x4b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x4d, 0x6f, 0x64, + 0x65, 0x12, 0x17, 0x0a, 0x07, 0x6b, 0x65, 0x79, 0x5f, 0x63, 0x74, 0x78, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x06, 0x6b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x42, 0x0a, 0x0f, 0x70, 0x72, + 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, + 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0e, + 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2c, + 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2a, 0xb3, 0x01, 0x0a, + 0x15, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x75, 0x6c, 0x65, 0x54, 0x79, + 0x70, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x28, 0x0a, 0x24, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, + 0x55, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, + 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x23, 0x0a, 0x1f, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, 0x5f, 0x52, 0x55, + 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, 0x4c, 0x4c, + 0x5f, 0x4f, 0x46, 0x10, 0x01, 0x12, 0x23, 0x0a, 0x1f, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, 0x55, + 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, + 0x4d, 0x5f, 0x41, 0x4e, 0x59, 0x5f, 0x4f, 0x46, 0x10, 0x02, 0x12, 0x26, 0x0a, 0x22, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x23, 0x0a, 0x1f, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, - 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, - 0x5f, 0x41, 0x4c, 0x4c, 0x5f, 0x4f, 0x46, 0x10, 0x01, 0x12, 0x23, 0x0a, 0x1f, 0x41, 0x54, 0x54, - 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, - 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, 0x4e, 0x59, 0x5f, 0x4f, 0x46, 0x10, 0x02, 0x12, 0x26, - 0x0a, 0x22, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, - 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x48, 0x49, 0x45, 0x52, 0x41, - 0x52, 0x43, 0x48, 0x59, 0x10, 0x03, 0x2a, 0xca, 0x01, 0x0a, 0x1a, 0x53, 0x75, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, - 0x72, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x2d, 0x0a, 0x29, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, - 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, - 0x52, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x24, 0x0a, 0x20, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, - 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, - 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x49, 0x4e, 0x10, 0x01, 0x12, 0x28, 0x0a, 0x24, 0x53, 0x55, - 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, - 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, - 0x49, 0x4e, 0x10, 0x02, 0x12, 0x2d, 0x0a, 0x29, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, - 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, - 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x49, 0x4e, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, - 0x53, 0x10, 0x03, 0x2a, 0x90, 0x01, 0x0a, 0x18, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, - 0x6e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x45, 0x6e, 0x75, 0x6d, - 0x12, 0x2b, 0x0a, 0x27, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x4f, - 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, - 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x23, 0x0a, - 0x1f, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x45, - 0x41, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, 0x4e, 0x44, - 0x10, 0x01, 0x12, 0x22, 0x0a, 0x1e, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, - 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, - 0x4d, 0x5f, 0x4f, 0x52, 0x10, 0x02, 0x2a, 0x5d, 0x0a, 0x0a, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, - 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, - 0x00, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, - 0x5f, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x53, - 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x52, - 0x4e, 0x41, 0x4c, 0x10, 0x02, 0x2a, 0x88, 0x02, 0x0a, 0x13, 0x4b, 0x61, 0x73, 0x50, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x41, 0x6c, 0x67, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x27, 0x0a, - 0x23, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, - 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, - 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x24, 0x0a, 0x20, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, - 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, - 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x32, 0x30, 0x34, 0x38, 0x10, 0x01, 0x12, 0x24, 0x0a, 0x20, - 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, - 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x34, 0x30, 0x39, 0x36, - 0x10, 0x02, 0x12, 0x28, 0x0a, 0x24, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, + 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x48, 0x49, 0x45, 0x52, 0x41, 0x52, 0x43, 0x48, 0x59, + 0x10, 0x03, 0x2a, 0xca, 0x01, 0x0a, 0x1a, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, + 0x70, 0x70, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x45, 0x6e, 0x75, + 0x6d, 0x12, 0x2d, 0x0a, 0x29, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, + 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, + 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x24, 0x0a, 0x20, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, + 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x55, + 0x4d, 0x5f, 0x49, 0x4e, 0x10, 0x01, 0x12, 0x28, 0x0a, 0x24, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, + 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, + 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x49, 0x4e, 0x10, 0x02, + 0x12, 0x2d, 0x0a, 0x29, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, + 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x55, + 0x4d, 0x5f, 0x49, 0x4e, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x53, 0x10, 0x03, 0x2a, + 0x90, 0x01, 0x0a, 0x18, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x6f, 0x6f, + 0x6c, 0x65, 0x61, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x27, + 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, + 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x23, 0x0a, 0x1f, 0x43, 0x4f, 0x4e, + 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x22, + 0x0a, 0x1e, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, + 0x45, 0x41, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x4f, 0x52, + 0x10, 0x02, 0x2a, 0x5d, 0x0a, 0x0a, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x18, 0x0a, + 0x14, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, + 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x4f, 0x55, 0x52, 0x43, + 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, + 0x02, 0x2a, 0x88, 0x02, 0x0a, 0x13, 0x4b, 0x61, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, + 0x65, 0x79, 0x41, 0x6c, 0x67, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x27, 0x0a, 0x23, 0x4b, 0x41, 0x53, + 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, + 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, + 0x10, 0x00, 0x12, 0x24, 0x0a, 0x20, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, + 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x52, 0x53, + 0x41, 0x5f, 0x32, 0x30, 0x34, 0x38, 0x10, 0x01, 0x12, 0x24, 0x0a, 0x20, 0x4b, 0x41, 0x53, 0x5f, + 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, + 0x4e, 0x55, 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x34, 0x30, 0x39, 0x36, 0x10, 0x02, 0x12, 0x28, + 0x0a, 0x24, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, + 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x53, 0x45, 0x43, + 0x50, 0x32, 0x35, 0x36, 0x52, 0x31, 0x10, 0x05, 0x12, 0x28, 0x0a, 0x24, 0x4b, 0x41, 0x53, 0x5f, + 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, + 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x53, 0x45, 0x43, 0x50, 0x33, 0x38, 0x34, 0x52, 0x31, + 0x10, 0x06, 0x12, 0x28, 0x0a, 0x24, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x43, - 0x5f, 0x53, 0x45, 0x43, 0x50, 0x32, 0x35, 0x36, 0x52, 0x31, 0x10, 0x05, 0x12, 0x28, 0x0a, 0x24, - 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, - 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x53, 0x45, 0x43, 0x50, 0x33, - 0x38, 0x34, 0x52, 0x31, 0x10, 0x06, 0x12, 0x28, 0x0a, 0x24, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, - 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, - 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x53, 0x45, 0x43, 0x50, 0x35, 0x32, 0x31, 0x52, 0x31, 0x10, 0x07, - 0x2a, 0x9b, 0x01, 0x0a, 0x09, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x19, - 0x0a, 0x15, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, - 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x4c, 0x47, - 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x32, 0x30, 0x34, 0x38, 0x10, - 0x01, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x52, - 0x53, 0x41, 0x5f, 0x34, 0x30, 0x39, 0x36, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x4c, 0x47, - 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x50, 0x32, 0x35, 0x36, 0x10, 0x03, - 0x12, 0x15, 0x0a, 0x11, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x45, 0x43, - 0x5f, 0x50, 0x33, 0x38, 0x34, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x4c, 0x47, 0x4f, 0x52, - 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x50, 0x35, 0x32, 0x31, 0x10, 0x05, 0x2a, 0x56, - 0x0a, 0x09, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x16, 0x4b, - 0x45, 0x59, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, - 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x4b, 0x45, 0x59, 0x5f, 0x53, - 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x16, - 0x0a, 0x12, 0x4b, 0x45, 0x59, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x52, 0x4f, 0x54, - 0x41, 0x54, 0x45, 0x44, 0x10, 0x02, 0x2a, 0x94, 0x01, 0x0a, 0x07, 0x4b, 0x65, 0x79, 0x4d, 0x6f, - 0x64, 0x65, 0x12, 0x18, 0x0a, 0x14, 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x55, - 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, - 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x5f, - 0x52, 0x4f, 0x4f, 0x54, 0x5f, 0x4b, 0x45, 0x59, 0x10, 0x01, 0x12, 0x1e, 0x0a, 0x1a, 0x4b, 0x45, - 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x52, 0x5f, - 0x52, 0x4f, 0x4f, 0x54, 0x5f, 0x4b, 0x45, 0x59, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x4b, 0x45, - 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x54, 0x45, 0x10, 0x03, 0x12, - 0x1c, 0x0a, 0x18, 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x50, 0x55, 0x42, 0x4c, - 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x04, 0x42, 0x82, 0x01, - 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x42, 0x0c, 0x4f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x64, 0x66, - 0x2f, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, - 0x6f, 0x6c, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0xa2, 0x02, 0x03, 0x50, - 0x58, 0x58, 0xaa, 0x02, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0xca, 0x02, 0x06, 0x50, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0xe2, 0x02, 0x12, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x47, 0x50, - 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x50, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x5f, 0x53, 0x45, 0x43, 0x50, 0x35, 0x32, 0x31, 0x52, 0x31, 0x10, 0x07, 0x2a, 0x9b, 0x01, 0x0a, + 0x09, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x4c, + 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, + 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, + 0x48, 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x32, 0x30, 0x34, 0x38, 0x10, 0x01, 0x12, 0x16, 0x0a, + 0x12, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x34, + 0x30, 0x39, 0x36, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, + 0x48, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x50, 0x32, 0x35, 0x36, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, + 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x50, 0x33, 0x38, + 0x34, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, + 0x5f, 0x45, 0x43, 0x5f, 0x50, 0x35, 0x32, 0x31, 0x10, 0x05, 0x2a, 0x56, 0x0a, 0x09, 0x4b, 0x65, + 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x16, 0x4b, 0x45, 0x59, 0x5f, 0x53, + 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x4b, 0x45, 0x59, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, + 0x53, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4b, 0x45, + 0x59, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x52, 0x4f, 0x54, 0x41, 0x54, 0x45, 0x44, + 0x10, 0x02, 0x2a, 0x94, 0x01, 0x0a, 0x07, 0x4b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x18, + 0x0a, 0x14, 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, + 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, 0x4b, 0x45, 0x59, 0x5f, + 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x5f, 0x52, 0x4f, 0x4f, 0x54, + 0x5f, 0x4b, 0x45, 0x59, 0x10, 0x01, 0x12, 0x1e, 0x0a, 0x1a, 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, + 0x44, 0x45, 0x5f, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x52, 0x5f, 0x52, 0x4f, 0x4f, 0x54, + 0x5f, 0x4b, 0x45, 0x59, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, + 0x44, 0x45, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x54, 0x45, 0x10, 0x03, 0x12, 0x1c, 0x0a, 0x18, 0x4b, + 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, + 0x45, 0x59, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x04, 0x42, 0x82, 0x01, 0x0a, 0x0a, 0x63, 0x6f, + 0x6d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x42, 0x0c, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x64, 0x66, 0x2f, 0x70, 0x6c, 0x61, + 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x67, + 0x6f, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0xa2, 0x02, 0x03, 0x50, 0x58, 0x58, 0xaa, 0x02, + 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0xca, 0x02, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0xe2, 0x02, 0x12, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3649,30 +3637,29 @@ var file_policy_objects_proto_depIdxs = []int32{ 31, // 57: policy.ObligationValue.obligation:type_name -> policy.Obligation 33, // 58: policy.ObligationValue.triggers:type_name -> policy.ObligationTrigger 40, // 59: policy.ObligationValue.metadata:type_name -> common.Metadata - 32, // 60: policy.ObligationTrigger.obligation_value:type_name -> policy.ObligationValue - 15, // 61: policy.ObligationTrigger.action:type_name -> policy.Action - 14, // 62: policy.ObligationTrigger.attribute_value:type_name -> policy.Value - 40, // 63: policy.ObligationTrigger.metadata:type_name -> common.Metadata - 37, // 64: policy.KasKey.key:type_name -> policy.AsymmetricKey - 5, // 65: policy.AsymmetricKey.key_algorithm:type_name -> policy.Algorithm - 6, // 66: policy.AsymmetricKey.key_status:type_name -> policy.KeyStatus - 7, // 67: policy.AsymmetricKey.key_mode:type_name -> policy.KeyMode - 35, // 68: policy.AsymmetricKey.public_key_ctx:type_name -> policy.PublicKeyCtx - 36, // 69: policy.AsymmetricKey.private_key_ctx:type_name -> policy.PrivateKeyCtx - 11, // 70: policy.AsymmetricKey.provider_config:type_name -> policy.KeyProviderConfig - 40, // 71: policy.AsymmetricKey.metadata:type_name -> common.Metadata - 6, // 72: policy.SymmetricKey.key_status:type_name -> policy.KeyStatus - 7, // 73: policy.SymmetricKey.key_mode:type_name -> policy.KeyMode - 11, // 74: policy.SymmetricKey.provider_config:type_name -> policy.KeyProviderConfig - 40, // 75: policy.SymmetricKey.metadata:type_name -> common.Metadata - 15, // 76: policy.RegisteredResourceValue.ActionAttributeValue.action:type_name -> policy.Action - 14, // 77: policy.RegisteredResourceValue.ActionAttributeValue.attribute_value:type_name -> policy.Value - 40, // 78: policy.RegisteredResourceValue.ActionAttributeValue.metadata:type_name -> common.Metadata - 79, // [79:79] is the sub-list for method output_type - 79, // [79:79] is the sub-list for method input_type - 79, // [79:79] is the sub-list for extension type_name - 79, // [79:79] is the sub-list for extension extendee - 0, // [0:79] is the sub-list for field type_name + 15, // 60: policy.ObligationTrigger.action:type_name -> policy.Action + 14, // 61: policy.ObligationTrigger.attribute_value:type_name -> policy.Value + 40, // 62: policy.ObligationTrigger.metadata:type_name -> common.Metadata + 37, // 63: policy.KasKey.key:type_name -> policy.AsymmetricKey + 5, // 64: policy.AsymmetricKey.key_algorithm:type_name -> policy.Algorithm + 6, // 65: policy.AsymmetricKey.key_status:type_name -> policy.KeyStatus + 7, // 66: policy.AsymmetricKey.key_mode:type_name -> policy.KeyMode + 35, // 67: policy.AsymmetricKey.public_key_ctx:type_name -> policy.PublicKeyCtx + 36, // 68: policy.AsymmetricKey.private_key_ctx:type_name -> policy.PrivateKeyCtx + 11, // 69: policy.AsymmetricKey.provider_config:type_name -> policy.KeyProviderConfig + 40, // 70: policy.AsymmetricKey.metadata:type_name -> common.Metadata + 6, // 71: policy.SymmetricKey.key_status:type_name -> policy.KeyStatus + 7, // 72: policy.SymmetricKey.key_mode:type_name -> policy.KeyMode + 11, // 73: policy.SymmetricKey.provider_config:type_name -> policy.KeyProviderConfig + 40, // 74: policy.SymmetricKey.metadata:type_name -> common.Metadata + 15, // 75: policy.RegisteredResourceValue.ActionAttributeValue.action:type_name -> policy.Action + 14, // 76: policy.RegisteredResourceValue.ActionAttributeValue.attribute_value:type_name -> policy.Value + 40, // 77: policy.RegisteredResourceValue.ActionAttributeValue.metadata:type_name -> common.Metadata + 78, // [78:78] is the sub-list for method output_type + 78, // [78:78] is the sub-list for method input_type + 78, // [78:78] is the sub-list for extension type_name + 78, // [78:78] is the sub-list for extension extendee + 0, // [0:78] is the sub-list for field type_name } func init() { file_policy_objects_proto_init() } From fd36cfb7a1ce922313684e11ba41a0c9480d1937 Mon Sep 17 00:00:00 2001 From: Chris Reed Date: Wed, 3 Sep 2025 14:43:11 -0500 Subject: [PATCH 124/137] add obligation value back --- docs/grpc/index.html | 7 + docs/openapi/policy/objects.openapi.yaml | 3 + .../obligations/obligations.openapi.yaml | 3 + protocol/go/policy/objects.pb.go | 383 +++++++++--------- service/policy/objects.proto | 6 +- 5 files changed, 215 insertions(+), 187 deletions(-) diff --git a/docs/grpc/index.html b/docs/grpc/index.html index ed8230e74e..620eb2fa4f 100644 --- a/docs/grpc/index.html +++ b/docs/grpc/index.html @@ -2928,6 +2928,13 @@

ObligationTrigger

+ + obligation_value + ObligationValue + +

+ + action Action diff --git a/docs/openapi/policy/objects.openapi.yaml b/docs/openapi/policy/objects.openapi.yaml index a89b0b8856..e0ddbb6673 100644 --- a/docs/openapi/policy/objects.openapi.yaml +++ b/docs/openapi/policy/objects.openapi.yaml @@ -609,6 +609,9 @@ components: id: type: string title: id + obligationValue: + title: obligation_value + $ref: '#/components/schemas/policy.ObligationValue' action: title: action $ref: '#/components/schemas/policy.Action' diff --git a/docs/openapi/policy/obligations/obligations.openapi.yaml b/docs/openapi/policy/obligations/obligations.openapi.yaml index f5d0f7fee7..e0bb358663 100644 --- a/docs/openapi/policy/obligations/obligations.openapi.yaml +++ b/docs/openapi/policy/obligations/obligations.openapi.yaml @@ -973,6 +973,9 @@ components: id: type: string title: id + obligationValue: + title: obligation_value + $ref: '#/components/schemas/policy.ObligationValue' action: title: action $ref: '#/components/schemas/policy.Action' diff --git a/protocol/go/policy/objects.pb.go b/protocol/go/policy/objects.pb.go index 848c7068a1..309c802ef0 100644 --- a/protocol/go/policy/objects.pb.go +++ b/protocol/go/policy/objects.pb.go @@ -2446,10 +2446,11 @@ type ObligationTrigger struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Action *Action `protobuf:"bytes,2,opt,name=action,proto3" json:"action,omitempty"` - AttributeValue *Value `protobuf:"bytes,3,opt,name=attribute_value,json=attributeValue,proto3" json:"attribute_value,omitempty"` - Metadata *common.Metadata `protobuf:"bytes,100,opt,name=metadata,proto3" json:"metadata,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ObligationValue *ObligationValue `protobuf:"bytes,2,opt,name=obligation_value,json=obligationValue,proto3" json:"obligation_value,omitempty"` + Action *Action `protobuf:"bytes,3,opt,name=action,proto3" json:"action,omitempty"` + AttributeValue *Value `protobuf:"bytes,4,opt,name=attribute_value,json=attributeValue,proto3" json:"attribute_value,omitempty"` + Metadata *common.Metadata `protobuf:"bytes,100,opt,name=metadata,proto3" json:"metadata,omitempty"` } func (x *ObligationTrigger) Reset() { @@ -2491,6 +2492,13 @@ func (x *ObligationTrigger) GetId() string { return "" } +func (x *ObligationTrigger) GetObligationValue() *ObligationValue { + if x != nil { + return x.ObligationValue + } + return nil +} + func (x *ObligationTrigger) GetAction() *Action { if x != nil { return x.Action @@ -3353,169 +3361,173 @@ var file_policy_objects_proto_rawDesc = []byte{ 0x67, 0x67, 0x65, 0x72, 0x73, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x22, 0xb1, 0x01, 0x0a, 0x11, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x61, 0x74, 0x61, 0x22, 0xf5, 0x01, 0x0a, 0x11, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x26, 0x0a, 0x06, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x36, 0x0a, 0x0f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0e, 0x61, 0x74, 0x74, 0x72, 0x69, - 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x61, 0x0a, 0x06, 0x4b, 0x61, 0x73, 0x4b, 0x65, - 0x79, 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x61, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x6b, 0x61, 0x73, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, - 0x73, 0x79, 0x6d, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x12, 0x17, 0x0a, 0x07, 0x6b, 0x61, 0x73, 0x5f, 0x75, 0x72, 0x69, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x6b, 0x61, 0x73, 0x55, 0x72, 0x69, 0x22, 0x29, 0x0a, 0x0c, 0x50, 0x75, - 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x19, 0x0a, 0x03, 0x70, 0x65, - 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, - 0x52, 0x03, 0x70, 0x65, 0x6d, 0x22, 0x50, 0x0a, 0x0d, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, - 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x1e, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, - 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, - 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x72, 0x61, - 0x70, 0x70, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x22, 0xd1, 0x03, 0x0a, 0x0d, 0x41, 0x73, 0x79, 0x6d, - 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x65, 0x79, - 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, - 0x12, 0x36, 0x0a, 0x0d, 0x6b, 0x65, 0x79, 0x5f, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, - 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x2e, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x52, 0x0c, 0x6b, 0x65, 0x79, 0x41, - 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x30, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, - 0x09, 0x6b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, 0x0a, 0x08, 0x6b, 0x65, - 0x79, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x07, 0x6b, - 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x3a, 0x0a, 0x0e, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, - 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x63, 0x74, 0x78, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, - 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, - 0x79, 0x43, 0x74, 0x78, 0x52, 0x0c, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x43, - 0x74, 0x78, 0x12, 0x3d, 0x0a, 0x0f, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, - 0x79, 0x5f, 0x63, 0x74, 0x78, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x43, - 0x74, 0x78, 0x52, 0x0d, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x43, 0x74, - 0x78, 0x12, 0x42, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x18, - 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x12, 0x2c, 0x0a, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x42, 0x0a, 0x10, 0x6f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, 0x6f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x26, 0x0a, + 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, + 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x0f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0e, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x9e, 0x02, 0x0a, 0x0c, - 0x53, 0x79, 0x6d, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x15, 0x0a, 0x06, - 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6b, 0x65, - 0x79, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x6b, 0x65, 0x79, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, 0x6d, 0x6f, 0x64, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x2e, 0x4b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x4d, 0x6f, 0x64, - 0x65, 0x12, 0x17, 0x0a, 0x07, 0x6b, 0x65, 0x79, 0x5f, 0x63, 0x74, 0x78, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x06, 0x6b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x42, 0x0a, 0x0f, 0x70, 0x72, - 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, - 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0e, - 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2c, - 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2a, 0xb3, 0x01, 0x0a, - 0x15, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x75, 0x6c, 0x65, 0x54, 0x79, - 0x70, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x28, 0x0a, 0x24, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, - 0x55, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, - 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, - 0x12, 0x23, 0x0a, 0x1f, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, 0x5f, 0x52, 0x55, - 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, 0x4c, 0x4c, - 0x5f, 0x4f, 0x46, 0x10, 0x01, 0x12, 0x23, 0x0a, 0x1f, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, 0x55, - 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, - 0x4d, 0x5f, 0x41, 0x4e, 0x59, 0x5f, 0x4f, 0x46, 0x10, 0x02, 0x12, 0x26, 0x0a, 0x22, 0x41, 0x54, + 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x61, 0x0a, 0x06, 0x4b, + 0x61, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x61, 0x73, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6b, 0x61, 0x73, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x2e, 0x41, 0x73, 0x79, 0x6d, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x6b, 0x61, 0x73, 0x5f, 0x75, 0x72, 0x69, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6b, 0x61, 0x73, 0x55, 0x72, 0x69, 0x22, 0x29, + 0x0a, 0x0c, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x19, + 0x0a, 0x03, 0x70, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, + 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x70, 0x65, 0x6d, 0x22, 0x50, 0x0a, 0x0d, 0x50, 0x72, 0x69, + 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x1e, 0x0a, 0x06, 0x6b, 0x65, + 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, + 0x02, 0x10, 0x01, 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x72, + 0x61, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0a, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x22, 0xd1, 0x03, 0x0a, 0x0d, + 0x41, 0x73, 0x79, 0x6d, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x15, 0x0a, + 0x06, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6b, + 0x65, 0x79, 0x49, 0x64, 0x12, 0x36, 0x0a, 0x0d, 0x6b, 0x65, 0x79, 0x5f, 0x61, 0x6c, 0x67, 0x6f, + 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x52, 0x0c, + 0x6b, 0x65, 0x79, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x30, 0x0a, 0x0a, + 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x11, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x09, 0x6b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, + 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x0f, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x4d, 0x6f, 0x64, + 0x65, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x3a, 0x0a, 0x0e, 0x70, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x63, 0x74, 0x78, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x75, 0x62, 0x6c, + 0x69, 0x63, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x52, 0x0c, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x3d, 0x0a, 0x0f, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, + 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x63, 0x74, 0x78, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x15, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, + 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x52, 0x0d, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, + 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x42, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, + 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x67, + 0x61, 0x63, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x6c, 0x65, 0x67, 0x61, 0x63, + 0x79, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, + 0x9e, 0x02, 0x0a, 0x0c, 0x53, 0x79, 0x6d, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, + 0x6b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, 0x0a, 0x08, 0x6b, 0x65, 0x79, + 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x07, 0x6b, 0x65, + 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x6b, 0x65, 0x79, 0x5f, 0x63, 0x74, 0x78, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x42, + 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x2e, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x2a, 0xb3, 0x01, 0x0a, 0x15, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x75, + 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x28, 0x0a, 0x24, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x48, 0x49, 0x45, 0x52, 0x41, 0x52, 0x43, 0x48, 0x59, - 0x10, 0x03, 0x2a, 0xca, 0x01, 0x0a, 0x1a, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, - 0x70, 0x70, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x45, 0x6e, 0x75, - 0x6d, 0x12, 0x2d, 0x0a, 0x29, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, - 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, - 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, - 0x12, 0x24, 0x0a, 0x20, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, - 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x55, - 0x4d, 0x5f, 0x49, 0x4e, 0x10, 0x01, 0x12, 0x28, 0x0a, 0x24, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, - 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, - 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x49, 0x4e, 0x10, 0x02, - 0x12, 0x2d, 0x0a, 0x29, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, - 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x55, - 0x4d, 0x5f, 0x49, 0x4e, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x53, 0x10, 0x03, 0x2a, - 0x90, 0x01, 0x0a, 0x18, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x6f, 0x6f, - 0x6c, 0x65, 0x61, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x27, - 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, - 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, - 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x23, 0x0a, 0x1f, 0x43, 0x4f, 0x4e, - 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x5f, 0x54, - 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x22, - 0x0a, 0x1e, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, - 0x45, 0x41, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x4f, 0x52, - 0x10, 0x02, 0x2a, 0x5d, 0x0a, 0x0a, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, - 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x18, 0x0a, - 0x14, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, - 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x4f, 0x55, 0x52, 0x43, - 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, - 0x02, 0x2a, 0x88, 0x02, 0x0a, 0x13, 0x4b, 0x61, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, - 0x65, 0x79, 0x41, 0x6c, 0x67, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x27, 0x0a, 0x23, 0x4b, 0x41, 0x53, - 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, - 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, - 0x10, 0x00, 0x12, 0x24, 0x0a, 0x20, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, - 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x52, 0x53, - 0x41, 0x5f, 0x32, 0x30, 0x34, 0x38, 0x10, 0x01, 0x12, 0x24, 0x0a, 0x20, 0x4b, 0x41, 0x53, 0x5f, - 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, - 0x4e, 0x55, 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x34, 0x30, 0x39, 0x36, 0x10, 0x02, 0x12, 0x28, - 0x0a, 0x24, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, - 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x53, 0x45, 0x43, - 0x50, 0x32, 0x35, 0x36, 0x52, 0x31, 0x10, 0x05, 0x12, 0x28, 0x0a, 0x24, 0x4b, 0x41, 0x53, 0x5f, - 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, - 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x53, 0x45, 0x43, 0x50, 0x33, 0x38, 0x34, 0x52, 0x31, - 0x10, 0x06, 0x12, 0x28, 0x0a, 0x24, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, + 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x23, 0x0a, 0x1f, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, + 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, + 0x5f, 0x41, 0x4c, 0x4c, 0x5f, 0x4f, 0x46, 0x10, 0x01, 0x12, 0x23, 0x0a, 0x1f, 0x41, 0x54, 0x54, + 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, 0x4e, 0x59, 0x5f, 0x4f, 0x46, 0x10, 0x02, 0x12, 0x26, + 0x0a, 0x22, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x48, 0x49, 0x45, 0x52, 0x41, + 0x52, 0x43, 0x48, 0x59, 0x10, 0x03, 0x2a, 0xca, 0x01, 0x0a, 0x1a, 0x53, 0x75, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, + 0x72, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x2d, 0x0a, 0x29, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, + 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, + 0x52, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x24, 0x0a, 0x20, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, + 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, + 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x49, 0x4e, 0x10, 0x01, 0x12, 0x28, 0x0a, 0x24, 0x53, 0x55, + 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, + 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, + 0x49, 0x4e, 0x10, 0x02, 0x12, 0x2d, 0x0a, 0x29, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, + 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, + 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x49, 0x4e, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, + 0x53, 0x10, 0x03, 0x2a, 0x90, 0x01, 0x0a, 0x18, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x45, 0x6e, 0x75, 0x6d, + 0x12, 0x2b, 0x0a, 0x27, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x4f, + 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, + 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x23, 0x0a, + 0x1f, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x45, + 0x41, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, 0x4e, 0x44, + 0x10, 0x01, 0x12, 0x22, 0x0a, 0x1e, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, + 0x4d, 0x5f, 0x4f, 0x52, 0x10, 0x02, 0x2a, 0x5d, 0x0a, 0x0a, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x53, + 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x52, + 0x4e, 0x41, 0x4c, 0x10, 0x02, 0x2a, 0x88, 0x02, 0x0a, 0x13, 0x4b, 0x61, 0x73, 0x50, 0x75, 0x62, + 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x41, 0x6c, 0x67, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x27, 0x0a, + 0x23, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, + 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, + 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x24, 0x0a, 0x20, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, + 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, + 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x32, 0x30, 0x34, 0x38, 0x10, 0x01, 0x12, 0x24, 0x0a, 0x20, + 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, + 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x34, 0x30, 0x39, 0x36, + 0x10, 0x02, 0x12, 0x28, 0x0a, 0x24, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x43, - 0x5f, 0x53, 0x45, 0x43, 0x50, 0x35, 0x32, 0x31, 0x52, 0x31, 0x10, 0x07, 0x2a, 0x9b, 0x01, 0x0a, - 0x09, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x4c, - 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, - 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, - 0x48, 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x32, 0x30, 0x34, 0x38, 0x10, 0x01, 0x12, 0x16, 0x0a, - 0x12, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x34, - 0x30, 0x39, 0x36, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, - 0x48, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x50, 0x32, 0x35, 0x36, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, - 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x50, 0x33, 0x38, - 0x34, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, - 0x5f, 0x45, 0x43, 0x5f, 0x50, 0x35, 0x32, 0x31, 0x10, 0x05, 0x2a, 0x56, 0x0a, 0x09, 0x4b, 0x65, - 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x16, 0x4b, 0x45, 0x59, 0x5f, 0x53, - 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, - 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x4b, 0x45, 0x59, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, - 0x53, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4b, 0x45, - 0x59, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x52, 0x4f, 0x54, 0x41, 0x54, 0x45, 0x44, - 0x10, 0x02, 0x2a, 0x94, 0x01, 0x0a, 0x07, 0x4b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x18, - 0x0a, 0x14, 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, - 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, 0x4b, 0x45, 0x59, 0x5f, - 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x5f, 0x52, 0x4f, 0x4f, 0x54, - 0x5f, 0x4b, 0x45, 0x59, 0x10, 0x01, 0x12, 0x1e, 0x0a, 0x1a, 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, - 0x44, 0x45, 0x5f, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x52, 0x5f, 0x52, 0x4f, 0x4f, 0x54, - 0x5f, 0x4b, 0x45, 0x59, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, - 0x44, 0x45, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x54, 0x45, 0x10, 0x03, 0x12, 0x1c, 0x0a, 0x18, 0x4b, - 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, - 0x45, 0x59, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x04, 0x42, 0x82, 0x01, 0x0a, 0x0a, 0x63, 0x6f, - 0x6d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x42, 0x0c, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x64, 0x66, 0x2f, 0x70, 0x6c, 0x61, - 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x67, - 0x6f, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0xa2, 0x02, 0x03, 0x50, 0x58, 0x58, 0xaa, 0x02, - 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0xca, 0x02, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0xe2, 0x02, 0x12, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x5f, 0x53, 0x45, 0x43, 0x50, 0x32, 0x35, 0x36, 0x52, 0x31, 0x10, 0x05, 0x12, 0x28, 0x0a, 0x24, + 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, + 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x53, 0x45, 0x43, 0x50, 0x33, + 0x38, 0x34, 0x52, 0x31, 0x10, 0x06, 0x12, 0x28, 0x0a, 0x24, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, + 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, + 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x53, 0x45, 0x43, 0x50, 0x35, 0x32, 0x31, 0x52, 0x31, 0x10, 0x07, + 0x2a, 0x9b, 0x01, 0x0a, 0x09, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x19, + 0x0a, 0x15, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x4c, 0x47, + 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x32, 0x30, 0x34, 0x38, 0x10, + 0x01, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x52, + 0x53, 0x41, 0x5f, 0x34, 0x30, 0x39, 0x36, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x4c, 0x47, + 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x50, 0x32, 0x35, 0x36, 0x10, 0x03, + 0x12, 0x15, 0x0a, 0x11, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x45, 0x43, + 0x5f, 0x50, 0x33, 0x38, 0x34, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x4c, 0x47, 0x4f, 0x52, + 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x50, 0x35, 0x32, 0x31, 0x10, 0x05, 0x2a, 0x56, + 0x0a, 0x09, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x16, 0x4b, + 0x45, 0x59, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, + 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x4b, 0x45, 0x59, 0x5f, 0x53, + 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x16, + 0x0a, 0x12, 0x4b, 0x45, 0x59, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x52, 0x4f, 0x54, + 0x41, 0x54, 0x45, 0x44, 0x10, 0x02, 0x2a, 0x94, 0x01, 0x0a, 0x07, 0x4b, 0x65, 0x79, 0x4d, 0x6f, + 0x64, 0x65, 0x12, 0x18, 0x0a, 0x14, 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x55, + 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, + 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x5f, + 0x52, 0x4f, 0x4f, 0x54, 0x5f, 0x4b, 0x45, 0x59, 0x10, 0x01, 0x12, 0x1e, 0x0a, 0x1a, 0x4b, 0x45, + 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x52, 0x5f, + 0x52, 0x4f, 0x4f, 0x54, 0x5f, 0x4b, 0x45, 0x59, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x4b, 0x45, + 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x54, 0x45, 0x10, 0x03, 0x12, + 0x1c, 0x0a, 0x18, 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x50, 0x55, 0x42, 0x4c, + 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x04, 0x42, 0x82, 0x01, + 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x42, 0x0c, 0x4f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x64, 0x66, + 0x2f, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, + 0x6f, 0x6c, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0xa2, 0x02, 0x03, 0x50, + 0x58, 0x58, 0xaa, 0x02, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0xca, 0x02, 0x06, 0x50, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0xe2, 0x02, 0x12, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x50, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3637,29 +3649,30 @@ var file_policy_objects_proto_depIdxs = []int32{ 31, // 57: policy.ObligationValue.obligation:type_name -> policy.Obligation 33, // 58: policy.ObligationValue.triggers:type_name -> policy.ObligationTrigger 40, // 59: policy.ObligationValue.metadata:type_name -> common.Metadata - 15, // 60: policy.ObligationTrigger.action:type_name -> policy.Action - 14, // 61: policy.ObligationTrigger.attribute_value:type_name -> policy.Value - 40, // 62: policy.ObligationTrigger.metadata:type_name -> common.Metadata - 37, // 63: policy.KasKey.key:type_name -> policy.AsymmetricKey - 5, // 64: policy.AsymmetricKey.key_algorithm:type_name -> policy.Algorithm - 6, // 65: policy.AsymmetricKey.key_status:type_name -> policy.KeyStatus - 7, // 66: policy.AsymmetricKey.key_mode:type_name -> policy.KeyMode - 35, // 67: policy.AsymmetricKey.public_key_ctx:type_name -> policy.PublicKeyCtx - 36, // 68: policy.AsymmetricKey.private_key_ctx:type_name -> policy.PrivateKeyCtx - 11, // 69: policy.AsymmetricKey.provider_config:type_name -> policy.KeyProviderConfig - 40, // 70: policy.AsymmetricKey.metadata:type_name -> common.Metadata - 6, // 71: policy.SymmetricKey.key_status:type_name -> policy.KeyStatus - 7, // 72: policy.SymmetricKey.key_mode:type_name -> policy.KeyMode - 11, // 73: policy.SymmetricKey.provider_config:type_name -> policy.KeyProviderConfig - 40, // 74: policy.SymmetricKey.metadata:type_name -> common.Metadata - 15, // 75: policy.RegisteredResourceValue.ActionAttributeValue.action:type_name -> policy.Action - 14, // 76: policy.RegisteredResourceValue.ActionAttributeValue.attribute_value:type_name -> policy.Value - 40, // 77: policy.RegisteredResourceValue.ActionAttributeValue.metadata:type_name -> common.Metadata - 78, // [78:78] is the sub-list for method output_type - 78, // [78:78] is the sub-list for method input_type - 78, // [78:78] is the sub-list for extension type_name - 78, // [78:78] is the sub-list for extension extendee - 0, // [0:78] is the sub-list for field type_name + 32, // 60: policy.ObligationTrigger.obligation_value:type_name -> policy.ObligationValue + 15, // 61: policy.ObligationTrigger.action:type_name -> policy.Action + 14, // 62: policy.ObligationTrigger.attribute_value:type_name -> policy.Value + 40, // 63: policy.ObligationTrigger.metadata:type_name -> common.Metadata + 37, // 64: policy.KasKey.key:type_name -> policy.AsymmetricKey + 5, // 65: policy.AsymmetricKey.key_algorithm:type_name -> policy.Algorithm + 6, // 66: policy.AsymmetricKey.key_status:type_name -> policy.KeyStatus + 7, // 67: policy.AsymmetricKey.key_mode:type_name -> policy.KeyMode + 35, // 68: policy.AsymmetricKey.public_key_ctx:type_name -> policy.PublicKeyCtx + 36, // 69: policy.AsymmetricKey.private_key_ctx:type_name -> policy.PrivateKeyCtx + 11, // 70: policy.AsymmetricKey.provider_config:type_name -> policy.KeyProviderConfig + 40, // 71: policy.AsymmetricKey.metadata:type_name -> common.Metadata + 6, // 72: policy.SymmetricKey.key_status:type_name -> policy.KeyStatus + 7, // 73: policy.SymmetricKey.key_mode:type_name -> policy.KeyMode + 11, // 74: policy.SymmetricKey.provider_config:type_name -> policy.KeyProviderConfig + 40, // 75: policy.SymmetricKey.metadata:type_name -> common.Metadata + 15, // 76: policy.RegisteredResourceValue.ActionAttributeValue.action:type_name -> policy.Action + 14, // 77: policy.RegisteredResourceValue.ActionAttributeValue.attribute_value:type_name -> policy.Value + 40, // 78: policy.RegisteredResourceValue.ActionAttributeValue.metadata:type_name -> common.Metadata + 79, // [79:79] is the sub-list for method output_type + 79, // [79:79] is the sub-list for method input_type + 79, // [79:79] is the sub-list for extension type_name + 79, // [79:79] is the sub-list for extension extendee + 0, // [0:79] is the sub-list for field type_name } func init() { file_policy_objects_proto_init() } diff --git a/service/policy/objects.proto b/service/policy/objects.proto index ff815189ad..406ad8462c 100644 --- a/service/policy/objects.proto +++ b/service/policy/objects.proto @@ -487,9 +487,11 @@ message ObligationValue { message ObligationTrigger { string id = 1; - Action action = 2; + ObligationValue obligation_value = 2; - Value attribute_value = 3; + Action action = 3; + + Value attribute_value = 4; common.Metadata metadata = 100; } From 51b4f7a118d2d36f6932dd77ba40cc85f8d16b5e Mon Sep 17 00:00:00 2001 From: Chris Reed Date: Wed, 3 Sep 2025 15:07:16 -0500 Subject: [PATCH 125/137] feat(policy): Add obligation triggers. --- docs/grpc/index.html | 4 +- .../obligations/obligations.openapi.yaml | 6 + .../go/policy/obligations/obligations.pb.go | 589 +++++++++--------- .../integration/obligation_triggers_test.go | 217 +++++++ service/logger/audit/constants.go | 2 + service/policy/db/obligations.go | 76 +++ service/policy/db/obligations.sql.go | 58 ++ service/policy/db/queries/obligations.sql | 15 + service/policy/obligations/obligations.go | 60 +- service/policy/obligations/obligations.proto | 11 +- .../policy/obligations/obligations_test.go | 158 +++++ 11 files changed, 893 insertions(+), 303 deletions(-) create mode 100644 service/integration/obligation_triggers_test.go diff --git a/docs/grpc/index.html b/docs/grpc/index.html index 620eb2fa4f..a38e1da618 100644 --- a/docs/grpc/index.html +++ b/docs/grpc/index.html @@ -12210,14 +12210,14 @@

AddObligationTriggerRequ action_id string -

+

Required

attribute_value_id string -

+

Required

diff --git a/docs/openapi/policy/obligations/obligations.openapi.yaml b/docs/openapi/policy/obligations/obligations.openapi.yaml index e0bb358663..3824d79692 100644 --- a/docs/openapi/policy/obligations/obligations.openapi.yaml +++ b/docs/openapi/policy/obligations/obligations.openapi.yaml @@ -1283,13 +1283,18 @@ components: obligationValueId: type: string title: obligation_value_id + format: uuid description: Required actionId: type: string title: action_id + format: uuid + description: Required attributeValueId: type: string title: attribute_value_id + format: uuid + description: Required metadata: title: metadata description: |- @@ -1604,6 +1609,7 @@ components: id: type: string title: id + format: uuid title: RemoveObligationTriggerRequest additionalProperties: false policy.obligations.RemoveObligationTriggerResponse: diff --git a/protocol/go/policy/obligations/obligations.pb.go b/protocol/go/policy/obligations/obligations.pb.go index 2d18bf755d..67c7d7530f 100644 --- a/protocol/go/policy/obligations/obligations.pb.go +++ b/protocol/go/policy/obligations/obligations.pb.go @@ -7,6 +7,7 @@ package obligations import ( + _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" common "github.com/opentdf/platform/protocol/go/common" policy "github.com/opentdf/platform/protocol/go/policy" protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -1425,8 +1426,10 @@ type AddObligationTriggerRequest struct { // Required ObligationValueId string `protobuf:"bytes,1,opt,name=obligation_value_id,json=obligationValueId,proto3" json:"obligation_value_id,omitempty"` - ActionId string `protobuf:"bytes,2,opt,name=action_id,json=actionId,proto3" json:"action_id,omitempty"` - AttributeValueId string `protobuf:"bytes,3,opt,name=attribute_value_id,json=attributeValueId,proto3" json:"attribute_value_id,omitempty"` + // Required + ActionId string `protobuf:"bytes,2,opt,name=action_id,json=actionId,proto3" json:"action_id,omitempty"` + // Required + AttributeValueId string `protobuf:"bytes,3,opt,name=attribute_value_id,json=attributeValueId,proto3" json:"attribute_value_id,omitempty"` // Optional // Common metadata Metadata *common.MetadataMutable `protobuf:"bytes,100,opt,name=metadata,proto3" json:"metadata,omitempty"` @@ -1643,56 +1646,147 @@ var file_policy_obligations_obligations_proto_rawDesc = []byte{ 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2f, 0x73, 0x65, - 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x4a, 0x0a, - 0x14, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x69, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4b, 0x0a, 0x15, 0x47, 0x65, 0x74, - 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, - 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x31, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71, 0x6e, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x04, 0x66, 0x71, 0x6e, 0x73, 0x22, 0xed, 0x01, 0x0a, 0x1c, 0x47, 0x65, - 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, - 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x74, 0x0a, 0x12, 0x66, 0x71, - 0x6e, 0x5f, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x61, 0x70, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, - 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x46, 0x71, 0x6e, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x10, - 0x66, 0x71, 0x6e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x70, - 0x1a, 0x57, 0x0a, 0x15, 0x46, 0x71, 0x6e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x28, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xb8, 0x01, 0x0a, 0x17, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, - 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, - 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x16, 0x0a, 0x14, - 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, 0x18, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xc8, 0x01, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, - 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x62, + 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x4a, 0x0a, 0x14, 0x47, 0x65, + 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4b, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x22, 0x31, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x04, 0x66, 0x71, 0x6e, 0x73, 0x22, 0xed, 0x01, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x4f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x74, 0x0a, 0x12, 0x66, 0x71, 0x6e, 0x5f, 0x6f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x46, 0x71, 0x6e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x10, 0x66, 0x71, 0x6e, + 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x70, 0x1a, 0x57, 0x0a, + 0x15, 0x46, 0x71, 0x6e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, + 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xb8, 0x01, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x16, 0x0a, 0x14, 0x6e, 0x61, 0x6d, + 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, + 0x72, 0x22, 0x4e, 0x0a, 0x18, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, + 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x22, 0xc8, 0x01, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x54, 0x0a, 0x18, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, + 0x6f, 0x72, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x16, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x22, 0x4e, 0x0a, 0x18, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4d, 0x0a, 0x17, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x42, 0x0c, 0x0a, + 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, 0x18, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x8b, 0x01, 0x0a, 0x16, + 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x12, 0x33, 0x0a, 0x0a, + 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x13, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x42, 0x16, 0x0a, 0x14, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x85, 0x01, 0x0a, 0x17, 0x4c, 0x69, + 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, + 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x34, 0x0a, 0x0a, 0x70, + 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x14, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x22, 0x4f, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x03, 0x66, 0x71, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, + 0x65, 0x72, 0x22, 0x4b, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x36, 0x0a, 0x20, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x04, 0x66, 0x71, 0x6e, 0x73, 0x22, 0xe8, 0x01, 0x0a, 0x21, 0x47, 0x65, 0x74, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, + 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6a, 0x0a, + 0x0d, 0x66, 0x71, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, + 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x46, 0x71, 0x6e, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x66, 0x71, + 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x70, 0x1a, 0x57, 0x0a, 0x10, 0x46, 0x71, 0x6e, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, + 0x38, 0x01, 0x22, 0xa8, 0x01, 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, + 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x42, 0x17, 0x0a, 0x15, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, + 0x1d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, + 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xcf, 0x01, + 0x0a, 0x1c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x54, 0x0a, 0x18, 0x6d, 0x65, 0x74, @@ -1701,252 +1795,165 @@ var file_policy_obligations_obligations_proto_rawDesc = []byte{ 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x16, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x22, - 0x4e, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0a, 0x6f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, - 0x4d, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, - 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, - 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, - 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, - 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x8b, - 0x01, 0x0a, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, - 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x12, - 0x33, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x61, 0x67, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x16, 0x0a, 0x14, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, - 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x85, 0x01, 0x0a, - 0x17, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x6f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, - 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x0b, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x34, - 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x61, 0x67, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4f, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4b, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0x36, 0x0a, 0x20, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71, 0x6e, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x66, 0x71, 0x6e, 0x73, 0x22, 0xe8, 0x01, 0x0a, 0x21, 0x47, - 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x6a, 0x0a, 0x0d, 0x66, 0x71, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x6d, 0x61, - 0x70, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, - 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x46, - 0x71, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x0b, 0x66, 0x71, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x70, 0x1a, 0x57, 0x0a, 0x10, - 0x46, 0x71, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xa8, 0x01, 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x17, 0x0a, 0x15, 0x6f, 0x62, 0x6c, 0x69, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, - 0x22, 0x4e, 0x0a, 0x1d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x22, 0xcf, 0x01, 0x0a, 0x1c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, - 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, - 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x54, 0x0a, 0x18, - 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, - 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, + 0x4e, 0x0a, 0x1d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x52, 0x0a, 0x1c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x03, 0x66, 0x71, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, + 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, 0x1d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x22, 0xeb, 0x01, 0x0a, 0x1b, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x13, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x11, 0x6f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x64, 0x12, 0x25, 0x0a, + 0x09, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x08, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x36, 0x0a, 0x12, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x10, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x64, 0x12, 0x33, 0x0a, 0x08, + 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x16, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, - 0x6f, 0x72, 0x22, 0x4e, 0x0a, 0x1d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0x52, 0x0a, 0x1c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, 0x1d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, - 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xcd, 0x01, 0x0a, 0x1b, 0x41, 0x64, 0x64, 0x4f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x13, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x11, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x10, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, - 0x64, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x53, 0x0a, 0x1c, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, - 0x65, 0x72, 0x52, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x22, 0x30, 0x0a, 0x1e, 0x52, - 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, - 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x56, 0x0a, - 0x1f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x33, 0x0a, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x07, 0x74, 0x72, - 0x69, 0x67, 0x67, 0x65, 0x72, 0x32, 0xc6, 0x0c, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x12, 0x6f, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, - 0x02, 0x01, 0x12, 0x69, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, + 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x22, 0x53, 0x0a, 0x1c, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x07, 0x74, + 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x22, 0x3a, 0x0a, 0x1e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, + 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x02, + 0x69, 0x64, 0x22, 0x56, 0x0a, 0x1f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, + 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, + 0x72, 0x52, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x32, 0xc6, 0x0c, 0x0a, 0x07, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6f, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x69, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, + 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, + 0x02, 0x01, 0x12, 0x7e, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x12, 0x2f, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, + 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, + 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, + 0x02, 0x01, 0x12, 0x6f, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, + 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x6f, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x6f, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x78, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2d, 0x2e, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, + 0x8d, 0x01, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x12, 0x34, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x7e, 0x0a, - 0x14, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, - 0x79, 0x46, 0x51, 0x4e, 0x73, 0x12, 0x2f, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, - 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x6f, 0x0a, - 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, - 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6f, - 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x2c, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x6f, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x12, 0x78, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, - 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x8d, 0x01, 0x0a, 0x19, 0x47, - 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x12, 0x34, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, - 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, - 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x7e, 0x0a, 0x15, 0x43, 0x72, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, + 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, + 0x7e, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x12, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x7e, 0x0a, 0x15, 0x55, 0x70, + 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x7e, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x12, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x7e, 0x0a, 0x15, 0x44, 0x65, + 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x7e, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x12, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x7b, 0x0a, 0x14, 0x41, 0x64, + 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x7b, 0x0a, 0x14, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12, 0x2f, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x41, 0x64, 0x64, + 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, - 0x65, 0x72, 0x12, 0x2f, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x84, 0x01, 0x0a, 0x17, 0x52, 0x65, 0x6d, 0x6f, - 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, - 0x67, 0x65, 0x72, 0x12, 0x32, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, - 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0xcf, - 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x10, 0x4f, 0x62, 0x6c, 0x69, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3a, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x64, - 0x66, 0x2f, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x63, 0x6f, 0x6c, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2f, 0x6f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x4f, 0x58, 0xaa, - 0x02, 0x12, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0xca, 0x02, 0x12, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x4f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xe2, 0x02, 0x1e, 0x50, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x5c, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5c, 0x47, - 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x50, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x3a, 0x3a, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x84, 0x01, 0x0a, + 0x17, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12, 0x32, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, + 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, + 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x70, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x42, 0xcf, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x10, + 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, + 0x70, 0x65, 0x6e, 0x74, 0x64, 0x66, 0x2f, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x2f, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xa2, 0x02, + 0x03, 0x50, 0x4f, 0x58, 0xaa, 0x02, 0x12, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xca, 0x02, 0x12, 0x50, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x5c, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xe2, 0x02, + 0x1e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x13, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x3a, 0x3a, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/service/integration/obligation_triggers_test.go b/service/integration/obligation_triggers_test.go new file mode 100644 index 0000000000..80c6fe245a --- /dev/null +++ b/service/integration/obligation_triggers_test.go @@ -0,0 +1,217 @@ +package integration + +import ( + "context" + "log/slog" + "testing" + + "github.com/google/uuid" + "github.com/opentdf/platform/protocol/go/common" + "github.com/opentdf/platform/protocol/go/policy" + "github.com/opentdf/platform/protocol/go/policy/actions" + "github.com/opentdf/platform/protocol/go/policy/attributes" + "github.com/opentdf/platform/protocol/go/policy/namespaces" + "github.com/opentdf/platform/protocol/go/policy/obligations" + "github.com/opentdf/platform/service/internal/fixtures" + "github.com/opentdf/platform/service/pkg/db" + "github.com/stretchr/testify/suite" +) + +type ObligationTriggersSuite struct { + suite.Suite + ctx context.Context //nolint:containedctx // context is used in the test suite + db fixtures.DBInterface + f fixtures.Fixtures + namespace *policy.Namespace + attribute *policy.Attribute + attributeValue *policy.Value + action *policy.Action + obligation *policy.Obligation + obligationValue *policy.ObligationValue + triggerIDsToClean []string +} + +func (s *ObligationTriggersSuite) SetupSuite() { + slog.Info("setting up db.Obligations test suite") + s.ctx = context.Background() + c := *Config + c.DB.Schema = "test_opentdf_obligation_triggers" + s.db = fixtures.NewDBInterface(c) + s.f = fixtures.NewFixture(s.db) + s.f.Provision() + + var err error + + // Create a namespace + s.namespace, err = s.db.PolicyClient.CreateNamespace(s.ctx, &namespaces.CreateNamespaceRequest{ + Name: "test-namespace", + }) + s.Require().NoError(err) + + // Create an attribute + s.attribute, err = s.db.PolicyClient.CreateAttribute(s.ctx, &attributes.CreateAttributeRequest{ + Name: "test-attribute", + NamespaceId: s.namespace.GetId(), + Rule: policy.AttributeRuleTypeEnum_ATTRIBUTE_RULE_TYPE_ENUM_ALL_OF, + }) + s.Require().NoError(err) + + // Create an attribute value + s.attributeValue, err = s.db.PolicyClient.CreateAttributeValue(s.ctx, s.attribute.GetId(), &attributes.CreateAttributeValueRequest{ + Value: "test-value", + AttributeId: s.attribute.GetId(), + }) + s.Require().NoError(err) + + // Create an action + s.action, err = s.db.PolicyClient.CreateAction(s.ctx, &actions.CreateActionRequest{ + Name: "test-action", + }) + s.Require().NoError(err) + + // Create an obligation + s.obligation, err = s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ + Name: "test-obligation", + NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ + Id: s.namespace.GetId(), + }, + }) + s.Require().NoError(err) + + // Create an obligation value + s.obligationValue, err = s.db.PolicyClient.CreateObligationValue(s.ctx, &obligations.CreateObligationValueRequest{ + ObligationIdentifier: &obligations.CreateObligationValueRequest_Id{ + Id: s.obligation.GetId(), + }, + Value: "test-obligation-value", + }) + s.Require().NoError(err) +} + +func (s *ObligationTriggersSuite) TearDownSuite() { + var err error + ctx := context.Background() + + _, err = s.db.PolicyClient.DeleteObligation(ctx, &obligations.DeleteObligationRequest{ + Identifier: &obligations.DeleteObligationRequest_Id{ + Id: s.obligation.GetId(), + }, + }) + s.Require().NoError(err) + + _, err = s.db.PolicyClient.DeleteAction(ctx, &actions.DeleteActionRequest{ + Id: s.action.GetId(), + }) + s.Require().NoError(err) + + _, err = s.db.PolicyClient.UnsafeDeleteNamespace(ctx, s.namespace, s.namespace.GetFqn()) + s.Require().NoError(err) +} + +func (s *ObligationTriggersSuite) TearDownTest() { + for _, triggerID := range s.triggerIDsToClean { + _, err := s.db.PolicyClient.DeleteObligationTrigger(s.ctx, &obligations.RemoveObligationTriggerRequest{ + Id: triggerID, + }) + s.Require().NoError(err) + } + s.triggerIDsToClean = nil +} + +func TestObligationTriggersSuite(t *testing.T) { + suite.Run(t, new(ObligationTriggersSuite)) +} + +func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_NoMetadata_Success() { + s.triggerIDsToClean = append(s.triggerIDsToClean, s.createGenericTrigger().GetId()) +} + +func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_Success() { + trigger, err := s.db.PolicyClient.CreateObligationTrigger(s.ctx, &obligations.AddObligationTriggerRequest{ + ObligationValueId: s.obligationValue.GetId(), + AttributeValueId: s.attributeValue.GetId(), + ActionId: s.action.GetId(), + Metadata: &common.MetadataMutable{ + Labels: map[string]string{"source": "test"}, + }, + }) + s.triggerIDsToClean = append(s.triggerIDsToClean, trigger.GetId()) + s.Require().NoError(err) + s.Require().NotNil(trigger) + s.Require().NotEmpty(trigger.GetId()) + s.Require().Equal(s.attributeValue, trigger.GetAttributeValue()) + s.Require().Equal(s.obligationValue, trigger.GetObligationValue()) + s.Require().Equal(s.action, trigger.GetAction()) + s.Require().Equal("test", trigger.GetMetadata().GetLabels()["source"]) +} + +func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_ObligationValueNotFound_Fails() { + randomID := uuid.NewString() + trigger, err := s.db.PolicyClient.CreateObligationTrigger(s.ctx, &obligations.AddObligationTriggerRequest{ + ObligationValueId: randomID, + AttributeValueId: s.attributeValue.GetId(), + ActionId: s.action.GetId(), + }) + s.Require().Error(err) + s.Require().ErrorIs(err, db.ErrForeignKeyViolation) + s.Nil(trigger) +} + +func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_AttributeValueNotFound_Fails() { + randomID := uuid.NewString() + trigger, err := s.db.PolicyClient.CreateObligationTrigger(s.ctx, &obligations.AddObligationTriggerRequest{ + ObligationValueId: s.obligationValue.GetId(), + AttributeValueId: randomID, + ActionId: s.action.GetId(), + }) + s.Require().Error(err) + s.Require().ErrorIs(err, db.ErrForeignKeyViolation) + s.Nil(trigger) +} + +func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_ActionNotFound_Fails() { + randomID := uuid.NewString() + trigger, err := s.db.PolicyClient.CreateObligationTrigger(s.ctx, &obligations.AddObligationTriggerRequest{ + ObligationValueId: s.obligationValue.GetId(), + AttributeValueId: s.attributeValue.GetId(), + ActionId: randomID, + }) + s.Require().Error(err) + s.Require().ErrorIs(err, db.ErrForeignKeyViolation) + s.Nil(trigger) +} + +func (s *ObligationTriggersSuite) Test_DeleteObligationTrigger_Success() { + trigger := s.createGenericTrigger() + deletedTrigger, err := s.db.PolicyClient.DeleteObligationTrigger(s.ctx, &obligations.RemoveObligationTriggerRequest{ + Id: trigger.GetId(), + }) + s.Require().NoError(err) + s.NotNil(deletedTrigger) + s.Equal(trigger.GetId(), deletedTrigger.GetId()) +} + +func (s *ObligationTriggersSuite) Test_DeleteObligationTrigger_NotFound_Fails() { + randomID := uuid.NewString() + _, err := s.db.PolicyClient.DeleteObligationTrigger(s.ctx, &obligations.RemoveObligationTriggerRequest{ + Id: randomID, + }) + s.Require().Error(err) + s.Require().ErrorIs(err, db.ErrNotFound) +} + +func (s *ObligationTriggersSuite) createGenericTrigger() *policy.ObligationTrigger { + trigger, err := s.db.PolicyClient.CreateObligationTrigger(s.ctx, &obligations.AddObligationTriggerRequest{ + ObligationValueId: s.obligationValue.GetId(), + AttributeValueId: s.attributeValue.GetId(), + ActionId: s.action.GetId(), + Metadata: &common.MetadataMutable{}, + }) + s.Require().NoError(err) + s.Require().NotNil(trigger) + s.Require().NotEmpty(trigger.GetId()) + s.Require().Equal(s.attributeValue, trigger.GetAttributeValue()) + s.Require().Equal(s.obligationValue, trigger.GetObligationValue()) + s.Require().Equal(s.action, trigger.GetAction()) + return trigger +} diff --git a/service/logger/audit/constants.go b/service/logger/audit/constants.go index 2b2a16f6ae..9a0bb2db1b 100644 --- a/service/logger/audit/constants.go +++ b/service/logger/audit/constants.go @@ -13,6 +13,7 @@ const ( ObjectTypeAttributeValue ObjectTypeObligationDefinition ObjectTypeObligationValue + ObjectTypeObligationTrigger ObjectTypeNamespace ObjectTypeConditionSet ObjectTypeKasRegistry @@ -41,6 +42,7 @@ func (ot ObjectType) String() string { "attribute_value", "obligation_definition", "obligation_value", + "obligation_trigger", "namespace", "condition_set", "kas_registry", diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 7d798562ed..458dfeba91 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -7,6 +7,8 @@ import ( "github.com/opentdf/platform/protocol/go/common" "github.com/opentdf/platform/protocol/go/policy" + "github.com/opentdf/platform/protocol/go/policy/actions" + "github.com/opentdf/platform/protocol/go/policy/attributes" "github.com/opentdf/platform/protocol/go/policy/obligations" "github.com/opentdf/platform/service/pkg/db" "google.golang.org/protobuf/types/known/timestamppb" @@ -507,3 +509,77 @@ func (c PolicyDBClient) DeleteObligationValue(ctx context.Context, r *obligation Id: id, }, nil } + +// ******************************************** +// ! Obligation Triggers +// ******************************************** + +func (c PolicyDBClient) CreateObligationTrigger(ctx context.Context, r *obligations.AddObligationTriggerRequest) (*policy.ObligationTrigger, error) { + metadataJSON, _, err := db.MarshalCreateMetadata(r.GetMetadata()) + if err != nil { + return nil, err + } + + params := createObligationTriggerParams{ + ObligationValueID: r.GetObligationValueId(), + ActionID: r.GetActionId(), + AttributeValueID: r.GetAttributeValueId(), + Metadata: metadataJSON, + } + row, err := c.queries.createObligationTrigger(ctx, params) + if err != nil { + return nil, db.WrapIfKnownInvalidQueryErr(err) + } + + metadata := &common.Metadata{} + if err := unmarshalMetadata(row.Metadata, metadata); err != nil { + return nil, err + } + + action, err := c.GetAction(ctx, &actions.GetActionRequest{ + Identifier: &actions.GetActionRequest_Id{ + Id: row.ActionID, + }, + }) + if err != nil { + return nil, err + } + + attributeValue, err := c.GetAttributeValue(ctx, &attributes.GetAttributeValueRequest_ValueId{ + ValueId: row.AttributeValueID, + }) + if err != nil { + return nil, err + } + + oblVal, err := c.GetObligationValue(ctx, &obligations.GetObligationValueRequest{ + Identifier: &obligations.GetObligationValueRequest_Id{ + Id: row.ObligationValueID, + }, + }) + if err != nil { + return nil, err + } + + return &policy.ObligationTrigger{ + Id: row.ID, + ObligationValue: oblVal, + Metadata: metadata, + Action: action, + AttributeValue: attributeValue, + }, nil +} + +func (c PolicyDBClient) DeleteObligationTrigger(ctx context.Context, r *obligations.RemoveObligationTriggerRequest) (*policy.ObligationTrigger, error) { + id, err := c.queries.deleteObligationTrigger(ctx, r.GetId()) + if err != nil { + return nil, db.WrapIfKnownInvalidQueryErr(err) + } + if id == "" { + return nil, db.ErrNotFound + } + + return &policy.ObligationTrigger{ + Id: id, + }, nil +} diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index b1dd08b1ee..b3837c8492 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -144,6 +144,47 @@ func (q *Queries) createObligation(ctx context.Context, arg createObligationPara return i, err } +const createObligationTrigger = `-- name: createObligationTrigger :one + +INSERT INTO obligation_triggers (obligation_value_id, action_id, attribute_value_id, metadata) +VALUES ($1, $2, $3, $4) +RETURNING id, obligation_value_id, action_id, attribute_value_id, metadata, created_at, updated_at +` + +type createObligationTriggerParams struct { + ObligationValueID string `json:"obligation_value_id"` + ActionID string `json:"action_id"` + AttributeValueID string `json:"attribute_value_id"` + Metadata []byte `json:"metadata"` +} + +// -------------------------------------------------------------- +// OBLIGATION TRIGGERS +// -------------------------------------------------------------- +// +// INSERT INTO obligation_triggers (obligation_value_id, action_id, attribute_value_id, metadata) +// VALUES ($1, $2, $3, $4) +// RETURNING id, obligation_value_id, action_id, attribute_value_id, metadata, created_at, updated_at +func (q *Queries) createObligationTrigger(ctx context.Context, arg createObligationTriggerParams) (ObligationTrigger, error) { + row := q.db.QueryRow(ctx, createObligationTrigger, + arg.ObligationValueID, + arg.ActionID, + arg.AttributeValueID, + arg.Metadata, + ) + var i ObligationTrigger + err := row.Scan( + &i.ID, + &i.ObligationValueID, + &i.ActionID, + &i.AttributeValueID, + &i.Metadata, + &i.CreatedAt, + &i.UpdatedAt, + ) + return i, err +} + const createObligationValue = `-- name: createObligationValue :one WITH obligation_lookup AS ( @@ -315,6 +356,23 @@ func (q *Queries) deleteObligation(ctx context.Context, arg deleteObligationPara return id, err } +const deleteObligationTrigger = `-- name: deleteObligationTrigger :one +DELETE FROM obligation_triggers +WHERE id = $1 +RETURNING id +` + +// deleteObligationTrigger +// +// DELETE FROM obligation_triggers +// WHERE id = $1 +// RETURNING id +func (q *Queries) deleteObligationTrigger(ctx context.Context, id string) (string, error) { + row := q.db.QueryRow(ctx, deleteObligationTrigger, id) + err := row.Scan(&id) + return id, err +} + const deleteObligationValue = `-- name: deleteObligationValue :one DELETE FROM obligation_values_standard WHERE id IN ( diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 8fc3d79f30..3b54c9cd2e 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -304,4 +304,19 @@ WHERE id IN ( AND fqns.fqn = @namespace_fqn::VARCHAR AND od.name = @name::VARCHAR AND ov.value = @value::VARCHAR) ) ) +RETURNING id; + +---------------------------------------------------------------- +-- OBLIGATION TRIGGERS +---------------------------------------------------------------- + +-- name: createObligationTrigger :one +INSERT INTO obligation_triggers (obligation_value_id, action_id, attribute_value_id, metadata) +VALUES ($1, $2, $3, $4) +RETURNING *; + + +-- name: deleteObligationTrigger :one +DELETE FROM obligation_triggers +WHERE id = $1 RETURNING id; \ No newline at end of file diff --git a/service/policy/obligations/obligations.go b/service/policy/obligations/obligations.go index 92dab79e65..f546aa568e 100644 --- a/service/policy/obligations/obligations.go +++ b/service/policy/obligations/obligations.go @@ -344,14 +344,62 @@ func (s *Service) DeleteObligationValue(ctx context.Context, req *connect.Reques return connect.NewResponse(rsp), nil } -func (s *Service) AddObligationTrigger(_ context.Context, _ *connect.Request[obligations.AddObligationTriggerRequest]) (*connect.Response[obligations.AddObligationTriggerResponse], error) { - // TODO: Implement AddObligationTrigger logic - return connect.NewResponse(&obligations.AddObligationTriggerResponse{}), nil +func (s *Service) AddObligationTrigger(ctx context.Context, req *connect.Request[obligations.AddObligationTriggerRequest]) (*connect.Response[obligations.AddObligationTriggerResponse], error) { + rsp := &obligations.AddObligationTriggerResponse{} + + auditParams := audit.PolicyEventParams{ + ActionType: audit.ActionTypeCreate, + ObjectType: audit.ObjectTypeObligationTrigger, + } + + s.logger.DebugContext(ctx, "adding obligation trigger", + slog.String("obligation_value_id", req.Msg.GetObligationValueId()), + slog.String("action_id", req.Msg.GetActionId()), + slog.String("attribute_value_id", req.Msg.GetAttributeValueId()), + ) + + err := s.dbClient.RunInTx(ctx, func(txClient *policydb.PolicyDBClient) error { + trigger, err := txClient.CreateObligationTrigger(ctx, req.Msg) + if err != nil { + return err + } + + auditParams.ObjectID = trigger.GetId() + auditParams.Original = trigger + s.logger.Audit.PolicyCRUDSuccess(ctx, auditParams) + + rsp.Trigger = trigger + return nil + }) + if err != nil { + s.logger.Audit.PolicyCRUDFailure(ctx, auditParams) + return nil, db.StatusifyError(ctx, s.logger, err, db.ErrTextCreationFailed, slog.String("obligation trigger", req.Msg.String())) + } + + return connect.NewResponse(rsp), nil } -func (s *Service) RemoveObligationTrigger(_ context.Context, _ *connect.Request[obligations.RemoveObligationTriggerRequest]) (*connect.Response[obligations.RemoveObligationTriggerResponse], error) { - // TODO: Implement RemoveObligationTrigger logic - return connect.NewResponse(&obligations.RemoveObligationTriggerResponse{}), nil +func (s *Service) RemoveObligationTrigger(ctx context.Context, req *connect.Request[obligations.RemoveObligationTriggerRequest]) (*connect.Response[obligations.RemoveObligationTriggerResponse], error) { + id := req.Msg.GetId() + + auditParams := audit.PolicyEventParams{ + ActionType: audit.ActionTypeDelete, + ObjectType: audit.ObjectTypeObligationTrigger, + ObjectID: id, + } + + s.logger.DebugContext(ctx, "removing obligation trigger", slog.String("id", id)) + + deleted, err := s.dbClient.DeleteObligationTrigger(ctx, req.Msg) + if err != nil { + s.logger.Audit.PolicyCRUDFailure(ctx, auditParams) + return nil, db.StatusifyError(ctx, s.logger, err, db.ErrTextDeletionFailed, slog.String("obligation trigger", req.Msg.String())) + } + + s.logger.Audit.PolicyCRUDSuccess(ctx, auditParams) + + rsp := &obligations.RemoveObligationTriggerResponse{Trigger: deleted} + return connect.NewResponse(rsp), nil } // func (s *Service) AddObligationFulfiller(_ context.Context, _ *connect.Request[obligations.AddObligationFulfillerRequest]) (*connect.Response[obligations.AddObligationFulfillerResponse], error) { diff --git a/service/policy/obligations/obligations.proto b/service/policy/obligations/obligations.proto index 8926127ef5..b29af8fb6d 100644 --- a/service/policy/obligations/obligations.proto +++ b/service/policy/obligations/obligations.proto @@ -5,6 +5,7 @@ package policy.obligations; import "common/common.proto"; import "policy/objects.proto"; import "policy/selectors.proto"; +import "buf/validate/validate.proto"; // import "google/protobuf/struct.proto"; /// @@ -158,9 +159,11 @@ message DeleteObligationValueResponse { // Triggers message AddObligationTriggerRequest { // Required - string obligation_value_id = 1; - string action_id = 2; - string attribute_value_id = 3; + string obligation_value_id = 1 [(buf.validate.field).string.uuid = true]; + // Required + string action_id = 2 [(buf.validate.field).string.uuid = true]; + // Required + string attribute_value_id = 3 [(buf.validate.field).string.uuid = true]; // Optional // Common metadata common.MetadataMutable metadata = 100; @@ -171,7 +174,7 @@ message AddObligationTriggerResponse { } message RemoveObligationTriggerRequest { - string id = 1; + string id = 1 [(buf.validate.field).string.uuid = true]; } message RemoveObligationTriggerResponse { diff --git a/service/policy/obligations/obligations_test.go b/service/policy/obligations/obligations_test.go index 12d85d8183..72cc8e9adb 100644 --- a/service/policy/obligations/obligations_test.go +++ b/service/policy/obligations/obligations_test.go @@ -1 +1,159 @@ package obligations + +import ( + "testing" + + "buf.build/go/protovalidate" + "github.com/google/uuid" + "github.com/opentdf/platform/protocol/go/policy/obligations" + "github.com/stretchr/testify/require" +) + +const ( + invalidUUID = "invalid-uuid" +) + +func getValidator() protovalidate.Validator { + v, err := protovalidate.New() + if err != nil { + panic(err) + } + return v +} + +func Test_AddObligationTrigger_Request(t *testing.T) { + validUUID := uuid.NewString() + testCases := []struct { + name string + req *obligations.AddObligationTriggerRequest + expectError bool + errorMessage string + }{ + { + name: "valid", + req: &obligations.AddObligationTriggerRequest{ + ObligationValueId: validUUID, + ActionId: validUUID, + AttributeValueId: validUUID, + }, + expectError: false, + }, + { + name: "invalid obligation_value_id", + req: &obligations.AddObligationTriggerRequest{ + ObligationValueId: invalidUUID, + ActionId: validUUID, + AttributeValueId: validUUID, + }, + expectError: true, + errorMessage: "obligation_value_id", + }, + { + name: "invalid action_id", + req: &obligations.AddObligationTriggerRequest{ + ObligationValueId: validUUID, + ActionId: invalidUUID, + AttributeValueId: validUUID, + }, + expectError: true, + errorMessage: "action_id", + }, + { + name: "invalid attribute_value_id", + req: &obligations.AddObligationTriggerRequest{ + ObligationValueId: validUUID, + ActionId: validUUID, + AttributeValueId: invalidUUID, + }, + expectError: true, + errorMessage: "attribute_value_id", + }, + { + name: "missing obligation_value_id", + req: &obligations.AddObligationTriggerRequest{ + ActionId: validUUID, + AttributeValueId: validUUID, + }, + expectError: true, + errorMessage: "obligation_value_id", + }, + { + name: "missing action_id", + req: &obligations.AddObligationTriggerRequest{ + ObligationValueId: validUUID, + AttributeValueId: validUUID, + }, + expectError: true, + errorMessage: "action_id", + }, + { + name: "missing attribute_value_id", + req: &obligations.AddObligationTriggerRequest{ + ObligationValueId: validUUID, + ActionId: validUUID, + }, + expectError: true, + errorMessage: "attribute_value_id", + }, + } + + v := getValidator() + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + err := v.Validate(tc.req) + if tc.expectError { + require.Error(t, err) + require.Contains(t, err.Error(), tc.errorMessage) + } else { + require.NoError(t, err) + } + }) + } +} + +func Test_RemoveObligationTrigger_Request(t *testing.T) { + validUUID := uuid.NewString() + testCases := []struct { + name string + req *obligations.RemoveObligationTriggerRequest + expectError bool + errorMessage string + }{ + { + name: "valid", + req: &obligations.RemoveObligationTriggerRequest{ + Id: validUUID, + }, + expectError: false, + }, + { + name: "invalid id", + req: &obligations.RemoveObligationTriggerRequest{ + Id: invalidUUID, + }, + expectError: true, + errorMessage: "id", + }, + { + name: "missing id", + req: &obligations.RemoveObligationTriggerRequest{}, + expectError: true, + errorMessage: "id", + }, + } + + v := getValidator() + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + err := v.Validate(tc.req) + if tc.expectError { + require.Error(t, err) + require.Contains(t, err.Error(), tc.errorMessage) + } else { + require.NoError(t, err) + } + }) + } +} From d33ae1e80dd883378bb2988ca16223b2d5892c1d Mon Sep 17 00:00:00 2001 From: Chris Reed Date: Wed, 3 Sep 2025 15:31:04 -0500 Subject: [PATCH 126/137] fix tests. --- service/integration/obligation_triggers_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/service/integration/obligation_triggers_test.go b/service/integration/obligation_triggers_test.go index 80c6fe245a..c4a713a645 100644 --- a/service/integration/obligation_triggers_test.go +++ b/service/integration/obligation_triggers_test.go @@ -139,9 +139,9 @@ func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_Success() { s.Require().NoError(err) s.Require().NotNil(trigger) s.Require().NotEmpty(trigger.GetId()) - s.Require().Equal(s.attributeValue, trigger.GetAttributeValue()) - s.Require().Equal(s.obligationValue, trigger.GetObligationValue()) - s.Require().Equal(s.action, trigger.GetAction()) + s.Require().Equal(s.attributeValue.GetId(), trigger.GetAttributeValue().GetId()) + s.Require().Equal(s.obligationValue.GetId(), trigger.GetObligationValue().GetId()) + s.Require().Equal(s.action.GetId(), trigger.GetAction().GetId()) s.Require().Equal("test", trigger.GetMetadata().GetLabels()["source"]) } @@ -210,8 +210,8 @@ func (s *ObligationTriggersSuite) createGenericTrigger() *policy.ObligationTrigg s.Require().NoError(err) s.Require().NotNil(trigger) s.Require().NotEmpty(trigger.GetId()) - s.Require().Equal(s.attributeValue, trigger.GetAttributeValue()) - s.Require().Equal(s.obligationValue, trigger.GetObligationValue()) - s.Require().Equal(s.action, trigger.GetAction()) + s.Require().Equal(s.attributeValue.GetId(), trigger.GetAttributeValue().GetId()) + s.Require().Equal(s.obligationValue.GetId(), trigger.GetObligationValue().GetId()) + s.Require().Equal(s.action.GetId(), trigger.GetAction().GetId()) return trigger } From 83177ee3db9be729c767a21f36ef0f6d8131166a Mon Sep 17 00:00:00 2001 From: Chris Reed Date: Thu, 4 Sep 2025 11:36:31 -0500 Subject: [PATCH 127/137] create query returns trigger obj. --- .../integration/obligation_triggers_test.go | 41 ++++-- service/policy/db/obligations.go | 32 +---- service/policy/db/obligations.sql.go | 121 +++++++++++++++--- service/policy/db/queries/obligations.sql | 52 +++++++- service/policy/db/utils.go | 11 ++ 5 files changed, 195 insertions(+), 62 deletions(-) diff --git a/service/integration/obligation_triggers_test.go b/service/integration/obligation_triggers_test.go index c4a713a645..76ab3a91e5 100644 --- a/service/integration/obligation_triggers_test.go +++ b/service/integration/obligation_triggers_test.go @@ -17,6 +17,15 @@ import ( "github.com/stretchr/testify/suite" ) +const ( + namespaceName = "test-namespace" + attributeName = "test-attribute" + attributeValueName = "test-value" + actionName = "test-action" + obligationName = "test-obligation" + obligationValue = "test-obligation-value" +) + type ObligationTriggersSuite struct { suite.Suite ctx context.Context //nolint:containedctx // context is used in the test suite @@ -44,13 +53,13 @@ func (s *ObligationTriggersSuite) SetupSuite() { // Create a namespace s.namespace, err = s.db.PolicyClient.CreateNamespace(s.ctx, &namespaces.CreateNamespaceRequest{ - Name: "test-namespace", + Name: namespaceName, }) s.Require().NoError(err) // Create an attribute s.attribute, err = s.db.PolicyClient.CreateAttribute(s.ctx, &attributes.CreateAttributeRequest{ - Name: "test-attribute", + Name: attributeName, NamespaceId: s.namespace.GetId(), Rule: policy.AttributeRuleTypeEnum_ATTRIBUTE_RULE_TYPE_ENUM_ALL_OF, }) @@ -58,20 +67,20 @@ func (s *ObligationTriggersSuite) SetupSuite() { // Create an attribute value s.attributeValue, err = s.db.PolicyClient.CreateAttributeValue(s.ctx, s.attribute.GetId(), &attributes.CreateAttributeValueRequest{ - Value: "test-value", + Value: attributeValueName, AttributeId: s.attribute.GetId(), }) s.Require().NoError(err) // Create an action s.action, err = s.db.PolicyClient.CreateAction(s.ctx, &actions.CreateActionRequest{ - Name: "test-action", + Name: actionName, }) s.Require().NoError(err) // Create an obligation s.obligation, err = s.db.PolicyClient.CreateObligation(s.ctx, &obligations.CreateObligationRequest{ - Name: "test-obligation", + Name: obligationName, NamespaceIdentifier: &obligations.CreateObligationRequest_Id{ Id: s.namespace.GetId(), }, @@ -83,7 +92,7 @@ func (s *ObligationTriggersSuite) SetupSuite() { ObligationIdentifier: &obligations.CreateObligationValueRequest_Id{ Id: s.obligation.GetId(), }, - Value: "test-obligation-value", + Value: obligationValue, }) s.Require().NoError(err) } @@ -137,11 +146,7 @@ func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_Success() { }) s.triggerIDsToClean = append(s.triggerIDsToClean, trigger.GetId()) s.Require().NoError(err) - s.Require().NotNil(trigger) - s.Require().NotEmpty(trigger.GetId()) - s.Require().Equal(s.attributeValue.GetId(), trigger.GetAttributeValue().GetId()) - s.Require().Equal(s.obligationValue.GetId(), trigger.GetObligationValue().GetId()) - s.Require().Equal(s.action.GetId(), trigger.GetAction().GetId()) + s.validateTrigger(trigger) s.Require().Equal("test", trigger.GetMetadata().GetLabels()["source"]) } @@ -208,10 +213,22 @@ func (s *ObligationTriggersSuite) createGenericTrigger() *policy.ObligationTrigg Metadata: &common.MetadataMutable{}, }) s.Require().NoError(err) + s.validateTrigger(trigger) + return trigger +} + +func (s *ObligationTriggersSuite) validateTrigger(trigger *policy.ObligationTrigger) { s.Require().NotNil(trigger) s.Require().NotEmpty(trigger.GetId()) s.Require().Equal(s.attributeValue.GetId(), trigger.GetAttributeValue().GetId()) + s.Require().Equal(s.attributeValue.GetFqn(), trigger.GetAttributeValue().GetFqn()) + s.Require().Equal(s.attributeValue.GetValue(), trigger.GetAttributeValue().GetValue()) s.Require().Equal(s.obligationValue.GetId(), trigger.GetObligationValue().GetId()) + s.Require().Equal(s.obligationValue.GetValue(), trigger.GetObligationValue().GetValue()) + s.Require().Equal(s.obligationValue.GetObligation().GetId(), trigger.GetObligationValue().GetObligation().GetId()) + s.Require().Equal(s.obligationValue.GetObligation().GetName(), trigger.GetObligationValue().GetObligation().GetName()) + s.Require().Equal(s.obligationValue.GetObligation().GetNamespace().GetFqn(), trigger.GetObligationValue().GetObligation().GetNamespace().GetFqn()) + s.Require().Empty(trigger.GetObligationValue().GetTriggers()) s.Require().Equal(s.action.GetId(), trigger.GetAction().GetId()) - return trigger + s.Require().Equal(s.action.GetName(), trigger.GetAction().GetName()) } diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 458dfeba91..93bf71a0e9 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -7,8 +7,6 @@ import ( "github.com/opentdf/platform/protocol/go/common" "github.com/opentdf/platform/protocol/go/policy" - "github.com/opentdf/platform/protocol/go/policy/actions" - "github.com/opentdf/platform/protocol/go/policy/attributes" "github.com/opentdf/platform/protocol/go/policy/obligations" "github.com/opentdf/platform/service/pkg/db" "google.golang.org/protobuf/types/known/timestamppb" @@ -536,38 +534,14 @@ func (c PolicyDBClient) CreateObligationTrigger(ctx context.Context, r *obligati return nil, err } - action, err := c.GetAction(ctx, &actions.GetActionRequest{ - Identifier: &actions.GetActionRequest_Id{ - Id: row.ActionID, - }, - }) - if err != nil { - return nil, err - } - - attributeValue, err := c.GetAttributeValue(ctx, &attributes.GetAttributeValueRequest_ValueId{ - ValueId: row.AttributeValueID, - }) + trigger, err := unmarshalObligationTrigger(row.Trigger) if err != nil { return nil, err } - oblVal, err := c.GetObligationValue(ctx, &obligations.GetObligationValueRequest{ - Identifier: &obligations.GetObligationValueRequest_Id{ - Id: row.ObligationValueID, - }, - }) - if err != nil { - return nil, err - } + trigger.Metadata = metadata - return &policy.ObligationTrigger{ - Id: row.ID, - ObligationValue: oblVal, - Metadata: metadata, - Action: action, - AttributeValue: attributeValue, - }, nil + return trigger, nil } func (c PolicyDBClient) DeleteObligationTrigger(ctx context.Context, r *obligations.RemoveObligationTriggerRequest) (*policy.ObligationTrigger, error) { diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index b3837c8492..21e8c8b8af 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -146,9 +146,54 @@ func (q *Queries) createObligation(ctx context.Context, arg createObligationPara const createObligationTrigger = `-- name: createObligationTrigger :one -INSERT INTO obligation_triggers (obligation_value_id, action_id, attribute_value_id, metadata) -VALUES ($1, $2, $3, $4) -RETURNING id, obligation_value_id, action_id, attribute_value_id, metadata, created_at, updated_at +WITH inserted AS ( + INSERT INTO obligation_triggers (obligation_value_id, action_id, attribute_value_id, metadata) + VALUES ($1, $2, $3, $4) + RETURNING id, obligation_value_id, action_id, attribute_value_id, metadata, created_at, updated_at +) +SELECT + JSON_STRIP_NULLS( + JSON_BUILD_OBJECT( + 'labels', i.metadata -> 'labels', + 'created_at', i.created_at, + 'updated_at', i.updated_at + ) + ) AS metadata, + JSON_STRIP_NULLS( + JSON_BUILD_OBJECT( + 'id', i.id, + 'obligation_value', JSON_BUILD_OBJECT( + 'id', ov.id, + 'value', ov.value, + 'obligation', JSON_BUILD_OBJECT( + 'id', od.id, + 'name', od.name, + 'namespace', JSON_BUILD_OBJECT( + 'id', n.id, + 'name', n.name, + 'fqn', COALESCE(ns_fqns.fqn, '') + ) + ) + ), + 'action', JSON_BUILD_OBJECT( + 'id', a.id, + 'name', a.name + ), + 'attribute_value', JSON_BUILD_OBJECT( + 'id', av.id, + 'value', av.value, + 'fqn', COALESCE(av_fqns.fqn, '') + ) + ) + ) as trigger +FROM inserted i +JOIN obligation_values_standard ov ON i.obligation_value_id = ov.id +JOIN obligation_definitions od ON ov.obligation_definition_id = od.id +JOIN attribute_namespaces n ON od.namespace_id = n.id +LEFT JOIN attribute_fqns ns_fqns ON ns_fqns.namespace_id = n.id AND ns_fqns.attribute_id IS NULL AND ns_fqns.value_id IS NULL +JOIN actions a ON i.action_id = a.id +JOIN attribute_values av ON i.attribute_value_id = av.id +LEFT JOIN attribute_fqns av_fqns ON av_fqns.value_id = av.id ` type createObligationTriggerParams struct { @@ -158,30 +203,72 @@ type createObligationTriggerParams struct { Metadata []byte `json:"metadata"` } +type createObligationTriggerRow struct { + Metadata []byte `json:"metadata"` + Trigger []byte `json:"trigger"` +} + // -------------------------------------------------------------- // OBLIGATION TRIGGERS // -------------------------------------------------------------- // -// INSERT INTO obligation_triggers (obligation_value_id, action_id, attribute_value_id, metadata) -// VALUES ($1, $2, $3, $4) -// RETURNING id, obligation_value_id, action_id, attribute_value_id, metadata, created_at, updated_at -func (q *Queries) createObligationTrigger(ctx context.Context, arg createObligationTriggerParams) (ObligationTrigger, error) { +// WITH inserted AS ( +// INSERT INTO obligation_triggers (obligation_value_id, action_id, attribute_value_id, metadata) +// VALUES ($1, $2, $3, $4) +// RETURNING id, obligation_value_id, action_id, attribute_value_id, metadata, created_at, updated_at +// ) +// SELECT +// JSON_STRIP_NULLS( +// JSON_BUILD_OBJECT( +// 'labels', i.metadata -> 'labels', +// 'created_at', i.created_at, +// 'updated_at', i.updated_at +// ) +// ) AS metadata, +// JSON_STRIP_NULLS( +// JSON_BUILD_OBJECT( +// 'id', i.id, +// 'obligation_value', JSON_BUILD_OBJECT( +// 'id', ov.id, +// 'value', ov.value, +// 'obligation', JSON_BUILD_OBJECT( +// 'id', od.id, +// 'name', od.name, +// 'namespace', JSON_BUILD_OBJECT( +// 'id', n.id, +// 'name', n.name, +// 'fqn', COALESCE(ns_fqns.fqn, '') +// ) +// ) +// ), +// 'action', JSON_BUILD_OBJECT( +// 'id', a.id, +// 'name', a.name +// ), +// 'attribute_value', JSON_BUILD_OBJECT( +// 'id', av.id, +// 'value', av.value, +// 'fqn', COALESCE(av_fqns.fqn, '') +// ) +// ) +// ) as trigger +// FROM inserted i +// JOIN obligation_values_standard ov ON i.obligation_value_id = ov.id +// JOIN obligation_definitions od ON ov.obligation_definition_id = od.id +// JOIN attribute_namespaces n ON od.namespace_id = n.id +// LEFT JOIN attribute_fqns ns_fqns ON ns_fqns.namespace_id = n.id AND ns_fqns.attribute_id IS NULL AND ns_fqns.value_id IS NULL +// JOIN actions a ON i.action_id = a.id +// JOIN attribute_values av ON i.attribute_value_id = av.id +// LEFT JOIN attribute_fqns av_fqns ON av_fqns.value_id = av.id +func (q *Queries) createObligationTrigger(ctx context.Context, arg createObligationTriggerParams) (createObligationTriggerRow, error) { row := q.db.QueryRow(ctx, createObligationTrigger, arg.ObligationValueID, arg.ActionID, arg.AttributeValueID, arg.Metadata, ) - var i ObligationTrigger - err := row.Scan( - &i.ID, - &i.ObligationValueID, - &i.ActionID, - &i.AttributeValueID, - &i.Metadata, - &i.CreatedAt, - &i.UpdatedAt, - ) + var i createObligationTriggerRow + err := row.Scan(&i.Metadata, &i.Trigger) return i, err } diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 3b54c9cd2e..d2375f036c 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -311,10 +311,54 @@ RETURNING id; ---------------------------------------------------------------- -- name: createObligationTrigger :one -INSERT INTO obligation_triggers (obligation_value_id, action_id, attribute_value_id, metadata) -VALUES ($1, $2, $3, $4) -RETURNING *; - +WITH inserted AS ( + INSERT INTO obligation_triggers (obligation_value_id, action_id, attribute_value_id, metadata) + VALUES ($1, $2, $3, $4) + RETURNING * +) +SELECT + JSON_STRIP_NULLS( + JSON_BUILD_OBJECT( + 'labels', i.metadata -> 'labels', + 'created_at', i.created_at, + 'updated_at', i.updated_at + ) + ) AS metadata, + JSON_STRIP_NULLS( + JSON_BUILD_OBJECT( + 'id', i.id, + 'obligation_value', JSON_BUILD_OBJECT( + 'id', ov.id, + 'value', ov.value, + 'obligation', JSON_BUILD_OBJECT( + 'id', od.id, + 'name', od.name, + 'namespace', JSON_BUILD_OBJECT( + 'id', n.id, + 'name', n.name, + 'fqn', COALESCE(ns_fqns.fqn, '') + ) + ) + ), + 'action', JSON_BUILD_OBJECT( + 'id', a.id, + 'name', a.name + ), + 'attribute_value', JSON_BUILD_OBJECT( + 'id', av.id, + 'value', av.value, + 'fqn', COALESCE(av_fqns.fqn, '') + ) + ) + ) as trigger +FROM inserted i +JOIN obligation_values_standard ov ON i.obligation_value_id = ov.id +JOIN obligation_definitions od ON ov.obligation_definition_id = od.id +JOIN attribute_namespaces n ON od.namespace_id = n.id +LEFT JOIN attribute_fqns ns_fqns ON ns_fqns.namespace_id = n.id AND ns_fqns.attribute_id IS NULL AND ns_fqns.value_id IS NULL +JOIN actions a ON i.action_id = a.id +JOIN attribute_values av ON i.attribute_value_id = av.id +LEFT JOIN attribute_fqns av_fqns ON av_fqns.value_id = av.id; -- name: deleteObligationTrigger :one DELETE FROM obligation_triggers diff --git a/service/policy/db/utils.go b/service/policy/db/utils.go index 790c087ed6..33cf66399c 100644 --- a/service/policy/db/utils.go +++ b/service/policy/db/utils.go @@ -125,6 +125,17 @@ func unmarshalPrivatePublicKeyContext(pubCtx, privCtx []byte) (*policy.PublicKey return pubKey, privKey, nil } +func unmarshalObligationTrigger(triggerJSON []byte) (*policy.ObligationTrigger, error) { + if triggerJSON == nil { + return nil, nil + } + trigger := &policy.ObligationTrigger{} + if err := protojson.Unmarshal(triggerJSON, trigger); err != nil { + return nil, errors.Join(fmt.Errorf("failed to unmarshal obligation trigger context [%s]: %w", string(triggerJSON), err), db.ErrUnmarshalValueFailed) + } + return trigger, nil +} + func unmarshalObligationValues(valuesJSON []byte) ([]*policy.ObligationValue, error) { if valuesJSON == nil { return nil, nil From 7e9e97d1d061e1802111d980bd1b6cf3e128d3ba Mon Sep 17 00:00:00 2001 From: Chris Reed Date: Thu, 4 Sep 2025 11:38:57 -0500 Subject: [PATCH 128/137] fix linting. --- service/policy/db/utils.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service/policy/db/utils.go b/service/policy/db/utils.go index 33cf66399c..c8483639db 100644 --- a/service/policy/db/utils.go +++ b/service/policy/db/utils.go @@ -126,10 +126,10 @@ func unmarshalPrivatePublicKeyContext(pubCtx, privCtx []byte) (*policy.PublicKey } func unmarshalObligationTrigger(triggerJSON []byte) (*policy.ObligationTrigger, error) { + trigger := &policy.ObligationTrigger{} if triggerJSON == nil { - return nil, nil + return trigger, nil } - trigger := &policy.ObligationTrigger{} if err := protojson.Unmarshal(triggerJSON, trigger); err != nil { return nil, errors.Join(fmt.Errorf("failed to unmarshal obligation trigger context [%s]: %w", string(triggerJSON), err), db.ErrUnmarshalValueFailed) } From f582eab62f4ad8e9ebf306a1c2f79e3c13ba0071 Mon Sep 17 00:00:00 2001 From: Chris Reed Date: Thu, 4 Sep 2025 15:09:34 -0500 Subject: [PATCH 129/137] proto generate. --- protocol/go/policy/objects.pb.go | 893 ++++++++++++++++--------------- 1 file changed, 458 insertions(+), 435 deletions(-) diff --git a/protocol/go/policy/objects.pb.go b/protocol/go/policy/objects.pb.go index 29f3bc487a..bf9563f478 100644 --- a/protocol/go/policy/objects.pb.go +++ b/protocol/go/policy/objects.pb.go @@ -7,14 +7,13 @@ package policy import ( - reflect "reflect" - sync "sync" - _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" common "github.com/opentdf/platform/protocol/go/common" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" + reflect "reflect" + sync "sync" ) const ( @@ -3068,453 +3067,477 @@ var file_policy_objects_proto_rawDesc = []byte{ 0x76, 0x65, 0x12, 0x2f, 0x0a, 0x08, 0x6b, 0x61, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4b, 0x61, 0x73, 0x4b, 0x65, 0x79, 0x52, 0x07, 0x6b, 0x61, 0x73, 0x4b, - 0x65, 0x79, 0x73, 0x12, 0x44, 0x0a, 0x11, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, - 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x10, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, + 0x65, 0x79, 0x73, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, + 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x22, 0xcc, 0x03, 0x0a, 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2f, 0x0a, 0x09, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x52, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x12, 0x2f, 0x0a, 0x06, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x41, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, 0x67, 0x72, 0x61, + 0x6e, 0x74, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x66, 0x71, 0x6e, 0x12, 0x32, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x41, 0x0a, 0x10, 0x73, 0x75, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x08, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x75, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x0f, 0x73, 0x75, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x2f, 0x0a, 0x08, + 0x6b, 0x61, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4b, 0x61, + 0x73, 0x4b, 0x65, 0x79, 0x52, 0x07, 0x6b, 0x61, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x44, 0x0a, + 0x11, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, + 0x67, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, + 0x67, 0x52, 0x10, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4d, 0x61, 0x70, 0x70, 0x69, + 0x6e, 0x67, 0x73, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, + 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, + 0x22, 0xa8, 0x02, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3b, 0x0a, 0x08, 0x73, + 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, + 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, + 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x08, + 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x12, 0x18, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, + 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x63, 0x75, 0x73, 0x74, + 0x6f, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x22, 0x6c, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, + 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x1b, 0x53, 0x54, 0x41, 0x4e, 0x44, 0x41, + 0x52, 0x44, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, + 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x54, 0x41, 0x4e, 0x44, + 0x41, 0x52, 0x44, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x44, 0x45, 0x43, 0x52, 0x59, + 0x50, 0x54, 0x10, 0x01, 0x12, 0x1c, 0x0a, 0x18, 0x53, 0x54, 0x41, 0x4e, 0x44, 0x41, 0x52, 0x44, + 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x4d, 0x49, 0x54, + 0x10, 0x02, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x81, 0x02, 0x0a, 0x0e, + 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x36, + 0x0a, 0x0f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x4f, 0x0a, 0x15, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, + 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x53, + 0x65, 0x74, 0x52, 0x13, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x64, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x74, 0x12, 0x28, 0x0a, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, + 0xe9, 0x01, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4d, 0x0a, + 0x1f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, + 0x6c, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x06, 0xba, 0x48, 0x03, 0xc8, 0x01, 0x01, 0x52, 0x1c, + 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x53, + 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x4b, 0x0a, 0x08, + 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x22, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, + 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x45, 0x6e, + 0x75, 0x6d, 0x42, 0x0b, 0xba, 0x48, 0x08, 0xc8, 0x01, 0x01, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, + 0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x40, 0x0a, 0x17, 0x73, 0x75, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, + 0x01, 0x02, 0x08, 0x01, 0x52, 0x15, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x45, 0x78, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x0e, + 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x3b, + 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x43, 0x6f, 0x6e, 0x64, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, + 0x0a, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x58, 0x0a, 0x10, 0x62, + 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x43, + 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x54, + 0x79, 0x70, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x42, 0x0b, 0xba, 0x48, 0x08, 0xc8, 0x01, 0x01, 0x82, + 0x01, 0x02, 0x10, 0x01, 0x52, 0x0f, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x4f, 0x70, 0x65, + 0x72, 0x61, 0x74, 0x6f, 0x72, 0x22, 0x59, 0x0a, 0x0a, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x53, 0x65, 0x74, 0x12, 0x4b, 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, + 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, + 0x0f, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, + 0x22, 0x94, 0x01, 0x0a, 0x13, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x64, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3f, 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, + 0x65, 0x74, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x0b, 0x73, 0x75, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x74, 0x73, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x52, 0x07, 0x6d, - 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x22, 0xa8, 0x02, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x3b, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x41, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x08, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x12, 0x18, - 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x08, - 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, - 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x6c, 0x0a, 0x0e, 0x53, 0x74, - 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x1b, - 0x53, 0x54, 0x41, 0x4e, 0x44, 0x41, 0x52, 0x44, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, - 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1b, 0x0a, - 0x17, 0x53, 0x54, 0x41, 0x4e, 0x44, 0x41, 0x52, 0x44, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, - 0x5f, 0x44, 0x45, 0x43, 0x52, 0x59, 0x50, 0x54, 0x10, 0x01, 0x12, 0x1c, 0x0a, 0x18, 0x53, 0x54, - 0x41, 0x4e, 0x44, 0x41, 0x52, 0x44, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x52, - 0x41, 0x4e, 0x53, 0x4d, 0x49, 0x54, 0x10, 0x02, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0x81, 0x02, 0x0a, 0x0e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, - 0x70, 0x69, 0x6e, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x36, 0x0a, 0x0f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, - 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0e, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x4f, 0x0a, 0x15, - 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, - 0x6e, 0x5f, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x64, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x74, 0x52, 0x13, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x74, 0x12, 0x28, 0x0a, - 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x7c, 0x0a, 0x0f, 0x53, 0x75, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x42, 0x0a, 0x17, 0x65, 0x78, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, + 0xc8, 0x01, 0x01, 0x72, 0x02, 0x10, 0x01, 0x52, 0x15, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, + 0x6c, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x25, + 0x0a, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9b, 0x01, 0x0a, 0x14, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x29, + 0x0a, 0x0c, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x06, 0xba, 0x48, 0x03, 0xc8, 0x01, 0x01, 0x52, 0x0b, 0x6e, 0x61, + 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x06, 0xba, 0x48, 0x03, 0xc8, 0x01, 0x01, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x22, 0xd9, 0x01, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0xe9, 0x01, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x4d, 0x0a, 0x1f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x65, - 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x06, 0xba, 0x48, - 0x03, 0xc8, 0x01, 0x01, 0x52, 0x1c, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x45, 0x78, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x12, 0x4b, 0x0a, 0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x22, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x75, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x65, 0x72, - 0x61, 0x74, 0x6f, 0x72, 0x45, 0x6e, 0x75, 0x6d, 0x42, 0x0b, 0xba, 0x48, 0x08, 0xc8, 0x01, 0x01, - 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, - 0x40, 0x0a, 0x17, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x72, - 0x6e, 0x61, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, - 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x15, 0x73, 0x75, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x47, - 0x72, 0x6f, 0x75, 0x70, 0x12, 0x3b, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x2e, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xba, 0x48, 0x05, - 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x12, 0x58, 0x0a, 0x10, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x5f, 0x6f, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x6f, - 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x42, 0x0b, 0xba, - 0x48, 0x08, 0xc8, 0x01, 0x01, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x0f, 0x62, 0x6f, 0x6f, 0x6c, - 0x65, 0x61, 0x6e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x22, 0x59, 0x0a, 0x0a, 0x53, - 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x74, 0x12, 0x4b, 0x0a, 0x10, 0x63, 0x6f, 0x6e, - 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x43, 0x6f, 0x6e, - 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x42, 0x08, 0xba, 0x48, 0x05, - 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x22, 0x94, 0x01, 0x0a, 0x13, 0x53, 0x75, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x74, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3f, - 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x75, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x74, 0x42, 0x08, 0xba, 0x48, 0x05, 0x92, 0x01, 0x02, - 0x08, 0x01, 0x52, 0x0b, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x74, 0x73, 0x12, - 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x7c, 0x0a, - 0x0f, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, - 0x12, 0x42, 0x0a, 0x17, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x65, 0x6c, - 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0xc8, 0x01, 0x01, 0x72, 0x02, 0x10, 0x01, 0x52, 0x15, 0x65, - 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x65, 0x78, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9b, 0x01, 0x0a, 0x14, - 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x47, - 0x72, 0x6f, 0x75, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x29, 0x0a, 0x0c, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, - 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x06, 0xba, 0x48, 0x03, 0xc8, - 0x01, 0x01, 0x52, 0x0b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, - 0x1a, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x06, 0xba, - 0x48, 0x03, 0xc8, 0x01, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x08, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, - 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0xd9, 0x01, 0x0a, 0x0f, 0x52, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2c, 0x0a, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x3e, 0x0a, 0x0f, 0x61, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x42, 0x06, 0xba, 0x48, 0x03, 0xc8, 0x01, 0x01, 0x52, 0x0e, 0x61, 0x74, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, - 0x65, 0x72, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x74, 0x65, 0x72, 0x6d, - 0x73, 0x12, 0x32, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1c, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x05, - 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x85, 0x05, 0x0a, 0x0f, 0x4b, 0x65, 0x79, 0x41, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x87, 0x03, 0x0a, 0x03, 0x75, 0x72, - 0x69, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0xf4, 0x02, 0xba, 0x48, 0xf0, 0x02, 0xba, 0x01, - 0xec, 0x02, 0x0a, 0x0a, 0x75, 0x72, 0x69, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0xcf, - 0x01, 0x55, 0x52, 0x49, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x61, 0x20, 0x76, - 0x61, 0x6c, 0x69, 0x64, 0x20, 0x55, 0x52, 0x4c, 0x20, 0x28, 0x65, 0x2e, 0x67, 0x2e, 0x2c, 0x20, - 0x27, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x64, 0x65, 0x6d, 0x6f, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x27, 0x29, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x20, 0x62, 0x79, - 0x20, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x65, 0x67, 0x6d, - 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x20, 0x45, 0x61, 0x63, 0x68, 0x20, 0x73, 0x65, 0x67, 0x6d, 0x65, - 0x6e, 0x74, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x61, 0x6e, - 0x64, 0x20, 0x65, 0x6e, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x61, 0x6e, 0x20, 0x61, 0x6c, - 0x70, 0x68, 0x61, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x20, 0x63, 0x68, 0x61, 0x72, 0x61, - 0x63, 0x74, 0x65, 0x72, 0x2c, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x20, 0x68, 0x79, 0x70, 0x68, 0x65, 0x6e, 0x73, 0x2c, 0x20, 0x61, 0x6c, 0x70, 0x68, 0x61, - 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x20, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, - 0x72, 0x73, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x65, 0x73, 0x2e, - 0x1a, 0x8b, 0x01, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x28, - 0x27, 0x5e, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3f, 0x3a, 0x2f, 0x2f, 0x5b, 0x61, 0x2d, 0x7a, 0x41, - 0x2d, 0x5a, 0x30, 0x2d, 0x39, 0x5d, 0x28, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, - 0x39, 0x5c, 0x5c, 0x2d, 0x5d, 0x7b, 0x30, 0x2c, 0x36, 0x31, 0x7d, 0x5b, 0x61, 0x2d, 0x7a, 0x41, - 0x2d, 0x5a, 0x30, 0x2d, 0x39, 0x5d, 0x29, 0x3f, 0x28, 0x5c, 0x5c, 0x2e, 0x5b, 0x61, 0x2d, 0x7a, - 0x41, 0x2d, 0x5a, 0x30, 0x2d, 0x39, 0x5d, 0x28, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, - 0x2d, 0x39, 0x5c, 0x5c, 0x2d, 0x5d, 0x7b, 0x30, 0x2c, 0x36, 0x31, 0x7d, 0x5b, 0x61, 0x2d, 0x7a, - 0x41, 0x2d, 0x5a, 0x30, 0x2d, 0x39, 0x5d, 0x29, 0x3f, 0x29, 0x2a, 0x28, 0x3a, 0x5b, 0x30, 0x2d, - 0x39, 0x5d, 0x2b, 0x29, 0x3f, 0x28, 0x2f, 0x2e, 0x2a, 0x29, 0x3f, 0x24, 0x27, 0x29, 0x52, 0x03, - 0x75, 0x72, 0x69, 0x12, 0x30, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, - 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x33, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2f, 0x0a, 0x08, 0x6b, 0x61, - 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4b, 0x61, 0x73, 0x4b, - 0x65, 0x79, 0x52, 0x07, 0x6b, 0x61, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x97, 0x02, - 0x0a, 0x03, 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x37, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x61, 0x63, 0x74, 0x69, - 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x52, 0x08, 0x69, 0x73, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x39, - 0x0a, 0x0a, 0x77, 0x61, 0x73, 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x65, 0x64, 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, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x09, - 0x77, 0x61, 0x73, 0x4d, 0x61, 0x70, 0x70, 0x65, 0x64, 0x12, 0x33, 0x0a, 0x0a, 0x70, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x61, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, - 0x4b, 0x65, 0x79, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x29, - 0x0a, 0x03, 0x6b, 0x61, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x53, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x52, 0x03, 0x6b, 0x61, 0x73, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x3e, 0x0a, 0x0f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x06, 0xba, + 0x48, 0x03, 0xc8, 0x01, 0x01, 0x52, 0x0e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x12, 0x32, 0x0a, 0x05, 0x67, + 0x72, 0x6f, 0x75, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4d, 0x61, 0x70, 0x70, + 0x69, 0x6e, 0x67, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, + 0x85, 0x05, 0x0a, 0x0f, 0x4b, 0x65, 0x79, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x53, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x87, 0x03, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x42, 0xf4, 0x02, 0xba, 0x48, 0xf0, 0x02, 0xba, 0x01, 0xec, 0x02, 0x0a, 0x0a, 0x75, 0x72, + 0x69, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0xcf, 0x01, 0x55, 0x52, 0x49, 0x20, 0x6d, + 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x61, 0x20, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x20, 0x55, + 0x52, 0x4c, 0x20, 0x28, 0x65, 0x2e, 0x67, 0x2e, 0x2c, 0x20, 0x27, 0x68, 0x74, 0x74, 0x70, 0x73, + 0x3a, 0x2f, 0x2f, 0x64, 0x65, 0x6d, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x27, 0x29, 0x20, 0x66, + 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x61, 0x64, 0x64, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x20, + 0x45, 0x61, 0x63, 0x68, 0x20, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x6d, 0x75, 0x73, + 0x74, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x65, 0x6e, 0x64, 0x20, + 0x77, 0x69, 0x74, 0x68, 0x20, 0x61, 0x6e, 0x20, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x6e, 0x75, 0x6d, + 0x65, 0x72, 0x69, 0x63, 0x20, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x2c, 0x20, + 0x63, 0x61, 0x6e, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x68, 0x79, 0x70, 0x68, + 0x65, 0x6e, 0x73, 0x2c, 0x20, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x69, + 0x63, 0x20, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x73, 0x2c, 0x20, 0x61, 0x6e, + 0x64, 0x20, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x65, 0x73, 0x2e, 0x1a, 0x8b, 0x01, 0x74, 0x68, 0x69, + 0x73, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x28, 0x27, 0x5e, 0x68, 0x74, 0x74, 0x70, + 0x73, 0x3f, 0x3a, 0x2f, 0x2f, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, 0x39, 0x5d, + 0x28, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, 0x39, 0x5c, 0x5c, 0x2d, 0x5d, 0x7b, + 0x30, 0x2c, 0x36, 0x31, 0x7d, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, 0x39, 0x5d, + 0x29, 0x3f, 0x28, 0x5c, 0x5c, 0x2e, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, 0x39, + 0x5d, 0x28, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, 0x39, 0x5c, 0x5c, 0x2d, 0x5d, + 0x7b, 0x30, 0x2c, 0x36, 0x31, 0x7d, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, 0x39, + 0x5d, 0x29, 0x3f, 0x29, 0x2a, 0x28, 0x3a, 0x5b, 0x30, 0x2d, 0x39, 0x5d, 0x2b, 0x29, 0x3f, 0x28, + 0x2f, 0x2e, 0x2a, 0x29, 0x3f, 0x24, 0x27, 0x29, 0x52, 0x03, 0x75, 0x72, 0x69, 0x12, 0x30, 0x0a, + 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, + 0x63, 0x4b, 0x65, 0x79, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, + 0x33, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x2f, 0x0a, 0x08, 0x6b, 0x61, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x73, + 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, + 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4b, 0x61, 0x73, 0x4b, 0x65, 0x79, 0x52, 0x07, 0x6b, 0x61, + 0x73, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x14, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x84, 0x01, 0x0a, 0x0c, 0x4b, 0x61, 0x73, 0x50, - 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x03, 0x70, 0x65, 0x6d, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0x72, 0x05, 0x10, 0x01, 0x18, 0x80, - 0x40, 0x52, 0x03, 0x70, 0x65, 0x6d, 0x12, 0x1b, 0x0a, 0x03, 0x6b, 0x69, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x09, 0xba, 0x48, 0x06, 0x72, 0x04, 0x10, 0x01, 0x18, 0x20, 0x52, 0x03, - 0x6b, 0x69, 0x64, 0x12, 0x39, 0x0a, 0x03, 0x61, 0x6c, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x1b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x61, 0x73, 0x50, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x41, 0x6c, 0x67, 0x45, 0x6e, 0x75, 0x6d, 0x42, 0x0a, 0xba, - 0x48, 0x07, 0x82, 0x01, 0x04, 0x10, 0x01, 0x20, 0x00, 0x52, 0x03, 0x61, 0x6c, 0x67, 0x22, 0x3b, - 0x0a, 0x0f, 0x4b, 0x61, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x53, 0x65, - 0x74, 0x12, 0x28, 0x0a, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x14, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x61, 0x73, 0x50, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, 0xe0, 0x03, 0x0a, 0x09, - 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x84, 0x03, 0x0a, 0x06, 0x72, 0x65, - 0x6d, 0x6f, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0xe9, 0x02, 0xba, 0x48, 0xe5, - 0x02, 0xba, 0x01, 0xe1, 0x02, 0x0a, 0x0a, 0x75, 0x72, 0x69, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, - 0x74, 0x12, 0xcf, 0x01, 0x55, 0x52, 0x49, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, - 0x61, 0x20, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x20, 0x55, 0x52, 0x4c, 0x20, 0x28, 0x65, 0x2e, 0x67, - 0x2e, 0x2c, 0x20, 0x27, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x64, 0x65, 0x6d, 0x6f, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x27, 0x29, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, - 0x20, 0x62, 0x79, 0x20, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, - 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x20, 0x45, 0x61, 0x63, 0x68, 0x20, 0x73, 0x65, - 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x20, 0x61, 0x6e, 0x64, 0x20, 0x65, 0x6e, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x61, 0x6e, - 0x20, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x20, 0x63, 0x68, - 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x2c, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x20, 0x68, 0x79, 0x70, 0x68, 0x65, 0x6e, 0x73, 0x2c, 0x20, 0x61, 0x6c, - 0x70, 0x68, 0x61, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x20, 0x63, 0x68, 0x61, 0x72, 0x61, - 0x63, 0x74, 0x65, 0x72, 0x73, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x6c, 0x61, 0x73, 0x68, - 0x65, 0x73, 0x2e, 0x1a, 0x80, 0x01, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x73, 0x28, 0x27, 0x5e, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x5b, 0x61, 0x2d, - 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, 0x39, 0x5d, 0x28, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, - 0x30, 0x2d, 0x39, 0x5c, 0x5c, 0x2d, 0x5d, 0x7b, 0x30, 0x2c, 0x36, 0x31, 0x7d, 0x5b, 0x61, 0x2d, - 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, 0x39, 0x5d, 0x29, 0x3f, 0x28, 0x5c, 0x5c, 0x2e, 0x5b, 0x61, - 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, 0x39, 0x5d, 0x28, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, - 0x5a, 0x30, 0x2d, 0x39, 0x5c, 0x5c, 0x2d, 0x5d, 0x7b, 0x30, 0x2c, 0x36, 0x31, 0x7d, 0x5b, 0x61, - 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, 0x39, 0x5d, 0x29, 0x3f, 0x29, 0x2a, 0x28, 0x2f, 0x2e, - 0x2a, 0x29, 0x3f, 0x24, 0x27, 0x29, 0x48, 0x00, 0x52, 0x06, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, - 0x12, 0x31, 0x0a, 0x06, 0x63, 0x61, 0x63, 0x68, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x61, 0x73, 0x50, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x53, 0x65, 0x74, 0x48, 0x00, 0x52, 0x06, 0x63, 0x61, 0x63, - 0x68, 0x65, 0x64, 0x42, 0x0c, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, - 0x79, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x52, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x22, 0x9f, - 0x01, 0x0a, 0x12, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x97, 0x02, 0x0a, 0x03, 0x4b, 0x65, 0x79, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x37, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x08, + 0x69, 0x73, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x39, 0x0a, 0x0a, 0x77, 0x61, 0x73, 0x5f, + 0x6d, 0x61, 0x70, 0x70, 0x65, 0x64, 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, 0x42, + 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x09, 0x77, 0x61, 0x73, 0x4d, 0x61, 0x70, + 0x70, 0x65, 0x64, 0x12, 0x33, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, + 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x2e, 0x4b, 0x61, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x09, 0x70, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x29, 0x0a, 0x03, 0x6b, 0x61, 0x73, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, + 0x65, 0x79, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x03, + 0x6b, 0x61, 0x73, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, + 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x22, 0x84, 0x01, 0x0a, 0x0c, 0x4b, 0x61, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, + 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x03, 0x70, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x0a, 0xba, 0x48, 0x07, 0x72, 0x05, 0x10, 0x01, 0x18, 0x80, 0x40, 0x52, 0x03, 0x70, 0x65, 0x6d, + 0x12, 0x1b, 0x0a, 0x03, 0x6b, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x09, 0xba, + 0x48, 0x06, 0x72, 0x04, 0x10, 0x01, 0x18, 0x20, 0x52, 0x03, 0x6b, 0x69, 0x64, 0x12, 0x39, 0x0a, + 0x03, 0x61, 0x6c, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x61, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, + 0x41, 0x6c, 0x67, 0x45, 0x6e, 0x75, 0x6d, 0x42, 0x0a, 0xba, 0x48, 0x07, 0x82, 0x01, 0x04, 0x10, + 0x01, 0x20, 0x00, 0x52, 0x03, 0x61, 0x6c, 0x67, 0x22, 0x3b, 0x0a, 0x0f, 0x4b, 0x61, 0x73, 0x50, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x53, 0x65, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x6b, + 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x2e, 0x4b, 0x61, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, + 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, 0xe0, 0x03, 0x0a, 0x09, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x4b, 0x65, 0x79, 0x12, 0x84, 0x03, 0x0a, 0x06, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x42, 0xe9, 0x02, 0xba, 0x48, 0xe5, 0x02, 0xba, 0x01, 0xe1, 0x02, 0x0a, + 0x0a, 0x75, 0x72, 0x69, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0xcf, 0x01, 0x55, 0x52, + 0x49, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x61, 0x20, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x20, 0x55, 0x52, 0x4c, 0x20, 0x28, 0x65, 0x2e, 0x67, 0x2e, 0x2c, 0x20, 0x27, 0x68, 0x74, + 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x64, 0x65, 0x6d, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x27, + 0x29, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x61, 0x64, + 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, + 0x73, 0x2e, 0x20, 0x45, 0x61, 0x63, 0x68, 0x20, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, + 0x6d, 0x75, 0x73, 0x74, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x65, + 0x6e, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x61, 0x6e, 0x20, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x20, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, + 0x72, 0x2c, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x68, + 0x79, 0x70, 0x68, 0x65, 0x6e, 0x73, 0x2c, 0x20, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x6e, 0x75, 0x6d, + 0x65, 0x72, 0x69, 0x63, 0x20, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x73, 0x2c, + 0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x65, 0x73, 0x2e, 0x1a, 0x80, 0x01, + 0x74, 0x68, 0x69, 0x73, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x28, 0x27, 0x5e, 0x68, + 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, + 0x39, 0x5d, 0x28, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, 0x39, 0x5c, 0x5c, 0x2d, + 0x5d, 0x7b, 0x30, 0x2c, 0x36, 0x31, 0x7d, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, + 0x39, 0x5d, 0x29, 0x3f, 0x28, 0x5c, 0x5c, 0x2e, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, + 0x2d, 0x39, 0x5d, 0x28, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, 0x39, 0x5c, 0x5c, + 0x2d, 0x5d, 0x7b, 0x30, 0x2c, 0x36, 0x31, 0x7d, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, + 0x2d, 0x39, 0x5d, 0x29, 0x3f, 0x29, 0x2a, 0x28, 0x2f, 0x2e, 0x2a, 0x29, 0x3f, 0x24, 0x27, 0x29, + 0x48, 0x00, 0x52, 0x06, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x06, 0x63, 0x61, + 0x63, 0x68, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x61, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, + 0x53, 0x65, 0x74, 0x48, 0x00, 0x52, 0x06, 0x63, 0x61, 0x63, 0x68, 0x65, 0x64, 0x42, 0x0c, 0x0a, + 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x4a, 0x04, 0x08, 0x02, 0x10, + 0x03, 0x52, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x22, 0x9f, 0x01, 0x0a, 0x12, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x08, + 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0xca, 0x03, 0x0a, 0x17, 0x52, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x36, 0x0a, 0x08, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, + 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x12, 0x6c, 0x0a, 0x17, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, + 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x52, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x15, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x22, 0xca, 0x03, 0x0a, 0x17, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x52, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x12, 0x36, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x52, 0x65, - 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x6c, 0x0a, 0x17, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x52, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x52, 0x15, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, - 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0xb4, 0x01, 0x0a, 0x14, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, - 0x26, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0e, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x0f, 0x61, 0x74, 0x74, 0x72, 0x69, - 0x62, 0x75, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, - 0x0e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, + 0x1a, 0xb4, 0x01, 0x0a, 0x14, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x26, 0x0a, 0x06, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x36, 0x0a, 0x0f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0e, 0x61, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0xc0, 0x01, 0x0a, 0x0a, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2f, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x09, 0x6e, 0x61, + 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2f, 0x0a, 0x06, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x08, + 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0xd0, 0x01, 0x0a, 0x0f, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x32, + 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x35, 0x0a, 0x08, 0x74, 0x72, 0x69, 0x67, + 0x67, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, + 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x08, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x73, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0xc0, 0x01, - 0x0a, 0x0a, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2f, 0x0a, 0x09, - 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x11, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x2f, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x22, 0xd0, 0x01, 0x0a, 0x0f, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x35, - 0x0a, 0x08, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x08, 0x74, 0x72, 0x69, - 0x67, 0x67, 0x65, 0x72, 0x73, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, - 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x22, 0xf5, 0x01, 0x0a, 0x11, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x42, 0x0a, 0x10, 0x6f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, 0x6f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x26, 0x0a, - 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, - 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x0f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, - 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0e, 0x61, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x61, 0x0a, 0x06, 0x4b, - 0x61, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x61, 0x73, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6b, 0x61, 0x73, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x2e, 0x41, 0x73, 0x79, 0x6d, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x6b, 0x61, 0x73, 0x5f, 0x75, 0x72, 0x69, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6b, 0x61, 0x73, 0x55, 0x72, 0x69, 0x22, 0x29, - 0x0a, 0x0c, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x19, - 0x0a, 0x03, 0x70, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, - 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x70, 0x65, 0x6d, 0x22, 0x50, 0x0a, 0x0d, 0x50, 0x72, 0x69, - 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x1e, 0x0a, 0x06, 0x6b, 0x65, - 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, - 0x02, 0x10, 0x01, 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x72, - 0x61, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0a, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x22, 0xd1, 0x03, 0x0a, 0x0d, - 0x41, 0x73, 0x79, 0x6d, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x15, 0x0a, - 0x06, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6b, - 0x65, 0x79, 0x49, 0x64, 0x12, 0x36, 0x0a, 0x0d, 0x6b, 0x65, 0x79, 0x5f, 0x61, 0x6c, 0x67, 0x6f, - 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x52, 0x0c, - 0x6b, 0x65, 0x79, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x30, 0x0a, 0x0a, - 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x11, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x52, 0x09, 0x6b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, - 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x0f, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x4d, 0x6f, 0x64, - 0x65, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x3a, 0x0a, 0x0e, 0x70, 0x75, - 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x63, 0x74, 0x78, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x52, 0x0c, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, - 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x3d, 0x0a, 0x0f, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, - 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x63, 0x74, 0x78, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x15, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, - 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x52, 0x0d, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, - 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x42, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, - 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, - 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, - 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x76, 0x69, - 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x67, - 0x61, 0x63, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x6c, 0x65, 0x67, 0x61, 0x63, - 0x79, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, - 0x9e, 0x02, 0x0a, 0x0c, 0x53, 0x79, 0x6d, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, - 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, - 0x6b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, 0x0a, 0x08, 0x6b, 0x65, 0x79, - 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x07, 0x6b, 0x65, - 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x6b, 0x65, 0x79, 0x5f, 0x63, 0x74, 0x78, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x42, - 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x2e, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x2a, 0xb3, 0x01, 0x0a, 0x15, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x75, - 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x28, 0x0a, 0x24, 0x41, 0x54, - 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x23, 0x0a, 0x1f, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, + 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0xf5, 0x01, + 0x0a, 0x11, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, + 0x67, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x42, 0x0a, 0x10, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, + 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x26, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x36, 0x0a, 0x0f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x61, 0x0a, 0x06, 0x4b, 0x61, 0x73, 0x4b, 0x65, 0x79, 0x12, + 0x15, 0x0a, 0x06, 0x6b, 0x61, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x6b, 0x61, 0x73, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, 0x73, 0x79, + 0x6d, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x17, 0x0a, 0x07, 0x6b, 0x61, 0x73, 0x5f, 0x75, 0x72, 0x69, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x6b, 0x61, 0x73, 0x55, 0x72, 0x69, 0x22, 0x29, 0x0a, 0x0c, 0x50, 0x75, 0x62, 0x6c, + 0x69, 0x63, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x19, 0x0a, 0x03, 0x70, 0x65, 0x6d, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, + 0x70, 0x65, 0x6d, 0x22, 0x50, 0x0a, 0x0d, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, + 0x79, 0x43, 0x74, 0x78, 0x12, 0x1e, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x05, 0x6b, + 0x65, 0x79, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x5f, + 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x72, 0x61, 0x70, 0x70, + 0x65, 0x64, 0x4b, 0x65, 0x79, 0x22, 0xd1, 0x03, 0x0a, 0x0d, 0x41, 0x73, 0x79, 0x6d, 0x6d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x5f, 0x69, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x36, + 0x0a, 0x0d, 0x6b, 0x65, 0x79, 0x5f, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, + 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x52, 0x0c, 0x6b, 0x65, 0x79, 0x41, 0x6c, 0x67, + 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x30, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x6b, + 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, + 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x07, 0x6b, 0x65, 0x79, + 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x3a, 0x0a, 0x0e, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, + 0x65, 0x79, 0x5f, 0x63, 0x74, 0x78, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x43, + 0x74, 0x78, 0x52, 0x0c, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, + 0x12, 0x3d, 0x0a, 0x0f, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x5f, + 0x63, 0x74, 0x78, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, + 0x52, 0x0d, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, + 0x42, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x06, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x12, 0x2c, 0x0a, 0x08, 0x6d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x9e, 0x02, 0x0a, 0x0c, 0x53, 0x79, + 0x6d, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x65, + 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, + 0x64, 0x12, 0x30, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, + 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x6b, 0x65, 0x79, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x12, 0x2a, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, + 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x12, + 0x17, 0x0a, 0x07, 0x6b, 0x65, 0x79, 0x5f, 0x63, 0x74, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x06, 0x6b, 0x65, 0x79, 0x43, 0x74, 0x78, 0x12, 0x42, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x76, + 0x69, 0x64, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x65, 0x79, 0x50, 0x72, + 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0e, 0x70, 0x72, + 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2c, 0x0a, 0x08, + 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2a, 0xb3, 0x01, 0x0a, 0x15, 0x41, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x75, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, + 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x28, 0x0a, 0x24, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, - 0x5f, 0x41, 0x4c, 0x4c, 0x5f, 0x4f, 0x46, 0x10, 0x01, 0x12, 0x23, 0x0a, 0x1f, 0x41, 0x54, 0x54, - 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, - 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, 0x4e, 0x59, 0x5f, 0x4f, 0x46, 0x10, 0x02, 0x12, 0x26, - 0x0a, 0x22, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, - 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x48, 0x49, 0x45, 0x52, 0x41, - 0x52, 0x43, 0x48, 0x59, 0x10, 0x03, 0x2a, 0xca, 0x01, 0x0a, 0x1a, 0x53, 0x75, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, - 0x72, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x2d, 0x0a, 0x29, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, - 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, - 0x52, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x24, 0x0a, 0x20, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, - 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, - 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x49, 0x4e, 0x10, 0x01, 0x12, 0x28, 0x0a, 0x24, 0x53, 0x55, - 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, - 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, - 0x49, 0x4e, 0x10, 0x02, 0x12, 0x2d, 0x0a, 0x29, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, + 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x23, + 0x0a, 0x1f, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, 0x4c, 0x4c, 0x5f, 0x4f, + 0x46, 0x10, 0x01, 0x12, 0x23, 0x0a, 0x1f, 0x41, 0x54, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, + 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, + 0x41, 0x4e, 0x59, 0x5f, 0x4f, 0x46, 0x10, 0x02, 0x12, 0x26, 0x0a, 0x22, 0x41, 0x54, 0x54, 0x52, + 0x49, 0x42, 0x55, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x48, 0x49, 0x45, 0x52, 0x41, 0x52, 0x43, 0x48, 0x59, 0x10, 0x03, + 0x2a, 0xca, 0x01, 0x0a, 0x1a, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, + 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x45, 0x6e, 0x75, 0x6d, 0x12, + 0x2d, 0x0a, 0x29, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, + 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x55, 0x4d, + 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x24, + 0x0a, 0x20, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, + 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, + 0x49, 0x4e, 0x10, 0x01, 0x12, 0x28, 0x0a, 0x24, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, - 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x49, 0x4e, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, - 0x53, 0x10, 0x03, 0x2a, 0x90, 0x01, 0x0a, 0x18, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, - 0x6e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x45, 0x6e, 0x75, 0x6d, - 0x12, 0x2b, 0x0a, 0x27, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x4f, - 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, - 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x23, 0x0a, - 0x1f, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x45, - 0x41, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, 0x4e, 0x44, - 0x10, 0x01, 0x12, 0x22, 0x0a, 0x1e, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, - 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, - 0x4d, 0x5f, 0x4f, 0x52, 0x10, 0x02, 0x2a, 0x5d, 0x0a, 0x0a, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, - 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, - 0x00, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, - 0x5f, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x53, - 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x52, - 0x4e, 0x41, 0x4c, 0x10, 0x02, 0x2a, 0x88, 0x02, 0x0a, 0x13, 0x4b, 0x61, 0x73, 0x50, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x41, 0x6c, 0x67, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x27, 0x0a, - 0x23, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, - 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, - 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x24, 0x0a, 0x20, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, + 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x2d, + 0x0a, 0x29, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, + 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, + 0x49, 0x4e, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x53, 0x10, 0x03, 0x2a, 0x90, 0x01, + 0x0a, 0x18, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, + 0x61, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x27, 0x43, 0x4f, + 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, + 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x23, 0x0a, 0x1f, 0x43, 0x4f, 0x4e, 0x44, 0x49, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x22, 0x0a, 0x1e, + 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, + 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x4f, 0x52, 0x10, 0x02, + 0x2a, 0x5d, 0x0a, 0x0a, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, + 0x0a, 0x17, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x14, 0x53, + 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x45, 0x52, + 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x02, 0x2a, + 0x88, 0x02, 0x0a, 0x13, 0x4b, 0x61, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, + 0x41, 0x6c, 0x67, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x27, 0x0a, 0x23, 0x4b, 0x41, 0x53, 0x5f, 0x50, + 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, + 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x24, 0x0a, 0x20, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, + 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, + 0x32, 0x30, 0x34, 0x38, 0x10, 0x01, 0x12, 0x24, 0x0a, 0x20, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, - 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x32, 0x30, 0x34, 0x38, 0x10, 0x01, 0x12, 0x24, 0x0a, 0x20, - 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, - 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x34, 0x30, 0x39, 0x36, - 0x10, 0x02, 0x12, 0x28, 0x0a, 0x24, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, - 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x43, - 0x5f, 0x53, 0x45, 0x43, 0x50, 0x32, 0x35, 0x36, 0x52, 0x31, 0x10, 0x05, 0x12, 0x28, 0x0a, 0x24, + 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x34, 0x30, 0x39, 0x36, 0x10, 0x02, 0x12, 0x28, 0x0a, 0x24, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, - 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x53, 0x45, 0x43, 0x50, 0x33, - 0x38, 0x34, 0x52, 0x31, 0x10, 0x06, 0x12, 0x28, 0x0a, 0x24, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, + 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x53, 0x45, 0x43, 0x50, 0x32, + 0x35, 0x36, 0x52, 0x31, 0x10, 0x05, 0x12, 0x28, 0x0a, 0x24, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, - 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x53, 0x45, 0x43, 0x50, 0x35, 0x32, 0x31, 0x52, 0x31, 0x10, 0x07, - 0x2a, 0x9b, 0x01, 0x0a, 0x09, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x19, - 0x0a, 0x15, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, - 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x4c, 0x47, - 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x32, 0x30, 0x34, 0x38, 0x10, - 0x01, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x52, - 0x53, 0x41, 0x5f, 0x34, 0x30, 0x39, 0x36, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x4c, 0x47, - 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x50, 0x32, 0x35, 0x36, 0x10, 0x03, - 0x12, 0x15, 0x0a, 0x11, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x45, 0x43, - 0x5f, 0x50, 0x33, 0x38, 0x34, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x4c, 0x47, 0x4f, 0x52, - 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x50, 0x35, 0x32, 0x31, 0x10, 0x05, 0x2a, 0x56, - 0x0a, 0x09, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x16, 0x4b, - 0x45, 0x59, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, - 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x4b, 0x45, 0x59, 0x5f, 0x53, - 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x16, - 0x0a, 0x12, 0x4b, 0x45, 0x59, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x52, 0x4f, 0x54, - 0x41, 0x54, 0x45, 0x44, 0x10, 0x02, 0x2a, 0x94, 0x01, 0x0a, 0x07, 0x4b, 0x65, 0x79, 0x4d, 0x6f, - 0x64, 0x65, 0x12, 0x18, 0x0a, 0x14, 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x55, - 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, - 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x5f, - 0x52, 0x4f, 0x4f, 0x54, 0x5f, 0x4b, 0x45, 0x59, 0x10, 0x01, 0x12, 0x1e, 0x0a, 0x1a, 0x4b, 0x45, - 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x52, 0x5f, - 0x52, 0x4f, 0x4f, 0x54, 0x5f, 0x4b, 0x45, 0x59, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x4b, 0x45, - 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x54, 0x45, 0x10, 0x03, 0x12, - 0x1c, 0x0a, 0x18, 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x50, 0x55, 0x42, 0x4c, - 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x04, 0x42, 0x82, 0x01, - 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x42, 0x0c, 0x4f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x64, 0x66, - 0x2f, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, - 0x6f, 0x6c, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0xa2, 0x02, 0x03, 0x50, - 0x58, 0x58, 0xaa, 0x02, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0xca, 0x02, 0x06, 0x50, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0xe2, 0x02, 0x12, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x47, 0x50, - 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x50, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x53, 0x45, 0x43, 0x50, 0x33, 0x38, 0x34, 0x52, 0x31, 0x10, 0x06, + 0x12, 0x28, 0x0a, 0x24, 0x4b, 0x41, 0x53, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, + 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x47, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x53, + 0x45, 0x43, 0x50, 0x35, 0x32, 0x31, 0x52, 0x31, 0x10, 0x07, 0x2a, 0x9b, 0x01, 0x0a, 0x09, 0x41, + 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x4c, 0x47, 0x4f, + 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, + 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x32, 0x30, 0x34, 0x38, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x41, + 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x34, 0x30, 0x39, + 0x36, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, + 0x5f, 0x45, 0x43, 0x5f, 0x50, 0x32, 0x35, 0x36, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x4c, + 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x45, 0x43, 0x5f, 0x50, 0x33, 0x38, 0x34, 0x10, + 0x04, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x4c, 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x5f, 0x45, + 0x43, 0x5f, 0x50, 0x35, 0x32, 0x31, 0x10, 0x05, 0x2a, 0x56, 0x0a, 0x09, 0x4b, 0x65, 0x79, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x16, 0x4b, 0x45, 0x59, 0x5f, 0x53, 0x54, 0x41, + 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x15, 0x0a, 0x11, 0x4b, 0x45, 0x59, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, + 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4b, 0x45, 0x59, 0x5f, + 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x52, 0x4f, 0x54, 0x41, 0x54, 0x45, 0x44, 0x10, 0x02, + 0x2a, 0x94, 0x01, 0x0a, 0x07, 0x4b, 0x65, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x14, + 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, + 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, + 0x44, 0x45, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x5f, 0x52, 0x4f, 0x4f, 0x54, 0x5f, 0x4b, + 0x45, 0x59, 0x10, 0x01, 0x12, 0x1e, 0x0a, 0x1a, 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, + 0x5f, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x52, 0x5f, 0x52, 0x4f, 0x4f, 0x54, 0x5f, 0x4b, + 0x45, 0x59, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x4b, 0x45, 0x59, 0x5f, 0x4d, 0x4f, 0x44, 0x45, + 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x54, 0x45, 0x10, 0x03, 0x12, 0x1c, 0x0a, 0x18, 0x4b, 0x45, 0x59, + 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, + 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x04, 0x42, 0x82, 0x01, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, + 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x42, 0x0c, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x64, 0x66, 0x2f, 0x70, 0x6c, 0x61, 0x74, 0x66, + 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x67, 0x6f, 0x2f, + 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0xa2, 0x02, 0x03, 0x50, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x50, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0xca, 0x02, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0xe2, 0x02, + 0x12, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( From 4b27a76c165614462f34eed89897ab2bb87fcdc6 Mon Sep 17 00:00:00 2001 From: Chris Reed Date: Fri, 5 Sep 2025 07:23:05 -0500 Subject: [PATCH 130/137] proto generate. --- service/policy/obligations/obligations.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/service/policy/obligations/obligations.proto b/service/policy/obligations/obligations.proto index b29af8fb6d..c895cdfb5a 100644 --- a/service/policy/obligations/obligations.proto +++ b/service/policy/obligations/obligations.proto @@ -174,6 +174,7 @@ message AddObligationTriggerResponse { } message RemoveObligationTriggerRequest { + // Required string id = 1 [(buf.validate.field).string.uuid = true]; } From af688bd70334c4ad48e52bae7fd522e09091ae40 Mon Sep 17 00:00:00 2001 From: Chris Reed Date: Fri, 5 Sep 2025 07:24:41 -0500 Subject: [PATCH 131/137] proto generate. --- docs/grpc/index.html | 2 +- docs/openapi/policy/obligations/obligations.openapi.yaml | 1 + protocol/go/policy/obligations/obligations.pb.go | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/grpc/index.html b/docs/grpc/index.html index 6bb5555227..97b2fc8781 100644 --- a/docs/grpc/index.html +++ b/docs/grpc/index.html @@ -12896,7 +12896,7 @@

RemoveObligationTrigg id string -

+

Required

diff --git a/docs/openapi/policy/obligations/obligations.openapi.yaml b/docs/openapi/policy/obligations/obligations.openapi.yaml index 3824d79692..158bb43dc6 100644 --- a/docs/openapi/policy/obligations/obligations.openapi.yaml +++ b/docs/openapi/policy/obligations/obligations.openapi.yaml @@ -1610,6 +1610,7 @@ components: type: string title: id format: uuid + description: Required title: RemoveObligationTriggerRequest additionalProperties: false policy.obligations.RemoveObligationTriggerResponse: diff --git a/protocol/go/policy/obligations/obligations.pb.go b/protocol/go/policy/obligations/obligations.pb.go index 67c7d7530f..eb910429db 100644 --- a/protocol/go/policy/obligations/obligations.pb.go +++ b/protocol/go/policy/obligations/obligations.pb.go @@ -1547,6 +1547,7 @@ type RemoveObligationTriggerRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // Required Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` } From d8ac7ed75aec26b97513725d9f146e1de2110d8d Mon Sep 17 00:00:00 2001 From: Chris Reed Date: Fri, 5 Sep 2025 13:12:31 -0500 Subject: [PATCH 132/137] add identifiers. --- buf.lock | 8 +- docs/grpc/index.html | 82 +- .../obligations/obligations.openapi.yaml | 52 +- .../go/policy/attributes/attributes.pb.go | 4 +- .../key_access_server_registry.pb.go | 4 +- .../go/policy/namespaces/namespaces.pb.go | 2 +- .../go/policy/obligations/obligations.pb.go | 1147 ++++++++++------- service/go.mod | 6 +- service/go.sum | 12 +- .../integration/obligation_triggers_test.go | 92 +- service/policy/attributes/attributes.proto | 4 +- service/policy/db/obligations.go | 14 +- service/policy/db/obligations.sql.go | 107 +- service/policy/db/queries/obligations.sql | 50 +- .../key_access_server_registry.proto | 4 +- service/policy/namespaces/namespaces.proto | 2 +- service/policy/obligations/obligations.go | 23 +- service/policy/obligations/obligations.proto | 23 +- .../policy/obligations/obligations_test.go | 86 +- 19 files changed, 1112 insertions(+), 610 deletions(-) diff --git a/buf.lock b/buf.lock index 10d51eb791..22c5f3b2a3 100644 --- a/buf.lock +++ b/buf.lock @@ -2,11 +2,11 @@ version: v2 deps: - name: buf.build/bufbuild/protovalidate - commit: 63bb56e204954558946a641ef0d68910 - digest: b5:ec5661b2855484eca2043fe61d27eb22673ab926ccd0e849531752eb17b08402fae1382705cee7f7b42d4d9ec56aff72bba7ec6835902cf6f86323c9ac682d16 + commit: 6c6e0d3c608e4549802254a2eee81bc8 + digest: b5:a7ca081f38656fc0f5aaa685cc111d3342876723851b47ca6b80cbb810cbb2380f8c444115c495ada58fa1f85eff44e68dc54a445761c195acdb5e8d9af675b6 - name: buf.build/googleapis/googleapis - commit: 83c0f6c19b2f4ea0b0fd84a80e753659 - digest: b5:e9d077ad9d2eaa08a056108a15292a69548880d3a935781c498f2e591e60e531e49e1f5fc1d7356e5f989d3a8540e9885a02df18cb0cecc4ffa439fa4438a09e + commit: 61b203b9a9164be9a834f58c37be6f62 + digest: b5:7811a98b35bd2e4ae5c3ac73c8b3d9ae429f3a790da15de188dc98fc2b77d6bb10e45711f14903af9553fa9821dff256054f2e4b7795789265bc476bec2f088c - name: buf.build/grpc-ecosystem/grpc-gateway commit: 4c5ba75caaf84e928b7137ae5c18c26a digest: b5:c113e62fb3b29289af785866cae062b55ec8ae19ab3f08f3004098928fbca657730a06810b2012951294326b95669547194fa84476b9e9b688d4f8bf77a0691d diff --git a/docs/grpc/index.html b/docs/grpc/index.html index 97b2fc8781..40f6c863b8 100644 --- a/docs/grpc/index.html +++ b/docs/grpc/index.html @@ -1492,6 +1492,14 @@

Table of Contents

MGetObligationsByFQNsResponse.FqnObligationMapEntry +
  • + MIdFqnIdentifier +
  • + +
  • + MIdNameIdentifier +
  • +
  • MListObligationsRequest
  • @@ -12229,22 +12237,22 @@

    AddObligationTriggerRequ - obligation_value_id - string + obligation_value + IdFqnIdentifier

    Required

    - action_id - string + action + IdNameIdentifier

    Required

    - attribute_value_id - string + attribute_value + IdFqnIdentifier

    Required

    @@ -12813,6 +12821,68 @@

    G +

    IdFqnIdentifier

    +

    + + + + + + + + + + + + + + + + + + + + + + + +
    FieldTypeLabelDescription
    idstring

    fqnstring

    + + + + + +

    IdNameIdentifier

    +

    + + + + + + + + + + + + + + + + + + + + + + + +
    FieldTypeLabelDescription
    idstring

    namestring

    + + + + +

    ListObligationsRequest

    diff --git a/docs/openapi/policy/obligations/obligations.openapi.yaml b/docs/openapi/policy/obligations/obligations.openapi.yaml index 158bb43dc6..33165d06cf 100644 --- a/docs/openapi/policy/obligations/obligations.openapi.yaml +++ b/docs/openapi/policy/obligations/obligations.openapi.yaml @@ -1280,21 +1280,18 @@ components: policy.obligations.AddObligationTriggerRequest: type: object properties: - obligationValueId: - type: string - title: obligation_value_id - format: uuid + obligationValue: + title: obligation_value description: Required - actionId: - type: string - title: action_id - format: uuid + $ref: '#/components/schemas/policy.obligations.IdFqnIdentifier' + action: + title: action description: Required - attributeValueId: - type: string - title: attribute_value_id - format: uuid + $ref: '#/components/schemas/policy.obligations.IdNameIdentifier' + attributeValue: + title: attribute_value description: Required + $ref: '#/components/schemas/policy.obligations.IdFqnIdentifier' metadata: title: metadata description: |- @@ -1302,6 +1299,10 @@ components: Common metadata $ref: '#/components/schemas/common.MetadataMutable' title: AddObligationTriggerRequest + required: + - obligationValue + - action + - attributeValue additionalProperties: false description: Triggers policy.obligations.AddObligationTriggerResponse: @@ -1566,6 +1567,33 @@ components: $ref: '#/components/schemas/policy.Obligation' title: FqnObligationMapEntry additionalProperties: false + policy.obligations.IdFqnIdentifier: + type: object + properties: + id: + type: string + title: id + format: uuid + fqn: + type: string + title: fqn + minLength: 1 + format: uri + title: IdFqnIdentifier + additionalProperties: false + policy.obligations.IdNameIdentifier: + type: object + properties: + id: + type: string + title: id + format: uuid + name: + type: string + title: name + minLength: 1 + title: IdNameIdentifier + additionalProperties: false policy.obligations.ListObligationsRequest: type: object oneOf: diff --git a/protocol/go/policy/attributes/attributes.pb.go b/protocol/go/policy/attributes/attributes.pb.go index 3559202e26..93e627f6e0 100644 --- a/protocol/go/policy/attributes/attributes.pb.go +++ b/protocol/go/policy/attributes/attributes.pb.go @@ -2445,7 +2445,7 @@ var file_policy_attributes_attributes_proto_rawDesc = []byte{ 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xbe, 0x03, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xba, 0x48, 0x08, 0xd8, - 0x01, 0x02, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x18, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2d, 0x0a, + 0x01, 0x01, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x18, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2d, 0x0a, 0x0c, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x48, 0x00, 0x52, 0x0b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x03, @@ -2544,7 +2544,7 @@ var file_policy_attributes_attributes_proto_rawDesc = []byte{ 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x22, 0xab, 0x03, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x0d, 0xba, 0x48, 0x08, 0xd8, 0x01, 0x02, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x18, 0x01, 0x52, + 0x42, 0x0d, 0xba, 0x48, 0x08, 0xd8, 0x01, 0x01, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x18, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x25, 0x0a, 0x08, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x48, 0x00, 0x52, 0x07, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x03, 0x66, 0x71, diff --git a/protocol/go/policy/kasregistry/key_access_server_registry.pb.go b/protocol/go/policy/kasregistry/key_access_server_registry.pb.go index 4408127fad..8e5c7b58b5 100644 --- a/protocol/go/policy/kasregistry/key_access_server_registry.pb.go +++ b/protocol/go/policy/kasregistry/key_access_server_registry.pb.go @@ -3604,7 +3604,7 @@ var file_policy_kasregistry_key_access_server_registry_proto_rawDesc = []byte{ 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe4, 0x03, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x0d, 0xba, 0x48, 0x08, 0xd8, 0x01, 0x02, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x18, 0x01, + 0x09, 0x42, 0x0d, 0xba, 0x48, 0x08, 0xd8, 0x01, 0x01, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x18, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x06, 0x6b, 0x61, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x48, 0x00, 0x52, 0x05, 0x6b, 0x61, 0x73, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, @@ -3860,7 +3860,7 @@ var file_policy_kasregistry_key_access_server_registry_proto_rawDesc = []byte{ 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0x72, 0x05, 0x10, 0x01, 0x88, 0x01, 0x01, 0x48, 0x00, 0x52, 0x06, 0x6b, 0x61, 0x73, 0x55, 0x72, 0x69, 0x12, 0x2f, 0x0a, 0x0d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x0b, 0xba, 0x48, 0x08, 0xd8, 0x01, 0x02, 0x72, 0x03, 0xb0, 0x01, 0x01, + 0x01, 0x28, 0x09, 0x42, 0x0b, 0xba, 0x48, 0x08, 0xd8, 0x01, 0x01, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x0b, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x33, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, diff --git a/protocol/go/policy/namespaces/namespaces.pb.go b/protocol/go/policy/namespaces/namespaces.pb.go index 0360665178..7a58b359e7 100644 --- a/protocol/go/policy/namespaces/namespaces.pb.go +++ b/protocol/go/policy/namespaces/namespaces.pb.go @@ -1102,7 +1102,7 @@ var file_policy_namespaces_namespaces_proto_rawDesc = []byte{ 0x42, 0x0b, 0xba, 0x48, 0x08, 0xc8, 0x01, 0x01, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x22, 0xbe, 0x03, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xba, 0x48, 0x08, 0xd8, 0x01, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xba, 0x48, 0x08, 0xd8, 0x01, 0x01, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x18, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2d, 0x0a, 0x0c, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x48, 0x00, 0x52, 0x0b, 0x6e, diff --git a/protocol/go/policy/obligations/obligations.pb.go b/protocol/go/policy/obligations/obligations.pb.go index eb910429db..41ab1b9767 100644 --- a/protocol/go/policy/obligations/obligations.pb.go +++ b/protocol/go/policy/obligations/obligations.pb.go @@ -105,6 +105,116 @@ func (*GetObligationRequest_Id) isGetObligationRequest_Identifier() {} func (*GetObligationRequest_Fqn) isGetObligationRequest_Identifier() {} +type IdNameIdentifier struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *IdNameIdentifier) Reset() { + *x = IdNameIdentifier{} + if protoimpl.UnsafeEnabled { + mi := &file_policy_obligations_obligations_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdNameIdentifier) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdNameIdentifier) ProtoMessage() {} + +func (x *IdNameIdentifier) ProtoReflect() protoreflect.Message { + mi := &file_policy_obligations_obligations_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 IdNameIdentifier.ProtoReflect.Descriptor instead. +func (*IdNameIdentifier) Descriptor() ([]byte, []int) { + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{1} +} + +func (x *IdNameIdentifier) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *IdNameIdentifier) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type IdFqnIdentifier struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Fqn string `protobuf:"bytes,2,opt,name=fqn,proto3" json:"fqn,omitempty"` +} + +func (x *IdFqnIdentifier) Reset() { + *x = IdFqnIdentifier{} + if protoimpl.UnsafeEnabled { + mi := &file_policy_obligations_obligations_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdFqnIdentifier) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdFqnIdentifier) ProtoMessage() {} + +func (x *IdFqnIdentifier) ProtoReflect() protoreflect.Message { + mi := &file_policy_obligations_obligations_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 IdFqnIdentifier.ProtoReflect.Descriptor instead. +func (*IdFqnIdentifier) Descriptor() ([]byte, []int) { + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{2} +} + +func (x *IdFqnIdentifier) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *IdFqnIdentifier) GetFqn() string { + if x != nil { + return x.Fqn + } + return "" +} + type GetObligationResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -116,7 +226,7 @@ type GetObligationResponse struct { func (x *GetObligationResponse) Reset() { *x = GetObligationResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[1] + mi := &file_policy_obligations_obligations_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -129,7 +239,7 @@ func (x *GetObligationResponse) String() string { func (*GetObligationResponse) ProtoMessage() {} func (x *GetObligationResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[1] + mi := &file_policy_obligations_obligations_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -142,7 +252,7 @@ func (x *GetObligationResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetObligationResponse.ProtoReflect.Descriptor instead. func (*GetObligationResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{1} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{3} } func (x *GetObligationResponse) GetObligation() *policy.Obligation { @@ -163,7 +273,7 @@ type GetObligationsByFQNsRequest struct { func (x *GetObligationsByFQNsRequest) Reset() { *x = GetObligationsByFQNsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[2] + mi := &file_policy_obligations_obligations_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -176,7 +286,7 @@ func (x *GetObligationsByFQNsRequest) String() string { func (*GetObligationsByFQNsRequest) ProtoMessage() {} func (x *GetObligationsByFQNsRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[2] + mi := &file_policy_obligations_obligations_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -189,7 +299,7 @@ func (x *GetObligationsByFQNsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetObligationsByFQNsRequest.ProtoReflect.Descriptor instead. func (*GetObligationsByFQNsRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{2} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{4} } func (x *GetObligationsByFQNsRequest) GetFqns() []string { @@ -210,7 +320,7 @@ type GetObligationsByFQNsResponse struct { func (x *GetObligationsByFQNsResponse) Reset() { *x = GetObligationsByFQNsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[3] + mi := &file_policy_obligations_obligations_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -223,7 +333,7 @@ func (x *GetObligationsByFQNsResponse) String() string { func (*GetObligationsByFQNsResponse) ProtoMessage() {} func (x *GetObligationsByFQNsResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[3] + mi := &file_policy_obligations_obligations_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -236,7 +346,7 @@ func (x *GetObligationsByFQNsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetObligationsByFQNsResponse.ProtoReflect.Descriptor instead. func (*GetObligationsByFQNsResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{3} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{5} } func (x *GetObligationsByFQNsResponse) GetFqnObligationMap() map[string]*policy.Obligation { @@ -269,7 +379,7 @@ type CreateObligationRequest struct { func (x *CreateObligationRequest) Reset() { *x = CreateObligationRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[4] + mi := &file_policy_obligations_obligations_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -282,7 +392,7 @@ func (x *CreateObligationRequest) String() string { func (*CreateObligationRequest) ProtoMessage() {} func (x *CreateObligationRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[4] + mi := &file_policy_obligations_obligations_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -295,7 +405,7 @@ func (x *CreateObligationRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateObligationRequest.ProtoReflect.Descriptor instead. func (*CreateObligationRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{4} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{6} } func (m *CreateObligationRequest) GetNamespaceIdentifier() isCreateObligationRequest_NamespaceIdentifier { @@ -367,7 +477,7 @@ type CreateObligationResponse struct { func (x *CreateObligationResponse) Reset() { *x = CreateObligationResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[5] + mi := &file_policy_obligations_obligations_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -380,7 +490,7 @@ func (x *CreateObligationResponse) String() string { func (*CreateObligationResponse) ProtoMessage() {} func (x *CreateObligationResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[5] + mi := &file_policy_obligations_obligations_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -393,7 +503,7 @@ func (x *CreateObligationResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateObligationResponse.ProtoReflect.Descriptor instead. func (*CreateObligationResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{5} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{7} } func (x *CreateObligationResponse) GetObligation() *policy.Obligation { @@ -419,7 +529,7 @@ type UpdateObligationRequest struct { func (x *UpdateObligationRequest) Reset() { *x = UpdateObligationRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[6] + mi := &file_policy_obligations_obligations_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -432,7 +542,7 @@ func (x *UpdateObligationRequest) String() string { func (*UpdateObligationRequest) ProtoMessage() {} func (x *UpdateObligationRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[6] + mi := &file_policy_obligations_obligations_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -445,7 +555,7 @@ func (x *UpdateObligationRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateObligationRequest.ProtoReflect.Descriptor instead. func (*UpdateObligationRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{6} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{8} } func (x *UpdateObligationRequest) GetId() string { @@ -487,7 +597,7 @@ type UpdateObligationResponse struct { func (x *UpdateObligationResponse) Reset() { *x = UpdateObligationResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[7] + mi := &file_policy_obligations_obligations_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -500,7 +610,7 @@ func (x *UpdateObligationResponse) String() string { func (*UpdateObligationResponse) ProtoMessage() {} func (x *UpdateObligationResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[7] + mi := &file_policy_obligations_obligations_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -513,7 +623,7 @@ func (x *UpdateObligationResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateObligationResponse.ProtoReflect.Descriptor instead. func (*UpdateObligationResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{7} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{9} } func (x *UpdateObligationResponse) GetObligation() *policy.Obligation { @@ -538,7 +648,7 @@ type DeleteObligationRequest struct { func (x *DeleteObligationRequest) Reset() { *x = DeleteObligationRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[8] + mi := &file_policy_obligations_obligations_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -551,7 +661,7 @@ func (x *DeleteObligationRequest) String() string { func (*DeleteObligationRequest) ProtoMessage() {} func (x *DeleteObligationRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[8] + mi := &file_policy_obligations_obligations_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -564,7 +674,7 @@ func (x *DeleteObligationRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteObligationRequest.ProtoReflect.Descriptor instead. func (*DeleteObligationRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{8} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{10} } func (m *DeleteObligationRequest) GetIdentifier() isDeleteObligationRequest_Identifier { @@ -615,7 +725,7 @@ type DeleteObligationResponse struct { func (x *DeleteObligationResponse) Reset() { *x = DeleteObligationResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[9] + mi := &file_policy_obligations_obligations_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -628,7 +738,7 @@ func (x *DeleteObligationResponse) String() string { func (*DeleteObligationResponse) ProtoMessage() {} func (x *DeleteObligationResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[9] + mi := &file_policy_obligations_obligations_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -641,7 +751,7 @@ func (x *DeleteObligationResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteObligationResponse.ProtoReflect.Descriptor instead. func (*DeleteObligationResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{9} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{11} } func (x *DeleteObligationResponse) GetObligation() *policy.Obligation { @@ -671,7 +781,7 @@ type ListObligationsRequest struct { func (x *ListObligationsRequest) Reset() { *x = ListObligationsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[10] + mi := &file_policy_obligations_obligations_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -684,7 +794,7 @@ func (x *ListObligationsRequest) String() string { func (*ListObligationsRequest) ProtoMessage() {} func (x *ListObligationsRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[10] + mi := &file_policy_obligations_obligations_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -697,7 +807,7 @@ func (x *ListObligationsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListObligationsRequest.ProtoReflect.Descriptor instead. func (*ListObligationsRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{10} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{12} } func (m *ListObligationsRequest) GetNamespaceIdentifier() isListObligationsRequest_NamespaceIdentifier { @@ -756,7 +866,7 @@ type ListObligationsResponse struct { func (x *ListObligationsResponse) Reset() { *x = ListObligationsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[11] + mi := &file_policy_obligations_obligations_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -769,7 +879,7 @@ func (x *ListObligationsResponse) String() string { func (*ListObligationsResponse) ProtoMessage() {} func (x *ListObligationsResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[11] + mi := &file_policy_obligations_obligations_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -782,7 +892,7 @@ func (x *ListObligationsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListObligationsResponse.ProtoReflect.Descriptor instead. func (*ListObligationsResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{11} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{13} } func (x *ListObligationsResponse) GetObligations() []*policy.Obligation { @@ -815,7 +925,7 @@ type GetObligationValueRequest struct { func (x *GetObligationValueRequest) Reset() { *x = GetObligationValueRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[12] + mi := &file_policy_obligations_obligations_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -828,7 +938,7 @@ func (x *GetObligationValueRequest) String() string { func (*GetObligationValueRequest) ProtoMessage() {} func (x *GetObligationValueRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[12] + mi := &file_policy_obligations_obligations_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -841,7 +951,7 @@ func (x *GetObligationValueRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetObligationValueRequest.ProtoReflect.Descriptor instead. func (*GetObligationValueRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{12} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{14} } func (m *GetObligationValueRequest) GetIdentifier() isGetObligationValueRequest_Identifier { @@ -892,7 +1002,7 @@ type GetObligationValueResponse struct { func (x *GetObligationValueResponse) Reset() { *x = GetObligationValueResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[13] + mi := &file_policy_obligations_obligations_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -905,7 +1015,7 @@ func (x *GetObligationValueResponse) String() string { func (*GetObligationValueResponse) ProtoMessage() {} func (x *GetObligationValueResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[13] + mi := &file_policy_obligations_obligations_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -918,7 +1028,7 @@ func (x *GetObligationValueResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetObligationValueResponse.ProtoReflect.Descriptor instead. func (*GetObligationValueResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{13} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{15} } func (x *GetObligationValueResponse) GetValue() *policy.ObligationValue { @@ -939,7 +1049,7 @@ type GetObligationValuesByFQNsRequest struct { func (x *GetObligationValuesByFQNsRequest) Reset() { *x = GetObligationValuesByFQNsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[14] + mi := &file_policy_obligations_obligations_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -952,7 +1062,7 @@ func (x *GetObligationValuesByFQNsRequest) String() string { func (*GetObligationValuesByFQNsRequest) ProtoMessage() {} func (x *GetObligationValuesByFQNsRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[14] + mi := &file_policy_obligations_obligations_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -965,7 +1075,7 @@ func (x *GetObligationValuesByFQNsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetObligationValuesByFQNsRequest.ProtoReflect.Descriptor instead. func (*GetObligationValuesByFQNsRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{14} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{16} } func (x *GetObligationValuesByFQNsRequest) GetFqns() []string { @@ -986,7 +1096,7 @@ type GetObligationValuesByFQNsResponse struct { func (x *GetObligationValuesByFQNsResponse) Reset() { *x = GetObligationValuesByFQNsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[15] + mi := &file_policy_obligations_obligations_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -999,7 +1109,7 @@ func (x *GetObligationValuesByFQNsResponse) String() string { func (*GetObligationValuesByFQNsResponse) ProtoMessage() {} func (x *GetObligationValuesByFQNsResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[15] + mi := &file_policy_obligations_obligations_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1012,7 +1122,7 @@ func (x *GetObligationValuesByFQNsResponse) ProtoReflect() protoreflect.Message // Deprecated: Use GetObligationValuesByFQNsResponse.ProtoReflect.Descriptor instead. func (*GetObligationValuesByFQNsResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{15} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{17} } func (x *GetObligationValuesByFQNsResponse) GetFqnValueMap() map[string]*policy.ObligationValue { @@ -1043,7 +1153,7 @@ type CreateObligationValueRequest struct { func (x *CreateObligationValueRequest) Reset() { *x = CreateObligationValueRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[16] + mi := &file_policy_obligations_obligations_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1056,7 +1166,7 @@ func (x *CreateObligationValueRequest) String() string { func (*CreateObligationValueRequest) ProtoMessage() {} func (x *CreateObligationValueRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[16] + mi := &file_policy_obligations_obligations_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1069,7 +1179,7 @@ func (x *CreateObligationValueRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateObligationValueRequest.ProtoReflect.Descriptor instead. func (*CreateObligationValueRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{16} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{18} } func (m *CreateObligationValueRequest) GetObligationIdentifier() isCreateObligationValueRequest_ObligationIdentifier { @@ -1134,7 +1244,7 @@ type CreateObligationValueResponse struct { func (x *CreateObligationValueResponse) Reset() { *x = CreateObligationValueResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[17] + mi := &file_policy_obligations_obligations_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1147,7 +1257,7 @@ func (x *CreateObligationValueResponse) String() string { func (*CreateObligationValueResponse) ProtoMessage() {} func (x *CreateObligationValueResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[17] + mi := &file_policy_obligations_obligations_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1160,7 +1270,7 @@ func (x *CreateObligationValueResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateObligationValueResponse.ProtoReflect.Descriptor instead. func (*CreateObligationValueResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{17} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{19} } func (x *CreateObligationValueResponse) GetValue() *policy.ObligationValue { @@ -1186,7 +1296,7 @@ type UpdateObligationValueRequest struct { func (x *UpdateObligationValueRequest) Reset() { *x = UpdateObligationValueRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[18] + mi := &file_policy_obligations_obligations_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1199,7 +1309,7 @@ func (x *UpdateObligationValueRequest) String() string { func (*UpdateObligationValueRequest) ProtoMessage() {} func (x *UpdateObligationValueRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[18] + mi := &file_policy_obligations_obligations_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1212,7 +1322,7 @@ func (x *UpdateObligationValueRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateObligationValueRequest.ProtoReflect.Descriptor instead. func (*UpdateObligationValueRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{18} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{20} } func (x *UpdateObligationValueRequest) GetId() string { @@ -1254,7 +1364,7 @@ type UpdateObligationValueResponse struct { func (x *UpdateObligationValueResponse) Reset() { *x = UpdateObligationValueResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[19] + mi := &file_policy_obligations_obligations_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1267,7 +1377,7 @@ func (x *UpdateObligationValueResponse) String() string { func (*UpdateObligationValueResponse) ProtoMessage() {} func (x *UpdateObligationValueResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[19] + mi := &file_policy_obligations_obligations_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1280,7 +1390,7 @@ func (x *UpdateObligationValueResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateObligationValueResponse.ProtoReflect.Descriptor instead. func (*UpdateObligationValueResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{19} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{21} } func (x *UpdateObligationValueResponse) GetValue() *policy.ObligationValue { @@ -1305,7 +1415,7 @@ type DeleteObligationValueRequest struct { func (x *DeleteObligationValueRequest) Reset() { *x = DeleteObligationValueRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[20] + mi := &file_policy_obligations_obligations_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1318,7 +1428,7 @@ func (x *DeleteObligationValueRequest) String() string { func (*DeleteObligationValueRequest) ProtoMessage() {} func (x *DeleteObligationValueRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[20] + mi := &file_policy_obligations_obligations_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1331,7 +1441,7 @@ func (x *DeleteObligationValueRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteObligationValueRequest.ProtoReflect.Descriptor instead. func (*DeleteObligationValueRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{20} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{22} } func (m *DeleteObligationValueRequest) GetIdentifier() isDeleteObligationValueRequest_Identifier { @@ -1382,7 +1492,7 @@ type DeleteObligationValueResponse struct { func (x *DeleteObligationValueResponse) Reset() { *x = DeleteObligationValueResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[21] + mi := &file_policy_obligations_obligations_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1395,7 +1505,7 @@ func (x *DeleteObligationValueResponse) String() string { func (*DeleteObligationValueResponse) ProtoMessage() {} func (x *DeleteObligationValueResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[21] + mi := &file_policy_obligations_obligations_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1408,7 +1518,7 @@ func (x *DeleteObligationValueResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteObligationValueResponse.ProtoReflect.Descriptor instead. func (*DeleteObligationValueResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{21} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{23} } func (x *DeleteObligationValueResponse) GetValue() *policy.ObligationValue { @@ -1425,11 +1535,11 @@ type AddObligationTriggerRequest struct { unknownFields protoimpl.UnknownFields // Required - ObligationValueId string `protobuf:"bytes,1,opt,name=obligation_value_id,json=obligationValueId,proto3" json:"obligation_value_id,omitempty"` + ObligationValue *IdFqnIdentifier `protobuf:"bytes,1,opt,name=obligation_value,json=obligationValue,proto3" json:"obligation_value,omitempty"` // Required - ActionId string `protobuf:"bytes,2,opt,name=action_id,json=actionId,proto3" json:"action_id,omitempty"` + Action *IdNameIdentifier `protobuf:"bytes,2,opt,name=action,proto3" json:"action,omitempty"` // Required - AttributeValueId string `protobuf:"bytes,3,opt,name=attribute_value_id,json=attributeValueId,proto3" json:"attribute_value_id,omitempty"` + AttributeValue *IdFqnIdentifier `protobuf:"bytes,3,opt,name=attribute_value,json=attributeValue,proto3" json:"attribute_value,omitempty"` // Optional // Common metadata Metadata *common.MetadataMutable `protobuf:"bytes,100,opt,name=metadata,proto3" json:"metadata,omitempty"` @@ -1438,7 +1548,7 @@ type AddObligationTriggerRequest struct { func (x *AddObligationTriggerRequest) Reset() { *x = AddObligationTriggerRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[22] + mi := &file_policy_obligations_obligations_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1451,7 +1561,7 @@ func (x *AddObligationTriggerRequest) String() string { func (*AddObligationTriggerRequest) ProtoMessage() {} func (x *AddObligationTriggerRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[22] + mi := &file_policy_obligations_obligations_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1464,28 +1574,28 @@ func (x *AddObligationTriggerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AddObligationTriggerRequest.ProtoReflect.Descriptor instead. func (*AddObligationTriggerRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{22} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{24} } -func (x *AddObligationTriggerRequest) GetObligationValueId() string { +func (x *AddObligationTriggerRequest) GetObligationValue() *IdFqnIdentifier { if x != nil { - return x.ObligationValueId + return x.ObligationValue } - return "" + return nil } -func (x *AddObligationTriggerRequest) GetActionId() string { +func (x *AddObligationTriggerRequest) GetAction() *IdNameIdentifier { if x != nil { - return x.ActionId + return x.Action } - return "" + return nil } -func (x *AddObligationTriggerRequest) GetAttributeValueId() string { +func (x *AddObligationTriggerRequest) GetAttributeValue() *IdFqnIdentifier { if x != nil { - return x.AttributeValueId + return x.AttributeValue } - return "" + return nil } func (x *AddObligationTriggerRequest) GetMetadata() *common.MetadataMutable { @@ -1506,7 +1616,7 @@ type AddObligationTriggerResponse struct { func (x *AddObligationTriggerResponse) Reset() { *x = AddObligationTriggerResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[23] + mi := &file_policy_obligations_obligations_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1519,7 +1629,7 @@ func (x *AddObligationTriggerResponse) String() string { func (*AddObligationTriggerResponse) ProtoMessage() {} func (x *AddObligationTriggerResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[23] + mi := &file_policy_obligations_obligations_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1532,7 +1642,7 @@ func (x *AddObligationTriggerResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AddObligationTriggerResponse.ProtoReflect.Descriptor instead. func (*AddObligationTriggerResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{23} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{25} } func (x *AddObligationTriggerResponse) GetTrigger() *policy.ObligationTrigger { @@ -1554,7 +1664,7 @@ type RemoveObligationTriggerRequest struct { func (x *RemoveObligationTriggerRequest) Reset() { *x = RemoveObligationTriggerRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[24] + mi := &file_policy_obligations_obligations_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1567,7 +1677,7 @@ func (x *RemoveObligationTriggerRequest) String() string { func (*RemoveObligationTriggerRequest) ProtoMessage() {} func (x *RemoveObligationTriggerRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[24] + mi := &file_policy_obligations_obligations_proto_msgTypes[26] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1580,7 +1690,7 @@ func (x *RemoveObligationTriggerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use RemoveObligationTriggerRequest.ProtoReflect.Descriptor instead. func (*RemoveObligationTriggerRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{24} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{26} } func (x *RemoveObligationTriggerRequest) GetId() string { @@ -1601,7 +1711,7 @@ type RemoveObligationTriggerResponse struct { func (x *RemoveObligationTriggerResponse) Reset() { *x = RemoveObligationTriggerResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[25] + mi := &file_policy_obligations_obligations_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1614,7 +1724,7 @@ func (x *RemoveObligationTriggerResponse) String() string { func (*RemoveObligationTriggerResponse) ProtoMessage() {} func (x *RemoveObligationTriggerResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[25] + mi := &file_policy_obligations_obligations_proto_msgTypes[27] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1627,7 +1737,7 @@ func (x *RemoveObligationTriggerResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use RemoveObligationTriggerResponse.ProtoReflect.Descriptor instead. func (*RemoveObligationTriggerResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{25} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{27} } func (x *RemoveObligationTriggerResponse) GetTrigger() *policy.ObligationTrigger { @@ -1654,307 +1764,325 @@ var file_policy_obligations_obligations_proto_rawDesc = []byte{ 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4b, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x22, 0x31, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x04, 0x66, 0x71, 0x6e, 0x73, 0x22, 0xed, 0x01, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x4f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x74, 0x0a, 0x12, 0x66, 0x71, 0x6e, 0x5f, 0x6f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x46, 0x71, 0x6e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x10, 0x66, 0x71, 0x6e, - 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x70, 0x1a, 0x57, 0x0a, - 0x15, 0x46, 0x71, 0x6e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, - 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xb8, 0x01, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x16, 0x0a, 0x14, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, - 0x72, 0x22, 0x4e, 0x0a, 0x18, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, - 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x22, 0xc8, 0x01, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x54, 0x0a, 0x18, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, - 0x6f, 0x72, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, - 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x16, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x22, 0x4e, 0x0a, 0x18, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x5c, 0x0a, 0x10, 0x49, 0x64, 0x4e, 0x61, 0x6d, 0x65, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x3a, 0x11, 0xba, 0x48, 0x0e, 0x22, 0x0c, 0x0a, 0x02, 0x69, 0x64, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x10, 0x01, 0x22, 0x5b, 0x0a, 0x0f, 0x49, 0x64, 0x46, 0x71, 0x6e, 0x49, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x1c, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, + 0xba, 0x48, 0x07, 0x72, 0x05, 0x10, 0x01, 0x88, 0x01, 0x01, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x3a, + 0x10, 0xba, 0x48, 0x0d, 0x22, 0x0b, 0x0a, 0x02, 0x69, 0x64, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x10, + 0x01, 0x22, 0x4b, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x31, + 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, + 0x04, 0x66, 0x71, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x66, 0x71, 0x6e, + 0x73, 0x22, 0xed, 0x01, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x74, 0x0a, 0x12, 0x66, 0x71, 0x6e, 0x5f, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x46, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x2e, 0x46, 0x71, 0x6e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, + 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x10, 0x66, 0x71, 0x6e, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x70, 0x1a, 0x57, 0x0a, 0x15, 0x46, 0x71, 0x6e, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, + 0x01, 0x22, 0xb8, 0x01, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, + 0x66, 0x71, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, + 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x42, 0x16, 0x0a, 0x14, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, 0x18, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4d, 0x0a, 0x17, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x42, 0x0c, 0x0a, - 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, 0x18, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x8b, 0x01, 0x0a, 0x16, - 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x12, 0x33, 0x0a, 0x0a, - 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x13, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x42, 0x16, 0x0a, 0x14, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x85, 0x01, 0x0a, 0x17, 0x4c, 0x69, - 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, - 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x34, 0x0a, 0x0a, 0x70, - 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x14, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x22, 0x4f, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xc8, 0x01, 0x0a, + 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x33, 0x0a, 0x08, + 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x12, 0x54, 0x0a, 0x18, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x18, 0x65, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, + 0x16, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, + 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x22, 0x4e, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4d, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, + 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x8b, 0x01, 0x0a, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x12, 0x33, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x16, 0x0a, 0x14, + 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x66, 0x69, 0x65, 0x72, 0x22, 0x85, 0x01, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x34, 0x0a, 0x0b, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x6f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x34, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4f, 0x0a, 0x19, + 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, + 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x42, + 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4b, 0x0a, + 0x1a, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x36, 0x0a, 0x20, 0x47, 0x65, + 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x66, 0x71, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x66, 0x71, + 0x6e, 0x73, 0x22, 0xe8, 0x01, 0x0a, 0x21, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6a, 0x0a, 0x0d, 0x66, 0x71, 0x6e, 0x5f, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x46, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x46, 0x71, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, + 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x66, 0x71, 0x6e, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x4d, 0x61, 0x70, 0x1a, 0x57, 0x0a, 0x10, 0x46, 0x71, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xa8, 0x01, + 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x03, 0x66, 0x71, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, - 0x65, 0x72, 0x22, 0x4b, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x36, 0x0a, 0x20, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x04, 0x66, 0x71, 0x6e, 0x73, 0x22, 0xe8, 0x01, 0x0a, 0x21, 0x47, 0x65, 0x74, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, - 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6a, 0x0a, - 0x0d, 0x66, 0x71, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, - 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x46, 0x71, 0x6e, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x66, 0x71, - 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x70, 0x1a, 0x57, 0x0a, 0x10, 0x46, 0x71, 0x6e, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x22, 0xa8, 0x01, 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, - 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, + 0x03, 0x66, 0x71, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, + 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, + 0x17, 0x0a, 0x15, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, 0x1d, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xcf, 0x01, 0x0a, 0x1c, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x42, 0x17, 0x0a, 0x15, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, - 0x1d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, - 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xcf, 0x01, - 0x0a, 0x1c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x54, 0x0a, 0x18, 0x6d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x65, 0x68, - 0x61, 0x76, 0x69, 0x6f, 0x72, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x63, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x16, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x22, - 0x4e, 0x0a, 0x1d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x52, 0x0a, 0x1c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x03, 0x66, 0x71, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, - 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, 0x1d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x22, 0xeb, 0x01, 0x0a, 0x1b, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x13, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x11, 0x6f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x64, 0x12, 0x25, 0x0a, - 0x09, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x08, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x36, 0x0a, 0x12, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x10, 0x61, 0x74, 0x74, 0x72, - 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x64, 0x12, 0x33, 0x0a, 0x08, - 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x22, 0x53, 0x0a, 0x1c, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x07, 0x74, - 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x22, 0x3a, 0x0a, 0x1e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, - 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, - 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x02, - 0x69, 0x64, 0x22, 0x56, 0x0a, 0x1f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, - 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, - 0x72, 0x52, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x32, 0xc6, 0x0c, 0x0a, 0x07, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6f, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x69, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x64, 0x61, 0x74, 0x61, 0x12, 0x54, 0x0a, 0x18, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, + 0x18, 0x65, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x6e, + 0x75, 0x6d, 0x52, 0x16, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x22, 0x4e, 0x0a, 0x1d, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x52, 0x0a, 0x1c, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, + 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, + 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, + 0x0a, 0x1d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xc6, + 0x02, 0x0a, 0x1b, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x56, + 0x0a, 0x10, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x64, + 0x46, 0x71, 0x6e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x42, 0x06, 0xba, + 0x48, 0x03, 0xc8, 0x01, 0x01, 0x52, 0x0f, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x44, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, + 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x64, 0x4e, 0x61, + 0x6d, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x42, 0x06, 0xba, 0x48, + 0x03, 0xc8, 0x01, 0x01, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x54, 0x0a, 0x0f, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x64, 0x46, 0x71, 0x6e, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x42, 0x06, 0xba, 0x48, 0x03, 0xc8, + 0x01, 0x01, 0x52, 0x0e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x53, 0x0a, 0x1c, 0x41, 0x64, 0x64, 0x4f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, + 0x67, 0x65, 0x72, 0x52, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x22, 0x3a, 0x0a, 0x1e, + 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, + 0x03, 0xb0, 0x01, 0x01, 0x52, 0x02, 0x69, 0x64, 0x22, 0x56, 0x0a, 0x1f, 0x52, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, + 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x07, 0x74, + 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, + 0x32, 0xc6, 0x0c, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6f, 0x0a, 0x0f, + 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x2a, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x69, 0x0a, + 0x0d, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, - 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, - 0x02, 0x01, 0x12, 0x7e, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x12, 0x2f, 0x2e, 0x70, 0x6f, 0x6c, + 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x7e, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, + 0x12, 0x2f, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x6f, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6f, 0x0a, 0x10, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, + 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, - 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, - 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, - 0x02, 0x01, 0x12, 0x6f, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, - 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x12, 0x6f, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x00, 0x12, 0x6f, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x78, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2d, 0x2e, 0x70, 0x6f, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6f, 0x0a, 0x10, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, - 0x8d, 0x01, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x12, 0x34, 0x2e, - 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, + 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x78, 0x0a, 0x12, 0x47, + 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x12, 0x2d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x2e, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x8d, 0x01, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, + 0x51, 0x4e, 0x73, 0x12, 0x34, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, - 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, - 0x7e, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x7e, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x7e, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x7b, 0x0a, 0x14, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12, 0x2f, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x41, 0x64, 0x64, - 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, - 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x41, 0x64, - 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, - 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x84, 0x01, 0x0a, - 0x17, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12, 0x32, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, - 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, - 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x42, 0xcf, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x10, - 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, - 0x70, 0x65, 0x6e, 0x74, 0x64, 0x66, 0x2f, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x2f, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xa2, 0x02, - 0x03, 0x50, 0x4f, 0x58, 0xaa, 0x02, 0x12, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xca, 0x02, 0x12, 0x50, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x5c, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xe2, 0x02, - 0x1e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x13, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x3a, 0x3a, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x70, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, + 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x7e, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x30, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x7e, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x30, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x7e, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x30, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x7b, 0x0a, 0x14, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12, 0x2f, 0x2e, + 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x12, 0x84, 0x01, 0x0a, 0x17, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12, 0x32, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0xcf, 0x01, 0x0a, 0x16, 0x63, 0x6f, + 0x6d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x10, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x64, 0x66, 0x2f, 0x70, 0x6c, 0x61, + 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x67, + 0x6f, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2f, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x4f, 0x58, 0xaa, 0x02, 0x12, 0x50, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xca, + 0x02, 0x12, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0xe2, 0x02, 0x1e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x4f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x3a, 0x3a, + 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -1969,100 +2097,105 @@ func file_policy_obligations_obligations_proto_rawDescGZIP() []byte { return file_policy_obligations_obligations_proto_rawDescData } -var file_policy_obligations_obligations_proto_msgTypes = make([]protoimpl.MessageInfo, 28) +var file_policy_obligations_obligations_proto_msgTypes = make([]protoimpl.MessageInfo, 30) var file_policy_obligations_obligations_proto_goTypes = []interface{}{ (*GetObligationRequest)(nil), // 0: policy.obligations.GetObligationRequest - (*GetObligationResponse)(nil), // 1: policy.obligations.GetObligationResponse - (*GetObligationsByFQNsRequest)(nil), // 2: policy.obligations.GetObligationsByFQNsRequest - (*GetObligationsByFQNsResponse)(nil), // 3: policy.obligations.GetObligationsByFQNsResponse - (*CreateObligationRequest)(nil), // 4: policy.obligations.CreateObligationRequest - (*CreateObligationResponse)(nil), // 5: policy.obligations.CreateObligationResponse - (*UpdateObligationRequest)(nil), // 6: policy.obligations.UpdateObligationRequest - (*UpdateObligationResponse)(nil), // 7: policy.obligations.UpdateObligationResponse - (*DeleteObligationRequest)(nil), // 8: policy.obligations.DeleteObligationRequest - (*DeleteObligationResponse)(nil), // 9: policy.obligations.DeleteObligationResponse - (*ListObligationsRequest)(nil), // 10: policy.obligations.ListObligationsRequest - (*ListObligationsResponse)(nil), // 11: policy.obligations.ListObligationsResponse - (*GetObligationValueRequest)(nil), // 12: policy.obligations.GetObligationValueRequest - (*GetObligationValueResponse)(nil), // 13: policy.obligations.GetObligationValueResponse - (*GetObligationValuesByFQNsRequest)(nil), // 14: policy.obligations.GetObligationValuesByFQNsRequest - (*GetObligationValuesByFQNsResponse)(nil), // 15: policy.obligations.GetObligationValuesByFQNsResponse - (*CreateObligationValueRequest)(nil), // 16: policy.obligations.CreateObligationValueRequest - (*CreateObligationValueResponse)(nil), // 17: policy.obligations.CreateObligationValueResponse - (*UpdateObligationValueRequest)(nil), // 18: policy.obligations.UpdateObligationValueRequest - (*UpdateObligationValueResponse)(nil), // 19: policy.obligations.UpdateObligationValueResponse - (*DeleteObligationValueRequest)(nil), // 20: policy.obligations.DeleteObligationValueRequest - (*DeleteObligationValueResponse)(nil), // 21: policy.obligations.DeleteObligationValueResponse - (*AddObligationTriggerRequest)(nil), // 22: policy.obligations.AddObligationTriggerRequest - (*AddObligationTriggerResponse)(nil), // 23: policy.obligations.AddObligationTriggerResponse - (*RemoveObligationTriggerRequest)(nil), // 24: policy.obligations.RemoveObligationTriggerRequest - (*RemoveObligationTriggerResponse)(nil), // 25: policy.obligations.RemoveObligationTriggerResponse - nil, // 26: policy.obligations.GetObligationsByFQNsResponse.FqnObligationMapEntry - nil, // 27: policy.obligations.GetObligationValuesByFQNsResponse.FqnValueMapEntry - (*policy.Obligation)(nil), // 28: policy.Obligation - (*common.MetadataMutable)(nil), // 29: common.MetadataMutable - (common.MetadataUpdateEnum)(0), // 30: common.MetadataUpdateEnum - (*policy.PageRequest)(nil), // 31: policy.PageRequest - (*policy.PageResponse)(nil), // 32: policy.PageResponse - (*policy.ObligationValue)(nil), // 33: policy.ObligationValue - (*policy.ObligationTrigger)(nil), // 34: policy.ObligationTrigger + (*IdNameIdentifier)(nil), // 1: policy.obligations.IdNameIdentifier + (*IdFqnIdentifier)(nil), // 2: policy.obligations.IdFqnIdentifier + (*GetObligationResponse)(nil), // 3: policy.obligations.GetObligationResponse + (*GetObligationsByFQNsRequest)(nil), // 4: policy.obligations.GetObligationsByFQNsRequest + (*GetObligationsByFQNsResponse)(nil), // 5: policy.obligations.GetObligationsByFQNsResponse + (*CreateObligationRequest)(nil), // 6: policy.obligations.CreateObligationRequest + (*CreateObligationResponse)(nil), // 7: policy.obligations.CreateObligationResponse + (*UpdateObligationRequest)(nil), // 8: policy.obligations.UpdateObligationRequest + (*UpdateObligationResponse)(nil), // 9: policy.obligations.UpdateObligationResponse + (*DeleteObligationRequest)(nil), // 10: policy.obligations.DeleteObligationRequest + (*DeleteObligationResponse)(nil), // 11: policy.obligations.DeleteObligationResponse + (*ListObligationsRequest)(nil), // 12: policy.obligations.ListObligationsRequest + (*ListObligationsResponse)(nil), // 13: policy.obligations.ListObligationsResponse + (*GetObligationValueRequest)(nil), // 14: policy.obligations.GetObligationValueRequest + (*GetObligationValueResponse)(nil), // 15: policy.obligations.GetObligationValueResponse + (*GetObligationValuesByFQNsRequest)(nil), // 16: policy.obligations.GetObligationValuesByFQNsRequest + (*GetObligationValuesByFQNsResponse)(nil), // 17: policy.obligations.GetObligationValuesByFQNsResponse + (*CreateObligationValueRequest)(nil), // 18: policy.obligations.CreateObligationValueRequest + (*CreateObligationValueResponse)(nil), // 19: policy.obligations.CreateObligationValueResponse + (*UpdateObligationValueRequest)(nil), // 20: policy.obligations.UpdateObligationValueRequest + (*UpdateObligationValueResponse)(nil), // 21: policy.obligations.UpdateObligationValueResponse + (*DeleteObligationValueRequest)(nil), // 22: policy.obligations.DeleteObligationValueRequest + (*DeleteObligationValueResponse)(nil), // 23: policy.obligations.DeleteObligationValueResponse + (*AddObligationTriggerRequest)(nil), // 24: policy.obligations.AddObligationTriggerRequest + (*AddObligationTriggerResponse)(nil), // 25: policy.obligations.AddObligationTriggerResponse + (*RemoveObligationTriggerRequest)(nil), // 26: policy.obligations.RemoveObligationTriggerRequest + (*RemoveObligationTriggerResponse)(nil), // 27: policy.obligations.RemoveObligationTriggerResponse + nil, // 28: policy.obligations.GetObligationsByFQNsResponse.FqnObligationMapEntry + nil, // 29: policy.obligations.GetObligationValuesByFQNsResponse.FqnValueMapEntry + (*policy.Obligation)(nil), // 30: policy.Obligation + (*common.MetadataMutable)(nil), // 31: common.MetadataMutable + (common.MetadataUpdateEnum)(0), // 32: common.MetadataUpdateEnum + (*policy.PageRequest)(nil), // 33: policy.PageRequest + (*policy.PageResponse)(nil), // 34: policy.PageResponse + (*policy.ObligationValue)(nil), // 35: policy.ObligationValue + (*policy.ObligationTrigger)(nil), // 36: policy.ObligationTrigger } var file_policy_obligations_obligations_proto_depIdxs = []int32{ - 28, // 0: policy.obligations.GetObligationResponse.obligation:type_name -> policy.Obligation - 26, // 1: policy.obligations.GetObligationsByFQNsResponse.fqn_obligation_map:type_name -> policy.obligations.GetObligationsByFQNsResponse.FqnObligationMapEntry - 29, // 2: policy.obligations.CreateObligationRequest.metadata:type_name -> common.MetadataMutable - 28, // 3: policy.obligations.CreateObligationResponse.obligation:type_name -> policy.Obligation - 29, // 4: policy.obligations.UpdateObligationRequest.metadata:type_name -> common.MetadataMutable - 30, // 5: policy.obligations.UpdateObligationRequest.metadata_update_behavior:type_name -> common.MetadataUpdateEnum - 28, // 6: policy.obligations.UpdateObligationResponse.obligation:type_name -> policy.Obligation - 28, // 7: policy.obligations.DeleteObligationResponse.obligation:type_name -> policy.Obligation - 31, // 8: policy.obligations.ListObligationsRequest.pagination:type_name -> policy.PageRequest - 28, // 9: policy.obligations.ListObligationsResponse.obligations:type_name -> policy.Obligation - 32, // 10: policy.obligations.ListObligationsResponse.pagination:type_name -> policy.PageResponse - 33, // 11: policy.obligations.GetObligationValueResponse.value:type_name -> policy.ObligationValue - 27, // 12: policy.obligations.GetObligationValuesByFQNsResponse.fqn_value_map:type_name -> policy.obligations.GetObligationValuesByFQNsResponse.FqnValueMapEntry - 29, // 13: policy.obligations.CreateObligationValueRequest.metadata:type_name -> common.MetadataMutable - 33, // 14: policy.obligations.CreateObligationValueResponse.value:type_name -> policy.ObligationValue - 29, // 15: policy.obligations.UpdateObligationValueRequest.metadata:type_name -> common.MetadataMutable - 30, // 16: policy.obligations.UpdateObligationValueRequest.metadata_update_behavior:type_name -> common.MetadataUpdateEnum - 33, // 17: policy.obligations.UpdateObligationValueResponse.value:type_name -> policy.ObligationValue - 33, // 18: policy.obligations.DeleteObligationValueResponse.value:type_name -> policy.ObligationValue - 29, // 19: policy.obligations.AddObligationTriggerRequest.metadata:type_name -> common.MetadataMutable - 34, // 20: policy.obligations.AddObligationTriggerResponse.trigger:type_name -> policy.ObligationTrigger - 34, // 21: policy.obligations.RemoveObligationTriggerResponse.trigger:type_name -> policy.ObligationTrigger - 28, // 22: policy.obligations.GetObligationsByFQNsResponse.FqnObligationMapEntry.value:type_name -> policy.Obligation - 33, // 23: policy.obligations.GetObligationValuesByFQNsResponse.FqnValueMapEntry.value:type_name -> policy.ObligationValue - 10, // 24: policy.obligations.Service.ListObligations:input_type -> policy.obligations.ListObligationsRequest - 0, // 25: policy.obligations.Service.GetObligation:input_type -> policy.obligations.GetObligationRequest - 2, // 26: policy.obligations.Service.GetObligationsByFQNs:input_type -> policy.obligations.GetObligationsByFQNsRequest - 4, // 27: policy.obligations.Service.CreateObligation:input_type -> policy.obligations.CreateObligationRequest - 6, // 28: policy.obligations.Service.UpdateObligation:input_type -> policy.obligations.UpdateObligationRequest - 8, // 29: policy.obligations.Service.DeleteObligation:input_type -> policy.obligations.DeleteObligationRequest - 12, // 30: policy.obligations.Service.GetObligationValue:input_type -> policy.obligations.GetObligationValueRequest - 14, // 31: policy.obligations.Service.GetObligationValuesByFQNs:input_type -> policy.obligations.GetObligationValuesByFQNsRequest - 16, // 32: policy.obligations.Service.CreateObligationValue:input_type -> policy.obligations.CreateObligationValueRequest - 18, // 33: policy.obligations.Service.UpdateObligationValue:input_type -> policy.obligations.UpdateObligationValueRequest - 20, // 34: policy.obligations.Service.DeleteObligationValue:input_type -> policy.obligations.DeleteObligationValueRequest - 22, // 35: policy.obligations.Service.AddObligationTrigger:input_type -> policy.obligations.AddObligationTriggerRequest - 24, // 36: policy.obligations.Service.RemoveObligationTrigger:input_type -> policy.obligations.RemoveObligationTriggerRequest - 11, // 37: policy.obligations.Service.ListObligations:output_type -> policy.obligations.ListObligationsResponse - 1, // 38: policy.obligations.Service.GetObligation:output_type -> policy.obligations.GetObligationResponse - 3, // 39: policy.obligations.Service.GetObligationsByFQNs:output_type -> policy.obligations.GetObligationsByFQNsResponse - 5, // 40: policy.obligations.Service.CreateObligation:output_type -> policy.obligations.CreateObligationResponse - 7, // 41: policy.obligations.Service.UpdateObligation:output_type -> policy.obligations.UpdateObligationResponse - 9, // 42: policy.obligations.Service.DeleteObligation:output_type -> policy.obligations.DeleteObligationResponse - 13, // 43: policy.obligations.Service.GetObligationValue:output_type -> policy.obligations.GetObligationValueResponse - 15, // 44: policy.obligations.Service.GetObligationValuesByFQNs:output_type -> policy.obligations.GetObligationValuesByFQNsResponse - 17, // 45: policy.obligations.Service.CreateObligationValue:output_type -> policy.obligations.CreateObligationValueResponse - 19, // 46: policy.obligations.Service.UpdateObligationValue:output_type -> policy.obligations.UpdateObligationValueResponse - 21, // 47: policy.obligations.Service.DeleteObligationValue:output_type -> policy.obligations.DeleteObligationValueResponse - 23, // 48: policy.obligations.Service.AddObligationTrigger:output_type -> policy.obligations.AddObligationTriggerResponse - 25, // 49: policy.obligations.Service.RemoveObligationTrigger:output_type -> policy.obligations.RemoveObligationTriggerResponse - 37, // [37:50] is the sub-list for method output_type - 24, // [24:37] is the sub-list for method input_type - 24, // [24:24] is the sub-list for extension type_name - 24, // [24:24] is the sub-list for extension extendee - 0, // [0:24] is the sub-list for field type_name + 30, // 0: policy.obligations.GetObligationResponse.obligation:type_name -> policy.Obligation + 28, // 1: policy.obligations.GetObligationsByFQNsResponse.fqn_obligation_map:type_name -> policy.obligations.GetObligationsByFQNsResponse.FqnObligationMapEntry + 31, // 2: policy.obligations.CreateObligationRequest.metadata:type_name -> common.MetadataMutable + 30, // 3: policy.obligations.CreateObligationResponse.obligation:type_name -> policy.Obligation + 31, // 4: policy.obligations.UpdateObligationRequest.metadata:type_name -> common.MetadataMutable + 32, // 5: policy.obligations.UpdateObligationRequest.metadata_update_behavior:type_name -> common.MetadataUpdateEnum + 30, // 6: policy.obligations.UpdateObligationResponse.obligation:type_name -> policy.Obligation + 30, // 7: policy.obligations.DeleteObligationResponse.obligation:type_name -> policy.Obligation + 33, // 8: policy.obligations.ListObligationsRequest.pagination:type_name -> policy.PageRequest + 30, // 9: policy.obligations.ListObligationsResponse.obligations:type_name -> policy.Obligation + 34, // 10: policy.obligations.ListObligationsResponse.pagination:type_name -> policy.PageResponse + 35, // 11: policy.obligations.GetObligationValueResponse.value:type_name -> policy.ObligationValue + 29, // 12: policy.obligations.GetObligationValuesByFQNsResponse.fqn_value_map:type_name -> policy.obligations.GetObligationValuesByFQNsResponse.FqnValueMapEntry + 31, // 13: policy.obligations.CreateObligationValueRequest.metadata:type_name -> common.MetadataMutable + 35, // 14: policy.obligations.CreateObligationValueResponse.value:type_name -> policy.ObligationValue + 31, // 15: policy.obligations.UpdateObligationValueRequest.metadata:type_name -> common.MetadataMutable + 32, // 16: policy.obligations.UpdateObligationValueRequest.metadata_update_behavior:type_name -> common.MetadataUpdateEnum + 35, // 17: policy.obligations.UpdateObligationValueResponse.value:type_name -> policy.ObligationValue + 35, // 18: policy.obligations.DeleteObligationValueResponse.value:type_name -> policy.ObligationValue + 2, // 19: policy.obligations.AddObligationTriggerRequest.obligation_value:type_name -> policy.obligations.IdFqnIdentifier + 1, // 20: policy.obligations.AddObligationTriggerRequest.action:type_name -> policy.obligations.IdNameIdentifier + 2, // 21: policy.obligations.AddObligationTriggerRequest.attribute_value:type_name -> policy.obligations.IdFqnIdentifier + 31, // 22: policy.obligations.AddObligationTriggerRequest.metadata:type_name -> common.MetadataMutable + 36, // 23: policy.obligations.AddObligationTriggerResponse.trigger:type_name -> policy.ObligationTrigger + 36, // 24: policy.obligations.RemoveObligationTriggerResponse.trigger:type_name -> policy.ObligationTrigger + 30, // 25: policy.obligations.GetObligationsByFQNsResponse.FqnObligationMapEntry.value:type_name -> policy.Obligation + 35, // 26: policy.obligations.GetObligationValuesByFQNsResponse.FqnValueMapEntry.value:type_name -> policy.ObligationValue + 12, // 27: policy.obligations.Service.ListObligations:input_type -> policy.obligations.ListObligationsRequest + 0, // 28: policy.obligations.Service.GetObligation:input_type -> policy.obligations.GetObligationRequest + 4, // 29: policy.obligations.Service.GetObligationsByFQNs:input_type -> policy.obligations.GetObligationsByFQNsRequest + 6, // 30: policy.obligations.Service.CreateObligation:input_type -> policy.obligations.CreateObligationRequest + 8, // 31: policy.obligations.Service.UpdateObligation:input_type -> policy.obligations.UpdateObligationRequest + 10, // 32: policy.obligations.Service.DeleteObligation:input_type -> policy.obligations.DeleteObligationRequest + 14, // 33: policy.obligations.Service.GetObligationValue:input_type -> policy.obligations.GetObligationValueRequest + 16, // 34: policy.obligations.Service.GetObligationValuesByFQNs:input_type -> policy.obligations.GetObligationValuesByFQNsRequest + 18, // 35: policy.obligations.Service.CreateObligationValue:input_type -> policy.obligations.CreateObligationValueRequest + 20, // 36: policy.obligations.Service.UpdateObligationValue:input_type -> policy.obligations.UpdateObligationValueRequest + 22, // 37: policy.obligations.Service.DeleteObligationValue:input_type -> policy.obligations.DeleteObligationValueRequest + 24, // 38: policy.obligations.Service.AddObligationTrigger:input_type -> policy.obligations.AddObligationTriggerRequest + 26, // 39: policy.obligations.Service.RemoveObligationTrigger:input_type -> policy.obligations.RemoveObligationTriggerRequest + 13, // 40: policy.obligations.Service.ListObligations:output_type -> policy.obligations.ListObligationsResponse + 3, // 41: policy.obligations.Service.GetObligation:output_type -> policy.obligations.GetObligationResponse + 5, // 42: policy.obligations.Service.GetObligationsByFQNs:output_type -> policy.obligations.GetObligationsByFQNsResponse + 7, // 43: policy.obligations.Service.CreateObligation:output_type -> policy.obligations.CreateObligationResponse + 9, // 44: policy.obligations.Service.UpdateObligation:output_type -> policy.obligations.UpdateObligationResponse + 11, // 45: policy.obligations.Service.DeleteObligation:output_type -> policy.obligations.DeleteObligationResponse + 15, // 46: policy.obligations.Service.GetObligationValue:output_type -> policy.obligations.GetObligationValueResponse + 17, // 47: policy.obligations.Service.GetObligationValuesByFQNs:output_type -> policy.obligations.GetObligationValuesByFQNsResponse + 19, // 48: policy.obligations.Service.CreateObligationValue:output_type -> policy.obligations.CreateObligationValueResponse + 21, // 49: policy.obligations.Service.UpdateObligationValue:output_type -> policy.obligations.UpdateObligationValueResponse + 23, // 50: policy.obligations.Service.DeleteObligationValue:output_type -> policy.obligations.DeleteObligationValueResponse + 25, // 51: policy.obligations.Service.AddObligationTrigger:output_type -> policy.obligations.AddObligationTriggerResponse + 27, // 52: policy.obligations.Service.RemoveObligationTrigger:output_type -> policy.obligations.RemoveObligationTriggerResponse + 40, // [40:53] is the sub-list for method output_type + 27, // [27:40] is the sub-list for method input_type + 27, // [27:27] is the sub-list for extension type_name + 27, // [27:27] is the sub-list for extension extendee + 0, // [0:27] is the sub-list for field type_name } func init() { file_policy_obligations_obligations_proto_init() } @@ -2084,7 +2217,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetObligationResponse); i { + switch v := v.(*IdNameIdentifier); i { case 0: return &v.state case 1: @@ -2096,7 +2229,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetObligationsByFQNsRequest); i { + switch v := v.(*IdFqnIdentifier); i { case 0: return &v.state case 1: @@ -2108,7 +2241,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetObligationsByFQNsResponse); i { + switch v := v.(*GetObligationResponse); i { case 0: return &v.state case 1: @@ -2120,7 +2253,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateObligationRequest); i { + switch v := v.(*GetObligationsByFQNsRequest); i { case 0: return &v.state case 1: @@ -2132,7 +2265,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateObligationResponse); i { + switch v := v.(*GetObligationsByFQNsResponse); i { case 0: return &v.state case 1: @@ -2144,7 +2277,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateObligationRequest); i { + switch v := v.(*CreateObligationRequest); i { case 0: return &v.state case 1: @@ -2156,7 +2289,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateObligationResponse); i { + switch v := v.(*CreateObligationResponse); i { case 0: return &v.state case 1: @@ -2168,7 +2301,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteObligationRequest); i { + switch v := v.(*UpdateObligationRequest); i { case 0: return &v.state case 1: @@ -2180,7 +2313,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteObligationResponse); i { + switch v := v.(*UpdateObligationResponse); i { case 0: return &v.state case 1: @@ -2192,7 +2325,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListObligationsRequest); i { + switch v := v.(*DeleteObligationRequest); i { case 0: return &v.state case 1: @@ -2204,7 +2337,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListObligationsResponse); i { + switch v := v.(*DeleteObligationResponse); i { case 0: return &v.state case 1: @@ -2216,7 +2349,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetObligationValueRequest); i { + switch v := v.(*ListObligationsRequest); i { case 0: return &v.state case 1: @@ -2228,7 +2361,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetObligationValueResponse); i { + switch v := v.(*ListObligationsResponse); i { case 0: return &v.state case 1: @@ -2240,7 +2373,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetObligationValuesByFQNsRequest); i { + switch v := v.(*GetObligationValueRequest); i { case 0: return &v.state case 1: @@ -2252,7 +2385,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetObligationValuesByFQNsResponse); i { + switch v := v.(*GetObligationValueResponse); i { case 0: return &v.state case 1: @@ -2264,7 +2397,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateObligationValueRequest); i { + switch v := v.(*GetObligationValuesByFQNsRequest); i { case 0: return &v.state case 1: @@ -2276,7 +2409,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateObligationValueResponse); i { + switch v := v.(*GetObligationValuesByFQNsResponse); i { case 0: return &v.state case 1: @@ -2288,7 +2421,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateObligationValueRequest); i { + switch v := v.(*CreateObligationValueRequest); i { case 0: return &v.state case 1: @@ -2300,7 +2433,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateObligationValueResponse); i { + switch v := v.(*CreateObligationValueResponse); i { case 0: return &v.state case 1: @@ -2312,7 +2445,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteObligationValueRequest); i { + switch v := v.(*UpdateObligationValueRequest); i { case 0: return &v.state case 1: @@ -2324,7 +2457,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteObligationValueResponse); i { + switch v := v.(*UpdateObligationValueResponse); i { case 0: return &v.state case 1: @@ -2336,7 +2469,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddObligationTriggerRequest); i { + switch v := v.(*DeleteObligationValueRequest); i { case 0: return &v.state case 1: @@ -2348,7 +2481,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddObligationTriggerResponse); i { + switch v := v.(*DeleteObligationValueResponse); i { case 0: return &v.state case 1: @@ -2360,7 +2493,7 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RemoveObligationTriggerRequest); i { + switch v := v.(*AddObligationTriggerRequest); i { case 0: return &v.state case 1: @@ -2372,6 +2505,30 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddObligationTriggerResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_policy_obligations_obligations_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveObligationTriggerRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_policy_obligations_obligations_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RemoveObligationTriggerResponse); i { case 0: return &v.state @@ -2388,27 +2545,27 @@ func file_policy_obligations_obligations_proto_init() { (*GetObligationRequest_Id)(nil), (*GetObligationRequest_Fqn)(nil), } - file_policy_obligations_obligations_proto_msgTypes[4].OneofWrappers = []interface{}{ + file_policy_obligations_obligations_proto_msgTypes[6].OneofWrappers = []interface{}{ (*CreateObligationRequest_Id)(nil), (*CreateObligationRequest_Fqn)(nil), } - file_policy_obligations_obligations_proto_msgTypes[8].OneofWrappers = []interface{}{ + file_policy_obligations_obligations_proto_msgTypes[10].OneofWrappers = []interface{}{ (*DeleteObligationRequest_Id)(nil), (*DeleteObligationRequest_Fqn)(nil), } - file_policy_obligations_obligations_proto_msgTypes[10].OneofWrappers = []interface{}{ + file_policy_obligations_obligations_proto_msgTypes[12].OneofWrappers = []interface{}{ (*ListObligationsRequest_Id)(nil), (*ListObligationsRequest_Fqn)(nil), } - file_policy_obligations_obligations_proto_msgTypes[12].OneofWrappers = []interface{}{ + file_policy_obligations_obligations_proto_msgTypes[14].OneofWrappers = []interface{}{ (*GetObligationValueRequest_Id)(nil), (*GetObligationValueRequest_Fqn)(nil), } - file_policy_obligations_obligations_proto_msgTypes[16].OneofWrappers = []interface{}{ + file_policy_obligations_obligations_proto_msgTypes[18].OneofWrappers = []interface{}{ (*CreateObligationValueRequest_Id)(nil), (*CreateObligationValueRequest_Fqn)(nil), } - file_policy_obligations_obligations_proto_msgTypes[20].OneofWrappers = []interface{}{ + file_policy_obligations_obligations_proto_msgTypes[22].OneofWrappers = []interface{}{ (*DeleteObligationValueRequest_Id)(nil), (*DeleteObligationValueRequest_Fqn)(nil), } @@ -2418,7 +2575,7 @@ func file_policy_obligations_obligations_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_policy_obligations_obligations_proto_rawDesc, NumEnums: 0, - NumMessages: 28, + NumMessages: 30, NumExtensions: 0, NumServices: 1, }, diff --git a/service/go.mod b/service/go.mod index db5dd7b906..022e00782a 100644 --- a/service/go.mod +++ b/service/go.mod @@ -5,7 +5,7 @@ go 1.24.0 toolchain go1.24.6 require ( - buf.build/go/protovalidate v0.13.1 + buf.build/go/protovalidate v0.14.0 connectrpc.com/connect v1.18.1 connectrpc.com/grpchealth v1.4.0 connectrpc.com/grpcreflect v1.3.0 @@ -52,14 +52,14 @@ require ( go.opentelemetry.io/otel/trace v1.36.0 golang.org/x/net v0.41.0 google.golang.org/grpc v1.73.0 - google.golang.org/protobuf v1.36.6 + google.golang.org/protobuf v1.36.8 gopkg.in/natefinch/lumberjack.v2 v2.2.1 gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 ) require ( - buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250613105001-9f2d3c737feb.1 // indirect + buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250717165733-d22d418d82d8.1 // indirect cel.dev/expr v0.23.1 // indirect github.com/Masterminds/semver/v3 v3.3.1 // indirect github.com/cenkalti/backoff/v5 v5.0.2 // indirect diff --git a/service/go.sum b/service/go.sum index 608779e7f9..7e0b13080d 100644 --- a/service/go.sum +++ b/service/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250613105001-9f2d3c737feb.1 h1:AUL6VF5YWL01j/1H/DQbPUSDkEwYqwVCNw7yhbpOxSQ= -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250613105001-9f2d3c737feb.1/go.mod h1:avRlCjnFzl98VPaeCtJ24RrV/wwHFzB8sWXhj26+n/U= -buf.build/go/protovalidate v0.13.1 h1:6loHDTWdY/1qmqmt1MijBIKeN4T9Eajrqb9isT1W1s8= -buf.build/go/protovalidate v0.13.1/go.mod h1:C/QcOn/CjXRn5udUwYBiLs8y1TGy7RS+GOSKqjS77aU= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250717165733-d22d418d82d8.1 h1:VahIvw/JagkamVOb0q87Az0zu2tmrzlqvO2IKIGOwnI= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250717165733-d22d418d82d8.1/go.mod h1:avRlCjnFzl98VPaeCtJ24RrV/wwHFzB8sWXhj26+n/U= +buf.build/go/protovalidate v0.14.0 h1:kr/rC/no+DtRyYX+8KXLDxNnI1rINz0imk5K44ZpZ3A= +buf.build/go/protovalidate v0.14.0/go.mod h1:+F/oISho9MO7gJQNYC2VWLzcO1fTPmaTA08SDYJZncA= cel.dev/expr v0.23.1 h1:K4KOtPCJQjVggkARsjG9RWXP6O4R73aHeJMa/dmCQQg= cel.dev/expr v0.23.1/go.mod h1:hLPLo1W4QUmuYdA72RBX06QTs6MXw941piREPl3Yfiw= connectrpc.com/connect v1.18.1 h1:PAg7CjSAGvscaf6YZKUefjoih5Z/qYkyaTrBW8xvYPw= @@ -453,8 +453,8 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 h1: google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= google.golang.org/grpc v1.73.0 h1:VIWSmpI2MegBtTuFt5/JWy2oXxtjJ/e89Z70ImfD2ok= google.golang.org/grpc v1.73.0/go.mod h1:50sbHOUqWoCQGI8V2HQLJM0B+LMlIUjNSZmow7EVBQc= -google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= -google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= +google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= +google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/service/integration/obligation_triggers_test.go b/service/integration/obligation_triggers_test.go index 76ab3a91e5..8bc7267101 100644 --- a/service/integration/obligation_triggers_test.go +++ b/service/integration/obligation_triggers_test.go @@ -135,11 +135,26 @@ func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_NoMetadata_Succes s.triggerIDsToClean = append(s.triggerIDsToClean, s.createGenericTrigger().GetId()) } -func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_Success() { +func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_WithIDs_Success() { trigger, err := s.db.PolicyClient.CreateObligationTrigger(s.ctx, &obligations.AddObligationTriggerRequest{ - ObligationValueId: s.obligationValue.GetId(), - AttributeValueId: s.attributeValue.GetId(), - ActionId: s.action.GetId(), + ObligationValue: &obligations.IdFqnIdentifier{Id: s.obligationValue.GetId()}, + AttributeValue: &obligations.IdFqnIdentifier{Id: s.attributeValue.GetId()}, + Action: &obligations.IdNameIdentifier{Id: s.action.GetId()}, + Metadata: &common.MetadataMutable{ + Labels: map[string]string{"source": "test"}, + }, + }) + s.triggerIDsToClean = append(s.triggerIDsToClean, trigger.GetId()) + s.Require().NoError(err) + s.validateTrigger(trigger) + s.Require().Equal("test", trigger.GetMetadata().GetLabels()["source"]) +} + +func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_WithNameFQN_Success() { + trigger, err := s.db.PolicyClient.CreateObligationTrigger(s.ctx, &obligations.AddObligationTriggerRequest{ + ObligationValue: &obligations.IdFqnIdentifier{Fqn: s.obligation.GetNamespace().GetFqn() + "/obl/" + s.obligationValue.GetObligation().GetName() + "/value/" + s.obligationValue.GetValue()}, + AttributeValue: &obligations.IdFqnIdentifier{Fqn: s.attributeValue.GetFqn()}, + Action: &obligations.IdNameIdentifier{Name: s.action.GetName()}, Metadata: &common.MetadataMutable{ Labels: map[string]string{"source": "test"}, }, @@ -153,36 +168,73 @@ func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_Success() { func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_ObligationValueNotFound_Fails() { randomID := uuid.NewString() trigger, err := s.db.PolicyClient.CreateObligationTrigger(s.ctx, &obligations.AddObligationTriggerRequest{ - ObligationValueId: randomID, - AttributeValueId: s.attributeValue.GetId(), - ActionId: s.action.GetId(), + ObligationValue: &obligations.IdFqnIdentifier{Id: randomID}, + AttributeValue: &obligations.IdFqnIdentifier{Id: s.attributeValue.GetId()}, + Action: &obligations.IdNameIdentifier{Id: s.action.GetId()}, }) s.Require().Error(err) - s.Require().ErrorIs(err, db.ErrForeignKeyViolation) + s.Require().ErrorIs(err, db.ErrNotNullViolation) s.Nil(trigger) } func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_AttributeValueNotFound_Fails() { randomID := uuid.NewString() trigger, err := s.db.PolicyClient.CreateObligationTrigger(s.ctx, &obligations.AddObligationTriggerRequest{ - ObligationValueId: s.obligationValue.GetId(), - AttributeValueId: randomID, - ActionId: s.action.GetId(), + ObligationValue: &obligations.IdFqnIdentifier{Id: s.obligationValue.GetId()}, + AttributeValue: &obligations.IdFqnIdentifier{Id: randomID}, + Action: &obligations.IdNameIdentifier{Id: s.action.GetId()}, }) s.Require().Error(err) - s.Require().ErrorIs(err, db.ErrForeignKeyViolation) + s.Require().ErrorIs(err, db.ErrNotNullViolation) s.Nil(trigger) } func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_ActionNotFound_Fails() { randomID := uuid.NewString() trigger, err := s.db.PolicyClient.CreateObligationTrigger(s.ctx, &obligations.AddObligationTriggerRequest{ - ObligationValueId: s.obligationValue.GetId(), - AttributeValueId: s.attributeValue.GetId(), - ActionId: randomID, + ObligationValue: &obligations.IdFqnIdentifier{Id: s.obligationValue.GetId()}, + AttributeValue: &obligations.IdFqnIdentifier{Id: s.attributeValue.GetId()}, + Action: &obligations.IdNameIdentifier{Id: randomID}, + }) + s.Require().Error(err) + s.Require().ErrorIs(err, db.ErrNotNullViolation) + s.Nil(trigger) +} + +func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_AttributeValueDifferentNamespace_Fails() { + // Create a different namespace + differentNamespace, err := s.db.PolicyClient.CreateNamespace(s.ctx, &namespaces.CreateNamespaceRequest{ + Name: "different-namespace", + }) + s.Require().NoError(err) + defer func() { + _, err := s.db.PolicyClient.UnsafeDeleteNamespace(s.ctx, differentNamespace, differentNamespace.GetFqn()) + s.Require().NoError(err) + }() + + // Create an attribute in the different namespace + differentAttribute, err := s.db.PolicyClient.CreateAttribute(s.ctx, &attributes.CreateAttributeRequest{ + Name: "different-attribute", + NamespaceId: differentNamespace.GetId(), + Rule: policy.AttributeRuleTypeEnum_ATTRIBUTE_RULE_TYPE_ENUM_ALL_OF, + }) + s.Require().NoError(err) + + // Create an attribute value in the different namespace + differentAttributeValue, err := s.db.PolicyClient.CreateAttributeValue(s.ctx, differentAttribute.GetId(), &attributes.CreateAttributeValueRequest{ + Value: "different-value", + AttributeId: differentAttribute.GetId(), + }) + s.Require().NoError(err) + + // Try to create a trigger with obligation value from one namespace and attribute value from another + trigger, err := s.db.PolicyClient.CreateObligationTrigger(s.ctx, &obligations.AddObligationTriggerRequest{ + ObligationValue: &obligations.IdFqnIdentifier{Id: s.obligationValue.GetId()}, + AttributeValue: &obligations.IdFqnIdentifier{Id: differentAttributeValue.GetId()}, + Action: &obligations.IdNameIdentifier{Id: s.action.GetId()}, }) s.Require().Error(err) - s.Require().ErrorIs(err, db.ErrForeignKeyViolation) + s.Require().ErrorIs(err, db.ErrNotNullViolation) s.Nil(trigger) } @@ -207,10 +259,10 @@ func (s *ObligationTriggersSuite) Test_DeleteObligationTrigger_NotFound_Fails() func (s *ObligationTriggersSuite) createGenericTrigger() *policy.ObligationTrigger { trigger, err := s.db.PolicyClient.CreateObligationTrigger(s.ctx, &obligations.AddObligationTriggerRequest{ - ObligationValueId: s.obligationValue.GetId(), - AttributeValueId: s.attributeValue.GetId(), - ActionId: s.action.GetId(), - Metadata: &common.MetadataMutable{}, + ObligationValue: &obligations.IdFqnIdentifier{Id: s.obligationValue.GetId()}, + AttributeValue: &obligations.IdFqnIdentifier{Id: s.attributeValue.GetId()}, + Action: &obligations.IdNameIdentifier{Id: s.action.GetId()}, + Metadata: &common.MetadataMutable{}, }) s.Require().NoError(err) s.validateTrigger(trigger) diff --git a/service/policy/attributes/attributes.proto b/service/policy/attributes/attributes.proto index 47c8d44888..695feb23cd 100644 --- a/service/policy/attributes/attributes.proto +++ b/service/policy/attributes/attributes.proto @@ -96,7 +96,7 @@ message GetAttributeRequest { // Deprecated string id = 1 [ deprecated = true, - (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE, + (buf.validate.field).ignore = IGNORE_IF_ZERO_VALUE, (buf.validate.field).string.uuid = true ]; @@ -192,7 +192,7 @@ message GetAttributeValueRequest { // Deprecated string id = 1 [ deprecated = true, - (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE, + (buf.validate.field).ignore = IGNORE_IF_ZERO_VALUE, (buf.validate.field).string.uuid = true ]; diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 93bf71a0e9..7bbf432203 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -518,11 +518,17 @@ func (c PolicyDBClient) CreateObligationTrigger(ctx context.Context, r *obligati return nil, err } + nsFQN, oblName, oblVal := breakOblValFQN(r.GetObligationValue().GetFqn()) params := createObligationTriggerParams{ - ObligationValueID: r.GetObligationValueId(), - ActionID: r.GetActionId(), - AttributeValueID: r.GetAttributeValueId(), - Metadata: metadataJSON, + ObligationValueID: r.GetObligationValue().GetId(), + ObligationNamespaceFqn: nsFQN, + ObligationName: oblName, + ObligationValue: oblVal, + ActionName: r.GetAction().GetName(), + ActionID: r.GetAction().GetId(), + AttributeValueID: r.GetAttributeValue().GetId(), + AttributeValueFqn: r.GetAttributeValue().GetFqn(), + Metadata: metadataJSON, } row, err := c.queries.createObligationTrigger(ctx, params) if err != nil { diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 21e8c8b8af..7a34cf5598 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -146,17 +146,54 @@ func (q *Queries) createObligation(ctx context.Context, arg createObligationPara const createObligationTrigger = `-- name: createObligationTrigger :one -WITH inserted AS ( +WITH +ov_id AS ( + SELECT ov.id, od.namespace_id + FROM obligation_values_standard ov + JOIN obligation_definitions od ON ov.obligation_definition_id = od.id + JOIN attribute_namespaces n ON od.namespace_id = n.id + LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL + WHERE + (NULLIF($1::TEXT, '') IS NOT NULL AND ov.id = $1::UUID) + OR + ( + (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL AND NULLIF($4::TEXT, '') IS NOT NULL AND + fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR AND ov.value = $4::VARCHAR) + ) +), +a_id AS ( + SELECT id FROM actions + WHERE + (NULLIF($5::TEXT, '') IS NOT NULL AND id = $5::UUID) + OR + (NULLIF($6::TEXT, '') IS NOT NULL AND name = $6::TEXT) +), +av_id AS ( + SELECT av.id + FROM attribute_values av + JOIN attribute_definitions ad ON av.attribute_definition_id = ad.id + LEFT JOIN attribute_fqns fqns ON fqns.value_id = av.id + WHERE + ((NULLIF($7::TEXT, '') IS NOT NULL AND av.id = $7::UUID) + OR + (NULLIF($8::TEXT, '') IS NOT NULL AND fqns.fqn = $8)) + AND ad.namespace_id = (SELECT namespace_id FROM ov_id) +), +inserted AS ( INSERT INTO obligation_triggers (obligation_value_id, action_id, attribute_value_id, metadata) - VALUES ($1, $2, $3, $4) + SELECT + (SELECT id FROM ov_id), + (SELECT id FROM a_id), + (SELECT id FROM av_id), + $9 RETURNING id, obligation_value_id, action_id, attribute_value_id, metadata, created_at, updated_at ) SELECT JSON_STRIP_NULLS( JSON_BUILD_OBJECT( - 'labels', i.metadata -> 'labels', - 'created_at', i.created_at, - 'updated_at', i.updated_at + 'labels', i.metadata -> 'labels', + 'created_at', i.created_at, + 'updated_at', i.updated_at ) ) AS metadata, JSON_STRIP_NULLS( @@ -197,10 +234,15 @@ LEFT JOIN attribute_fqns av_fqns ON av_fqns.value_id = av.id ` type createObligationTriggerParams struct { - ObligationValueID string `json:"obligation_value_id"` - ActionID string `json:"action_id"` - AttributeValueID string `json:"attribute_value_id"` - Metadata []byte `json:"metadata"` + ObligationValueID string `json:"obligation_value_id"` + ObligationNamespaceFqn string `json:"obligation_namespace_fqn"` + ObligationName string `json:"obligation_name"` + ObligationValue string `json:"obligation_value"` + ActionID string `json:"action_id"` + ActionName string `json:"action_name"` + AttributeValueID string `json:"attribute_value_id"` + AttributeValueFqn string `json:"attribute_value_fqn"` + Metadata []byte `json:"metadata"` } type createObligationTriggerRow struct { @@ -211,10 +253,48 @@ type createObligationTriggerRow struct { // -------------------------------------------------------------- // OBLIGATION TRIGGERS // -------------------------------------------------------------- +// Gets the attribute value, but also ensures that the attribute value belongs to the same namespace as the obligation, to which the obligation value belongs // -// WITH inserted AS ( +// WITH +// ov_id AS ( +// SELECT ov.id, od.namespace_id +// FROM obligation_values_standard ov +// JOIN obligation_definitions od ON ov.obligation_definition_id = od.id +// JOIN attribute_namespaces n ON od.namespace_id = n.id +// LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL +// WHERE +// (NULLIF($1::TEXT, '') IS NOT NULL AND ov.id = $1::UUID) +// OR +// ( +// (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL AND NULLIF($4::TEXT, '') IS NOT NULL AND +// fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR AND ov.value = $4::VARCHAR) +// ) +// ), +// a_id AS ( +// SELECT id FROM actions +// WHERE +// (NULLIF($5::TEXT, '') IS NOT NULL AND id = $5::UUID) +// OR +// (NULLIF($6::TEXT, '') IS NOT NULL AND name = $6::TEXT) +// ), +// av_id AS ( +// SELECT av.id +// FROM attribute_values av +// JOIN attribute_definitions ad ON av.attribute_definition_id = ad.id +// LEFT JOIN attribute_fqns fqns ON fqns.value_id = av.id +// WHERE +// ((NULLIF($7::TEXT, '') IS NOT NULL AND av.id = $7::UUID) +// OR +// (NULLIF($8::TEXT, '') IS NOT NULL AND fqns.fqn = $8)) +// AND ad.namespace_id = (SELECT namespace_id FROM ov_id) +// ), +// inserted AS ( // INSERT INTO obligation_triggers (obligation_value_id, action_id, attribute_value_id, metadata) -// VALUES ($1, $2, $3, $4) +// SELECT +// (SELECT id FROM ov_id), +// (SELECT id FROM a_id), +// (SELECT id FROM av_id), +// $9 // RETURNING id, obligation_value_id, action_id, attribute_value_id, metadata, created_at, updated_at // ) // SELECT @@ -263,8 +343,13 @@ type createObligationTriggerRow struct { func (q *Queries) createObligationTrigger(ctx context.Context, arg createObligationTriggerParams) (createObligationTriggerRow, error) { row := q.db.QueryRow(ctx, createObligationTrigger, arg.ObligationValueID, + arg.ObligationNamespaceFqn, + arg.ObligationName, + arg.ObligationValue, arg.ActionID, + arg.ActionName, arg.AttributeValueID, + arg.AttributeValueFqn, arg.Metadata, ) var i createObligationTriggerRow diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index d2375f036c..2400ddec3f 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -311,17 +311,55 @@ RETURNING id; ---------------------------------------------------------------- -- name: createObligationTrigger :one -WITH inserted AS ( +WITH +ov_id AS ( + SELECT ov.id, od.namespace_id + FROM obligation_values_standard ov + JOIN obligation_definitions od ON ov.obligation_definition_id = od.id + JOIN attribute_namespaces n ON od.namespace_id = n.id + LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL + WHERE + (NULLIF(@obligation_value_id::TEXT, '') IS NOT NULL AND ov.id = @obligation_value_id::UUID) + OR + ( + (NULLIF(@obligation_namespace_fqn::TEXT, '') IS NOT NULL AND NULLIF(@obligation_name::TEXT, '') IS NOT NULL AND NULLIF(@obligation_value::TEXT, '') IS NOT NULL AND + fqns.fqn = @obligation_namespace_fqn::VARCHAR AND od.name = @obligation_name::VARCHAR AND ov.value = @obligation_value::VARCHAR) + ) +), +a_id AS ( + SELECT id FROM actions + WHERE + (NULLIF(@action_id::TEXT, '') IS NOT NULL AND id = @action_id::UUID) + OR + (NULLIF(@action_name::TEXT, '') IS NOT NULL AND name = @action_name::TEXT) +), +-- Gets the attribute value, but also ensures that the attribute value belongs to the same namespace as the obligation, to which the obligation value belongs +av_id AS ( + SELECT av.id + FROM attribute_values av + JOIN attribute_definitions ad ON av.attribute_definition_id = ad.id + LEFT JOIN attribute_fqns fqns ON fqns.value_id = av.id + WHERE + ((NULLIF(@attribute_value_id::TEXT, '') IS NOT NULL AND av.id = @attribute_value_id::UUID) + OR + (NULLIF(@attribute_value_fqn::TEXT, '') IS NOT NULL AND fqns.fqn = @attribute_value_fqn)) + AND ad.namespace_id = (SELECT namespace_id FROM ov_id) +), +inserted AS ( INSERT INTO obligation_triggers (obligation_value_id, action_id, attribute_value_id, metadata) - VALUES ($1, $2, $3, $4) - RETURNING * + SELECT + (SELECT id FROM ov_id), + (SELECT id FROM a_id), + (SELECT id FROM av_id), + @metadata + RETURNING id, obligation_value_id, action_id, attribute_value_id, metadata, created_at, updated_at ) SELECT JSON_STRIP_NULLS( JSON_BUILD_OBJECT( - 'labels', i.metadata -> 'labels', - 'created_at', i.created_at, - 'updated_at', i.updated_at + 'labels', i.metadata -> 'labels', + 'created_at', i.created_at, + 'updated_at', i.updated_at ) ) AS metadata, JSON_STRIP_NULLS( diff --git a/service/policy/kasregistry/key_access_server_registry.proto b/service/policy/kasregistry/key_access_server_registry.proto index 7449420dd4..f7c4bdf7f8 100644 --- a/service/policy/kasregistry/key_access_server_registry.proto +++ b/service/policy/kasregistry/key_access_server_registry.proto @@ -25,7 +25,7 @@ message GetKeyAccessServerRequest { // Deprecated string id = 1 [ deprecated = true, - (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE, + (buf.validate.field).ignore = IGNORE_IF_ZERO_VALUE, (buf.validate.field).string.uuid = true ]; @@ -244,7 +244,7 @@ message ListPublicKeyMappingRequest { // Optional Public Key ID string public_key_id = 4 [ (buf.validate.field).string.uuid = true, - (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE + (buf.validate.field).ignore = IGNORE_IF_ZERO_VALUE ]; // Optional diff --git a/service/policy/namespaces/namespaces.proto b/service/policy/namespaces/namespaces.proto index 1d643bafdd..56f0908c33 100644 --- a/service/policy/namespaces/namespaces.proto +++ b/service/policy/namespaces/namespaces.proto @@ -60,7 +60,7 @@ message GetNamespaceRequest { // Deprecated string id = 1 [ deprecated = true, - (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE, + (buf.validate.field).ignore = IGNORE_IF_ZERO_VALUE, (buf.validate.field).string.uuid = true ]; diff --git a/service/policy/obligations/obligations.go b/service/policy/obligations/obligations.go index f546aa568e..ee03a6a424 100644 --- a/service/policy/obligations/obligations.go +++ b/service/policy/obligations/obligations.go @@ -352,10 +352,27 @@ func (s *Service) AddObligationTrigger(ctx context.Context, req *connect.Request ObjectType: audit.ObjectTypeObligationTrigger, } + var oblVal, act, attrVal string + if idf := req.Msg.GetObligationValue(); idf != nil { + oblVal = idf.GetId() + } else { + oblVal = idf.GetFqn() + } + if ida := req.Msg.GetAction(); ida != nil { + act = ida.GetId() + } else { + act = ida.GetName() + } + if idav := req.Msg.GetAttributeValue(); idav != nil { + attrVal = idav.GetId() + } else { + attrVal = idav.GetFqn() + } + s.logger.DebugContext(ctx, "adding obligation trigger", - slog.String("obligation_value_id", req.Msg.GetObligationValueId()), - slog.String("action_id", req.Msg.GetActionId()), - slog.String("attribute_value_id", req.Msg.GetAttributeValueId()), + slog.String("obligation_value_id", oblVal), + slog.String("action_id", act), + slog.String("attribute_value_id", attrVal), ) err := s.dbClient.RunInTx(ctx, func(txClient *policydb.PolicyDBClient) error { diff --git a/service/policy/obligations/obligations.proto b/service/policy/obligations/obligations.proto index c895cdfb5a..6c0a363642 100644 --- a/service/policy/obligations/obligations.proto +++ b/service/policy/obligations/obligations.proto @@ -20,6 +20,23 @@ message GetObligationRequest { } } +message IdNameIdentifier { + option (buf.validate.message).oneof = { fields: ["id", "name"], required: true }; + string id = 1 [(buf.validate.field).string.uuid = true]; + string name = 2 [(buf.validate.field).string = { + min_len: 1 + }]; +} + +message IdFqnIdentifier { + option (buf.validate.message).oneof = { fields: ["id", "fqn"], required: true }; + string id = 1 [(buf.validate.field).string.uuid = true]; + string fqn = 2 [(buf.validate.field).string = { + min_len: 1 + uri: true + }]; +} + message GetObligationResponse { policy.Obligation obligation = 1; } @@ -159,11 +176,11 @@ message DeleteObligationValueResponse { // Triggers message AddObligationTriggerRequest { // Required - string obligation_value_id = 1 [(buf.validate.field).string.uuid = true]; + IdFqnIdentifier obligation_value = 1 [(buf.validate.field).required = true]; // Required - string action_id = 2 [(buf.validate.field).string.uuid = true]; + IdNameIdentifier action = 2 [(buf.validate.field).required = true]; // Required - string attribute_value_id = 3 [(buf.validate.field).string.uuid = true]; + IdFqnIdentifier attribute_value = 3 [(buf.validate.field).required = true]; // Optional // Common metadata common.MetadataMutable metadata = 100; diff --git a/service/policy/obligations/obligations_test.go b/service/policy/obligations/obligations_test.go index 72cc8e9adb..d3c94ef030 100644 --- a/service/policy/obligations/obligations_test.go +++ b/service/policy/obligations/obligations_test.go @@ -23,6 +23,9 @@ func getValidator() protovalidate.Validator { func Test_AddObligationTrigger_Request(t *testing.T) { validUUID := uuid.NewString() + validFQN := "https://example.com/attr/value/1" + invalidFQN := "invalid-fqn" + validName := "kas" testCases := []struct { name string req *obligations.AddObligationTriggerRequest @@ -32,68 +35,97 @@ func Test_AddObligationTrigger_Request(t *testing.T) { { name: "valid", req: &obligations.AddObligationTriggerRequest{ - ObligationValueId: validUUID, - ActionId: validUUID, - AttributeValueId: validUUID, + ObligationValue: &obligations.IdFqnIdentifier{Id: validUUID}, + Action: &obligations.IdNameIdentifier{Id: validUUID}, + AttributeValue: &obligations.IdFqnIdentifier{Id: validUUID}, + }, + expectError: false, + }, + { + name: "valid fqn and name", + req: &obligations.AddObligationTriggerRequest{ + ObligationValue: &obligations.IdFqnIdentifier{Fqn: validFQN}, + Action: &obligations.IdNameIdentifier{Name: validName}, + AttributeValue: &obligations.IdFqnIdentifier{Fqn: validFQN}, }, expectError: false, }, { name: "invalid obligation_value_id", req: &obligations.AddObligationTriggerRequest{ - ObligationValueId: invalidUUID, - ActionId: validUUID, - AttributeValueId: validUUID, + ObligationValue: &obligations.IdFqnIdentifier{Id: invalidUUID}, + Action: &obligations.IdNameIdentifier{Id: validUUID}, + AttributeValue: &obligations.IdFqnIdentifier{Id: validUUID}, }, expectError: true, - errorMessage: "obligation_value_id", + errorMessage: "obligation_value.id", }, { name: "invalid action_id", req: &obligations.AddObligationTriggerRequest{ - ObligationValueId: validUUID, - ActionId: invalidUUID, - AttributeValueId: validUUID, + ObligationValue: &obligations.IdFqnIdentifier{Id: validUUID}, + Action: &obligations.IdNameIdentifier{Id: invalidUUID}, + AttributeValue: &obligations.IdFqnIdentifier{Id: validUUID}, }, expectError: true, - errorMessage: "action_id", + errorMessage: "action.id", }, { name: "invalid attribute_value_id", req: &obligations.AddObligationTriggerRequest{ - ObligationValueId: validUUID, - ActionId: validUUID, - AttributeValueId: invalidUUID, + ObligationValue: &obligations.IdFqnIdentifier{Id: validUUID}, + Action: &obligations.IdNameIdentifier{Id: validUUID}, + AttributeValue: &obligations.IdFqnIdentifier{Id: invalidUUID}, + }, + expectError: true, + errorMessage: "attribute_value.id", + }, + { + name: "invalid obligation_value_fqn", + req: &obligations.AddObligationTriggerRequest{ + ObligationValue: &obligations.IdFqnIdentifier{Fqn: invalidFQN}, + Action: &obligations.IdNameIdentifier{Id: validUUID}, + AttributeValue: &obligations.IdFqnIdentifier{Fqn: validFQN}, + }, + expectError: true, + errorMessage: "obligation_value.fqn", + }, + { + name: "invalid attribute_value_fqn", + req: &obligations.AddObligationTriggerRequest{ + ObligationValue: &obligations.IdFqnIdentifier{Id: validUUID}, + Action: &obligations.IdNameIdentifier{Id: validUUID}, + AttributeValue: &obligations.IdFqnIdentifier{Fqn: invalidFQN}, }, expectError: true, - errorMessage: "attribute_value_id", + errorMessage: "attribute_value.fqn", }, { - name: "missing obligation_value_id", + name: "missing obligation_value", req: &obligations.AddObligationTriggerRequest{ - ActionId: validUUID, - AttributeValueId: validUUID, + Action: &obligations.IdNameIdentifier{Id: validUUID}, + AttributeValue: &obligations.IdFqnIdentifier{Id: validUUID}, }, expectError: true, - errorMessage: "obligation_value_id", + errorMessage: "obligation_value", }, { - name: "missing action_id", + name: "missing action", req: &obligations.AddObligationTriggerRequest{ - ObligationValueId: validUUID, - AttributeValueId: validUUID, + ObligationValue: &obligations.IdFqnIdentifier{Id: validUUID}, + AttributeValue: &obligations.IdFqnIdentifier{Id: validUUID}, }, expectError: true, - errorMessage: "action_id", + errorMessage: "action", }, { - name: "missing attribute_value_id", + name: "missing attribute_value", req: &obligations.AddObligationTriggerRequest{ - ObligationValueId: validUUID, - ActionId: validUUID, + ObligationValue: &obligations.IdFqnIdentifier{Id: validUUID}, + Action: &obligations.IdNameIdentifier{Id: validUUID}, }, expectError: true, - errorMessage: "attribute_value_id", + errorMessage: "attribute_value", }, } From 57540b8cc927d032116a74a882a3a3d058f7af35 Mon Sep 17 00:00:00 2001 From: Chris Reed Date: Fri, 5 Sep 2025 13:52:37 -0500 Subject: [PATCH 133/137] move identifiers to common. --- docs/grpc/index.html | 146 +-- docs/openapi/common/common.openapi.yaml | 27 + .../obligations/obligations.openapi.yaml | 60 +- protocol/go/common/common.pb.go | 289 ++++- .../go/policy/obligations/obligations.pb.go | 1112 +++++++---------- service/common/common.proto | 18 + .../integration/obligation_triggers_test.go | 42 +- service/policy/obligations/obligations.proto | 23 +- .../policy/obligations/obligations_test.go | 85 +- 9 files changed, 932 insertions(+), 870 deletions(-) diff --git a/docs/grpc/index.html b/docs/grpc/index.html index 40f6c863b8..e6a236c077 100644 --- a/docs/grpc/index.html +++ b/docs/grpc/index.html @@ -178,6 +178,14 @@

    Table of Contents

    common/common.proto
      +
    • + MIdFqnIdentifier +
    • + +
    • + MIdNameIdentifier +
    • +
    • MMetadata
    • @@ -1492,14 +1500,6 @@

      Table of Contents

      MGetObligationsByFQNsResponse.FqnObligationMapEntry -
    • - MIdFqnIdentifier -
    • - -
    • - MIdNameIdentifier -
    • -
    • MListObligationsRequest
    • @@ -2017,6 +2017,68 @@

      common/common.proto

      Top

      +

      IdFqnIdentifier

      +

      + + + + + + + + + + + + + + + + + + + + + + + +
      FieldTypeLabelDescription
      idstring

      fqnstring

      + + + + + +

      IdNameIdentifier

      +

      + + + + + + + + + + + + + + + + + + + + + + + +
      FieldTypeLabelDescription
      idstring

      namestring

      + + + + +

      Metadata

      Struct to uniquely identify a resource with optional additional metadata

      @@ -12238,21 +12300,21 @@

      AddObligationTriggerRequ obligation_value - IdFqnIdentifier + common.IdFqnIdentifier

      Required

      action - IdNameIdentifier + common.IdNameIdentifier

      Required

      attribute_value - IdFqnIdentifier + common.IdFqnIdentifier

      Required

      @@ -12821,68 +12883,6 @@

      G -

      IdFqnIdentifier

      -

      - - - - - - - - - - - - - - - - - - - - - - - -
      FieldTypeLabelDescription
      idstring

      fqnstring

      - - - - - -

      IdNameIdentifier

      -

      - - - - - - - - - - - - - - - - - - - - - - - -
      FieldTypeLabelDescription
      idstring

      namestring

      - - - - -

      ListObligationsRequest

      diff --git a/docs/openapi/common/common.openapi.yaml b/docs/openapi/common/common.openapi.yaml index bff7e6603e..34c580864c 100644 --- a/docs/openapi/common/common.openapi.yaml +++ b/docs/openapi/common/common.openapi.yaml @@ -20,6 +20,33 @@ components: - METADATA_UPDATE_ENUM_UNSPECIFIED - METADATA_UPDATE_ENUM_EXTEND - METADATA_UPDATE_ENUM_REPLACE + common.IdFqnIdentifier: + type: object + properties: + id: + type: string + title: id + format: uuid + fqn: + type: string + title: fqn + minLength: 1 + format: uri + title: IdFqnIdentifier + additionalProperties: false + common.IdNameIdentifier: + type: object + properties: + id: + type: string + title: id + format: uuid + name: + type: string + title: name + minLength: 1 + title: IdNameIdentifier + additionalProperties: false common.Metadata: type: object properties: diff --git a/docs/openapi/policy/obligations/obligations.openapi.yaml b/docs/openapi/policy/obligations/obligations.openapi.yaml index 33165d06cf..168a9f1eb3 100644 --- a/docs/openapi/policy/obligations/obligations.openapi.yaml +++ b/docs/openapi/policy/obligations/obligations.openapi.yaml @@ -528,6 +528,33 @@ components: - SUBJECT_MAPPING_OPERATOR_ENUM_IN - SUBJECT_MAPPING_OPERATOR_ENUM_NOT_IN - SUBJECT_MAPPING_OPERATOR_ENUM_IN_CONTAINS + common.IdFqnIdentifier: + type: object + properties: + id: + type: string + title: id + format: uuid + fqn: + type: string + title: fqn + minLength: 1 + format: uri + title: IdFqnIdentifier + additionalProperties: false + common.IdNameIdentifier: + type: object + properties: + id: + type: string + title: id + format: uuid + name: + type: string + title: name + minLength: 1 + title: IdNameIdentifier + additionalProperties: false common.Metadata: type: object properties: @@ -1283,15 +1310,15 @@ components: obligationValue: title: obligation_value description: Required - $ref: '#/components/schemas/policy.obligations.IdFqnIdentifier' + $ref: '#/components/schemas/common.IdFqnIdentifier' action: title: action description: Required - $ref: '#/components/schemas/policy.obligations.IdNameIdentifier' + $ref: '#/components/schemas/common.IdNameIdentifier' attributeValue: title: attribute_value description: Required - $ref: '#/components/schemas/policy.obligations.IdFqnIdentifier' + $ref: '#/components/schemas/common.IdFqnIdentifier' metadata: title: metadata description: |- @@ -1567,33 +1594,6 @@ components: $ref: '#/components/schemas/policy.Obligation' title: FqnObligationMapEntry additionalProperties: false - policy.obligations.IdFqnIdentifier: - type: object - properties: - id: - type: string - title: id - format: uuid - fqn: - type: string - title: fqn - minLength: 1 - format: uri - title: IdFqnIdentifier - additionalProperties: false - policy.obligations.IdNameIdentifier: - type: object - properties: - id: - type: string - title: id - format: uuid - name: - type: string - title: name - minLength: 1 - title: IdNameIdentifier - additionalProperties: false policy.obligations.ListObligationsRequest: type: object oneOf: diff --git a/protocol/go/common/common.pb.go b/protocol/go/common/common.pb.go index 71a9cc5b1d..49fe1722a0 100644 --- a/protocol/go/common/common.pb.go +++ b/protocol/go/common/common.pb.go @@ -7,6 +7,7 @@ package common import ( + _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" timestamppb "google.golang.org/protobuf/types/known/timestamppb" @@ -126,6 +127,116 @@ func (ActiveStateEnum) EnumDescriptor() ([]byte, []int) { return file_common_common_proto_rawDescGZIP(), []int{1} } +type IdNameIdentifier struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *IdNameIdentifier) Reset() { + *x = IdNameIdentifier{} + if protoimpl.UnsafeEnabled { + mi := &file_common_common_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdNameIdentifier) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdNameIdentifier) ProtoMessage() {} + +func (x *IdNameIdentifier) ProtoReflect() protoreflect.Message { + mi := &file_common_common_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 IdNameIdentifier.ProtoReflect.Descriptor instead. +func (*IdNameIdentifier) Descriptor() ([]byte, []int) { + return file_common_common_proto_rawDescGZIP(), []int{0} +} + +func (x *IdNameIdentifier) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *IdNameIdentifier) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type IdFqnIdentifier struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Fqn string `protobuf:"bytes,2,opt,name=fqn,proto3" json:"fqn,omitempty"` +} + +func (x *IdFqnIdentifier) Reset() { + *x = IdFqnIdentifier{} + if protoimpl.UnsafeEnabled { + mi := &file_common_common_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdFqnIdentifier) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdFqnIdentifier) ProtoMessage() {} + +func (x *IdFqnIdentifier) ProtoReflect() protoreflect.Message { + mi := &file_common_common_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 IdFqnIdentifier.ProtoReflect.Descriptor instead. +func (*IdFqnIdentifier) Descriptor() ([]byte, []int) { + return file_common_common_proto_rawDescGZIP(), []int{1} +} + +func (x *IdFqnIdentifier) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *IdFqnIdentifier) GetFqn() string { + if x != nil { + return x.Fqn + } + return "" +} + // Struct to uniquely identify a resource with optional additional metadata type Metadata struct { state protoimpl.MessageState @@ -143,7 +254,7 @@ type Metadata struct { func (x *Metadata) Reset() { *x = Metadata{} if protoimpl.UnsafeEnabled { - mi := &file_common_common_proto_msgTypes[0] + mi := &file_common_common_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -156,7 +267,7 @@ func (x *Metadata) String() string { func (*Metadata) ProtoMessage() {} func (x *Metadata) ProtoReflect() protoreflect.Message { - mi := &file_common_common_proto_msgTypes[0] + mi := &file_common_common_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -169,7 +280,7 @@ func (x *Metadata) ProtoReflect() protoreflect.Message { // Deprecated: Use Metadata.ProtoReflect.Descriptor instead. func (*Metadata) Descriptor() ([]byte, []int) { - return file_common_common_proto_rawDescGZIP(), []int{0} + return file_common_common_proto_rawDescGZIP(), []int{2} } func (x *Metadata) GetCreatedAt() *timestamppb.Timestamp { @@ -205,7 +316,7 @@ type MetadataMutable struct { func (x *MetadataMutable) Reset() { *x = MetadataMutable{} if protoimpl.UnsafeEnabled { - mi := &file_common_common_proto_msgTypes[1] + mi := &file_common_common_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -218,7 +329,7 @@ func (x *MetadataMutable) String() string { func (*MetadataMutable) ProtoMessage() {} func (x *MetadataMutable) ProtoReflect() protoreflect.Message { - mi := &file_common_common_proto_msgTypes[1] + mi := &file_common_common_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -231,7 +342,7 @@ func (x *MetadataMutable) ProtoReflect() protoreflect.Message { // Deprecated: Use MetadataMutable.ProtoReflect.Descriptor instead. func (*MetadataMutable) Descriptor() ([]byte, []int) { - return file_common_common_proto_rawDescGZIP(), []int{1} + return file_common_common_proto_rawDescGZIP(), []int{3} } func (x *MetadataMutable) GetLabels() map[string]string { @@ -247,57 +358,71 @@ var file_common_common_proto_rawDesc = []byte{ 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 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, 0x22, 0xf1, - 0x01, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x39, 0x0a, 0x0a, 0x63, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x01, 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, 0x09, 0x63, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, 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, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, - 0x74, 0x12, 0x34, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x1a, 0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, - 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x22, 0x89, 0x01, 0x0a, 0x0f, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, - 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x2e, - 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, - 0x65, 0x6c, 0x73, 0x1a, 0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x7d, - 0x0a, 0x12, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x24, 0x0a, 0x20, 0x4d, 0x45, 0x54, 0x41, 0x44, 0x41, 0x54, 0x41, - 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, - 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1f, 0x0a, 0x1b, 0x4d, 0x45, - 0x54, 0x41, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x4e, - 0x55, 0x4d, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x20, 0x0a, 0x1c, 0x4d, - 0x45, 0x54, 0x41, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x5f, 0x45, - 0x4e, 0x55, 0x4d, 0x5f, 0x52, 0x45, 0x50, 0x4c, 0x41, 0x43, 0x45, 0x10, 0x02, 0x2a, 0x8d, 0x01, - 0x0a, 0x0f, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x75, - 0x6d, 0x12, 0x21, 0x0a, 0x1d, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, - 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x53, - 0x54, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, - 0x10, 0x01, 0x12, 0x1e, 0x0a, 0x1a, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x53, 0x54, 0x41, - 0x54, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x49, 0x4e, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, - 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x53, 0x54, 0x41, - 0x54, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, 0x4e, 0x59, 0x10, 0x03, 0x42, 0x81, 0x01, - 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x42, 0x0b, 0x43, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x64, 0x66, 0x2f, - 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, - 0x6c, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x43, 0x58, - 0x58, 0xaa, 0x02, 0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0xca, 0x02, 0x06, 0x43, 0x6f, 0x6d, - 0x6d, 0x6f, 0x6e, 0xe2, 0x02, 0x12, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, - 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, + 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, + 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5c, 0x0a, 0x10, 0x49, + 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, + 0x18, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, + 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x11, 0xba, 0x48, 0x0e, 0x22, 0x0c, 0x0a, 0x02, 0x69, + 0x64, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x10, 0x01, 0x22, 0x5b, 0x0a, 0x0f, 0x49, 0x64, 0x46, + 0x71, 0x6e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, + 0x01, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0x72, 0x05, 0x10, 0x01, 0x88, 0x01, 0x01, 0x52, + 0x03, 0x66, 0x71, 0x6e, 0x3a, 0x10, 0xba, 0x48, 0x0d, 0x22, 0x0b, 0x0a, 0x02, 0x69, 0x64, 0x0a, + 0x03, 0x66, 0x71, 0x6e, 0x10, 0x01, 0x22, 0xf1, 0x01, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, + 0x74, 0x18, 0x01, 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, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, + 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, 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, 0x09, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x34, 0x0a, 0x06, 0x6c, 0x61, 0x62, + 0x65, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x4c, 0x61, 0x62, 0x65, + 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x1a, + 0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x89, 0x01, 0x0a, 0x0f, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x3b, + 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x1a, 0x39, 0x0a, 0x0b, 0x4c, + 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x7d, 0x0a, 0x12, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x24, 0x0a, 0x20, + 0x4d, 0x45, 0x54, 0x41, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x5f, + 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, + 0x10, 0x00, 0x12, 0x1f, 0x0a, 0x1b, 0x4d, 0x45, 0x54, 0x41, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x55, + 0x50, 0x44, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x4e, + 0x44, 0x10, 0x01, 0x12, 0x20, 0x0a, 0x1c, 0x4d, 0x45, 0x54, 0x41, 0x44, 0x41, 0x54, 0x41, 0x5f, + 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x52, 0x45, 0x50, 0x4c, + 0x41, 0x43, 0x45, 0x10, 0x02, 0x2a, 0x8d, 0x01, 0x0a, 0x0f, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x21, 0x0a, 0x1d, 0x41, 0x43, 0x54, + 0x49, 0x56, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, + 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, + 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x4e, 0x55, + 0x4d, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x1e, 0x0a, 0x1a, 0x41, 0x43, + 0x54, 0x49, 0x56, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, + 0x49, 0x4e, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x43, + 0x54, 0x49, 0x56, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, + 0x41, 0x4e, 0x59, 0x10, 0x03, 0x42, 0x81, 0x01, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x42, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x64, 0x66, 0x2f, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x43, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x43, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0xca, 0x02, 0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0xe2, 0x02, 0x12, 0x43, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -313,21 +438,23 @@ func file_common_common_proto_rawDescGZIP() []byte { } var file_common_common_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_common_common_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_common_common_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_common_common_proto_goTypes = []interface{}{ (MetadataUpdateEnum)(0), // 0: common.MetadataUpdateEnum (ActiveStateEnum)(0), // 1: common.ActiveStateEnum - (*Metadata)(nil), // 2: common.Metadata - (*MetadataMutable)(nil), // 3: common.MetadataMutable - nil, // 4: common.Metadata.LabelsEntry - nil, // 5: common.MetadataMutable.LabelsEntry - (*timestamppb.Timestamp)(nil), // 6: google.protobuf.Timestamp + (*IdNameIdentifier)(nil), // 2: common.IdNameIdentifier + (*IdFqnIdentifier)(nil), // 3: common.IdFqnIdentifier + (*Metadata)(nil), // 4: common.Metadata + (*MetadataMutable)(nil), // 5: common.MetadataMutable + nil, // 6: common.Metadata.LabelsEntry + nil, // 7: common.MetadataMutable.LabelsEntry + (*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp } var file_common_common_proto_depIdxs = []int32{ - 6, // 0: common.Metadata.created_at:type_name -> google.protobuf.Timestamp - 6, // 1: common.Metadata.updated_at:type_name -> google.protobuf.Timestamp - 4, // 2: common.Metadata.labels:type_name -> common.Metadata.LabelsEntry - 5, // 3: common.MetadataMutable.labels:type_name -> common.MetadataMutable.LabelsEntry + 8, // 0: common.Metadata.created_at:type_name -> google.protobuf.Timestamp + 8, // 1: common.Metadata.updated_at:type_name -> google.protobuf.Timestamp + 6, // 2: common.Metadata.labels:type_name -> common.Metadata.LabelsEntry + 7, // 3: common.MetadataMutable.labels:type_name -> common.MetadataMutable.LabelsEntry 4, // [4:4] is the sub-list for method output_type 4, // [4:4] is the sub-list for method input_type 4, // [4:4] is the sub-list for extension type_name @@ -342,7 +469,7 @@ func file_common_common_proto_init() { } if !protoimpl.UnsafeEnabled { file_common_common_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Metadata); i { + switch v := v.(*IdNameIdentifier); i { case 0: return &v.state case 1: @@ -354,6 +481,30 @@ func file_common_common_proto_init() { } } file_common_common_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IdFqnIdentifier); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_common_common_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Metadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_common_common_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MetadataMutable); i { case 0: return &v.state @@ -372,7 +523,7 @@ func file_common_common_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_common_common_proto_rawDesc, NumEnums: 2, - NumMessages: 4, + NumMessages: 6, NumExtensions: 0, NumServices: 0, }, diff --git a/protocol/go/policy/obligations/obligations.pb.go b/protocol/go/policy/obligations/obligations.pb.go index 41ab1b9767..43152a2acf 100644 --- a/protocol/go/policy/obligations/obligations.pb.go +++ b/protocol/go/policy/obligations/obligations.pb.go @@ -105,116 +105,6 @@ func (*GetObligationRequest_Id) isGetObligationRequest_Identifier() {} func (*GetObligationRequest_Fqn) isGetObligationRequest_Identifier() {} -type IdNameIdentifier struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` -} - -func (x *IdNameIdentifier) Reset() { - *x = IdNameIdentifier{} - if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *IdNameIdentifier) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*IdNameIdentifier) ProtoMessage() {} - -func (x *IdNameIdentifier) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_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 IdNameIdentifier.ProtoReflect.Descriptor instead. -func (*IdNameIdentifier) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{1} -} - -func (x *IdNameIdentifier) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *IdNameIdentifier) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type IdFqnIdentifier struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Fqn string `protobuf:"bytes,2,opt,name=fqn,proto3" json:"fqn,omitempty"` -} - -func (x *IdFqnIdentifier) Reset() { - *x = IdFqnIdentifier{} - if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *IdFqnIdentifier) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*IdFqnIdentifier) ProtoMessage() {} - -func (x *IdFqnIdentifier) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_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 IdFqnIdentifier.ProtoReflect.Descriptor instead. -func (*IdFqnIdentifier) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{2} -} - -func (x *IdFqnIdentifier) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *IdFqnIdentifier) GetFqn() string { - if x != nil { - return x.Fqn - } - return "" -} - type GetObligationResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -226,7 +116,7 @@ type GetObligationResponse struct { func (x *GetObligationResponse) Reset() { *x = GetObligationResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[3] + mi := &file_policy_obligations_obligations_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -239,7 +129,7 @@ func (x *GetObligationResponse) String() string { func (*GetObligationResponse) ProtoMessage() {} func (x *GetObligationResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[3] + mi := &file_policy_obligations_obligations_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -252,7 +142,7 @@ func (x *GetObligationResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetObligationResponse.ProtoReflect.Descriptor instead. func (*GetObligationResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{3} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{1} } func (x *GetObligationResponse) GetObligation() *policy.Obligation { @@ -273,7 +163,7 @@ type GetObligationsByFQNsRequest struct { func (x *GetObligationsByFQNsRequest) Reset() { *x = GetObligationsByFQNsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[4] + mi := &file_policy_obligations_obligations_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -286,7 +176,7 @@ func (x *GetObligationsByFQNsRequest) String() string { func (*GetObligationsByFQNsRequest) ProtoMessage() {} func (x *GetObligationsByFQNsRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[4] + mi := &file_policy_obligations_obligations_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -299,7 +189,7 @@ func (x *GetObligationsByFQNsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetObligationsByFQNsRequest.ProtoReflect.Descriptor instead. func (*GetObligationsByFQNsRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{4} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{2} } func (x *GetObligationsByFQNsRequest) GetFqns() []string { @@ -320,7 +210,7 @@ type GetObligationsByFQNsResponse struct { func (x *GetObligationsByFQNsResponse) Reset() { *x = GetObligationsByFQNsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[5] + mi := &file_policy_obligations_obligations_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -333,7 +223,7 @@ func (x *GetObligationsByFQNsResponse) String() string { func (*GetObligationsByFQNsResponse) ProtoMessage() {} func (x *GetObligationsByFQNsResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[5] + mi := &file_policy_obligations_obligations_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -346,7 +236,7 @@ func (x *GetObligationsByFQNsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetObligationsByFQNsResponse.ProtoReflect.Descriptor instead. func (*GetObligationsByFQNsResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{5} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{3} } func (x *GetObligationsByFQNsResponse) GetFqnObligationMap() map[string]*policy.Obligation { @@ -379,7 +269,7 @@ type CreateObligationRequest struct { func (x *CreateObligationRequest) Reset() { *x = CreateObligationRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[6] + mi := &file_policy_obligations_obligations_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -392,7 +282,7 @@ func (x *CreateObligationRequest) String() string { func (*CreateObligationRequest) ProtoMessage() {} func (x *CreateObligationRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[6] + mi := &file_policy_obligations_obligations_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -405,7 +295,7 @@ func (x *CreateObligationRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateObligationRequest.ProtoReflect.Descriptor instead. func (*CreateObligationRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{6} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{4} } func (m *CreateObligationRequest) GetNamespaceIdentifier() isCreateObligationRequest_NamespaceIdentifier { @@ -477,7 +367,7 @@ type CreateObligationResponse struct { func (x *CreateObligationResponse) Reset() { *x = CreateObligationResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[7] + mi := &file_policy_obligations_obligations_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -490,7 +380,7 @@ func (x *CreateObligationResponse) String() string { func (*CreateObligationResponse) ProtoMessage() {} func (x *CreateObligationResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[7] + mi := &file_policy_obligations_obligations_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -503,7 +393,7 @@ func (x *CreateObligationResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateObligationResponse.ProtoReflect.Descriptor instead. func (*CreateObligationResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{7} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{5} } func (x *CreateObligationResponse) GetObligation() *policy.Obligation { @@ -529,7 +419,7 @@ type UpdateObligationRequest struct { func (x *UpdateObligationRequest) Reset() { *x = UpdateObligationRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[8] + mi := &file_policy_obligations_obligations_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -542,7 +432,7 @@ func (x *UpdateObligationRequest) String() string { func (*UpdateObligationRequest) ProtoMessage() {} func (x *UpdateObligationRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[8] + mi := &file_policy_obligations_obligations_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -555,7 +445,7 @@ func (x *UpdateObligationRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateObligationRequest.ProtoReflect.Descriptor instead. func (*UpdateObligationRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{8} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{6} } func (x *UpdateObligationRequest) GetId() string { @@ -597,7 +487,7 @@ type UpdateObligationResponse struct { func (x *UpdateObligationResponse) Reset() { *x = UpdateObligationResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[9] + mi := &file_policy_obligations_obligations_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -610,7 +500,7 @@ func (x *UpdateObligationResponse) String() string { func (*UpdateObligationResponse) ProtoMessage() {} func (x *UpdateObligationResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[9] + mi := &file_policy_obligations_obligations_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -623,7 +513,7 @@ func (x *UpdateObligationResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateObligationResponse.ProtoReflect.Descriptor instead. func (*UpdateObligationResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{9} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{7} } func (x *UpdateObligationResponse) GetObligation() *policy.Obligation { @@ -648,7 +538,7 @@ type DeleteObligationRequest struct { func (x *DeleteObligationRequest) Reset() { *x = DeleteObligationRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[10] + mi := &file_policy_obligations_obligations_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -661,7 +551,7 @@ func (x *DeleteObligationRequest) String() string { func (*DeleteObligationRequest) ProtoMessage() {} func (x *DeleteObligationRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[10] + mi := &file_policy_obligations_obligations_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -674,7 +564,7 @@ func (x *DeleteObligationRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteObligationRequest.ProtoReflect.Descriptor instead. func (*DeleteObligationRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{10} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{8} } func (m *DeleteObligationRequest) GetIdentifier() isDeleteObligationRequest_Identifier { @@ -725,7 +615,7 @@ type DeleteObligationResponse struct { func (x *DeleteObligationResponse) Reset() { *x = DeleteObligationResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[11] + mi := &file_policy_obligations_obligations_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -738,7 +628,7 @@ func (x *DeleteObligationResponse) String() string { func (*DeleteObligationResponse) ProtoMessage() {} func (x *DeleteObligationResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[11] + mi := &file_policy_obligations_obligations_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -751,7 +641,7 @@ func (x *DeleteObligationResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteObligationResponse.ProtoReflect.Descriptor instead. func (*DeleteObligationResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{11} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{9} } func (x *DeleteObligationResponse) GetObligation() *policy.Obligation { @@ -781,7 +671,7 @@ type ListObligationsRequest struct { func (x *ListObligationsRequest) Reset() { *x = ListObligationsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[12] + mi := &file_policy_obligations_obligations_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -794,7 +684,7 @@ func (x *ListObligationsRequest) String() string { func (*ListObligationsRequest) ProtoMessage() {} func (x *ListObligationsRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[12] + mi := &file_policy_obligations_obligations_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -807,7 +697,7 @@ func (x *ListObligationsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListObligationsRequest.ProtoReflect.Descriptor instead. func (*ListObligationsRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{12} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{10} } func (m *ListObligationsRequest) GetNamespaceIdentifier() isListObligationsRequest_NamespaceIdentifier { @@ -866,7 +756,7 @@ type ListObligationsResponse struct { func (x *ListObligationsResponse) Reset() { *x = ListObligationsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[13] + mi := &file_policy_obligations_obligations_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -879,7 +769,7 @@ func (x *ListObligationsResponse) String() string { func (*ListObligationsResponse) ProtoMessage() {} func (x *ListObligationsResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[13] + mi := &file_policy_obligations_obligations_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -892,7 +782,7 @@ func (x *ListObligationsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListObligationsResponse.ProtoReflect.Descriptor instead. func (*ListObligationsResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{13} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{11} } func (x *ListObligationsResponse) GetObligations() []*policy.Obligation { @@ -925,7 +815,7 @@ type GetObligationValueRequest struct { func (x *GetObligationValueRequest) Reset() { *x = GetObligationValueRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[14] + mi := &file_policy_obligations_obligations_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -938,7 +828,7 @@ func (x *GetObligationValueRequest) String() string { func (*GetObligationValueRequest) ProtoMessage() {} func (x *GetObligationValueRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[14] + mi := &file_policy_obligations_obligations_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -951,7 +841,7 @@ func (x *GetObligationValueRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetObligationValueRequest.ProtoReflect.Descriptor instead. func (*GetObligationValueRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{14} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{12} } func (m *GetObligationValueRequest) GetIdentifier() isGetObligationValueRequest_Identifier { @@ -1002,7 +892,7 @@ type GetObligationValueResponse struct { func (x *GetObligationValueResponse) Reset() { *x = GetObligationValueResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[15] + mi := &file_policy_obligations_obligations_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1015,7 +905,7 @@ func (x *GetObligationValueResponse) String() string { func (*GetObligationValueResponse) ProtoMessage() {} func (x *GetObligationValueResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[15] + mi := &file_policy_obligations_obligations_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1028,7 +918,7 @@ func (x *GetObligationValueResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetObligationValueResponse.ProtoReflect.Descriptor instead. func (*GetObligationValueResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{15} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{13} } func (x *GetObligationValueResponse) GetValue() *policy.ObligationValue { @@ -1049,7 +939,7 @@ type GetObligationValuesByFQNsRequest struct { func (x *GetObligationValuesByFQNsRequest) Reset() { *x = GetObligationValuesByFQNsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[16] + mi := &file_policy_obligations_obligations_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1062,7 +952,7 @@ func (x *GetObligationValuesByFQNsRequest) String() string { func (*GetObligationValuesByFQNsRequest) ProtoMessage() {} func (x *GetObligationValuesByFQNsRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[16] + mi := &file_policy_obligations_obligations_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1075,7 +965,7 @@ func (x *GetObligationValuesByFQNsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetObligationValuesByFQNsRequest.ProtoReflect.Descriptor instead. func (*GetObligationValuesByFQNsRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{16} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{14} } func (x *GetObligationValuesByFQNsRequest) GetFqns() []string { @@ -1096,7 +986,7 @@ type GetObligationValuesByFQNsResponse struct { func (x *GetObligationValuesByFQNsResponse) Reset() { *x = GetObligationValuesByFQNsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[17] + mi := &file_policy_obligations_obligations_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1109,7 +999,7 @@ func (x *GetObligationValuesByFQNsResponse) String() string { func (*GetObligationValuesByFQNsResponse) ProtoMessage() {} func (x *GetObligationValuesByFQNsResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[17] + mi := &file_policy_obligations_obligations_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1122,7 +1012,7 @@ func (x *GetObligationValuesByFQNsResponse) ProtoReflect() protoreflect.Message // Deprecated: Use GetObligationValuesByFQNsResponse.ProtoReflect.Descriptor instead. func (*GetObligationValuesByFQNsResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{17} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{15} } func (x *GetObligationValuesByFQNsResponse) GetFqnValueMap() map[string]*policy.ObligationValue { @@ -1153,7 +1043,7 @@ type CreateObligationValueRequest struct { func (x *CreateObligationValueRequest) Reset() { *x = CreateObligationValueRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[18] + mi := &file_policy_obligations_obligations_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1166,7 +1056,7 @@ func (x *CreateObligationValueRequest) String() string { func (*CreateObligationValueRequest) ProtoMessage() {} func (x *CreateObligationValueRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[18] + mi := &file_policy_obligations_obligations_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1179,7 +1069,7 @@ func (x *CreateObligationValueRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateObligationValueRequest.ProtoReflect.Descriptor instead. func (*CreateObligationValueRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{18} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{16} } func (m *CreateObligationValueRequest) GetObligationIdentifier() isCreateObligationValueRequest_ObligationIdentifier { @@ -1244,7 +1134,7 @@ type CreateObligationValueResponse struct { func (x *CreateObligationValueResponse) Reset() { *x = CreateObligationValueResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[19] + mi := &file_policy_obligations_obligations_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1257,7 +1147,7 @@ func (x *CreateObligationValueResponse) String() string { func (*CreateObligationValueResponse) ProtoMessage() {} func (x *CreateObligationValueResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[19] + mi := &file_policy_obligations_obligations_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1270,7 +1160,7 @@ func (x *CreateObligationValueResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateObligationValueResponse.ProtoReflect.Descriptor instead. func (*CreateObligationValueResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{19} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{17} } func (x *CreateObligationValueResponse) GetValue() *policy.ObligationValue { @@ -1296,7 +1186,7 @@ type UpdateObligationValueRequest struct { func (x *UpdateObligationValueRequest) Reset() { *x = UpdateObligationValueRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[20] + mi := &file_policy_obligations_obligations_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1309,7 +1199,7 @@ func (x *UpdateObligationValueRequest) String() string { func (*UpdateObligationValueRequest) ProtoMessage() {} func (x *UpdateObligationValueRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[20] + mi := &file_policy_obligations_obligations_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1322,7 +1212,7 @@ func (x *UpdateObligationValueRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateObligationValueRequest.ProtoReflect.Descriptor instead. func (*UpdateObligationValueRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{20} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{18} } func (x *UpdateObligationValueRequest) GetId() string { @@ -1364,7 +1254,7 @@ type UpdateObligationValueResponse struct { func (x *UpdateObligationValueResponse) Reset() { *x = UpdateObligationValueResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[21] + mi := &file_policy_obligations_obligations_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1377,7 +1267,7 @@ func (x *UpdateObligationValueResponse) String() string { func (*UpdateObligationValueResponse) ProtoMessage() {} func (x *UpdateObligationValueResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[21] + mi := &file_policy_obligations_obligations_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1390,7 +1280,7 @@ func (x *UpdateObligationValueResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateObligationValueResponse.ProtoReflect.Descriptor instead. func (*UpdateObligationValueResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{21} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{19} } func (x *UpdateObligationValueResponse) GetValue() *policy.ObligationValue { @@ -1415,7 +1305,7 @@ type DeleteObligationValueRequest struct { func (x *DeleteObligationValueRequest) Reset() { *x = DeleteObligationValueRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[22] + mi := &file_policy_obligations_obligations_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1428,7 +1318,7 @@ func (x *DeleteObligationValueRequest) String() string { func (*DeleteObligationValueRequest) ProtoMessage() {} func (x *DeleteObligationValueRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[22] + mi := &file_policy_obligations_obligations_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1441,7 +1331,7 @@ func (x *DeleteObligationValueRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteObligationValueRequest.ProtoReflect.Descriptor instead. func (*DeleteObligationValueRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{22} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{20} } func (m *DeleteObligationValueRequest) GetIdentifier() isDeleteObligationValueRequest_Identifier { @@ -1492,7 +1382,7 @@ type DeleteObligationValueResponse struct { func (x *DeleteObligationValueResponse) Reset() { *x = DeleteObligationValueResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[23] + mi := &file_policy_obligations_obligations_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1505,7 +1395,7 @@ func (x *DeleteObligationValueResponse) String() string { func (*DeleteObligationValueResponse) ProtoMessage() {} func (x *DeleteObligationValueResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[23] + mi := &file_policy_obligations_obligations_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1518,7 +1408,7 @@ func (x *DeleteObligationValueResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteObligationValueResponse.ProtoReflect.Descriptor instead. func (*DeleteObligationValueResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{23} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{21} } func (x *DeleteObligationValueResponse) GetValue() *policy.ObligationValue { @@ -1535,11 +1425,11 @@ type AddObligationTriggerRequest struct { unknownFields protoimpl.UnknownFields // Required - ObligationValue *IdFqnIdentifier `protobuf:"bytes,1,opt,name=obligation_value,json=obligationValue,proto3" json:"obligation_value,omitempty"` + ObligationValue *common.IdFqnIdentifier `protobuf:"bytes,1,opt,name=obligation_value,json=obligationValue,proto3" json:"obligation_value,omitempty"` // Required - Action *IdNameIdentifier `protobuf:"bytes,2,opt,name=action,proto3" json:"action,omitempty"` + Action *common.IdNameIdentifier `protobuf:"bytes,2,opt,name=action,proto3" json:"action,omitempty"` // Required - AttributeValue *IdFqnIdentifier `protobuf:"bytes,3,opt,name=attribute_value,json=attributeValue,proto3" json:"attribute_value,omitempty"` + AttributeValue *common.IdFqnIdentifier `protobuf:"bytes,3,opt,name=attribute_value,json=attributeValue,proto3" json:"attribute_value,omitempty"` // Optional // Common metadata Metadata *common.MetadataMutable `protobuf:"bytes,100,opt,name=metadata,proto3" json:"metadata,omitempty"` @@ -1548,7 +1438,7 @@ type AddObligationTriggerRequest struct { func (x *AddObligationTriggerRequest) Reset() { *x = AddObligationTriggerRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[24] + mi := &file_policy_obligations_obligations_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1561,7 +1451,7 @@ func (x *AddObligationTriggerRequest) String() string { func (*AddObligationTriggerRequest) ProtoMessage() {} func (x *AddObligationTriggerRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[24] + mi := &file_policy_obligations_obligations_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1574,24 +1464,24 @@ func (x *AddObligationTriggerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AddObligationTriggerRequest.ProtoReflect.Descriptor instead. func (*AddObligationTriggerRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{24} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{22} } -func (x *AddObligationTriggerRequest) GetObligationValue() *IdFqnIdentifier { +func (x *AddObligationTriggerRequest) GetObligationValue() *common.IdFqnIdentifier { if x != nil { return x.ObligationValue } return nil } -func (x *AddObligationTriggerRequest) GetAction() *IdNameIdentifier { +func (x *AddObligationTriggerRequest) GetAction() *common.IdNameIdentifier { if x != nil { return x.Action } return nil } -func (x *AddObligationTriggerRequest) GetAttributeValue() *IdFqnIdentifier { +func (x *AddObligationTriggerRequest) GetAttributeValue() *common.IdFqnIdentifier { if x != nil { return x.AttributeValue } @@ -1616,7 +1506,7 @@ type AddObligationTriggerResponse struct { func (x *AddObligationTriggerResponse) Reset() { *x = AddObligationTriggerResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[25] + mi := &file_policy_obligations_obligations_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1629,7 +1519,7 @@ func (x *AddObligationTriggerResponse) String() string { func (*AddObligationTriggerResponse) ProtoMessage() {} func (x *AddObligationTriggerResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[25] + mi := &file_policy_obligations_obligations_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1642,7 +1532,7 @@ func (x *AddObligationTriggerResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AddObligationTriggerResponse.ProtoReflect.Descriptor instead. func (*AddObligationTriggerResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{25} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{23} } func (x *AddObligationTriggerResponse) GetTrigger() *policy.ObligationTrigger { @@ -1664,7 +1554,7 @@ type RemoveObligationTriggerRequest struct { func (x *RemoveObligationTriggerRequest) Reset() { *x = RemoveObligationTriggerRequest{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[26] + mi := &file_policy_obligations_obligations_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1677,7 +1567,7 @@ func (x *RemoveObligationTriggerRequest) String() string { func (*RemoveObligationTriggerRequest) ProtoMessage() {} func (x *RemoveObligationTriggerRequest) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[26] + mi := &file_policy_obligations_obligations_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1690,7 +1580,7 @@ func (x *RemoveObligationTriggerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use RemoveObligationTriggerRequest.ProtoReflect.Descriptor instead. func (*RemoveObligationTriggerRequest) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{26} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{24} } func (x *RemoveObligationTriggerRequest) GetId() string { @@ -1711,7 +1601,7 @@ type RemoveObligationTriggerResponse struct { func (x *RemoveObligationTriggerResponse) Reset() { *x = RemoveObligationTriggerResponse{} if protoimpl.UnsafeEnabled { - mi := &file_policy_obligations_obligations_proto_msgTypes[27] + mi := &file_policy_obligations_obligations_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1724,7 +1614,7 @@ func (x *RemoveObligationTriggerResponse) String() string { func (*RemoveObligationTriggerResponse) ProtoMessage() {} func (x *RemoveObligationTriggerResponse) ProtoReflect() protoreflect.Message { - mi := &file_policy_obligations_obligations_proto_msgTypes[27] + mi := &file_policy_obligations_obligations_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1737,7 +1627,7 @@ func (x *RemoveObligationTriggerResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use RemoveObligationTriggerResponse.ProtoReflect.Descriptor instead. func (*RemoveObligationTriggerResponse) Descriptor() ([]byte, []int) { - return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{27} + return file_policy_obligations_obligations_proto_rawDescGZIP(), []int{25} } func (x *RemoveObligationTriggerResponse) GetTrigger() *policy.ObligationTrigger { @@ -1764,325 +1654,311 @@ var file_policy_obligations_obligations_proto_rawDesc = []byte{ 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x5c, 0x0a, 0x10, 0x49, 0x64, 0x4e, 0x61, 0x6d, 0x65, - 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x3a, 0x11, 0xba, 0x48, 0x0e, 0x22, 0x0c, 0x0a, 0x02, 0x69, 0x64, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x10, 0x01, 0x22, 0x5b, 0x0a, 0x0f, 0x49, 0x64, 0x46, 0x71, 0x6e, 0x49, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x1c, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, - 0xba, 0x48, 0x07, 0x72, 0x05, 0x10, 0x01, 0x88, 0x01, 0x01, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x3a, - 0x10, 0xba, 0x48, 0x0d, 0x22, 0x0b, 0x0a, 0x02, 0x69, 0x64, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x10, - 0x01, 0x22, 0x4b, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, - 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x31, - 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, - 0x04, 0x66, 0x71, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x66, 0x71, 0x6e, - 0x73, 0x22, 0xed, 0x01, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x74, 0x0a, 0x12, 0x66, 0x71, 0x6e, 0x5f, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x46, - 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x2e, 0x46, 0x71, 0x6e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, - 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x10, 0x66, 0x71, 0x6e, 0x4f, 0x62, 0x6c, 0x69, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x70, 0x1a, 0x57, 0x0a, 0x15, 0x46, 0x71, 0x6e, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x22, 0xb8, 0x01, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, - 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, - 0x66, 0x71, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, - 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x42, 0x16, 0x0a, 0x14, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, - 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, 0x18, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xc8, 0x01, 0x0a, - 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x33, 0x0a, 0x08, - 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x12, 0x54, 0x0a, 0x18, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x75, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x18, 0x65, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, - 0x16, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, - 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x22, 0x4e, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4d, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4b, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x22, 0x31, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x04, 0x66, 0x71, 0x6e, 0x73, 0x22, 0xed, 0x01, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x4f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x74, 0x0a, 0x12, 0x66, 0x71, 0x6e, 0x5f, 0x6f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x46, 0x71, 0x6e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x10, 0x66, 0x71, 0x6e, + 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x70, 0x1a, 0x57, 0x0a, + 0x15, 0x46, 0x71, 0x6e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, + 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xb8, 0x01, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, - 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x8b, 0x01, 0x0a, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x12, 0x33, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x16, 0x0a, 0x14, - 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x66, 0x69, 0x65, 0x72, 0x22, 0x85, 0x01, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x34, 0x0a, 0x0b, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x6f, 0x62, 0x6c, 0x69, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x34, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4f, 0x0a, 0x19, - 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, - 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x42, - 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4b, 0x0a, - 0x1a, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x36, 0x0a, 0x20, 0x47, 0x65, - 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, - 0x0a, 0x04, 0x66, 0x71, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x66, 0x71, - 0x6e, 0x73, 0x22, 0xe8, 0x01, 0x0a, 0x21, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6a, 0x0a, 0x0d, 0x66, 0x71, 0x6e, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x46, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x46, 0x71, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, - 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x66, 0x71, 0x6e, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x4d, 0x61, 0x70, 0x1a, 0x57, 0x0a, 0x10, 0x46, 0x71, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xa8, 0x01, - 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x16, 0x0a, 0x14, 0x6e, 0x61, 0x6d, + 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, + 0x72, 0x22, 0x4e, 0x0a, 0x18, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, + 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x22, 0xc8, 0x01, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x54, 0x0a, 0x18, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, + 0x6f, 0x72, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x16, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x22, 0x4e, 0x0a, 0x18, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4d, 0x0a, 0x17, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x42, 0x0c, 0x0a, + 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, 0x18, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x0a, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x8b, 0x01, 0x0a, 0x16, + 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x12, 0x33, 0x0a, 0x0a, + 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x13, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x42, 0x16, 0x0a, 0x14, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x85, 0x01, 0x0a, 0x17, 0x4c, 0x69, + 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, + 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x34, 0x0a, 0x0a, 0x70, + 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x14, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x22, 0x4f, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x03, 0x66, 0x71, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, - 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, - 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, - 0x17, 0x0a, 0x15, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, 0x1d, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xcf, 0x01, 0x0a, 0x1c, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, + 0x03, 0x66, 0x71, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, + 0x65, 0x72, 0x22, 0x4b, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x36, 0x0a, 0x20, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x04, 0x66, 0x71, 0x6e, 0x73, 0x22, 0xe8, 0x01, 0x0a, 0x21, 0x47, 0x65, 0x74, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, + 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6a, 0x0a, + 0x0d, 0x66, 0x71, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, + 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x46, 0x71, 0x6e, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x66, 0x71, + 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x70, 0x1a, 0x57, 0x0a, 0x10, 0x46, 0x71, 0x6e, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, + 0x38, 0x01, 0x22, 0xa8, 0x01, 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x12, 0x54, 0x0a, 0x18, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, - 0x18, 0x65, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x6e, - 0x75, 0x6d, 0x52, 0x16, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x22, 0x4e, 0x0a, 0x1d, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x52, 0x0a, 0x1c, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x03, - 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x66, 0x71, 0x6e, - 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, - 0x0a, 0x1d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xc6, - 0x02, 0x0a, 0x1b, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x56, - 0x0a, 0x10, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x64, - 0x46, 0x71, 0x6e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x42, 0x06, 0xba, - 0x48, 0x03, 0xc8, 0x01, 0x01, 0x52, 0x0f, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x44, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, - 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x64, 0x4e, 0x61, - 0x6d, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x42, 0x06, 0xba, 0x48, - 0x03, 0xc8, 0x01, 0x01, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x54, 0x0a, 0x0f, - 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x64, 0x46, 0x71, 0x6e, - 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x42, 0x06, 0xba, 0x48, 0x03, 0xc8, - 0x01, 0x01, 0x52, 0x0e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x64, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x53, 0x0a, 0x1c, 0x41, 0x64, 0x64, 0x4f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, - 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, - 0x67, 0x65, 0x72, 0x52, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x22, 0x3a, 0x0a, 0x1e, - 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, - 0x03, 0xb0, 0x01, 0x01, 0x52, 0x02, 0x69, 0x64, 0x22, 0x56, 0x0a, 0x1f, 0x52, 0x65, 0x6d, 0x6f, - 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, - 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x07, 0x74, - 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, - 0x32, 0xc6, 0x0c, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6f, 0x0a, 0x0f, - 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, - 0x2a, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x69, 0x0a, - 0x0d, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, - 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, - 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x7e, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, - 0x12, 0x2f, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x6f, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, + 0x64, 0x61, 0x74, 0x61, 0x42, 0x17, 0x0a, 0x15, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, + 0x1d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, + 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xcf, 0x01, + 0x0a, 0x1c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x54, 0x0a, 0x18, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x65, 0x68, + 0x61, 0x76, 0x69, 0x6f, 0x72, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x16, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x22, + 0x4e, 0x0a, 0x1d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x52, 0x0a, 0x1c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x12, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x03, 0x66, 0x71, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, + 0x69, 0x65, 0x72, 0x22, 0x4e, 0x0a, 0x1d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x22, 0xa2, 0x02, 0x0a, 0x1b, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x4a, 0x0a, 0x10, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x49, 0x64, 0x46, 0x71, 0x6e, 0x49, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x42, 0x06, 0xba, 0x48, 0x03, 0xc8, 0x01, 0x01, 0x52, 0x0f, + 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, + 0x38, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x49, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x49, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x42, 0x06, 0xba, 0x48, 0x03, 0xc8, 0x01, + 0x01, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, 0x0f, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x49, 0x64, 0x46, 0x71, + 0x6e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x42, 0x06, 0xba, 0x48, 0x03, + 0xc8, 0x01, 0x01, 0x52, 0x0e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, + 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x08, + 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x53, 0x0a, 0x1c, 0x41, 0x64, 0x64, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x72, 0x69, 0x67, + 0x67, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, + 0x67, 0x67, 0x65, 0x72, 0x52, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x22, 0x3a, 0x0a, + 0x1e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x18, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, + 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x02, 0x69, 0x64, 0x22, 0x56, 0x0a, 0x1f, 0x52, 0x65, 0x6d, + 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, + 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x07, + 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x07, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, + 0x72, 0x32, 0xc6, 0x0c, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6f, 0x0a, + 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6f, 0x0a, 0x10, 0x55, 0x70, 0x64, + 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x69, + 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x28, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, + 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x7e, 0x0a, 0x14, 0x47, 0x65, 0x74, + 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, + 0x73, 0x12, 0x2f, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x6f, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6f, 0x0a, 0x10, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6f, 0x0a, 0x10, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x78, 0x0a, 0x12, 0x47, - 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x12, 0x2d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, + 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6f, 0x0a, 0x10, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x2b, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x70, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x78, 0x0a, 0x12, + 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x12, 0x2d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x2e, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x2e, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x8d, 0x01, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, + 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x8d, 0x01, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, + 0x46, 0x51, 0x4e, 0x73, 0x12, 0x34, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, - 0x51, 0x4e, 0x73, 0x12, 0x34, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, - 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, - 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x7e, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x30, - 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x7e, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x30, - 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x7e, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, - 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x30, - 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x7b, 0x0a, 0x14, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12, 0x2f, 0x2e, - 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, + 0x51, 0x4e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x42, 0x79, 0x46, 0x51, 0x4e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x03, 0x90, 0x02, 0x01, 0x12, 0x7e, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, + 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x7e, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, + 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x7e, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, + 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x7b, 0x0a, 0x14, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12, 0x2f, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x84, 0x01, 0x0a, 0x17, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, - 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12, 0x32, - 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0xcf, 0x01, 0x0a, 0x16, 0x63, 0x6f, - 0x6d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x10, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x64, 0x66, 0x2f, 0x70, 0x6c, 0x61, - 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x67, - 0x6f, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2f, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x4f, 0x58, 0xaa, 0x02, 0x12, 0x50, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xca, - 0x02, 0x12, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0xe2, 0x02, 0x1e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x4f, 0x62, - 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x3a, 0x3a, - 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x30, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x84, 0x01, 0x0a, 0x17, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, + 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12, + 0x32, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x62, 0x6c, 0x69, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, + 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0xcf, 0x01, 0x0a, 0x16, 0x63, + 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x10, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x64, 0x66, 0x2f, 0x70, 0x6c, + 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, + 0x67, 0x6f, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2f, 0x6f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x4f, 0x58, 0xaa, 0x02, 0x12, 0x50, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0xca, 0x02, 0x12, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xe2, 0x02, 0x1e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x4f, + 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x3a, + 0x3a, 0x4f, 0x62, 0x6c, 0x69, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2097,100 +1973,100 @@ func file_policy_obligations_obligations_proto_rawDescGZIP() []byte { return file_policy_obligations_obligations_proto_rawDescData } -var file_policy_obligations_obligations_proto_msgTypes = make([]protoimpl.MessageInfo, 30) +var file_policy_obligations_obligations_proto_msgTypes = make([]protoimpl.MessageInfo, 28) var file_policy_obligations_obligations_proto_goTypes = []interface{}{ (*GetObligationRequest)(nil), // 0: policy.obligations.GetObligationRequest - (*IdNameIdentifier)(nil), // 1: policy.obligations.IdNameIdentifier - (*IdFqnIdentifier)(nil), // 2: policy.obligations.IdFqnIdentifier - (*GetObligationResponse)(nil), // 3: policy.obligations.GetObligationResponse - (*GetObligationsByFQNsRequest)(nil), // 4: policy.obligations.GetObligationsByFQNsRequest - (*GetObligationsByFQNsResponse)(nil), // 5: policy.obligations.GetObligationsByFQNsResponse - (*CreateObligationRequest)(nil), // 6: policy.obligations.CreateObligationRequest - (*CreateObligationResponse)(nil), // 7: policy.obligations.CreateObligationResponse - (*UpdateObligationRequest)(nil), // 8: policy.obligations.UpdateObligationRequest - (*UpdateObligationResponse)(nil), // 9: policy.obligations.UpdateObligationResponse - (*DeleteObligationRequest)(nil), // 10: policy.obligations.DeleteObligationRequest - (*DeleteObligationResponse)(nil), // 11: policy.obligations.DeleteObligationResponse - (*ListObligationsRequest)(nil), // 12: policy.obligations.ListObligationsRequest - (*ListObligationsResponse)(nil), // 13: policy.obligations.ListObligationsResponse - (*GetObligationValueRequest)(nil), // 14: policy.obligations.GetObligationValueRequest - (*GetObligationValueResponse)(nil), // 15: policy.obligations.GetObligationValueResponse - (*GetObligationValuesByFQNsRequest)(nil), // 16: policy.obligations.GetObligationValuesByFQNsRequest - (*GetObligationValuesByFQNsResponse)(nil), // 17: policy.obligations.GetObligationValuesByFQNsResponse - (*CreateObligationValueRequest)(nil), // 18: policy.obligations.CreateObligationValueRequest - (*CreateObligationValueResponse)(nil), // 19: policy.obligations.CreateObligationValueResponse - (*UpdateObligationValueRequest)(nil), // 20: policy.obligations.UpdateObligationValueRequest - (*UpdateObligationValueResponse)(nil), // 21: policy.obligations.UpdateObligationValueResponse - (*DeleteObligationValueRequest)(nil), // 22: policy.obligations.DeleteObligationValueRequest - (*DeleteObligationValueResponse)(nil), // 23: policy.obligations.DeleteObligationValueResponse - (*AddObligationTriggerRequest)(nil), // 24: policy.obligations.AddObligationTriggerRequest - (*AddObligationTriggerResponse)(nil), // 25: policy.obligations.AddObligationTriggerResponse - (*RemoveObligationTriggerRequest)(nil), // 26: policy.obligations.RemoveObligationTriggerRequest - (*RemoveObligationTriggerResponse)(nil), // 27: policy.obligations.RemoveObligationTriggerResponse - nil, // 28: policy.obligations.GetObligationsByFQNsResponse.FqnObligationMapEntry - nil, // 29: policy.obligations.GetObligationValuesByFQNsResponse.FqnValueMapEntry - (*policy.Obligation)(nil), // 30: policy.Obligation - (*common.MetadataMutable)(nil), // 31: common.MetadataMutable - (common.MetadataUpdateEnum)(0), // 32: common.MetadataUpdateEnum - (*policy.PageRequest)(nil), // 33: policy.PageRequest - (*policy.PageResponse)(nil), // 34: policy.PageResponse - (*policy.ObligationValue)(nil), // 35: policy.ObligationValue + (*GetObligationResponse)(nil), // 1: policy.obligations.GetObligationResponse + (*GetObligationsByFQNsRequest)(nil), // 2: policy.obligations.GetObligationsByFQNsRequest + (*GetObligationsByFQNsResponse)(nil), // 3: policy.obligations.GetObligationsByFQNsResponse + (*CreateObligationRequest)(nil), // 4: policy.obligations.CreateObligationRequest + (*CreateObligationResponse)(nil), // 5: policy.obligations.CreateObligationResponse + (*UpdateObligationRequest)(nil), // 6: policy.obligations.UpdateObligationRequest + (*UpdateObligationResponse)(nil), // 7: policy.obligations.UpdateObligationResponse + (*DeleteObligationRequest)(nil), // 8: policy.obligations.DeleteObligationRequest + (*DeleteObligationResponse)(nil), // 9: policy.obligations.DeleteObligationResponse + (*ListObligationsRequest)(nil), // 10: policy.obligations.ListObligationsRequest + (*ListObligationsResponse)(nil), // 11: policy.obligations.ListObligationsResponse + (*GetObligationValueRequest)(nil), // 12: policy.obligations.GetObligationValueRequest + (*GetObligationValueResponse)(nil), // 13: policy.obligations.GetObligationValueResponse + (*GetObligationValuesByFQNsRequest)(nil), // 14: policy.obligations.GetObligationValuesByFQNsRequest + (*GetObligationValuesByFQNsResponse)(nil), // 15: policy.obligations.GetObligationValuesByFQNsResponse + (*CreateObligationValueRequest)(nil), // 16: policy.obligations.CreateObligationValueRequest + (*CreateObligationValueResponse)(nil), // 17: policy.obligations.CreateObligationValueResponse + (*UpdateObligationValueRequest)(nil), // 18: policy.obligations.UpdateObligationValueRequest + (*UpdateObligationValueResponse)(nil), // 19: policy.obligations.UpdateObligationValueResponse + (*DeleteObligationValueRequest)(nil), // 20: policy.obligations.DeleteObligationValueRequest + (*DeleteObligationValueResponse)(nil), // 21: policy.obligations.DeleteObligationValueResponse + (*AddObligationTriggerRequest)(nil), // 22: policy.obligations.AddObligationTriggerRequest + (*AddObligationTriggerResponse)(nil), // 23: policy.obligations.AddObligationTriggerResponse + (*RemoveObligationTriggerRequest)(nil), // 24: policy.obligations.RemoveObligationTriggerRequest + (*RemoveObligationTriggerResponse)(nil), // 25: policy.obligations.RemoveObligationTriggerResponse + nil, // 26: policy.obligations.GetObligationsByFQNsResponse.FqnObligationMapEntry + nil, // 27: policy.obligations.GetObligationValuesByFQNsResponse.FqnValueMapEntry + (*policy.Obligation)(nil), // 28: policy.Obligation + (*common.MetadataMutable)(nil), // 29: common.MetadataMutable + (common.MetadataUpdateEnum)(0), // 30: common.MetadataUpdateEnum + (*policy.PageRequest)(nil), // 31: policy.PageRequest + (*policy.PageResponse)(nil), // 32: policy.PageResponse + (*policy.ObligationValue)(nil), // 33: policy.ObligationValue + (*common.IdFqnIdentifier)(nil), // 34: common.IdFqnIdentifier + (*common.IdNameIdentifier)(nil), // 35: common.IdNameIdentifier (*policy.ObligationTrigger)(nil), // 36: policy.ObligationTrigger } var file_policy_obligations_obligations_proto_depIdxs = []int32{ - 30, // 0: policy.obligations.GetObligationResponse.obligation:type_name -> policy.Obligation - 28, // 1: policy.obligations.GetObligationsByFQNsResponse.fqn_obligation_map:type_name -> policy.obligations.GetObligationsByFQNsResponse.FqnObligationMapEntry - 31, // 2: policy.obligations.CreateObligationRequest.metadata:type_name -> common.MetadataMutable - 30, // 3: policy.obligations.CreateObligationResponse.obligation:type_name -> policy.Obligation - 31, // 4: policy.obligations.UpdateObligationRequest.metadata:type_name -> common.MetadataMutable - 32, // 5: policy.obligations.UpdateObligationRequest.metadata_update_behavior:type_name -> common.MetadataUpdateEnum - 30, // 6: policy.obligations.UpdateObligationResponse.obligation:type_name -> policy.Obligation - 30, // 7: policy.obligations.DeleteObligationResponse.obligation:type_name -> policy.Obligation - 33, // 8: policy.obligations.ListObligationsRequest.pagination:type_name -> policy.PageRequest - 30, // 9: policy.obligations.ListObligationsResponse.obligations:type_name -> policy.Obligation - 34, // 10: policy.obligations.ListObligationsResponse.pagination:type_name -> policy.PageResponse - 35, // 11: policy.obligations.GetObligationValueResponse.value:type_name -> policy.ObligationValue - 29, // 12: policy.obligations.GetObligationValuesByFQNsResponse.fqn_value_map:type_name -> policy.obligations.GetObligationValuesByFQNsResponse.FqnValueMapEntry - 31, // 13: policy.obligations.CreateObligationValueRequest.metadata:type_name -> common.MetadataMutable - 35, // 14: policy.obligations.CreateObligationValueResponse.value:type_name -> policy.ObligationValue - 31, // 15: policy.obligations.UpdateObligationValueRequest.metadata:type_name -> common.MetadataMutable - 32, // 16: policy.obligations.UpdateObligationValueRequest.metadata_update_behavior:type_name -> common.MetadataUpdateEnum - 35, // 17: policy.obligations.UpdateObligationValueResponse.value:type_name -> policy.ObligationValue - 35, // 18: policy.obligations.DeleteObligationValueResponse.value:type_name -> policy.ObligationValue - 2, // 19: policy.obligations.AddObligationTriggerRequest.obligation_value:type_name -> policy.obligations.IdFqnIdentifier - 1, // 20: policy.obligations.AddObligationTriggerRequest.action:type_name -> policy.obligations.IdNameIdentifier - 2, // 21: policy.obligations.AddObligationTriggerRequest.attribute_value:type_name -> policy.obligations.IdFqnIdentifier - 31, // 22: policy.obligations.AddObligationTriggerRequest.metadata:type_name -> common.MetadataMutable + 28, // 0: policy.obligations.GetObligationResponse.obligation:type_name -> policy.Obligation + 26, // 1: policy.obligations.GetObligationsByFQNsResponse.fqn_obligation_map:type_name -> policy.obligations.GetObligationsByFQNsResponse.FqnObligationMapEntry + 29, // 2: policy.obligations.CreateObligationRequest.metadata:type_name -> common.MetadataMutable + 28, // 3: policy.obligations.CreateObligationResponse.obligation:type_name -> policy.Obligation + 29, // 4: policy.obligations.UpdateObligationRequest.metadata:type_name -> common.MetadataMutable + 30, // 5: policy.obligations.UpdateObligationRequest.metadata_update_behavior:type_name -> common.MetadataUpdateEnum + 28, // 6: policy.obligations.UpdateObligationResponse.obligation:type_name -> policy.Obligation + 28, // 7: policy.obligations.DeleteObligationResponse.obligation:type_name -> policy.Obligation + 31, // 8: policy.obligations.ListObligationsRequest.pagination:type_name -> policy.PageRequest + 28, // 9: policy.obligations.ListObligationsResponse.obligations:type_name -> policy.Obligation + 32, // 10: policy.obligations.ListObligationsResponse.pagination:type_name -> policy.PageResponse + 33, // 11: policy.obligations.GetObligationValueResponse.value:type_name -> policy.ObligationValue + 27, // 12: policy.obligations.GetObligationValuesByFQNsResponse.fqn_value_map:type_name -> policy.obligations.GetObligationValuesByFQNsResponse.FqnValueMapEntry + 29, // 13: policy.obligations.CreateObligationValueRequest.metadata:type_name -> common.MetadataMutable + 33, // 14: policy.obligations.CreateObligationValueResponse.value:type_name -> policy.ObligationValue + 29, // 15: policy.obligations.UpdateObligationValueRequest.metadata:type_name -> common.MetadataMutable + 30, // 16: policy.obligations.UpdateObligationValueRequest.metadata_update_behavior:type_name -> common.MetadataUpdateEnum + 33, // 17: policy.obligations.UpdateObligationValueResponse.value:type_name -> policy.ObligationValue + 33, // 18: policy.obligations.DeleteObligationValueResponse.value:type_name -> policy.ObligationValue + 34, // 19: policy.obligations.AddObligationTriggerRequest.obligation_value:type_name -> common.IdFqnIdentifier + 35, // 20: policy.obligations.AddObligationTriggerRequest.action:type_name -> common.IdNameIdentifier + 34, // 21: policy.obligations.AddObligationTriggerRequest.attribute_value:type_name -> common.IdFqnIdentifier + 29, // 22: policy.obligations.AddObligationTriggerRequest.metadata:type_name -> common.MetadataMutable 36, // 23: policy.obligations.AddObligationTriggerResponse.trigger:type_name -> policy.ObligationTrigger 36, // 24: policy.obligations.RemoveObligationTriggerResponse.trigger:type_name -> policy.ObligationTrigger - 30, // 25: policy.obligations.GetObligationsByFQNsResponse.FqnObligationMapEntry.value:type_name -> policy.Obligation - 35, // 26: policy.obligations.GetObligationValuesByFQNsResponse.FqnValueMapEntry.value:type_name -> policy.ObligationValue - 12, // 27: policy.obligations.Service.ListObligations:input_type -> policy.obligations.ListObligationsRequest + 28, // 25: policy.obligations.GetObligationsByFQNsResponse.FqnObligationMapEntry.value:type_name -> policy.Obligation + 33, // 26: policy.obligations.GetObligationValuesByFQNsResponse.FqnValueMapEntry.value:type_name -> policy.ObligationValue + 10, // 27: policy.obligations.Service.ListObligations:input_type -> policy.obligations.ListObligationsRequest 0, // 28: policy.obligations.Service.GetObligation:input_type -> policy.obligations.GetObligationRequest - 4, // 29: policy.obligations.Service.GetObligationsByFQNs:input_type -> policy.obligations.GetObligationsByFQNsRequest - 6, // 30: policy.obligations.Service.CreateObligation:input_type -> policy.obligations.CreateObligationRequest - 8, // 31: policy.obligations.Service.UpdateObligation:input_type -> policy.obligations.UpdateObligationRequest - 10, // 32: policy.obligations.Service.DeleteObligation:input_type -> policy.obligations.DeleteObligationRequest - 14, // 33: policy.obligations.Service.GetObligationValue:input_type -> policy.obligations.GetObligationValueRequest - 16, // 34: policy.obligations.Service.GetObligationValuesByFQNs:input_type -> policy.obligations.GetObligationValuesByFQNsRequest - 18, // 35: policy.obligations.Service.CreateObligationValue:input_type -> policy.obligations.CreateObligationValueRequest - 20, // 36: policy.obligations.Service.UpdateObligationValue:input_type -> policy.obligations.UpdateObligationValueRequest - 22, // 37: policy.obligations.Service.DeleteObligationValue:input_type -> policy.obligations.DeleteObligationValueRequest - 24, // 38: policy.obligations.Service.AddObligationTrigger:input_type -> policy.obligations.AddObligationTriggerRequest - 26, // 39: policy.obligations.Service.RemoveObligationTrigger:input_type -> policy.obligations.RemoveObligationTriggerRequest - 13, // 40: policy.obligations.Service.ListObligations:output_type -> policy.obligations.ListObligationsResponse - 3, // 41: policy.obligations.Service.GetObligation:output_type -> policy.obligations.GetObligationResponse - 5, // 42: policy.obligations.Service.GetObligationsByFQNs:output_type -> policy.obligations.GetObligationsByFQNsResponse - 7, // 43: policy.obligations.Service.CreateObligation:output_type -> policy.obligations.CreateObligationResponse - 9, // 44: policy.obligations.Service.UpdateObligation:output_type -> policy.obligations.UpdateObligationResponse - 11, // 45: policy.obligations.Service.DeleteObligation:output_type -> policy.obligations.DeleteObligationResponse - 15, // 46: policy.obligations.Service.GetObligationValue:output_type -> policy.obligations.GetObligationValueResponse - 17, // 47: policy.obligations.Service.GetObligationValuesByFQNs:output_type -> policy.obligations.GetObligationValuesByFQNsResponse - 19, // 48: policy.obligations.Service.CreateObligationValue:output_type -> policy.obligations.CreateObligationValueResponse - 21, // 49: policy.obligations.Service.UpdateObligationValue:output_type -> policy.obligations.UpdateObligationValueResponse - 23, // 50: policy.obligations.Service.DeleteObligationValue:output_type -> policy.obligations.DeleteObligationValueResponse - 25, // 51: policy.obligations.Service.AddObligationTrigger:output_type -> policy.obligations.AddObligationTriggerResponse - 27, // 52: policy.obligations.Service.RemoveObligationTrigger:output_type -> policy.obligations.RemoveObligationTriggerResponse + 2, // 29: policy.obligations.Service.GetObligationsByFQNs:input_type -> policy.obligations.GetObligationsByFQNsRequest + 4, // 30: policy.obligations.Service.CreateObligation:input_type -> policy.obligations.CreateObligationRequest + 6, // 31: policy.obligations.Service.UpdateObligation:input_type -> policy.obligations.UpdateObligationRequest + 8, // 32: policy.obligations.Service.DeleteObligation:input_type -> policy.obligations.DeleteObligationRequest + 12, // 33: policy.obligations.Service.GetObligationValue:input_type -> policy.obligations.GetObligationValueRequest + 14, // 34: policy.obligations.Service.GetObligationValuesByFQNs:input_type -> policy.obligations.GetObligationValuesByFQNsRequest + 16, // 35: policy.obligations.Service.CreateObligationValue:input_type -> policy.obligations.CreateObligationValueRequest + 18, // 36: policy.obligations.Service.UpdateObligationValue:input_type -> policy.obligations.UpdateObligationValueRequest + 20, // 37: policy.obligations.Service.DeleteObligationValue:input_type -> policy.obligations.DeleteObligationValueRequest + 22, // 38: policy.obligations.Service.AddObligationTrigger:input_type -> policy.obligations.AddObligationTriggerRequest + 24, // 39: policy.obligations.Service.RemoveObligationTrigger:input_type -> policy.obligations.RemoveObligationTriggerRequest + 11, // 40: policy.obligations.Service.ListObligations:output_type -> policy.obligations.ListObligationsResponse + 1, // 41: policy.obligations.Service.GetObligation:output_type -> policy.obligations.GetObligationResponse + 3, // 42: policy.obligations.Service.GetObligationsByFQNs:output_type -> policy.obligations.GetObligationsByFQNsResponse + 5, // 43: policy.obligations.Service.CreateObligation:output_type -> policy.obligations.CreateObligationResponse + 7, // 44: policy.obligations.Service.UpdateObligation:output_type -> policy.obligations.UpdateObligationResponse + 9, // 45: policy.obligations.Service.DeleteObligation:output_type -> policy.obligations.DeleteObligationResponse + 13, // 46: policy.obligations.Service.GetObligationValue:output_type -> policy.obligations.GetObligationValueResponse + 15, // 47: policy.obligations.Service.GetObligationValuesByFQNs:output_type -> policy.obligations.GetObligationValuesByFQNsResponse + 17, // 48: policy.obligations.Service.CreateObligationValue:output_type -> policy.obligations.CreateObligationValueResponse + 19, // 49: policy.obligations.Service.UpdateObligationValue:output_type -> policy.obligations.UpdateObligationValueResponse + 21, // 50: policy.obligations.Service.DeleteObligationValue:output_type -> policy.obligations.DeleteObligationValueResponse + 23, // 51: policy.obligations.Service.AddObligationTrigger:output_type -> policy.obligations.AddObligationTriggerResponse + 25, // 52: policy.obligations.Service.RemoveObligationTrigger:output_type -> policy.obligations.RemoveObligationTriggerResponse 40, // [40:53] is the sub-list for method output_type 27, // [27:40] is the sub-list for method input_type 27, // [27:27] is the sub-list for extension type_name @@ -2217,30 +2093,6 @@ func file_policy_obligations_obligations_proto_init() { } } file_policy_obligations_obligations_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IdNameIdentifier); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_policy_obligations_obligations_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IdFqnIdentifier); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_policy_obligations_obligations_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetObligationResponse); i { case 0: return &v.state @@ -2252,7 +2104,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetObligationsByFQNsRequest); i { case 0: return &v.state @@ -2264,7 +2116,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetObligationsByFQNsResponse); i { case 0: return &v.state @@ -2276,7 +2128,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CreateObligationRequest); i { case 0: return &v.state @@ -2288,7 +2140,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CreateObligationResponse); i { case 0: return &v.state @@ -2300,7 +2152,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UpdateObligationRequest); i { case 0: return &v.state @@ -2312,7 +2164,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UpdateObligationResponse); i { case 0: return &v.state @@ -2324,7 +2176,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeleteObligationRequest); i { case 0: return &v.state @@ -2336,7 +2188,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeleteObligationResponse); i { case 0: return &v.state @@ -2348,7 +2200,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ListObligationsRequest); i { case 0: return &v.state @@ -2360,7 +2212,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ListObligationsResponse); i { case 0: return &v.state @@ -2372,7 +2224,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetObligationValueRequest); i { case 0: return &v.state @@ -2384,7 +2236,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetObligationValueResponse); i { case 0: return &v.state @@ -2396,7 +2248,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetObligationValuesByFQNsRequest); i { case 0: return &v.state @@ -2408,7 +2260,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetObligationValuesByFQNsResponse); i { case 0: return &v.state @@ -2420,7 +2272,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CreateObligationValueRequest); i { case 0: return &v.state @@ -2432,7 +2284,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CreateObligationValueResponse); i { case 0: return &v.state @@ -2444,7 +2296,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UpdateObligationValueRequest); i { case 0: return &v.state @@ -2456,7 +2308,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UpdateObligationValueResponse); i { case 0: return &v.state @@ -2468,7 +2320,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeleteObligationValueRequest); i { case 0: return &v.state @@ -2480,7 +2332,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeleteObligationValueResponse); i { case 0: return &v.state @@ -2492,7 +2344,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AddObligationTriggerRequest); i { case 0: return &v.state @@ -2504,7 +2356,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AddObligationTriggerResponse); i { case 0: return &v.state @@ -2516,7 +2368,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RemoveObligationTriggerRequest); i { case 0: return &v.state @@ -2528,7 +2380,7 @@ func file_policy_obligations_obligations_proto_init() { return nil } } - file_policy_obligations_obligations_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + file_policy_obligations_obligations_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RemoveObligationTriggerResponse); i { case 0: return &v.state @@ -2545,27 +2397,27 @@ func file_policy_obligations_obligations_proto_init() { (*GetObligationRequest_Id)(nil), (*GetObligationRequest_Fqn)(nil), } - file_policy_obligations_obligations_proto_msgTypes[6].OneofWrappers = []interface{}{ + file_policy_obligations_obligations_proto_msgTypes[4].OneofWrappers = []interface{}{ (*CreateObligationRequest_Id)(nil), (*CreateObligationRequest_Fqn)(nil), } - file_policy_obligations_obligations_proto_msgTypes[10].OneofWrappers = []interface{}{ + file_policy_obligations_obligations_proto_msgTypes[8].OneofWrappers = []interface{}{ (*DeleteObligationRequest_Id)(nil), (*DeleteObligationRequest_Fqn)(nil), } - file_policy_obligations_obligations_proto_msgTypes[12].OneofWrappers = []interface{}{ + file_policy_obligations_obligations_proto_msgTypes[10].OneofWrappers = []interface{}{ (*ListObligationsRequest_Id)(nil), (*ListObligationsRequest_Fqn)(nil), } - file_policy_obligations_obligations_proto_msgTypes[14].OneofWrappers = []interface{}{ + file_policy_obligations_obligations_proto_msgTypes[12].OneofWrappers = []interface{}{ (*GetObligationValueRequest_Id)(nil), (*GetObligationValueRequest_Fqn)(nil), } - file_policy_obligations_obligations_proto_msgTypes[18].OneofWrappers = []interface{}{ + file_policy_obligations_obligations_proto_msgTypes[16].OneofWrappers = []interface{}{ (*CreateObligationValueRequest_Id)(nil), (*CreateObligationValueRequest_Fqn)(nil), } - file_policy_obligations_obligations_proto_msgTypes[22].OneofWrappers = []interface{}{ + file_policy_obligations_obligations_proto_msgTypes[20].OneofWrappers = []interface{}{ (*DeleteObligationValueRequest_Id)(nil), (*DeleteObligationValueRequest_Fqn)(nil), } @@ -2575,7 +2427,7 @@ func file_policy_obligations_obligations_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_policy_obligations_obligations_proto_rawDesc, NumEnums: 0, - NumMessages: 30, + NumMessages: 28, NumExtensions: 0, NumServices: 1, }, diff --git a/service/common/common.proto b/service/common/common.proto index 645235d393..3a9038aad9 100644 --- a/service/common/common.proto +++ b/service/common/common.proto @@ -3,6 +3,24 @@ syntax = "proto3"; package common; import "google/protobuf/timestamp.proto"; +import "buf/validate/validate.proto"; + +message IdNameIdentifier { + option (buf.validate.message).oneof = { fields: ["id", "name"], required: true }; + string id = 1 [(buf.validate.field).string.uuid = true]; + string name = 2 [(buf.validate.field).string = { + min_len: 1 + }]; +} + +message IdFqnIdentifier { + option (buf.validate.message).oneof = { fields: ["id", "fqn"], required: true }; + string id = 1 [(buf.validate.field).string.uuid = true]; + string fqn = 2 [(buf.validate.field).string = { + min_len: 1 + uri: true + }]; +} // Struct to uniquely identify a resource with optional additional metadata message Metadata { diff --git a/service/integration/obligation_triggers_test.go b/service/integration/obligation_triggers_test.go index 8bc7267101..db4df89f8c 100644 --- a/service/integration/obligation_triggers_test.go +++ b/service/integration/obligation_triggers_test.go @@ -137,9 +137,9 @@ func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_NoMetadata_Succes func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_WithIDs_Success() { trigger, err := s.db.PolicyClient.CreateObligationTrigger(s.ctx, &obligations.AddObligationTriggerRequest{ - ObligationValue: &obligations.IdFqnIdentifier{Id: s.obligationValue.GetId()}, - AttributeValue: &obligations.IdFqnIdentifier{Id: s.attributeValue.GetId()}, - Action: &obligations.IdNameIdentifier{Id: s.action.GetId()}, + ObligationValue: &common.IdFqnIdentifier{Id: s.obligationValue.GetId()}, + AttributeValue: &common.IdFqnIdentifier{Id: s.attributeValue.GetId()}, + Action: &common.IdNameIdentifier{Id: s.action.GetId()}, Metadata: &common.MetadataMutable{ Labels: map[string]string{"source": "test"}, }, @@ -152,9 +152,9 @@ func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_WithIDs_Success() func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_WithNameFQN_Success() { trigger, err := s.db.PolicyClient.CreateObligationTrigger(s.ctx, &obligations.AddObligationTriggerRequest{ - ObligationValue: &obligations.IdFqnIdentifier{Fqn: s.obligation.GetNamespace().GetFqn() + "/obl/" + s.obligationValue.GetObligation().GetName() + "/value/" + s.obligationValue.GetValue()}, - AttributeValue: &obligations.IdFqnIdentifier{Fqn: s.attributeValue.GetFqn()}, - Action: &obligations.IdNameIdentifier{Name: s.action.GetName()}, + ObligationValue: &common.IdFqnIdentifier{Fqn: s.obligation.GetNamespace().GetFqn() + "/obl/" + s.obligationValue.GetObligation().GetName() + "/value/" + s.obligationValue.GetValue()}, + AttributeValue: &common.IdFqnIdentifier{Fqn: s.attributeValue.GetFqn()}, + Action: &common.IdNameIdentifier{Name: s.action.GetName()}, Metadata: &common.MetadataMutable{ Labels: map[string]string{"source": "test"}, }, @@ -168,9 +168,9 @@ func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_WithNameFQN_Succe func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_ObligationValueNotFound_Fails() { randomID := uuid.NewString() trigger, err := s.db.PolicyClient.CreateObligationTrigger(s.ctx, &obligations.AddObligationTriggerRequest{ - ObligationValue: &obligations.IdFqnIdentifier{Id: randomID}, - AttributeValue: &obligations.IdFqnIdentifier{Id: s.attributeValue.GetId()}, - Action: &obligations.IdNameIdentifier{Id: s.action.GetId()}, + ObligationValue: &common.IdFqnIdentifier{Id: randomID}, + AttributeValue: &common.IdFqnIdentifier{Id: s.attributeValue.GetId()}, + Action: &common.IdNameIdentifier{Id: s.action.GetId()}, }) s.Require().Error(err) s.Require().ErrorIs(err, db.ErrNotNullViolation) @@ -180,9 +180,9 @@ func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_ObligationValueNo func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_AttributeValueNotFound_Fails() { randomID := uuid.NewString() trigger, err := s.db.PolicyClient.CreateObligationTrigger(s.ctx, &obligations.AddObligationTriggerRequest{ - ObligationValue: &obligations.IdFqnIdentifier{Id: s.obligationValue.GetId()}, - AttributeValue: &obligations.IdFqnIdentifier{Id: randomID}, - Action: &obligations.IdNameIdentifier{Id: s.action.GetId()}, + ObligationValue: &common.IdFqnIdentifier{Id: s.obligationValue.GetId()}, + AttributeValue: &common.IdFqnIdentifier{Id: randomID}, + Action: &common.IdNameIdentifier{Id: s.action.GetId()}, }) s.Require().Error(err) s.Require().ErrorIs(err, db.ErrNotNullViolation) @@ -192,9 +192,9 @@ func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_AttributeValueNot func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_ActionNotFound_Fails() { randomID := uuid.NewString() trigger, err := s.db.PolicyClient.CreateObligationTrigger(s.ctx, &obligations.AddObligationTriggerRequest{ - ObligationValue: &obligations.IdFqnIdentifier{Id: s.obligationValue.GetId()}, - AttributeValue: &obligations.IdFqnIdentifier{Id: s.attributeValue.GetId()}, - Action: &obligations.IdNameIdentifier{Id: randomID}, + ObligationValue: &common.IdFqnIdentifier{Id: s.obligationValue.GetId()}, + AttributeValue: &common.IdFqnIdentifier{Id: s.attributeValue.GetId()}, + Action: &common.IdNameIdentifier{Id: randomID}, }) s.Require().Error(err) s.Require().ErrorIs(err, db.ErrNotNullViolation) @@ -229,9 +229,9 @@ func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_AttributeValueDif // Try to create a trigger with obligation value from one namespace and attribute value from another trigger, err := s.db.PolicyClient.CreateObligationTrigger(s.ctx, &obligations.AddObligationTriggerRequest{ - ObligationValue: &obligations.IdFqnIdentifier{Id: s.obligationValue.GetId()}, - AttributeValue: &obligations.IdFqnIdentifier{Id: differentAttributeValue.GetId()}, - Action: &obligations.IdNameIdentifier{Id: s.action.GetId()}, + ObligationValue: &common.IdFqnIdentifier{Id: s.obligationValue.GetId()}, + AttributeValue: &common.IdFqnIdentifier{Id: differentAttributeValue.GetId()}, + Action: &common.IdNameIdentifier{Id: s.action.GetId()}, }) s.Require().Error(err) s.Require().ErrorIs(err, db.ErrNotNullViolation) @@ -259,9 +259,9 @@ func (s *ObligationTriggersSuite) Test_DeleteObligationTrigger_NotFound_Fails() func (s *ObligationTriggersSuite) createGenericTrigger() *policy.ObligationTrigger { trigger, err := s.db.PolicyClient.CreateObligationTrigger(s.ctx, &obligations.AddObligationTriggerRequest{ - ObligationValue: &obligations.IdFqnIdentifier{Id: s.obligationValue.GetId()}, - AttributeValue: &obligations.IdFqnIdentifier{Id: s.attributeValue.GetId()}, - Action: &obligations.IdNameIdentifier{Id: s.action.GetId()}, + ObligationValue: &common.IdFqnIdentifier{Id: s.obligationValue.GetId()}, + AttributeValue: &common.IdFqnIdentifier{Id: s.attributeValue.GetId()}, + Action: &common.IdNameIdentifier{Id: s.action.GetId()}, Metadata: &common.MetadataMutable{}, }) s.Require().NoError(err) diff --git a/service/policy/obligations/obligations.proto b/service/policy/obligations/obligations.proto index 6c0a363642..c661e9ba81 100644 --- a/service/policy/obligations/obligations.proto +++ b/service/policy/obligations/obligations.proto @@ -20,23 +20,6 @@ message GetObligationRequest { } } -message IdNameIdentifier { - option (buf.validate.message).oneof = { fields: ["id", "name"], required: true }; - string id = 1 [(buf.validate.field).string.uuid = true]; - string name = 2 [(buf.validate.field).string = { - min_len: 1 - }]; -} - -message IdFqnIdentifier { - option (buf.validate.message).oneof = { fields: ["id", "fqn"], required: true }; - string id = 1 [(buf.validate.field).string.uuid = true]; - string fqn = 2 [(buf.validate.field).string = { - min_len: 1 - uri: true - }]; -} - message GetObligationResponse { policy.Obligation obligation = 1; } @@ -176,11 +159,11 @@ message DeleteObligationValueResponse { // Triggers message AddObligationTriggerRequest { // Required - IdFqnIdentifier obligation_value = 1 [(buf.validate.field).required = true]; + common.IdFqnIdentifier obligation_value = 1 [(buf.validate.field).required = true]; // Required - IdNameIdentifier action = 2 [(buf.validate.field).required = true]; + common.IdNameIdentifier action = 2 [(buf.validate.field).required = true]; // Required - IdFqnIdentifier attribute_value = 3 [(buf.validate.field).required = true]; + common.IdFqnIdentifier attribute_value = 3 [(buf.validate.field).required = true]; // Optional // Common metadata common.MetadataMutable metadata = 100; diff --git a/service/policy/obligations/obligations_test.go b/service/policy/obligations/obligations_test.go index d3c94ef030..b96e1ed67e 100644 --- a/service/policy/obligations/obligations_test.go +++ b/service/policy/obligations/obligations_test.go @@ -5,6 +5,7 @@ import ( "buf.build/go/protovalidate" "github.com/google/uuid" + "github.com/opentdf/platform/protocol/go/common" "github.com/opentdf/platform/protocol/go/policy/obligations" "github.com/stretchr/testify/require" ) @@ -35,27 +36,27 @@ func Test_AddObligationTrigger_Request(t *testing.T) { { name: "valid", req: &obligations.AddObligationTriggerRequest{ - ObligationValue: &obligations.IdFqnIdentifier{Id: validUUID}, - Action: &obligations.IdNameIdentifier{Id: validUUID}, - AttributeValue: &obligations.IdFqnIdentifier{Id: validUUID}, + ObligationValue: &common.IdFqnIdentifier{Id: validUUID}, + Action: &common.IdNameIdentifier{Id: validUUID}, + AttributeValue: &common.IdFqnIdentifier{Id: validUUID}, }, expectError: false, }, { name: "valid fqn and name", req: &obligations.AddObligationTriggerRequest{ - ObligationValue: &obligations.IdFqnIdentifier{Fqn: validFQN}, - Action: &obligations.IdNameIdentifier{Name: validName}, - AttributeValue: &obligations.IdFqnIdentifier{Fqn: validFQN}, + ObligationValue: &common.IdFqnIdentifier{Fqn: validFQN}, + Action: &common.IdNameIdentifier{Name: validName}, + AttributeValue: &common.IdFqnIdentifier{Fqn: validFQN}, }, expectError: false, }, { name: "invalid obligation_value_id", req: &obligations.AddObligationTriggerRequest{ - ObligationValue: &obligations.IdFqnIdentifier{Id: invalidUUID}, - Action: &obligations.IdNameIdentifier{Id: validUUID}, - AttributeValue: &obligations.IdFqnIdentifier{Id: validUUID}, + ObligationValue: &common.IdFqnIdentifier{Id: invalidUUID}, + Action: &common.IdNameIdentifier{Id: validUUID}, + AttributeValue: &common.IdFqnIdentifier{Id: validUUID}, }, expectError: true, errorMessage: "obligation_value.id", @@ -63,9 +64,9 @@ func Test_AddObligationTrigger_Request(t *testing.T) { { name: "invalid action_id", req: &obligations.AddObligationTriggerRequest{ - ObligationValue: &obligations.IdFqnIdentifier{Id: validUUID}, - Action: &obligations.IdNameIdentifier{Id: invalidUUID}, - AttributeValue: &obligations.IdFqnIdentifier{Id: validUUID}, + ObligationValue: &common.IdFqnIdentifier{Id: validUUID}, + Action: &common.IdNameIdentifier{Id: invalidUUID}, + AttributeValue: &common.IdFqnIdentifier{Id: validUUID}, }, expectError: true, errorMessage: "action.id", @@ -73,9 +74,9 @@ func Test_AddObligationTrigger_Request(t *testing.T) { { name: "invalid attribute_value_id", req: &obligations.AddObligationTriggerRequest{ - ObligationValue: &obligations.IdFqnIdentifier{Id: validUUID}, - Action: &obligations.IdNameIdentifier{Id: validUUID}, - AttributeValue: &obligations.IdFqnIdentifier{Id: invalidUUID}, + ObligationValue: &common.IdFqnIdentifier{Id: validUUID}, + Action: &common.IdNameIdentifier{Id: validUUID}, + AttributeValue: &common.IdFqnIdentifier{Id: invalidUUID}, }, expectError: true, errorMessage: "attribute_value.id", @@ -83,9 +84,9 @@ func Test_AddObligationTrigger_Request(t *testing.T) { { name: "invalid obligation_value_fqn", req: &obligations.AddObligationTriggerRequest{ - ObligationValue: &obligations.IdFqnIdentifier{Fqn: invalidFQN}, - Action: &obligations.IdNameIdentifier{Id: validUUID}, - AttributeValue: &obligations.IdFqnIdentifier{Fqn: validFQN}, + ObligationValue: &common.IdFqnIdentifier{Fqn: invalidFQN}, + Action: &common.IdNameIdentifier{Id: validUUID}, + AttributeValue: &common.IdFqnIdentifier{Fqn: validFQN}, }, expectError: true, errorMessage: "obligation_value.fqn", @@ -93,9 +94,9 @@ func Test_AddObligationTrigger_Request(t *testing.T) { { name: "invalid attribute_value_fqn", req: &obligations.AddObligationTriggerRequest{ - ObligationValue: &obligations.IdFqnIdentifier{Id: validUUID}, - Action: &obligations.IdNameIdentifier{Id: validUUID}, - AttributeValue: &obligations.IdFqnIdentifier{Fqn: invalidFQN}, + ObligationValue: &common.IdFqnIdentifier{Id: validUUID}, + Action: &common.IdNameIdentifier{Id: validUUID}, + AttributeValue: &common.IdFqnIdentifier{Fqn: invalidFQN}, }, expectError: true, errorMessage: "attribute_value.fqn", @@ -103,8 +104,8 @@ func Test_AddObligationTrigger_Request(t *testing.T) { { name: "missing obligation_value", req: &obligations.AddObligationTriggerRequest{ - Action: &obligations.IdNameIdentifier{Id: validUUID}, - AttributeValue: &obligations.IdFqnIdentifier{Id: validUUID}, + Action: &common.IdNameIdentifier{Id: validUUID}, + AttributeValue: &common.IdFqnIdentifier{Id: validUUID}, }, expectError: true, errorMessage: "obligation_value", @@ -112,8 +113,8 @@ func Test_AddObligationTrigger_Request(t *testing.T) { { name: "missing action", req: &obligations.AddObligationTriggerRequest{ - ObligationValue: &obligations.IdFqnIdentifier{Id: validUUID}, - AttributeValue: &obligations.IdFqnIdentifier{Id: validUUID}, + ObligationValue: &common.IdFqnIdentifier{Id: validUUID}, + AttributeValue: &common.IdFqnIdentifier{Id: validUUID}, }, expectError: true, errorMessage: "action", @@ -121,12 +122,42 @@ func Test_AddObligationTrigger_Request(t *testing.T) { { name: "missing attribute_value", req: &obligations.AddObligationTriggerRequest{ - ObligationValue: &obligations.IdFqnIdentifier{Id: validUUID}, - Action: &obligations.IdNameIdentifier{Id: validUUID}, + ObligationValue: &common.IdFqnIdentifier{Id: validUUID}, + Action: &common.IdNameIdentifier{Id: validUUID}, }, expectError: true, errorMessage: "attribute_value", }, + { + name: "two attribute_values - fqn and id", + req: &obligations.AddObligationTriggerRequest{ + ObligationValue: &common.IdFqnIdentifier{Id: validUUID}, + Action: &common.IdNameIdentifier{Id: validUUID}, + AttributeValue: &common.IdFqnIdentifier{Id: validUUID, Fqn: validFQN}, + }, + expectError: true, + errorMessage: "attribute_value", + }, + { + name: "two obligation_values - fqn and id", + req: &obligations.AddObligationTriggerRequest{ + ObligationValue: &common.IdFqnIdentifier{Id: validUUID, Fqn: validFQN}, + Action: &common.IdNameIdentifier{Id: validUUID}, + AttributeValue: &common.IdFqnIdentifier{Id: validUUID}, + }, + expectError: true, + errorMessage: "obligation_value", + }, + { + name: "two actions - name and id", + req: &obligations.AddObligationTriggerRequest{ + ObligationValue: &common.IdFqnIdentifier{Id: validUUID}, + Action: &common.IdNameIdentifier{Id: validUUID, Name: validName}, + AttributeValue: &common.IdFqnIdentifier{Id: validUUID}, + }, + expectError: true, + errorMessage: "action", + }, } v := getValidator() From 2de37779118231ecd403e7f991020140a809a28f Mon Sep 17 00:00:00 2001 From: Chris Reed Date: Fri, 5 Sep 2025 14:04:19 -0500 Subject: [PATCH 134/137] fix logging. --- service/policy/obligations/obligations.go | 33 ++++++++++++----------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/service/policy/obligations/obligations.go b/service/policy/obligations/obligations.go index ee03a6a424..28da21ff8b 100644 --- a/service/policy/obligations/obligations.go +++ b/service/policy/obligations/obligations.go @@ -352,27 +352,28 @@ func (s *Service) AddObligationTrigger(ctx context.Context, req *connect.Request ObjectType: audit.ObjectTypeObligationTrigger, } - var oblVal, act, attrVal string - if idf := req.Msg.GetObligationValue(); idf != nil { - oblVal = idf.GetId() - } else { - oblVal = idf.GetFqn() + oblIdentifier := req.Msg.GetObligationValue() + oblVal := oblIdentifier.GetId() + if oblVal == "" { + oblVal = oblIdentifier.GetFqn() } - if ida := req.Msg.GetAction(); ida != nil { - act = ida.GetId() - } else { - act = ida.GetName() + + actionIdentifier := req.Msg.GetAction() + act := actionIdentifier.GetId() + if act == "" { + act = actionIdentifier.GetName() } - if idav := req.Msg.GetAttributeValue(); idav != nil { - attrVal = idav.GetId() - } else { - attrVal = idav.GetFqn() + + attrValIdentifier := req.Msg.GetAttributeValue() + attrVal := attrValIdentifier.GetId() + if attrVal == "" { + attrVal = attrValIdentifier.GetFqn() } s.logger.DebugContext(ctx, "adding obligation trigger", - slog.String("obligation_value_id", oblVal), - slog.String("action_id", act), - slog.String("attribute_value_id", attrVal), + slog.String("obligation_value", oblVal), + slog.String("action", act), + slog.String("attribute_value", attrVal), ) err := s.dbClient.RunInTx(ctx, func(txClient *policydb.PolicyDBClient) error { From 1a085f1d1b4722e53bceaab40fb0626d92cc2099 Mon Sep 17 00:00:00 2001 From: Chris Reed Date: Mon, 8 Sep 2025 08:07:06 -0500 Subject: [PATCH 135/137] remove complex obligation query. --- .../integration/obligation_triggers_test.go | 2 +- service/policy/db/obligations.go | 37 ++++++++---- service/policy/db/obligations.sql.go | 58 ++++++------------- service/policy/db/queries/obligations.sql | 10 +--- 4 files changed, 47 insertions(+), 60 deletions(-) diff --git a/service/integration/obligation_triggers_test.go b/service/integration/obligation_triggers_test.go index db4df89f8c..f8444f98c9 100644 --- a/service/integration/obligation_triggers_test.go +++ b/service/integration/obligation_triggers_test.go @@ -173,7 +173,7 @@ func (s *ObligationTriggersSuite) Test_CreateObligationTrigger_ObligationValueNo Action: &common.IdNameIdentifier{Id: s.action.GetId()}, }) s.Require().Error(err) - s.Require().ErrorIs(err, db.ErrNotNullViolation) + s.Require().ErrorIs(err, db.ErrNotFound) s.Nil(trigger) } diff --git a/service/policy/db/obligations.go b/service/policy/db/obligations.go index 7bbf432203..a6766a16c8 100644 --- a/service/policy/db/obligations.go +++ b/service/policy/db/obligations.go @@ -518,17 +518,34 @@ func (c PolicyDBClient) CreateObligationTrigger(ctx context.Context, r *obligati return nil, err } - nsFQN, oblName, oblVal := breakOblValFQN(r.GetObligationValue().GetFqn()) + // Get obligation + var oblValReq *obligations.GetObligationValueRequest + if r.GetObligationValue().GetId() != "" { + oblValReq = &obligations.GetObligationValueRequest{ + Identifier: &obligations.GetObligationValueRequest_Id{ + Id: r.GetObligationValue().GetId(), + }, + } + } else { + oblValReq = &obligations.GetObligationValueRequest{ + Identifier: &obligations.GetObligationValueRequest_Fqn{ + Fqn: r.GetObligationValue().GetFqn(), + }, + } + } + + oblVal, err := c.GetObligationValue(ctx, oblValReq) + if err != nil { + return nil, fmt.Errorf("failed to get obligation value: %w", err) + } + params := createObligationTriggerParams{ - ObligationValueID: r.GetObligationValue().GetId(), - ObligationNamespaceFqn: nsFQN, - ObligationName: oblName, - ObligationValue: oblVal, - ActionName: r.GetAction().GetName(), - ActionID: r.GetAction().GetId(), - AttributeValueID: r.GetAttributeValue().GetId(), - AttributeValueFqn: r.GetAttributeValue().GetFqn(), - Metadata: metadataJSON, + ObligationValueID: oblVal.GetId(), + ActionName: r.GetAction().GetName(), + ActionID: r.GetAction().GetId(), + AttributeValueID: r.GetAttributeValue().GetId(), + AttributeValueFqn: r.GetAttributeValue().GetFqn(), + Metadata: metadataJSON, } row, err := c.queries.createObligationTrigger(ctx, params) if err != nil { diff --git a/service/policy/db/obligations.sql.go b/service/policy/db/obligations.sql.go index 7a34cf5598..3e0c9ac120 100644 --- a/service/policy/db/obligations.sql.go +++ b/service/policy/db/obligations.sql.go @@ -146,27 +146,19 @@ func (q *Queries) createObligation(ctx context.Context, arg createObligationPara const createObligationTrigger = `-- name: createObligationTrigger :one -WITH -ov_id AS ( +WITH ov_id AS ( SELECT ov.id, od.namespace_id FROM obligation_values_standard ov JOIN obligation_definitions od ON ov.obligation_definition_id = od.id - JOIN attribute_namespaces n ON od.namespace_id = n.id - LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL WHERE (NULLIF($1::TEXT, '') IS NOT NULL AND ov.id = $1::UUID) - OR - ( - (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL AND NULLIF($4::TEXT, '') IS NOT NULL AND - fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR AND ov.value = $4::VARCHAR) - ) ), a_id AS ( SELECT id FROM actions WHERE - (NULLIF($5::TEXT, '') IS NOT NULL AND id = $5::UUID) + (NULLIF($2::TEXT, '') IS NOT NULL AND id = $2::UUID) OR - (NULLIF($6::TEXT, '') IS NOT NULL AND name = $6::TEXT) + (NULLIF($3::TEXT, '') IS NOT NULL AND name = $3::TEXT) ), av_id AS ( SELECT av.id @@ -174,9 +166,9 @@ av_id AS ( JOIN attribute_definitions ad ON av.attribute_definition_id = ad.id LEFT JOIN attribute_fqns fqns ON fqns.value_id = av.id WHERE - ((NULLIF($7::TEXT, '') IS NOT NULL AND av.id = $7::UUID) + ((NULLIF($4::TEXT, '') IS NOT NULL AND av.id = $4::UUID) OR - (NULLIF($8::TEXT, '') IS NOT NULL AND fqns.fqn = $8)) + (NULLIF($5::TEXT, '') IS NOT NULL AND fqns.fqn = $5)) AND ad.namespace_id = (SELECT namespace_id FROM ov_id) ), inserted AS ( @@ -185,7 +177,7 @@ inserted AS ( (SELECT id FROM ov_id), (SELECT id FROM a_id), (SELECT id FROM av_id), - $9 + $6 RETURNING id, obligation_value_id, action_id, attribute_value_id, metadata, created_at, updated_at ) SELECT @@ -234,15 +226,12 @@ LEFT JOIN attribute_fqns av_fqns ON av_fqns.value_id = av.id ` type createObligationTriggerParams struct { - ObligationValueID string `json:"obligation_value_id"` - ObligationNamespaceFqn string `json:"obligation_namespace_fqn"` - ObligationName string `json:"obligation_name"` - ObligationValue string `json:"obligation_value"` - ActionID string `json:"action_id"` - ActionName string `json:"action_name"` - AttributeValueID string `json:"attribute_value_id"` - AttributeValueFqn string `json:"attribute_value_fqn"` - Metadata []byte `json:"metadata"` + ObligationValueID string `json:"obligation_value_id"` + ActionID string `json:"action_id"` + ActionName string `json:"action_name"` + AttributeValueID string `json:"attribute_value_id"` + AttributeValueFqn string `json:"attribute_value_fqn"` + Metadata []byte `json:"metadata"` } type createObligationTriggerRow struct { @@ -255,27 +244,19 @@ type createObligationTriggerRow struct { // -------------------------------------------------------------- // Gets the attribute value, but also ensures that the attribute value belongs to the same namespace as the obligation, to which the obligation value belongs // -// WITH -// ov_id AS ( +// WITH ov_id AS ( // SELECT ov.id, od.namespace_id // FROM obligation_values_standard ov // JOIN obligation_definitions od ON ov.obligation_definition_id = od.id -// JOIN attribute_namespaces n ON od.namespace_id = n.id -// LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL // WHERE // (NULLIF($1::TEXT, '') IS NOT NULL AND ov.id = $1::UUID) -// OR -// ( -// (NULLIF($2::TEXT, '') IS NOT NULL AND NULLIF($3::TEXT, '') IS NOT NULL AND NULLIF($4::TEXT, '') IS NOT NULL AND -// fqns.fqn = $2::VARCHAR AND od.name = $3::VARCHAR AND ov.value = $4::VARCHAR) -// ) // ), // a_id AS ( // SELECT id FROM actions // WHERE -// (NULLIF($5::TEXT, '') IS NOT NULL AND id = $5::UUID) +// (NULLIF($2::TEXT, '') IS NOT NULL AND id = $2::UUID) // OR -// (NULLIF($6::TEXT, '') IS NOT NULL AND name = $6::TEXT) +// (NULLIF($3::TEXT, '') IS NOT NULL AND name = $3::TEXT) // ), // av_id AS ( // SELECT av.id @@ -283,9 +264,9 @@ type createObligationTriggerRow struct { // JOIN attribute_definitions ad ON av.attribute_definition_id = ad.id // LEFT JOIN attribute_fqns fqns ON fqns.value_id = av.id // WHERE -// ((NULLIF($7::TEXT, '') IS NOT NULL AND av.id = $7::UUID) +// ((NULLIF($4::TEXT, '') IS NOT NULL AND av.id = $4::UUID) // OR -// (NULLIF($8::TEXT, '') IS NOT NULL AND fqns.fqn = $8)) +// (NULLIF($5::TEXT, '') IS NOT NULL AND fqns.fqn = $5)) // AND ad.namespace_id = (SELECT namespace_id FROM ov_id) // ), // inserted AS ( @@ -294,7 +275,7 @@ type createObligationTriggerRow struct { // (SELECT id FROM ov_id), // (SELECT id FROM a_id), // (SELECT id FROM av_id), -// $9 +// $6 // RETURNING id, obligation_value_id, action_id, attribute_value_id, metadata, created_at, updated_at // ) // SELECT @@ -343,9 +324,6 @@ type createObligationTriggerRow struct { func (q *Queries) createObligationTrigger(ctx context.Context, arg createObligationTriggerParams) (createObligationTriggerRow, error) { row := q.db.QueryRow(ctx, createObligationTrigger, arg.ObligationValueID, - arg.ObligationNamespaceFqn, - arg.ObligationName, - arg.ObligationValue, arg.ActionID, arg.ActionName, arg.AttributeValueID, diff --git a/service/policy/db/queries/obligations.sql b/service/policy/db/queries/obligations.sql index 2400ddec3f..61103403a0 100644 --- a/service/policy/db/queries/obligations.sql +++ b/service/policy/db/queries/obligations.sql @@ -311,20 +311,12 @@ RETURNING id; ---------------------------------------------------------------- -- name: createObligationTrigger :one -WITH -ov_id AS ( +WITH ov_id AS ( SELECT ov.id, od.namespace_id FROM obligation_values_standard ov JOIN obligation_definitions od ON ov.obligation_definition_id = od.id - JOIN attribute_namespaces n ON od.namespace_id = n.id - LEFT JOIN attribute_fqns fqns ON fqns.namespace_id = n.id AND fqns.attribute_id IS NULL AND fqns.value_id IS NULL WHERE (NULLIF(@obligation_value_id::TEXT, '') IS NOT NULL AND ov.id = @obligation_value_id::UUID) - OR - ( - (NULLIF(@obligation_namespace_fqn::TEXT, '') IS NOT NULL AND NULLIF(@obligation_name::TEXT, '') IS NOT NULL AND NULLIF(@obligation_value::TEXT, '') IS NOT NULL AND - fqns.fqn = @obligation_namespace_fqn::VARCHAR AND od.name = @obligation_name::VARCHAR AND ov.value = @obligation_value::VARCHAR) - ) ), a_id AS ( SELECT id FROM actions From 2b68fc5e1e9bfa8ffdbbe2a18bc4bdbb6517131f Mon Sep 17 00:00:00 2001 From: Chris Reed Date: Mon, 8 Sep 2025 11:42:24 -0500 Subject: [PATCH 136/137] fix go mod and sum. --- service/go.mod | 6 +++--- service/go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/service/go.mod b/service/go.mod index 022e00782a..db5dd7b906 100644 --- a/service/go.mod +++ b/service/go.mod @@ -5,7 +5,7 @@ go 1.24.0 toolchain go1.24.6 require ( - buf.build/go/protovalidate v0.14.0 + buf.build/go/protovalidate v0.13.1 connectrpc.com/connect v1.18.1 connectrpc.com/grpchealth v1.4.0 connectrpc.com/grpcreflect v1.3.0 @@ -52,14 +52,14 @@ require ( go.opentelemetry.io/otel/trace v1.36.0 golang.org/x/net v0.41.0 google.golang.org/grpc v1.73.0 - google.golang.org/protobuf v1.36.8 + google.golang.org/protobuf v1.36.6 gopkg.in/natefinch/lumberjack.v2 v2.2.1 gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 ) require ( - buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250717165733-d22d418d82d8.1 // indirect + buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250613105001-9f2d3c737feb.1 // indirect cel.dev/expr v0.23.1 // indirect github.com/Masterminds/semver/v3 v3.3.1 // indirect github.com/cenkalti/backoff/v5 v5.0.2 // indirect diff --git a/service/go.sum b/service/go.sum index 7e0b13080d..608779e7f9 100644 --- a/service/go.sum +++ b/service/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250717165733-d22d418d82d8.1 h1:VahIvw/JagkamVOb0q87Az0zu2tmrzlqvO2IKIGOwnI= -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250717165733-d22d418d82d8.1/go.mod h1:avRlCjnFzl98VPaeCtJ24RrV/wwHFzB8sWXhj26+n/U= -buf.build/go/protovalidate v0.14.0 h1:kr/rC/no+DtRyYX+8KXLDxNnI1rINz0imk5K44ZpZ3A= -buf.build/go/protovalidate v0.14.0/go.mod h1:+F/oISho9MO7gJQNYC2VWLzcO1fTPmaTA08SDYJZncA= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250613105001-9f2d3c737feb.1 h1:AUL6VF5YWL01j/1H/DQbPUSDkEwYqwVCNw7yhbpOxSQ= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250613105001-9f2d3c737feb.1/go.mod h1:avRlCjnFzl98VPaeCtJ24RrV/wwHFzB8sWXhj26+n/U= +buf.build/go/protovalidate v0.13.1 h1:6loHDTWdY/1qmqmt1MijBIKeN4T9Eajrqb9isT1W1s8= +buf.build/go/protovalidate v0.13.1/go.mod h1:C/QcOn/CjXRn5udUwYBiLs8y1TGy7RS+GOSKqjS77aU= cel.dev/expr v0.23.1 h1:K4KOtPCJQjVggkARsjG9RWXP6O4R73aHeJMa/dmCQQg= cel.dev/expr v0.23.1/go.mod h1:hLPLo1W4QUmuYdA72RBX06QTs6MXw941piREPl3Yfiw= connectrpc.com/connect v1.18.1 h1:PAg7CjSAGvscaf6YZKUefjoih5Z/qYkyaTrBW8xvYPw= @@ -453,8 +453,8 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 h1: google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= google.golang.org/grpc v1.73.0 h1:VIWSmpI2MegBtTuFt5/JWy2oXxtjJ/e89Z70ImfD2ok= google.golang.org/grpc v1.73.0/go.mod h1:50sbHOUqWoCQGI8V2HQLJM0B+LMlIUjNSZmow7EVBQc= -google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= -google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= +google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= From 3f2d12a5b78bd19a49d392cc3132861ca3a8f684 Mon Sep 17 00:00:00 2001 From: Chris Reed Date: Mon, 8 Sep 2025 12:22:48 -0500 Subject: [PATCH 137/137] add alphanumeric check. --- docs/openapi/common/common.openapi.yaml | 7 + .../obligations/obligations.openapi.yaml | 7 + protocol/go/common/common.pb.go | 141 ++++++++++-------- service/common/common.proto | 12 +- .../policy/obligations/obligations_test.go | 11 ++ 5 files changed, 112 insertions(+), 66 deletions(-) diff --git a/docs/openapi/common/common.openapi.yaml b/docs/openapi/common/common.openapi.yaml index 34c580864c..0d1e60b152 100644 --- a/docs/openapi/common/common.openapi.yaml +++ b/docs/openapi/common/common.openapi.yaml @@ -44,7 +44,14 @@ components: name: type: string title: name + maxLength: 253 minLength: 1 + description: |+ + Name must be an alphanumeric string, allowing hyphens and underscores but not as the first or last character. The stored name will be normalized to lower case.: + ``` + this.matches('^[a-zA-Z0-9](?:[a-zA-Z0-9_-]*[a-zA-Z0-9])?$') + ``` + title: IdNameIdentifier additionalProperties: false common.Metadata: diff --git a/docs/openapi/policy/obligations/obligations.openapi.yaml b/docs/openapi/policy/obligations/obligations.openapi.yaml index 168a9f1eb3..2b697845be 100644 --- a/docs/openapi/policy/obligations/obligations.openapi.yaml +++ b/docs/openapi/policy/obligations/obligations.openapi.yaml @@ -552,7 +552,14 @@ components: name: type: string title: name + maxLength: 253 minLength: 1 + description: |+ + Name must be an alphanumeric string, allowing hyphens and underscores but not as the first or last character. The stored name will be normalized to lower case.: + ``` + this.matches('^[a-zA-Z0-9](?:[a-zA-Z0-9_-]*[a-zA-Z0-9])?$') + ``` + title: IdNameIdentifier additionalProperties: false common.Metadata: diff --git a/protocol/go/common/common.pb.go b/protocol/go/common/common.pb.go index 49fe1722a0..b17e4eb977 100644 --- a/protocol/go/common/common.pb.go +++ b/protocol/go/common/common.pb.go @@ -360,69 +360,84 @@ var file_common_common_proto_rawDesc = []byte{ 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, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5c, 0x0a, 0x10, 0x49, - 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, - 0x18, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, - 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x11, 0xba, 0x48, 0x0e, 0x22, 0x0c, 0x0a, 0x02, 0x69, - 0x64, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x10, 0x01, 0x22, 0x5b, 0x0a, 0x0f, 0x49, 0x64, 0x46, - 0x71, 0x6e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, - 0x01, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0x72, 0x05, 0x10, 0x01, 0x88, 0x01, 0x01, 0x52, - 0x03, 0x66, 0x71, 0x6e, 0x3a, 0x10, 0xba, 0x48, 0x0d, 0x22, 0x0b, 0x0a, 0x02, 0x69, 0x64, 0x0a, - 0x03, 0x66, 0x71, 0x6e, 0x10, 0x01, 0x22, 0xf1, 0x01, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, - 0x74, 0x18, 0x01, 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, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, - 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, 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, 0x09, - 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x34, 0x0a, 0x06, 0x6c, 0x61, 0x62, - 0x65, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, - 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x4c, 0x61, 0x62, 0x65, - 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x1a, - 0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x89, 0x01, 0x0a, 0x0f, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x3b, - 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, - 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x1a, 0x39, 0x0a, 0x0b, 0x4c, - 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x7d, 0x0a, 0x12, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x24, 0x0a, 0x20, - 0x4d, 0x45, 0x54, 0x41, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x5f, - 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, - 0x10, 0x00, 0x12, 0x1f, 0x0a, 0x1b, 0x4d, 0x45, 0x54, 0x41, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x55, - 0x50, 0x44, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x4e, - 0x44, 0x10, 0x01, 0x12, 0x20, 0x0a, 0x1c, 0x4d, 0x45, 0x54, 0x41, 0x44, 0x41, 0x54, 0x41, 0x5f, - 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x52, 0x45, 0x50, 0x4c, - 0x41, 0x43, 0x45, 0x10, 0x02, 0x2a, 0x8d, 0x01, 0x0a, 0x0f, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x21, 0x0a, 0x1d, 0x41, 0x43, 0x54, - 0x49, 0x56, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, - 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, - 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x4e, 0x55, - 0x4d, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x1e, 0x0a, 0x1a, 0x41, 0x43, - 0x54, 0x49, 0x56, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, - 0x49, 0x4e, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x43, - 0x54, 0x49, 0x56, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, - 0x41, 0x4e, 0x59, 0x10, 0x03, 0x42, 0x81, 0x01, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x42, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x64, 0x66, 0x2f, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6d, - 0x6d, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x43, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x43, 0x6f, 0x6d, 0x6d, - 0x6f, 0x6e, 0xca, 0x02, 0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0xe2, 0x02, 0x12, 0x43, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd2, 0x02, 0x0a, 0x10, + 0x49, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, + 0x12, 0x18, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, + 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x90, 0x02, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0xfb, 0x01, 0xba, 0x48, 0xf7, 0x01, + 0xba, 0x01, 0xec, 0x01, 0x0a, 0x0b, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, + 0x74, 0x12, 0x9f, 0x01, 0x4e, 0x61, 0x6d, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, + 0x20, 0x61, 0x6e, 0x20, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, + 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2c, 0x20, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, + 0x67, 0x20, 0x68, 0x79, 0x70, 0x68, 0x65, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x6e, + 0x64, 0x65, 0x72, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x20, 0x62, 0x75, 0x74, 0x20, 0x6e, 0x6f, + 0x74, 0x20, 0x61, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20, 0x6f, + 0x72, 0x20, 0x6c, 0x61, 0x73, 0x74, 0x20, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, + 0x2e, 0x20, 0x54, 0x68, 0x65, 0x20, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x64, 0x20, 0x6e, 0x61, 0x6d, + 0x65, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, + 0x69, 0x7a, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x6c, 0x6f, 0x77, 0x65, 0x72, 0x20, 0x63, 0x61, + 0x73, 0x65, 0x2e, 0x1a, 0x3b, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, + 0x73, 0x28, 0x27, 0x5e, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, 0x39, 0x5d, 0x28, + 0x3f, 0x3a, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, 0x39, 0x5f, 0x2d, 0x5d, 0x2a, + 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, 0x39, 0x5d, 0x29, 0x3f, 0x24, 0x27, 0x29, + 0x72, 0x05, 0x10, 0x01, 0x18, 0xfd, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x11, 0xba, + 0x48, 0x0e, 0x22, 0x0c, 0x0a, 0x02, 0x69, 0x64, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x10, 0x01, + 0x22, 0x5b, 0x0a, 0x0f, 0x49, 0x64, 0x46, 0x71, 0x6e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, + 0x69, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, + 0x03, 0x66, 0x71, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0x72, + 0x05, 0x10, 0x01, 0x88, 0x01, 0x01, 0x52, 0x03, 0x66, 0x71, 0x6e, 0x3a, 0x10, 0xba, 0x48, 0x0d, + 0x22, 0x0b, 0x0a, 0x02, 0x69, 0x64, 0x0a, 0x03, 0x66, 0x71, 0x6e, 0x10, 0x01, 0x22, 0xf1, 0x01, + 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x01, 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, 0x09, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, + 0x5f, 0x61, 0x74, 0x18, 0x02, 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, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, + 0x12, 0x34, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, + 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x1a, 0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, + 0x01, 0x22, 0x89, 0x01, 0x0a, 0x0f, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, + 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x2e, 0x4c, + 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, + 0x6c, 0x73, 0x1a, 0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x7d, 0x0a, + 0x12, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, + 0x6e, 0x75, 0x6d, 0x12, 0x24, 0x0a, 0x20, 0x4d, 0x45, 0x54, 0x41, 0x44, 0x41, 0x54, 0x41, 0x5f, + 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1f, 0x0a, 0x1b, 0x4d, 0x45, 0x54, + 0x41, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x4e, 0x55, + 0x4d, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x20, 0x0a, 0x1c, 0x4d, 0x45, + 0x54, 0x41, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x5f, 0x45, 0x4e, + 0x55, 0x4d, 0x5f, 0x52, 0x45, 0x50, 0x4c, 0x41, 0x43, 0x45, 0x10, 0x02, 0x2a, 0x8d, 0x01, 0x0a, + 0x0f, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x75, 0x6d, + 0x12, 0x21, 0x0a, 0x1d, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, + 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x53, 0x54, + 0x41, 0x54, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, + 0x01, 0x12, 0x1e, 0x0a, 0x1a, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, + 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x49, 0x4e, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, + 0x02, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, + 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x41, 0x4e, 0x59, 0x10, 0x03, 0x42, 0x81, 0x01, 0x0a, + 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x42, 0x0b, 0x43, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x64, 0x66, 0x2f, 0x70, + 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x43, 0x58, 0x58, + 0xaa, 0x02, 0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0xca, 0x02, 0x06, 0x43, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0xe2, 0x02, 0x12, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/service/common/common.proto b/service/common/common.proto index 3a9038aad9..bb3af378a1 100644 --- a/service/common/common.proto +++ b/service/common/common.proto @@ -8,9 +8,15 @@ import "buf/validate/validate.proto"; message IdNameIdentifier { option (buf.validate.message).oneof = { fields: ["id", "name"], required: true }; string id = 1 [(buf.validate.field).string.uuid = true]; - string name = 2 [(buf.validate.field).string = { - min_len: 1 - }]; + string name = 2 [ + (buf.validate.field).string.min_len = 1, + (buf.validate.field).string.max_len = 253, + (buf.validate.field).cel = { + id: "name_format" + message: "Name must be an alphanumeric string, allowing hyphens and underscores but not as the first or last character. The stored name will be normalized to lower case." + expression: "this.matches('^[a-zA-Z0-9](?:[a-zA-Z0-9_-]*[a-zA-Z0-9])?$')" + } + ]; } message IdFqnIdentifier { diff --git a/service/policy/obligations/obligations_test.go b/service/policy/obligations/obligations_test.go index b96e1ed67e..8fee37b38e 100644 --- a/service/policy/obligations/obligations_test.go +++ b/service/policy/obligations/obligations_test.go @@ -12,6 +12,7 @@ import ( const ( invalidUUID = "invalid-uuid" + invalidName = "&hello" ) func getValidator() protovalidate.Validator { @@ -158,6 +159,16 @@ func Test_AddObligationTrigger_Request(t *testing.T) { expectError: true, errorMessage: "action", }, + { + name: "action name not alphanumeric", + req: &obligations.AddObligationTriggerRequest{ + ObligationValue: &common.IdFqnIdentifier{Id: validUUID}, + Action: &common.IdNameIdentifier{Name: invalidName}, + AttributeValue: &common.IdFqnIdentifier{Id: validUUID}, + }, + expectError: true, + errorMessage: "name_format", + }, } v := getValidator()