diff --git a/Makefile b/Makefile index b965f5d..bb12076 100644 --- a/Makefile +++ b/Makefile @@ -1,27 +1,50 @@ .PHONY: generate +generate: fetch-protos format go-gen -generate: patch-swagger-doc format - go mod tidy - go mod vendor +.PHONY: clean +clean: + @find ./proto -type f -name '*.go' -exec rm {} + -patch-swagger-doc: buf-gen - #./scripts/update_swagger.sh docs/openapiv2/apidocs.swagger.json +.PHONY: fetch-protos +fetch-protos: + @protofetch -o vendor-proto fetch -init-git-hooks: - git config --local core.hooksPath .githooks/ +.PHONY: go-gen +go-gen: clean + @find ./proto -type f -iname '*.proto' -exec \ + protoc -I./proto -I./vendor-proto \ + --go_out=./proto \ + --go_opt=paths=import \ + --go_opt=module=github.com/openkcm/api-sdk/proto \ + --go-grpc_out=./proto \ + --go-grpc_opt=paths=import \ + --go-grpc_opt=module=github.com/openkcm/api-sdk/proto \ + {} + + @go mod tidy -buf-gen: init-git-hooks - buf dep update - ./buf.gen.yaml +.PHONY: install-tools +install-tools: + brew install protobuf + go install \ + google.golang.org/protobuf/cmd/protoc-gen-go@latest \ + google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest + brew install bufbuild/buf/buf + npm install -g @coralogix/protofetch -format: buf-gen - buf format -w +.PHONY: validate +validate: format lint breaking -.PHONY: test -test: - go test -race -coverprofile cover.out ./... - # On a Mac, you can use the following command to open the coverage report in the browser - # go tool cover -html=cover.out -o cover.html && open cover.html +.PHONY: lint +lint: + @buf lint + +.PHONY: breaking +breaking: + @buf breaking --against https://github.com/openkcm/api-sdk.git#branch=main + +.PHONY: format +format: + @buf format -w .PHONY: reuse-lint reuse-lint: diff --git a/README.md b/README.md index 8fe8498..2ec66a3 100644 --- a/README.md +++ b/README.md @@ -4,36 +4,77 @@ Have all service definitions and code generated stubs for OpenKCM APIs. -## Generate protobuf code +## Pre-requisites -1. **Install `buf`:** If you haven't already, install `buf` by following the instructions on - the [Buf website](https://buf.build/docs/installation/). - You can install buf on macOS or Linux using Homebrew: +Several tools are required to generate the code: -```sh - brew install bufbuild/buf/buf +1. **`protoc compiler`**: see the instruction on the official [web site](https://protobuf.dev/installation) or install using homebrew `brew install protobuf`. +2. **`protoc-gen-go`**: install via `go install google.golang.org/protobuf/cmd/protoc-gen-go@latest`. +3. **`protoc-gen-go-grpc`**: install via `go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest`. +4. **`protofetch`**: download from the [releases page](https://github.com/coralogix/protofetch/releases/latest) of [the GitHub repository](https://github.com/coralogix/protofetch) or install via `cargo install protofetch` or `npm install -g @coralogix/protofetch`, or using any similar tool compatible with the npm registry. + +## Optional tools + +Optionally, the [`buf` CLI](https://github.com/bufbuild/buf) tool can be used to validate, detect breaking changes, and format `.proto` files: + +- **`buf breaking --against https://github.com/openkcm/api-sdk.git#branch=main`**: detect breaking changes against the main branch of the remote repository. +- **`buf format -w`**: format `.proto` files. +- **`buf lint`**: lint `.proto` files. + +## Makefile + +There are several `make` targets defined in the `Makefile`: + +- **`fetch-protos`**: download `.proto` dependencies using `protofetch`. +- **`generate`**: fetches `.proto` dependencies, formats `.proto` files, and generates Go code. +- **`install-tools`**: installs the tools (including optional) from the following sources: Homebrew, Go registry (via `go install`), NPM registry (via `npm install -g`). See the target definition for the details. +- **`validate`**: formats and lints `.proto` files, detects breaking changes. + +For the rest `make` targets see `Makefile`. + +## Dependencies + +`.proto` dependencies are managed with the [`protofetch`](https://github.com/coralogix/protofetch) tool. This tool downloads `.proto` files from a specified location of a git repository and places them into the `vendor-proto` directory. The dependencies are specified in the `protofetch.toml` file. + +For instance, a dependency on the [`protovalidate`](https://github.com/bufbuild/protovalidate) proto definitions can be specified as follow: + +``` toml +name = "github.com/openkcm/api-sdk" +description = "API proto definitions and Go generated code used in the openkcm project" + +[protovalidate] +url = "github.com/bufbuild/protovalidate" +revision = "v1.1.1" +content_roots = ["/proto/protovalidate"] +allow_policies = ["buf/validate/*"] ``` -2. **Generate code:** Use the ```sh make generate``` command to run the entire process. +In order to fetch dependencies, execute: -```sh - make generate +``` sh +$ protofetch -o vendor-proto fetch ``` ---- +## Generate Go code from the .proto definitions + +The code can be generated with executing the following Make target + +```sh +$ make generate +``` ## Using a specific branch Ensure that the GOPRIVATE environment variable is set up: - ```sh - go env -w GOPRIVATE="github.com/*" - ``` +```sh +$ go env -w GOPRIVATE="github.com/openkcm/*" +``` To use a specific branch of a repository in your Go project, you can use the `go get` command with the branch name. Here's an example: -> go get github.com/openkcm/api-sdk/proto/kms/api/cmk/registry/system/v1@ +> go get github.com/openkcm/api-sdk/proto/kms/api/cmk/registry/system/v1@\ To switch back to the default branch, follow these steps: @@ -44,7 +85,7 @@ To switch back to the default branch, follow these steps: 2. Clean up: ```sh - go mod tidy +$ go mod tidy ``` ## Support, Feedback, Contributing diff --git a/buf.gen.yaml b/buf.gen.yaml deleted file mode 100755 index 56f9c82..0000000 --- a/buf.gen.yaml +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env -S buf generate --template ---- -version: v2 -managed: - enabled: true - override: - - file_option: go_package_prefix - value: github.com/openkcm/api-sdk/proto -plugins: - - remote: buf.build/protocolbuffers/go - out: proto - opt: - - paths=source_relative - - remote: buf.build/grpc/go - out: proto - opt: - - paths=source_relative - - remote: buf.build/bufbuild/validate-go - out: proto - opt: - - paths=source_relative -inputs: - - directory: proto diff --git a/buf.yaml b/buf.yaml index 6aa4477..498a79d 100644 --- a/buf.yaml +++ b/buf.yaml @@ -1,9 +1,12 @@ version: v2 modules: - path: proto + - path: vendor-proto lint: use: - STANDARD + ignore: + - vendor-proto ignore_only: # To not break existing APIs. ENUM_FIRST_VALUE_ZERO: diff --git a/go.mod b/go.mod index 51f0a63..037eaf2 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,11 @@ module github.com/openkcm/api-sdk go 1.24.2 +tool ( + google.golang.org/grpc/cmd/protoc-gen-go-grpc + google.golang.org/protobuf/cmd/protoc-gen-go +) + require ( google.golang.org/grpc v1.80.0 google.golang.org/protobuf v1.36.11 @@ -12,4 +17,5 @@ require ( golang.org/x/sys v0.40.0 // indirect golang.org/x/text v0.33.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260120221211-b8f7ae30c516 // indirect + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.1 // indirect ) diff --git a/go.sum b/go.sum index 98ff7bd..e09d98f 100644 --- a/go.sum +++ b/go.sum @@ -34,5 +34,7 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20260120221211-b8f7ae30c516 h1: google.golang.org/genproto/googleapis/rpc v0.0.0-20260120221211-b8f7ae30c516/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ= google.golang.org/grpc v1.80.0 h1:Xr6m2WmWZLETvUNvIUmeD5OAagMw3FiKmMlTdViWsHM= google.golang.org/grpc v1.80.0/go.mod h1:ho/dLnxwi3EDJA4Zghp7k2Ec1+c2jqup0bFkw07bwF4= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.1 h1:/WILD1UcXj/ujCxgoL/DvRgt2CP3txG8+FwkUbb9110= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.1/go.mod h1:YNKnb2OAApgYn2oYY47Rn7alMr1zWjb2U8Q0aoGWiNc= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= diff --git a/proto/kms/api/cmk/eventprocessor/task/v1/task.pb.go b/proto/kms/api/cmk/eventprocessor/task/v1/task.pb.go index 438c194..9b58da0 100644 --- a/proto/kms/api/cmk/eventprocessor/task/v1/task.pb.go +++ b/proto/kms/api/cmk/eventprocessor/task/v1/task.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc (unknown) +// protoc v7.34.1 // source: kms/api/cmk/eventprocessor/task/v1/task.proto package taskv1 @@ -407,8 +407,7 @@ const file_kms_api_cmk_eventprocessor_task_v1_task_proto_rawDesc = "" + "\rSYSTEM_UNLINK\x10\x05\x12\x11\n" + "\rSYSTEM_SWITCH\x10\x06\x12\x0e\n" + "\n" + - "KEY_DETACH\x10\aB\xae\x02\n" + - "&com.kms.api.cmk.eventprocessor.task.v1B\tTaskProtoP\x01ZJgithub.com/openkcm/api-sdk/proto/kms/api/cmk/eventprocessor/task/v1;taskv1\xa2\x02\x05KACET\xaa\x02\"Kms.Api.Cmk.Eventprocessor.Task.V1\xca\x02\"Kms\\Api\\Cmk\\Eventprocessor\\Task\\V1\xe2\x02.Kms\\Api\\Cmk\\Eventprocessor\\Task\\V1\\GPBMetadata\xea\x02'Kms::Api::Cmk::Eventprocessor::Task::V1b\x06proto3" + "KEY_DETACH\x10\aBLZJgithub.com/openkcm/api-sdk/proto/kms/api/cmk/eventprocessor/task/v1;taskv1b\x06proto3" var ( file_kms_api_cmk_eventprocessor_task_v1_task_proto_rawDescOnce sync.Once diff --git a/proto/kms/api/cmk/eventprocessor/task/v1/task.pb.validate.go b/proto/kms/api/cmk/eventprocessor/task/v1/task.pb.validate.go deleted file mode 100644 index 693cca5..0000000 --- a/proto/kms/api/cmk/eventprocessor/task/v1/task.pb.validate.go +++ /dev/null @@ -1,449 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: kms/api/cmk/eventprocessor/task/v1/task.proto - -package taskv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on Data with the rules defined in the proto -// definition for this message. If any rules are violated, the first error -// encountered is returned, or nil if there are no violations. -func (m *Data) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Data with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in DataMultiError, or nil if none found. -func (m *Data) ValidateAll() error { - return m.validate(true) -} - -func (m *Data) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for TaskType - - switch v := m.Data.(type) { - case *Data_KeyAction: - if v == nil { - err := DataValidationError{ - field: "Data", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetKeyAction()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DataValidationError{ - field: "KeyAction", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DataValidationError{ - field: "KeyAction", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKeyAction()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DataValidationError{ - field: "KeyAction", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Data_SystemAction: - if v == nil { - err := DataValidationError{ - field: "Data", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetSystemAction()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DataValidationError{ - field: "SystemAction", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DataValidationError{ - field: "SystemAction", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSystemAction()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DataValidationError{ - field: "SystemAction", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return DataMultiError(errors) - } - - return nil -} - -// DataMultiError is an error wrapping multiple validation errors returned by -// Data.ValidateAll() if the designated constraints aren't met. -type DataMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DataMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DataMultiError) AllErrors() []error { return m } - -// DataValidationError is the validation error returned by Data.Validate if the -// designated constraints aren't met. -type DataValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DataValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DataValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DataValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DataValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DataValidationError) ErrorName() string { return "DataValidationError" } - -// Error satisfies the builtin error interface -func (e DataValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sData.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DataValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DataValidationError{} - -// Validate checks the field values on KeyAction with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *KeyAction) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on KeyAction with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in KeyActionMultiError, or nil -// if none found. -func (m *KeyAction) ValidateAll() error { - return m.validate(true) -} - -func (m *KeyAction) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for KeyId - - // no validation rules for TenantId - - // no validation rules for CmkRegion - - if len(errors) > 0 { - return KeyActionMultiError(errors) - } - - return nil -} - -// KeyActionMultiError is an error wrapping multiple validation errors returned -// by KeyAction.ValidateAll() if the designated constraints aren't met. -type KeyActionMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m KeyActionMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m KeyActionMultiError) AllErrors() []error { return m } - -// KeyActionValidationError is the validation error returned by -// KeyAction.Validate if the designated constraints aren't met. -type KeyActionValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e KeyActionValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e KeyActionValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e KeyActionValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e KeyActionValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e KeyActionValidationError) ErrorName() string { return "KeyActionValidationError" } - -// Error satisfies the builtin error interface -func (e KeyActionValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sKeyAction.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = KeyActionValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = KeyActionValidationError{} - -// Validate checks the field values on SystemAction with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *SystemAction) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SystemAction with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in SystemActionMultiError, or -// nil if none found. -func (m *SystemAction) ValidateAll() error { - return m.validate(true) -} - -func (m *SystemAction) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for SystemId - - // no validation rules for SystemRegion - - // no validation rules for SystemType - - // no validation rules for KeyIdFrom - - // no validation rules for KeyIdTo - - // no validation rules for KeyProvider - - // no validation rules for KeyAccessMetaData - - // no validation rules for TenantId - - // no validation rules for TenantOwnerId - - // no validation rules for TenantOwnerType - - // no validation rules for CmkRegion - - if len(errors) > 0 { - return SystemActionMultiError(errors) - } - - return nil -} - -// SystemActionMultiError is an error wrapping multiple validation errors -// returned by SystemAction.ValidateAll() if the designated constraints aren't met. -type SystemActionMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SystemActionMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SystemActionMultiError) AllErrors() []error { return m } - -// SystemActionValidationError is the validation error returned by -// SystemAction.Validate if the designated constraints aren't met. -type SystemActionValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SystemActionValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SystemActionValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SystemActionValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SystemActionValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SystemActionValidationError) ErrorName() string { return "SystemActionValidationError" } - -// Error satisfies the builtin error interface -func (e SystemActionValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSystemAction.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SystemActionValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SystemActionValidationError{} diff --git a/proto/kms/api/cmk/eventprocessor/task/v1/task.proto b/proto/kms/api/cmk/eventprocessor/task/v1/task.proto index ad4b95c..53830bb 100644 --- a/proto/kms/api/cmk/eventprocessor/task/v1/task.proto +++ b/proto/kms/api/cmk/eventprocessor/task/v1/task.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package kms.api.cmk.eventprocessor.task.v1; +option go_package = "github.com/openkcm/api-sdk/proto/kms/api/cmk/eventprocessor/task/v1;taskv1"; + enum TaskType { KEY_ENABLE = 0; KEY_DISABLE = 1; diff --git a/proto/kms/api/cmk/registry/auth/v1/auth.pb.go b/proto/kms/api/cmk/registry/auth/v1/auth.pb.go index f9c1e67..49594c3 100644 --- a/proto/kms/api/cmk/registry/auth/v1/auth.pb.go +++ b/proto/kms/api/cmk/registry/auth/v1/auth.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc (unknown) +// protoc v7.34.1 // source: kms/api/cmk/registry/auth/v1/auth.proto package authv1 @@ -723,8 +723,7 @@ const file_kms_api_cmk_registry_auth_v1_auth_proto_rawDesc = "" + "\aGetAuth\x12,.kms.api.cmk.registry.auth.v1.GetAuthRequest\x1a-.kms.api.cmk.registry.auth.v1.GetAuthResponse\"\x00\x12n\n" + "\tListAuths\x12..kms.api.cmk.registry.auth.v1.ListAuthsRequest\x1a/.kms.api.cmk.registry.auth.v1.ListAuthsResponse\"\x00\x12q\n" + "\n" + - "RemoveAuth\x12/.kms.api.cmk.registry.auth.v1.RemoveAuthRequest\x1a0.kms.api.cmk.registry.auth.v1.RemoveAuthResponse\"\x00B\x8a\x02\n" + - " com.kms.api.cmk.registry.auth.v1B\tAuthProtoP\x01ZDgithub.com/openkcm/api-sdk/proto/kms/api/cmk/registry/auth/v1;authv1\xa2\x02\x05KACRA\xaa\x02\x1cKms.Api.Cmk.Registry.Auth.V1\xca\x02\x1cKms\\Api\\Cmk\\Registry\\Auth\\V1\xe2\x02(Kms\\Api\\Cmk\\Registry\\Auth\\V1\\GPBMetadata\xea\x02!Kms::Api::Cmk::Registry::Auth::V1b\x06proto3" + "RemoveAuth\x12/.kms.api.cmk.registry.auth.v1.RemoveAuthRequest\x1a0.kms.api.cmk.registry.auth.v1.RemoveAuthResponse\"\x00BFZDgithub.com/openkcm/api-sdk/proto/kms/api/cmk/registry/auth/v1;authv1b\x06proto3" var ( file_kms_api_cmk_registry_auth_v1_auth_proto_rawDescOnce sync.Once diff --git a/proto/kms/api/cmk/registry/auth/v1/auth.pb.validate.go b/proto/kms/api/cmk/registry/auth/v1/auth.pb.validate.go deleted file mode 100644 index 18db00e..0000000 --- a/proto/kms/api/cmk/registry/auth/v1/auth.pb.validate.go +++ /dev/null @@ -1,1045 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: kms/api/cmk/registry/auth/v1/auth.proto - -package authv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on Auth with the rules defined in the proto -// definition for this message. If any rules are violated, the first error -// encountered is returned, or nil if there are no violations. -func (m *Auth) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Auth with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in AuthMultiError, or nil if none found. -func (m *Auth) ValidateAll() error { - return m.validate(true) -} - -func (m *Auth) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ExternalId - - // no validation rules for TenantId - - // no validation rules for Type - - // no validation rules for Properties - - // no validation rules for Status - - // no validation rules for ErrorMessage - - // no validation rules for UpdatedAt - - // no validation rules for CreatedAt - - if len(errors) > 0 { - return AuthMultiError(errors) - } - - return nil -} - -// AuthMultiError is an error wrapping multiple validation errors returned by -// Auth.ValidateAll() if the designated constraints aren't met. -type AuthMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AuthMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AuthMultiError) AllErrors() []error { return m } - -// AuthValidationError is the validation error returned by Auth.Validate if the -// designated constraints aren't met. -type AuthValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AuthValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AuthValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AuthValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AuthValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AuthValidationError) ErrorName() string { return "AuthValidationError" } - -// Error satisfies the builtin error interface -func (e AuthValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAuth.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AuthValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AuthValidationError{} - -// Validate checks the field values on ApplyAuthRequest with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *ApplyAuthRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ApplyAuthRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ApplyAuthRequestMultiError, or nil if none found. -func (m *ApplyAuthRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *ApplyAuthRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ExternalId - - // no validation rules for TenantId - - // no validation rules for Type - - // no validation rules for Properties - - if len(errors) > 0 { - return ApplyAuthRequestMultiError(errors) - } - - return nil -} - -// ApplyAuthRequestMultiError is an error wrapping multiple validation errors -// returned by ApplyAuthRequest.ValidateAll() if the designated constraints -// aren't met. -type ApplyAuthRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ApplyAuthRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ApplyAuthRequestMultiError) AllErrors() []error { return m } - -// ApplyAuthRequestValidationError is the validation error returned by -// ApplyAuthRequest.Validate if the designated constraints aren't met. -type ApplyAuthRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ApplyAuthRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ApplyAuthRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ApplyAuthRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ApplyAuthRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ApplyAuthRequestValidationError) ErrorName() string { return "ApplyAuthRequestValidationError" } - -// Error satisfies the builtin error interface -func (e ApplyAuthRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sApplyAuthRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ApplyAuthRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ApplyAuthRequestValidationError{} - -// Validate checks the field values on ApplyAuthResponse with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *ApplyAuthResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ApplyAuthResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ApplyAuthResponseMultiError, or nil if none found. -func (m *ApplyAuthResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *ApplyAuthResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Success - - if len(errors) > 0 { - return ApplyAuthResponseMultiError(errors) - } - - return nil -} - -// ApplyAuthResponseMultiError is an error wrapping multiple validation errors -// returned by ApplyAuthResponse.ValidateAll() if the designated constraints -// aren't met. -type ApplyAuthResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ApplyAuthResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ApplyAuthResponseMultiError) AllErrors() []error { return m } - -// ApplyAuthResponseValidationError is the validation error returned by -// ApplyAuthResponse.Validate if the designated constraints aren't met. -type ApplyAuthResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ApplyAuthResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ApplyAuthResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ApplyAuthResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ApplyAuthResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ApplyAuthResponseValidationError) ErrorName() string { - return "ApplyAuthResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e ApplyAuthResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sApplyAuthResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ApplyAuthResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ApplyAuthResponseValidationError{} - -// Validate checks the field values on GetAuthRequest with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *GetAuthRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetAuthRequest with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in GetAuthRequestMultiError, -// or nil if none found. -func (m *GetAuthRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *GetAuthRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ExternalId - - if len(errors) > 0 { - return GetAuthRequestMultiError(errors) - } - - return nil -} - -// GetAuthRequestMultiError is an error wrapping multiple validation errors -// returned by GetAuthRequest.ValidateAll() if the designated constraints -// aren't met. -type GetAuthRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetAuthRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetAuthRequestMultiError) AllErrors() []error { return m } - -// GetAuthRequestValidationError is the validation error returned by -// GetAuthRequest.Validate if the designated constraints aren't met. -type GetAuthRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetAuthRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetAuthRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetAuthRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetAuthRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetAuthRequestValidationError) ErrorName() string { return "GetAuthRequestValidationError" } - -// Error satisfies the builtin error interface -func (e GetAuthRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetAuthRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetAuthRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetAuthRequestValidationError{} - -// Validate checks the field values on GetAuthResponse with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *GetAuthResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetAuthResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GetAuthResponseMultiError, or nil if none found. -func (m *GetAuthResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *GetAuthResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetAuth()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetAuthResponseValidationError{ - field: "Auth", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetAuthResponseValidationError{ - field: "Auth", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAuth()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetAuthResponseValidationError{ - field: "Auth", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return GetAuthResponseMultiError(errors) - } - - return nil -} - -// GetAuthResponseMultiError is an error wrapping multiple validation errors -// returned by GetAuthResponse.ValidateAll() if the designated constraints -// aren't met. -type GetAuthResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetAuthResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetAuthResponseMultiError) AllErrors() []error { return m } - -// GetAuthResponseValidationError is the validation error returned by -// GetAuthResponse.Validate if the designated constraints aren't met. -type GetAuthResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetAuthResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetAuthResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetAuthResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetAuthResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetAuthResponseValidationError) ErrorName() string { return "GetAuthResponseValidationError" } - -// Error satisfies the builtin error interface -func (e GetAuthResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetAuthResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetAuthResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetAuthResponseValidationError{} - -// Validate checks the field values on ListAuthsRequest with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *ListAuthsRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ListAuthsRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ListAuthsRequestMultiError, or nil if none found. -func (m *ListAuthsRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *ListAuthsRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for TenantId - - // no validation rules for Limit - - // no validation rules for NextPageToken - - if len(errors) > 0 { - return ListAuthsRequestMultiError(errors) - } - - return nil -} - -// ListAuthsRequestMultiError is an error wrapping multiple validation errors -// returned by ListAuthsRequest.ValidateAll() if the designated constraints -// aren't met. -type ListAuthsRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ListAuthsRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ListAuthsRequestMultiError) AllErrors() []error { return m } - -// ListAuthsRequestValidationError is the validation error returned by -// ListAuthsRequest.Validate if the designated constraints aren't met. -type ListAuthsRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ListAuthsRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ListAuthsRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ListAuthsRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ListAuthsRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ListAuthsRequestValidationError) ErrorName() string { return "ListAuthsRequestValidationError" } - -// Error satisfies the builtin error interface -func (e ListAuthsRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sListAuthsRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ListAuthsRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ListAuthsRequestValidationError{} - -// Validate checks the field values on ListAuthsResponse with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *ListAuthsResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ListAuthsResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ListAuthsResponseMultiError, or nil if none found. -func (m *ListAuthsResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *ListAuthsResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetAuth() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ListAuthsResponseValidationError{ - field: fmt.Sprintf("Auth[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ListAuthsResponseValidationError{ - field: fmt.Sprintf("Auth[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ListAuthsResponseValidationError{ - field: fmt.Sprintf("Auth[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - // no validation rules for NextPageToken - - if len(errors) > 0 { - return ListAuthsResponseMultiError(errors) - } - - return nil -} - -// ListAuthsResponseMultiError is an error wrapping multiple validation errors -// returned by ListAuthsResponse.ValidateAll() if the designated constraints -// aren't met. -type ListAuthsResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ListAuthsResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ListAuthsResponseMultiError) AllErrors() []error { return m } - -// ListAuthsResponseValidationError is the validation error returned by -// ListAuthsResponse.Validate if the designated constraints aren't met. -type ListAuthsResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ListAuthsResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ListAuthsResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ListAuthsResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ListAuthsResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ListAuthsResponseValidationError) ErrorName() string { - return "ListAuthsResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e ListAuthsResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sListAuthsResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ListAuthsResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ListAuthsResponseValidationError{} - -// Validate checks the field values on RemoveAuthRequest with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *RemoveAuthRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RemoveAuthRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RemoveAuthRequestMultiError, or nil if none found. -func (m *RemoveAuthRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *RemoveAuthRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ExternalId - - if len(errors) > 0 { - return RemoveAuthRequestMultiError(errors) - } - - return nil -} - -// RemoveAuthRequestMultiError is an error wrapping multiple validation errors -// returned by RemoveAuthRequest.ValidateAll() if the designated constraints -// aren't met. -type RemoveAuthRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RemoveAuthRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RemoveAuthRequestMultiError) AllErrors() []error { return m } - -// RemoveAuthRequestValidationError is the validation error returned by -// RemoveAuthRequest.Validate if the designated constraints aren't met. -type RemoveAuthRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RemoveAuthRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RemoveAuthRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RemoveAuthRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RemoveAuthRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RemoveAuthRequestValidationError) ErrorName() string { - return "RemoveAuthRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e RemoveAuthRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRemoveAuthRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RemoveAuthRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RemoveAuthRequestValidationError{} - -// Validate checks the field values on RemoveAuthResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RemoveAuthResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RemoveAuthResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RemoveAuthResponseMultiError, or nil if none found. -func (m *RemoveAuthResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *RemoveAuthResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Success - - if len(errors) > 0 { - return RemoveAuthResponseMultiError(errors) - } - - return nil -} - -// RemoveAuthResponseMultiError is an error wrapping multiple validation errors -// returned by RemoveAuthResponse.ValidateAll() if the designated constraints -// aren't met. -type RemoveAuthResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RemoveAuthResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RemoveAuthResponseMultiError) AllErrors() []error { return m } - -// RemoveAuthResponseValidationError is the validation error returned by -// RemoveAuthResponse.Validate if the designated constraints aren't met. -type RemoveAuthResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RemoveAuthResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RemoveAuthResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RemoveAuthResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RemoveAuthResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RemoveAuthResponseValidationError) ErrorName() string { - return "RemoveAuthResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e RemoveAuthResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRemoveAuthResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RemoveAuthResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RemoveAuthResponseValidationError{} diff --git a/proto/kms/api/cmk/registry/auth/v1/auth.proto b/proto/kms/api/cmk/registry/auth/v1/auth.proto index 3958244..4912609 100644 --- a/proto/kms/api/cmk/registry/auth/v1/auth.proto +++ b/proto/kms/api/cmk/registry/auth/v1/auth.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package kms.api.cmk.registry.auth.v1; +option go_package = "github.com/openkcm/api-sdk/proto/kms/api/cmk/registry/auth/v1;authv1"; + service Service { rpc ApplyAuth(ApplyAuthRequest) returns (ApplyAuthResponse) {} rpc GetAuth(GetAuthRequest) returns (GetAuthResponse) {} diff --git a/proto/kms/api/cmk/registry/auth/v1/auth_grpc.pb.go b/proto/kms/api/cmk/registry/auth/v1/auth_grpc.pb.go index 08a21fd..42d108a 100644 --- a/proto/kms/api/cmk/registry/auth/v1/auth_grpc.pb.go +++ b/proto/kms/api/cmk/registry/auth/v1/auth_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.6.1 -// - protoc (unknown) +// - protoc v7.34.1 // source: kms/api/cmk/registry/auth/v1/auth.proto package authv1 diff --git a/proto/kms/api/cmk/registry/mapping/v1/mapping.pb.go b/proto/kms/api/cmk/registry/mapping/v1/mapping.pb.go index 61ee568..1a5a3ce 100644 --- a/proto/kms/api/cmk/registry/mapping/v1/mapping.pb.go +++ b/proto/kms/api/cmk/registry/mapping/v1/mapping.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc (unknown) +// protoc v7.34.1 // source: kms/api/cmk/registry/mapping/v1/mapping.proto package mappingv1 @@ -360,8 +360,7 @@ const file_kms_api_cmk_registry_mapping_v1_mapping_proto_rawDesc = "" + "\aService\x12\x98\x01\n" + "\x15UnmapSystemFromTenant\x12=.kms.api.cmk.registry.mapping.v1.UnmapSystemFromTenantRequest\x1a>.kms.api.cmk.registry.mapping.v1.UnmapSystemFromTenantResponse\"\x00\x12\x8c\x01\n" + "\x11MapSystemToTenant\x129.kms.api.cmk.registry.mapping.v1.MapSystemToTenantRequest\x1a:.kms.api.cmk.registry.mapping.v1.MapSystemToTenantResponse\"\x00\x12b\n" + - "\x03Get\x12+.kms.api.cmk.registry.mapping.v1.GetRequest\x1a,.kms.api.cmk.registry.mapping.v1.GetResponse\"\x00B\xa2\x02\n" + - "#com.kms.api.cmk.registry.mapping.v1B\fMappingProtoP\x01ZJgithub.com/openkcm/api-sdk/proto/kms/api/cmk/registry/mapping/v1;mappingv1\xa2\x02\x05KACRM\xaa\x02\x1fKms.Api.Cmk.Registry.Mapping.V1\xca\x02\x1fKms\\Api\\Cmk\\Registry\\Mapping\\V1\xe2\x02+Kms\\Api\\Cmk\\Registry\\Mapping\\V1\\GPBMetadata\xea\x02$Kms::Api::Cmk::Registry::Mapping::V1b\x06proto3" + "\x03Get\x12+.kms.api.cmk.registry.mapping.v1.GetRequest\x1a,.kms.api.cmk.registry.mapping.v1.GetResponse\"\x00BLZJgithub.com/openkcm/api-sdk/proto/kms/api/cmk/registry/mapping/v1;mappingv1b\x06proto3" var ( file_kms_api_cmk_registry_mapping_v1_mapping_proto_rawDescOnce sync.Once diff --git a/proto/kms/api/cmk/registry/mapping/v1/mapping.pb.validate.go b/proto/kms/api/cmk/registry/mapping/v1/mapping.pb.validate.go deleted file mode 100644 index dff4bfa..0000000 --- a/proto/kms/api/cmk/registry/mapping/v1/mapping.pb.validate.go +++ /dev/null @@ -1,666 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: kms/api/cmk/registry/mapping/v1/mapping.proto - -package mappingv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on UnmapSystemFromTenantRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *UnmapSystemFromTenantRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UnmapSystemFromTenantRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// UnmapSystemFromTenantRequestMultiError, or nil if none found. -func (m *UnmapSystemFromTenantRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *UnmapSystemFromTenantRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ExternalId - - // no validation rules for Type - - // no validation rules for TenantId - - if len(errors) > 0 { - return UnmapSystemFromTenantRequestMultiError(errors) - } - - return nil -} - -// UnmapSystemFromTenantRequestMultiError is an error wrapping multiple -// validation errors returned by UnmapSystemFromTenantRequest.ValidateAll() if -// the designated constraints aren't met. -type UnmapSystemFromTenantRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UnmapSystemFromTenantRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m UnmapSystemFromTenantRequestMultiError) AllErrors() []error { return m } - -// UnmapSystemFromTenantRequestValidationError is the validation error returned -// by UnmapSystemFromTenantRequest.Validate if the designated constraints -// aren't met. -type UnmapSystemFromTenantRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UnmapSystemFromTenantRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UnmapSystemFromTenantRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UnmapSystemFromTenantRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UnmapSystemFromTenantRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UnmapSystemFromTenantRequestValidationError) ErrorName() string { - return "UnmapSystemFromTenantRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e UnmapSystemFromTenantRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sUnmapSystemFromTenantRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UnmapSystemFromTenantRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UnmapSystemFromTenantRequestValidationError{} - -// Validate checks the field values on UnmapSystemFromTenantResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *UnmapSystemFromTenantResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UnmapSystemFromTenantResponse with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// UnmapSystemFromTenantResponseMultiError, or nil if none found. -func (m *UnmapSystemFromTenantResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *UnmapSystemFromTenantResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Success - - if len(errors) > 0 { - return UnmapSystemFromTenantResponseMultiError(errors) - } - - return nil -} - -// UnmapSystemFromTenantResponseMultiError is an error wrapping multiple -// validation errors returned by UnmapSystemFromTenantResponse.ValidateAll() -// if the designated constraints aren't met. -type UnmapSystemFromTenantResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UnmapSystemFromTenantResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m UnmapSystemFromTenantResponseMultiError) AllErrors() []error { return m } - -// UnmapSystemFromTenantResponseValidationError is the validation error -// returned by UnmapSystemFromTenantResponse.Validate if the designated -// constraints aren't met. -type UnmapSystemFromTenantResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UnmapSystemFromTenantResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UnmapSystemFromTenantResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UnmapSystemFromTenantResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UnmapSystemFromTenantResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UnmapSystemFromTenantResponseValidationError) ErrorName() string { - return "UnmapSystemFromTenantResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e UnmapSystemFromTenantResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sUnmapSystemFromTenantResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UnmapSystemFromTenantResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UnmapSystemFromTenantResponseValidationError{} - -// Validate checks the field values on MapSystemToTenantRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *MapSystemToTenantRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on MapSystemToTenantRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// MapSystemToTenantRequestMultiError, or nil if none found. -func (m *MapSystemToTenantRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *MapSystemToTenantRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ExternalId - - // no validation rules for Type - - // no validation rules for TenantId - - if len(errors) > 0 { - return MapSystemToTenantRequestMultiError(errors) - } - - return nil -} - -// MapSystemToTenantRequestMultiError is an error wrapping multiple validation -// errors returned by MapSystemToTenantRequest.ValidateAll() if the designated -// constraints aren't met. -type MapSystemToTenantRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m MapSystemToTenantRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m MapSystemToTenantRequestMultiError) AllErrors() []error { return m } - -// MapSystemToTenantRequestValidationError is the validation error returned by -// MapSystemToTenantRequest.Validate if the designated constraints aren't met. -type MapSystemToTenantRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MapSystemToTenantRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MapSystemToTenantRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MapSystemToTenantRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MapSystemToTenantRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MapSystemToTenantRequestValidationError) ErrorName() string { - return "MapSystemToTenantRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e MapSystemToTenantRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMapSystemToTenantRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MapSystemToTenantRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MapSystemToTenantRequestValidationError{} - -// Validate checks the field values on MapSystemToTenantResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *MapSystemToTenantResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on MapSystemToTenantResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// MapSystemToTenantResponseMultiError, or nil if none found. -func (m *MapSystemToTenantResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *MapSystemToTenantResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Success - - if len(errors) > 0 { - return MapSystemToTenantResponseMultiError(errors) - } - - return nil -} - -// MapSystemToTenantResponseMultiError is an error wrapping multiple validation -// errors returned by MapSystemToTenantResponse.ValidateAll() if the -// designated constraints aren't met. -type MapSystemToTenantResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m MapSystemToTenantResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m MapSystemToTenantResponseMultiError) AllErrors() []error { return m } - -// MapSystemToTenantResponseValidationError is the validation error returned by -// MapSystemToTenantResponse.Validate if the designated constraints aren't met. -type MapSystemToTenantResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MapSystemToTenantResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MapSystemToTenantResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MapSystemToTenantResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MapSystemToTenantResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MapSystemToTenantResponseValidationError) ErrorName() string { - return "MapSystemToTenantResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e MapSystemToTenantResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMapSystemToTenantResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MapSystemToTenantResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MapSystemToTenantResponseValidationError{} - -// Validate checks the field values on GetRequest with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *GetRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetRequest with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in GetRequestMultiError, or -// nil if none found. -func (m *GetRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *GetRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ExternalId - - // no validation rules for Type - - if len(errors) > 0 { - return GetRequestMultiError(errors) - } - - return nil -} - -// GetRequestMultiError is an error wrapping multiple validation errors -// returned by GetRequest.ValidateAll() if the designated constraints aren't met. -type GetRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetRequestMultiError) AllErrors() []error { return m } - -// GetRequestValidationError is the validation error returned by -// GetRequest.Validate if the designated constraints aren't met. -type GetRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetRequestValidationError) ErrorName() string { return "GetRequestValidationError" } - -// Error satisfies the builtin error interface -func (e GetRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetRequestValidationError{} - -// Validate checks the field values on GetResponse with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *GetResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetResponse with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in GetResponseMultiError, or -// nil if none found. -func (m *GetResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *GetResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for TenantId - - if len(errors) > 0 { - return GetResponseMultiError(errors) - } - - return nil -} - -// GetResponseMultiError is an error wrapping multiple validation errors -// returned by GetResponse.ValidateAll() if the designated constraints aren't met. -type GetResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetResponseMultiError) AllErrors() []error { return m } - -// GetResponseValidationError is the validation error returned by -// GetResponse.Validate if the designated constraints aren't met. -type GetResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetResponseValidationError) ErrorName() string { return "GetResponseValidationError" } - -// Error satisfies the builtin error interface -func (e GetResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetResponseValidationError{} diff --git a/proto/kms/api/cmk/registry/mapping/v1/mapping.proto b/proto/kms/api/cmk/registry/mapping/v1/mapping.proto index 0871fdd..7083409 100644 --- a/proto/kms/api/cmk/registry/mapping/v1/mapping.proto +++ b/proto/kms/api/cmk/registry/mapping/v1/mapping.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package kms.api.cmk.registry.mapping.v1; +option go_package = "github.com/openkcm/api-sdk/proto/kms/api/cmk/registry/mapping/v1;mappingv1"; + service Service { rpc UnmapSystemFromTenant(UnmapSystemFromTenantRequest) returns (UnmapSystemFromTenantResponse) {} rpc MapSystemToTenant(MapSystemToTenantRequest) returns (MapSystemToTenantResponse) {} diff --git a/proto/kms/api/cmk/registry/mapping/v1/mapping_grpc.pb.go b/proto/kms/api/cmk/registry/mapping/v1/mapping_grpc.pb.go index fedde79..bfd50ac 100644 --- a/proto/kms/api/cmk/registry/mapping/v1/mapping_grpc.pb.go +++ b/proto/kms/api/cmk/registry/mapping/v1/mapping_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.6.1 -// - protoc (unknown) +// - protoc v7.34.1 // source: kms/api/cmk/registry/mapping/v1/mapping.proto package mappingv1 diff --git a/proto/kms/api/cmk/registry/system/v1/system.pb.go b/proto/kms/api/cmk/registry/system/v1/system.pb.go index 1c32e09..243d215 100644 --- a/proto/kms/api/cmk/registry/system/v1/system.pb.go +++ b/proto/kms/api/cmk/registry/system/v1/system.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc (unknown) +// protoc v7.34.1 // source: kms/api/cmk/registry/system/v1/system.proto package systemv1 @@ -1084,8 +1084,7 @@ const file_kms_api_cmk_registry_system_v1_system_proto_rawDesc = "" + "\x16UpdateSystemL1KeyClaim\x12=.kms.api.cmk.registry.system.v1.UpdateSystemL1KeyClaimRequest\x1a>.kms.api.cmk.registry.system.v1.UpdateSystemL1KeyClaimResponse\"\x00\x12\x8d\x01\n" + "\x12UpdateSystemStatus\x129.kms.api.cmk.registry.system.v1.UpdateSystemStatusRequest\x1a:.kms.api.cmk.registry.system.v1.UpdateSystemStatusResponse\"\x00\x12\x84\x01\n" + "\x0fSetSystemLabels\x126.kms.api.cmk.registry.system.v1.SetSystemLabelsRequest\x1a7.kms.api.cmk.registry.system.v1.SetSystemLabelsResponse\"\x00\x12\x8d\x01\n" + - "\x12RemoveSystemLabels\x129.kms.api.cmk.registry.system.v1.RemoveSystemLabelsRequest\x1a:.kms.api.cmk.registry.system.v1.RemoveSystemLabelsResponse\"\x00B\x9a\x02\n" + - "\"com.kms.api.cmk.registry.system.v1B\vSystemProtoP\x01ZHgithub.com/openkcm/api-sdk/proto/kms/api/cmk/registry/system/v1;systemv1\xa2\x02\x05KACRS\xaa\x02\x1eKms.Api.Cmk.Registry.System.V1\xca\x02\x1eKms\\Api\\Cmk\\Registry\\System\\V1\xe2\x02*Kms\\Api\\Cmk\\Registry\\System\\V1\\GPBMetadata\xea\x02#Kms::Api::Cmk::Registry::System::V1b\x06proto3" + "\x12RemoveSystemLabels\x129.kms.api.cmk.registry.system.v1.RemoveSystemLabelsRequest\x1a:.kms.api.cmk.registry.system.v1.RemoveSystemLabelsResponse\"\x00BJZHgithub.com/openkcm/api-sdk/proto/kms/api/cmk/registry/system/v1;systemv1b\x06proto3" var ( file_kms_api_cmk_registry_system_v1_system_proto_rawDescOnce sync.Once diff --git a/proto/kms/api/cmk/registry/system/v1/system.pb.validate.go b/proto/kms/api/cmk/registry/system/v1/system.pb.validate.go deleted file mode 100644 index 2073c58..0000000 --- a/proto/kms/api/cmk/registry/system/v1/system.pb.validate.go +++ /dev/null @@ -1,1702 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: kms/api/cmk/registry/system/v1/system.proto - -package systemv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" - - typesv1 "github.com/openkcm/api-sdk/proto/kms/api/cmk/types/v1" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort - - _ = typesv1.Status(0) -) - -// Validate checks the field values on System with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *System) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on System with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in SystemMultiError, or nil if none found. -func (m *System) ValidateAll() error { - return m.validate(true) -} - -func (m *System) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ExternalId - - // no validation rules for TenantId - - // no validation rules for L2KeyId - - // no validation rules for HasL1KeyClaim - - // no validation rules for Region - - // no validation rules for Type - - // no validation rules for Status - - // no validation rules for UpdatedAt - - // no validation rules for CreatedAt - - // no validation rules for Labels - - if len(errors) > 0 { - return SystemMultiError(errors) - } - - return nil -} - -// SystemMultiError is an error wrapping multiple validation errors returned by -// System.ValidateAll() if the designated constraints aren't met. -type SystemMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SystemMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SystemMultiError) AllErrors() []error { return m } - -// SystemValidationError is the validation error returned by System.Validate if -// the designated constraints aren't met. -type SystemValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SystemValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SystemValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SystemValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SystemValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SystemValidationError) ErrorName() string { return "SystemValidationError" } - -// Error satisfies the builtin error interface -func (e SystemValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSystem.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SystemValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SystemValidationError{} - -// Validate checks the field values on RegisterSystemRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RegisterSystemRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RegisterSystemRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RegisterSystemRequestMultiError, or nil if none found. -func (m *RegisterSystemRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *RegisterSystemRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ExternalId - - // no validation rules for TenantId - - // no validation rules for L2KeyId - - // no validation rules for HasL1KeyClaim - - // no validation rules for Region - - // no validation rules for Status - - // no validation rules for Type - - // no validation rules for Labels - - if len(errors) > 0 { - return RegisterSystemRequestMultiError(errors) - } - - return nil -} - -// RegisterSystemRequestMultiError is an error wrapping multiple validation -// errors returned by RegisterSystemRequest.ValidateAll() if the designated -// constraints aren't met. -type RegisterSystemRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RegisterSystemRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RegisterSystemRequestMultiError) AllErrors() []error { return m } - -// RegisterSystemRequestValidationError is the validation error returned by -// RegisterSystemRequest.Validate if the designated constraints aren't met. -type RegisterSystemRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RegisterSystemRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RegisterSystemRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RegisterSystemRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RegisterSystemRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RegisterSystemRequestValidationError) ErrorName() string { - return "RegisterSystemRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e RegisterSystemRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRegisterSystemRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RegisterSystemRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RegisterSystemRequestValidationError{} - -// Validate checks the field values on RegisterSystemResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RegisterSystemResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RegisterSystemResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RegisterSystemResponseMultiError, or nil if none found. -func (m *RegisterSystemResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *RegisterSystemResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Success - - if len(errors) > 0 { - return RegisterSystemResponseMultiError(errors) - } - - return nil -} - -// RegisterSystemResponseMultiError is an error wrapping multiple validation -// errors returned by RegisterSystemResponse.ValidateAll() if the designated -// constraints aren't met. -type RegisterSystemResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RegisterSystemResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RegisterSystemResponseMultiError) AllErrors() []error { return m } - -// RegisterSystemResponseValidationError is the validation error returned by -// RegisterSystemResponse.Validate if the designated constraints aren't met. -type RegisterSystemResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RegisterSystemResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RegisterSystemResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RegisterSystemResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RegisterSystemResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RegisterSystemResponseValidationError) ErrorName() string { - return "RegisterSystemResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e RegisterSystemResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRegisterSystemResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RegisterSystemResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RegisterSystemResponseValidationError{} - -// Validate checks the field values on ListSystemsRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ListSystemsRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ListSystemsRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ListSystemsRequestMultiError, or nil if none found. -func (m *ListSystemsRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *ListSystemsRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ExternalId - - // no validation rules for Region - - // no validation rules for TenantId - - // no validation rules for Type - - // no validation rules for Limit - - // no validation rules for PageToken - - if len(errors) > 0 { - return ListSystemsRequestMultiError(errors) - } - - return nil -} - -// ListSystemsRequestMultiError is an error wrapping multiple validation errors -// returned by ListSystemsRequest.ValidateAll() if the designated constraints -// aren't met. -type ListSystemsRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ListSystemsRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ListSystemsRequestMultiError) AllErrors() []error { return m } - -// ListSystemsRequestValidationError is the validation error returned by -// ListSystemsRequest.Validate if the designated constraints aren't met. -type ListSystemsRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ListSystemsRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ListSystemsRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ListSystemsRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ListSystemsRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ListSystemsRequestValidationError) ErrorName() string { - return "ListSystemsRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e ListSystemsRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sListSystemsRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ListSystemsRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ListSystemsRequestValidationError{} - -// Validate checks the field values on ListSystemsResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ListSystemsResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ListSystemsResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ListSystemsResponseMultiError, or nil if none found. -func (m *ListSystemsResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *ListSystemsResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetSystems() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ListSystemsResponseValidationError{ - field: fmt.Sprintf("Systems[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ListSystemsResponseValidationError{ - field: fmt.Sprintf("Systems[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ListSystemsResponseValidationError{ - field: fmt.Sprintf("Systems[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - // no validation rules for NextPageToken - - if len(errors) > 0 { - return ListSystemsResponseMultiError(errors) - } - - return nil -} - -// ListSystemsResponseMultiError is an error wrapping multiple validation -// errors returned by ListSystemsResponse.ValidateAll() if the designated -// constraints aren't met. -type ListSystemsResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ListSystemsResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ListSystemsResponseMultiError) AllErrors() []error { return m } - -// ListSystemsResponseValidationError is the validation error returned by -// ListSystemsResponse.Validate if the designated constraints aren't met. -type ListSystemsResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ListSystemsResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ListSystemsResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ListSystemsResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ListSystemsResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ListSystemsResponseValidationError) ErrorName() string { - return "ListSystemsResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e ListSystemsResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sListSystemsResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ListSystemsResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ListSystemsResponseValidationError{} - -// Validate checks the field values on DeleteSystemRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *DeleteSystemRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DeleteSystemRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DeleteSystemRequestMultiError, or nil if none found. -func (m *DeleteSystemRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *DeleteSystemRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ExternalId - - // no validation rules for Region - - // no validation rules for Type - - if len(errors) > 0 { - return DeleteSystemRequestMultiError(errors) - } - - return nil -} - -// DeleteSystemRequestMultiError is an error wrapping multiple validation -// errors returned by DeleteSystemRequest.ValidateAll() if the designated -// constraints aren't met. -type DeleteSystemRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DeleteSystemRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DeleteSystemRequestMultiError) AllErrors() []error { return m } - -// DeleteSystemRequestValidationError is the validation error returned by -// DeleteSystemRequest.Validate if the designated constraints aren't met. -type DeleteSystemRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DeleteSystemRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DeleteSystemRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DeleteSystemRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DeleteSystemRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DeleteSystemRequestValidationError) ErrorName() string { - return "DeleteSystemRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e DeleteSystemRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDeleteSystemRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DeleteSystemRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DeleteSystemRequestValidationError{} - -// Validate checks the field values on DeleteSystemResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *DeleteSystemResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DeleteSystemResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DeleteSystemResponseMultiError, or nil if none found. -func (m *DeleteSystemResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *DeleteSystemResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Success - - if len(errors) > 0 { - return DeleteSystemResponseMultiError(errors) - } - - return nil -} - -// DeleteSystemResponseMultiError is an error wrapping multiple validation -// errors returned by DeleteSystemResponse.ValidateAll() if the designated -// constraints aren't met. -type DeleteSystemResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DeleteSystemResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DeleteSystemResponseMultiError) AllErrors() []error { return m } - -// DeleteSystemResponseValidationError is the validation error returned by -// DeleteSystemResponse.Validate if the designated constraints aren't met. -type DeleteSystemResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DeleteSystemResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DeleteSystemResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DeleteSystemResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DeleteSystemResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DeleteSystemResponseValidationError) ErrorName() string { - return "DeleteSystemResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e DeleteSystemResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDeleteSystemResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DeleteSystemResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DeleteSystemResponseValidationError{} - -// Validate checks the field values on UpdateSystemL1KeyClaimRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *UpdateSystemL1KeyClaimRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UpdateSystemL1KeyClaimRequest with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// UpdateSystemL1KeyClaimRequestMultiError, or nil if none found. -func (m *UpdateSystemL1KeyClaimRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *UpdateSystemL1KeyClaimRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ExternalId - - // no validation rules for Region - - // no validation rules for TenantId - - // no validation rules for L1KeyClaim - - // no validation rules for Type - - if len(errors) > 0 { - return UpdateSystemL1KeyClaimRequestMultiError(errors) - } - - return nil -} - -// UpdateSystemL1KeyClaimRequestMultiError is an error wrapping multiple -// validation errors returned by UpdateSystemL1KeyClaimRequest.ValidateAll() -// if the designated constraints aren't met. -type UpdateSystemL1KeyClaimRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UpdateSystemL1KeyClaimRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m UpdateSystemL1KeyClaimRequestMultiError) AllErrors() []error { return m } - -// UpdateSystemL1KeyClaimRequestValidationError is the validation error -// returned by UpdateSystemL1KeyClaimRequest.Validate if the designated -// constraints aren't met. -type UpdateSystemL1KeyClaimRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UpdateSystemL1KeyClaimRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UpdateSystemL1KeyClaimRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UpdateSystemL1KeyClaimRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UpdateSystemL1KeyClaimRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UpdateSystemL1KeyClaimRequestValidationError) ErrorName() string { - return "UpdateSystemL1KeyClaimRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e UpdateSystemL1KeyClaimRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sUpdateSystemL1KeyClaimRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UpdateSystemL1KeyClaimRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UpdateSystemL1KeyClaimRequestValidationError{} - -// Validate checks the field values on UpdateSystemL1KeyClaimResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *UpdateSystemL1KeyClaimResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UpdateSystemL1KeyClaimResponse with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// UpdateSystemL1KeyClaimResponseMultiError, or nil if none found. -func (m *UpdateSystemL1KeyClaimResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *UpdateSystemL1KeyClaimResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Success - - if len(errors) > 0 { - return UpdateSystemL1KeyClaimResponseMultiError(errors) - } - - return nil -} - -// UpdateSystemL1KeyClaimResponseMultiError is an error wrapping multiple -// validation errors returned by UpdateSystemL1KeyClaimResponse.ValidateAll() -// if the designated constraints aren't met. -type UpdateSystemL1KeyClaimResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UpdateSystemL1KeyClaimResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m UpdateSystemL1KeyClaimResponseMultiError) AllErrors() []error { return m } - -// UpdateSystemL1KeyClaimResponseValidationError is the validation error -// returned by UpdateSystemL1KeyClaimResponse.Validate if the designated -// constraints aren't met. -type UpdateSystemL1KeyClaimResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UpdateSystemL1KeyClaimResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UpdateSystemL1KeyClaimResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UpdateSystemL1KeyClaimResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UpdateSystemL1KeyClaimResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UpdateSystemL1KeyClaimResponseValidationError) ErrorName() string { - return "UpdateSystemL1KeyClaimResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e UpdateSystemL1KeyClaimResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sUpdateSystemL1KeyClaimResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UpdateSystemL1KeyClaimResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UpdateSystemL1KeyClaimResponseValidationError{} - -// Validate checks the field values on UpdateSystemStatusRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *UpdateSystemStatusRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UpdateSystemStatusRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// UpdateSystemStatusRequestMultiError, or nil if none found. -func (m *UpdateSystemStatusRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *UpdateSystemStatusRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ExternalId - - // no validation rules for Region - - // no validation rules for Status - - // no validation rules for Type - - if len(errors) > 0 { - return UpdateSystemStatusRequestMultiError(errors) - } - - return nil -} - -// UpdateSystemStatusRequestMultiError is an error wrapping multiple validation -// errors returned by UpdateSystemStatusRequest.ValidateAll() if the -// designated constraints aren't met. -type UpdateSystemStatusRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UpdateSystemStatusRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m UpdateSystemStatusRequestMultiError) AllErrors() []error { return m } - -// UpdateSystemStatusRequestValidationError is the validation error returned by -// UpdateSystemStatusRequest.Validate if the designated constraints aren't met. -type UpdateSystemStatusRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UpdateSystemStatusRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UpdateSystemStatusRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UpdateSystemStatusRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UpdateSystemStatusRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UpdateSystemStatusRequestValidationError) ErrorName() string { - return "UpdateSystemStatusRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e UpdateSystemStatusRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sUpdateSystemStatusRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UpdateSystemStatusRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UpdateSystemStatusRequestValidationError{} - -// Validate checks the field values on UpdateSystemStatusResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *UpdateSystemStatusResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UpdateSystemStatusResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// UpdateSystemStatusResponseMultiError, or nil if none found. -func (m *UpdateSystemStatusResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *UpdateSystemStatusResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Success - - if len(errors) > 0 { - return UpdateSystemStatusResponseMultiError(errors) - } - - return nil -} - -// UpdateSystemStatusResponseMultiError is an error wrapping multiple -// validation errors returned by UpdateSystemStatusResponse.ValidateAll() if -// the designated constraints aren't met. -type UpdateSystemStatusResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UpdateSystemStatusResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m UpdateSystemStatusResponseMultiError) AllErrors() []error { return m } - -// UpdateSystemStatusResponseValidationError is the validation error returned -// by UpdateSystemStatusResponse.Validate if the designated constraints aren't met. -type UpdateSystemStatusResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UpdateSystemStatusResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UpdateSystemStatusResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UpdateSystemStatusResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UpdateSystemStatusResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UpdateSystemStatusResponseValidationError) ErrorName() string { - return "UpdateSystemStatusResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e UpdateSystemStatusResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sUpdateSystemStatusResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UpdateSystemStatusResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UpdateSystemStatusResponseValidationError{} - -// Validate checks the field values on SetSystemLabelsRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *SetSystemLabelsRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SetSystemLabelsRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// SetSystemLabelsRequestMultiError, or nil if none found. -func (m *SetSystemLabelsRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *SetSystemLabelsRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ExternalId - - // no validation rules for Region - - // no validation rules for Labels - - // no validation rules for Type - - if len(errors) > 0 { - return SetSystemLabelsRequestMultiError(errors) - } - - return nil -} - -// SetSystemLabelsRequestMultiError is an error wrapping multiple validation -// errors returned by SetSystemLabelsRequest.ValidateAll() if the designated -// constraints aren't met. -type SetSystemLabelsRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SetSystemLabelsRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SetSystemLabelsRequestMultiError) AllErrors() []error { return m } - -// SetSystemLabelsRequestValidationError is the validation error returned by -// SetSystemLabelsRequest.Validate if the designated constraints aren't met. -type SetSystemLabelsRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SetSystemLabelsRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SetSystemLabelsRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SetSystemLabelsRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SetSystemLabelsRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SetSystemLabelsRequestValidationError) ErrorName() string { - return "SetSystemLabelsRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e SetSystemLabelsRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSetSystemLabelsRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SetSystemLabelsRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SetSystemLabelsRequestValidationError{} - -// Validate checks the field values on SetSystemLabelsResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *SetSystemLabelsResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SetSystemLabelsResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// SetSystemLabelsResponseMultiError, or nil if none found. -func (m *SetSystemLabelsResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *SetSystemLabelsResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Success - - if len(errors) > 0 { - return SetSystemLabelsResponseMultiError(errors) - } - - return nil -} - -// SetSystemLabelsResponseMultiError is an error wrapping multiple validation -// errors returned by SetSystemLabelsResponse.ValidateAll() if the designated -// constraints aren't met. -type SetSystemLabelsResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SetSystemLabelsResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SetSystemLabelsResponseMultiError) AllErrors() []error { return m } - -// SetSystemLabelsResponseValidationError is the validation error returned by -// SetSystemLabelsResponse.Validate if the designated constraints aren't met. -type SetSystemLabelsResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SetSystemLabelsResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SetSystemLabelsResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SetSystemLabelsResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SetSystemLabelsResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SetSystemLabelsResponseValidationError) ErrorName() string { - return "SetSystemLabelsResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e SetSystemLabelsResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSetSystemLabelsResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SetSystemLabelsResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SetSystemLabelsResponseValidationError{} - -// Validate checks the field values on RemoveSystemLabelsRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RemoveSystemLabelsRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RemoveSystemLabelsRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RemoveSystemLabelsRequestMultiError, or nil if none found. -func (m *RemoveSystemLabelsRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *RemoveSystemLabelsRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ExternalId - - // no validation rules for Region - - // no validation rules for Type - - if len(errors) > 0 { - return RemoveSystemLabelsRequestMultiError(errors) - } - - return nil -} - -// RemoveSystemLabelsRequestMultiError is an error wrapping multiple validation -// errors returned by RemoveSystemLabelsRequest.ValidateAll() if the -// designated constraints aren't met. -type RemoveSystemLabelsRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RemoveSystemLabelsRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RemoveSystemLabelsRequestMultiError) AllErrors() []error { return m } - -// RemoveSystemLabelsRequestValidationError is the validation error returned by -// RemoveSystemLabelsRequest.Validate if the designated constraints aren't met. -type RemoveSystemLabelsRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RemoveSystemLabelsRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RemoveSystemLabelsRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RemoveSystemLabelsRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RemoveSystemLabelsRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RemoveSystemLabelsRequestValidationError) ErrorName() string { - return "RemoveSystemLabelsRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e RemoveSystemLabelsRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRemoveSystemLabelsRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RemoveSystemLabelsRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RemoveSystemLabelsRequestValidationError{} - -// Validate checks the field values on RemoveSystemLabelsResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RemoveSystemLabelsResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RemoveSystemLabelsResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RemoveSystemLabelsResponseMultiError, or nil if none found. -func (m *RemoveSystemLabelsResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *RemoveSystemLabelsResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Success - - if len(errors) > 0 { - return RemoveSystemLabelsResponseMultiError(errors) - } - - return nil -} - -// RemoveSystemLabelsResponseMultiError is an error wrapping multiple -// validation errors returned by RemoveSystemLabelsResponse.ValidateAll() if -// the designated constraints aren't met. -type RemoveSystemLabelsResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RemoveSystemLabelsResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RemoveSystemLabelsResponseMultiError) AllErrors() []error { return m } - -// RemoveSystemLabelsResponseValidationError is the validation error returned -// by RemoveSystemLabelsResponse.Validate if the designated constraints aren't met. -type RemoveSystemLabelsResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RemoveSystemLabelsResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RemoveSystemLabelsResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RemoveSystemLabelsResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RemoveSystemLabelsResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RemoveSystemLabelsResponseValidationError) ErrorName() string { - return "RemoveSystemLabelsResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e RemoveSystemLabelsResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRemoveSystemLabelsResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RemoveSystemLabelsResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RemoveSystemLabelsResponseValidationError{} diff --git a/proto/kms/api/cmk/registry/system/v1/system.proto b/proto/kms/api/cmk/registry/system/v1/system.proto index 5d9f453..4ed3760 100644 --- a/proto/kms/api/cmk/registry/system/v1/system.proto +++ b/proto/kms/api/cmk/registry/system/v1/system.proto @@ -4,6 +4,8 @@ package kms.api.cmk.registry.system.v1; import "kms/api/cmk/types/v1/status.proto"; +option go_package = "github.com/openkcm/api-sdk/proto/kms/api/cmk/registry/system/v1;systemv1"; + service Service { rpc RegisterSystem(RegisterSystemRequest) returns (RegisterSystemResponse) {} rpc ListSystems(ListSystemsRequest) returns (ListSystemsResponse) {} diff --git a/proto/kms/api/cmk/registry/system/v1/system_grpc.pb.go b/proto/kms/api/cmk/registry/system/v1/system_grpc.pb.go index 234f998..6eb6195 100644 --- a/proto/kms/api/cmk/registry/system/v1/system_grpc.pb.go +++ b/proto/kms/api/cmk/registry/system/v1/system_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.6.1 -// - protoc (unknown) +// - protoc v7.34.1 // source: kms/api/cmk/registry/system/v1/system.proto package systemv1 diff --git a/proto/kms/api/cmk/registry/tenant/v1/tenant.pb.go b/proto/kms/api/cmk/registry/tenant/v1/tenant.pb.go index 71f0bae..a99181b 100644 --- a/proto/kms/api/cmk/registry/tenant/v1/tenant.pb.go +++ b/proto/kms/api/cmk/registry/tenant/v1/tenant.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc (unknown) +// protoc v7.34.1 // source: kms/api/cmk/registry/tenant/v1/tenant.proto package tenantv1 @@ -1402,8 +1402,7 @@ const file_kms_api_cmk_registry_tenant_v1_tenant_proto_rawDesc = "" + "\x0fTerminateTenant\x126.kms.api.cmk.registry.tenant.v1.TerminateTenantRequest\x1a7.kms.api.cmk.registry.tenant.v1.TerminateTenantResponse\"\x00\x12\x84\x01\n" + "\x0fSetTenantLabels\x126.kms.api.cmk.registry.tenant.v1.SetTenantLabelsRequest\x1a7.kms.api.cmk.registry.tenant.v1.SetTenantLabelsResponse\"\x00\x12\x8d\x01\n" + "\x12RemoveTenantLabels\x129.kms.api.cmk.registry.tenant.v1.RemoveTenantLabelsRequest\x1a:.kms.api.cmk.registry.tenant.v1.RemoveTenantLabelsResponse\"\x00\x12\x90\x01\n" + - "\x13SetTenantUserGroups\x12:.kms.api.cmk.registry.tenant.v1.SetTenantUserGroupsRequest\x1a;.kms.api.cmk.registry.tenant.v1.SetTenantUserGroupsResponse\"\x00B\x9a\x02\n" + - "\"com.kms.api.cmk.registry.tenant.v1B\vTenantProtoP\x01ZHgithub.com/openkcm/api-sdk/proto/kms/api/cmk/registry/tenant/v1;tenantv1\xa2\x02\x05KACRT\xaa\x02\x1eKms.Api.Cmk.Registry.Tenant.V1\xca\x02\x1eKms\\Api\\Cmk\\Registry\\Tenant\\V1\xe2\x02*Kms\\Api\\Cmk\\Registry\\Tenant\\V1\\GPBMetadata\xea\x02#Kms::Api::Cmk::Registry::Tenant::V1b\x06proto3" + "\x13SetTenantUserGroups\x12:.kms.api.cmk.registry.tenant.v1.SetTenantUserGroupsRequest\x1a;.kms.api.cmk.registry.tenant.v1.SetTenantUserGroupsResponse\"\x00BJZHgithub.com/openkcm/api-sdk/proto/kms/api/cmk/registry/tenant/v1;tenantv1b\x06proto3" var ( file_kms_api_cmk_registry_tenant_v1_tenant_proto_rawDescOnce sync.Once diff --git a/proto/kms/api/cmk/registry/tenant/v1/tenant.pb.validate.go b/proto/kms/api/cmk/registry/tenant/v1/tenant.pb.validate.go deleted file mode 100644 index d7ed067..0000000 --- a/proto/kms/api/cmk/registry/tenant/v1/tenant.pb.validate.go +++ /dev/null @@ -1,2116 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: kms/api/cmk/registry/tenant/v1/tenant.proto - -package tenantv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on Tenant with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Tenant) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Tenant with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in TenantMultiError, or nil if none found. -func (m *Tenant) ValidateAll() error { - return m.validate(true) -} - -func (m *Tenant) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Id - - // no validation rules for Name - - // no validation rules for Region - - // no validation rules for OwnerId - - // no validation rules for OwnerType - - // no validation rules for Status - - // no validation rules for StatusUpdatedAt - - // no validation rules for Role - - // no validation rules for UpdatedAt - - // no validation rules for CreatedAt - - // no validation rules for Labels - - if len(errors) > 0 { - return TenantMultiError(errors) - } - - return nil -} - -// TenantMultiError is an error wrapping multiple validation errors returned by -// Tenant.ValidateAll() if the designated constraints aren't met. -type TenantMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TenantMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TenantMultiError) AllErrors() []error { return m } - -// TenantValidationError is the validation error returned by Tenant.Validate if -// the designated constraints aren't met. -type TenantValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TenantValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TenantValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TenantValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TenantValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TenantValidationError) ErrorName() string { return "TenantValidationError" } - -// Error satisfies the builtin error interface -func (e TenantValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTenant.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TenantValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TenantValidationError{} - -// Validate checks the field values on RegisterTenantRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RegisterTenantRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RegisterTenantRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RegisterTenantRequestMultiError, or nil if none found. -func (m *RegisterTenantRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *RegisterTenantRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Name - - // no validation rules for Id - - // no validation rules for Region - - // no validation rules for OwnerId - - // no validation rules for OwnerType - - // no validation rules for Role - - // no validation rules for Labels - - if len(errors) > 0 { - return RegisterTenantRequestMultiError(errors) - } - - return nil -} - -// RegisterTenantRequestMultiError is an error wrapping multiple validation -// errors returned by RegisterTenantRequest.ValidateAll() if the designated -// constraints aren't met. -type RegisterTenantRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RegisterTenantRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RegisterTenantRequestMultiError) AllErrors() []error { return m } - -// RegisterTenantRequestValidationError is the validation error returned by -// RegisterTenantRequest.Validate if the designated constraints aren't met. -type RegisterTenantRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RegisterTenantRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RegisterTenantRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RegisterTenantRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RegisterTenantRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RegisterTenantRequestValidationError) ErrorName() string { - return "RegisterTenantRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e RegisterTenantRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRegisterTenantRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RegisterTenantRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RegisterTenantRequestValidationError{} - -// Validate checks the field values on RegisterTenantResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RegisterTenantResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RegisterTenantResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RegisterTenantResponseMultiError, or nil if none found. -func (m *RegisterTenantResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *RegisterTenantResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Id - - if len(errors) > 0 { - return RegisterTenantResponseMultiError(errors) - } - - return nil -} - -// RegisterTenantResponseMultiError is an error wrapping multiple validation -// errors returned by RegisterTenantResponse.ValidateAll() if the designated -// constraints aren't met. -type RegisterTenantResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RegisterTenantResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RegisterTenantResponseMultiError) AllErrors() []error { return m } - -// RegisterTenantResponseValidationError is the validation error returned by -// RegisterTenantResponse.Validate if the designated constraints aren't met. -type RegisterTenantResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RegisterTenantResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RegisterTenantResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RegisterTenantResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RegisterTenantResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RegisterTenantResponseValidationError) ErrorName() string { - return "RegisterTenantResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e RegisterTenantResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRegisterTenantResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RegisterTenantResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RegisterTenantResponseValidationError{} - -// Validate checks the field values on ListTenantsRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ListTenantsRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ListTenantsRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ListTenantsRequestMultiError, or nil if none found. -func (m *ListTenantsRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *ListTenantsRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Id - - // no validation rules for Name - - // no validation rules for Region - - // no validation rules for OwnerId - - // no validation rules for OwnerType - - // no validation rules for Limit - - // no validation rules for PageToken - - // no validation rules for Labels - - if len(errors) > 0 { - return ListTenantsRequestMultiError(errors) - } - - return nil -} - -// ListTenantsRequestMultiError is an error wrapping multiple validation errors -// returned by ListTenantsRequest.ValidateAll() if the designated constraints -// aren't met. -type ListTenantsRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ListTenantsRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ListTenantsRequestMultiError) AllErrors() []error { return m } - -// ListTenantsRequestValidationError is the validation error returned by -// ListTenantsRequest.Validate if the designated constraints aren't met. -type ListTenantsRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ListTenantsRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ListTenantsRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ListTenantsRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ListTenantsRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ListTenantsRequestValidationError) ErrorName() string { - return "ListTenantsRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e ListTenantsRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sListTenantsRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ListTenantsRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ListTenantsRequestValidationError{} - -// Validate checks the field values on ListTenantsResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ListTenantsResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ListTenantsResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ListTenantsResponseMultiError, or nil if none found. -func (m *ListTenantsResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *ListTenantsResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetTenants() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ListTenantsResponseValidationError{ - field: fmt.Sprintf("Tenants[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ListTenantsResponseValidationError{ - field: fmt.Sprintf("Tenants[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ListTenantsResponseValidationError{ - field: fmt.Sprintf("Tenants[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - // no validation rules for NextPageToken - - if len(errors) > 0 { - return ListTenantsResponseMultiError(errors) - } - - return nil -} - -// ListTenantsResponseMultiError is an error wrapping multiple validation -// errors returned by ListTenantsResponse.ValidateAll() if the designated -// constraints aren't met. -type ListTenantsResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ListTenantsResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ListTenantsResponseMultiError) AllErrors() []error { return m } - -// ListTenantsResponseValidationError is the validation error returned by -// ListTenantsResponse.Validate if the designated constraints aren't met. -type ListTenantsResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ListTenantsResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ListTenantsResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ListTenantsResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ListTenantsResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ListTenantsResponseValidationError) ErrorName() string { - return "ListTenantsResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e ListTenantsResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sListTenantsResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ListTenantsResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ListTenantsResponseValidationError{} - -// Validate checks the field values on BlockTenantRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *BlockTenantRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on BlockTenantRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// BlockTenantRequestMultiError, or nil if none found. -func (m *BlockTenantRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *BlockTenantRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Id - - if len(errors) > 0 { - return BlockTenantRequestMultiError(errors) - } - - return nil -} - -// BlockTenantRequestMultiError is an error wrapping multiple validation errors -// returned by BlockTenantRequest.ValidateAll() if the designated constraints -// aren't met. -type BlockTenantRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m BlockTenantRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m BlockTenantRequestMultiError) AllErrors() []error { return m } - -// BlockTenantRequestValidationError is the validation error returned by -// BlockTenantRequest.Validate if the designated constraints aren't met. -type BlockTenantRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e BlockTenantRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e BlockTenantRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e BlockTenantRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e BlockTenantRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e BlockTenantRequestValidationError) ErrorName() string { - return "BlockTenantRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e BlockTenantRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sBlockTenantRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = BlockTenantRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = BlockTenantRequestValidationError{} - -// Validate checks the field values on BlockTenantResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *BlockTenantResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on BlockTenantResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// BlockTenantResponseMultiError, or nil if none found. -func (m *BlockTenantResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *BlockTenantResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Success - - if len(errors) > 0 { - return BlockTenantResponseMultiError(errors) - } - - return nil -} - -// BlockTenantResponseMultiError is an error wrapping multiple validation -// errors returned by BlockTenantResponse.ValidateAll() if the designated -// constraints aren't met. -type BlockTenantResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m BlockTenantResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m BlockTenantResponseMultiError) AllErrors() []error { return m } - -// BlockTenantResponseValidationError is the validation error returned by -// BlockTenantResponse.Validate if the designated constraints aren't met. -type BlockTenantResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e BlockTenantResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e BlockTenantResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e BlockTenantResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e BlockTenantResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e BlockTenantResponseValidationError) ErrorName() string { - return "BlockTenantResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e BlockTenantResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sBlockTenantResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = BlockTenantResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = BlockTenantResponseValidationError{} - -// Validate checks the field values on UnblockTenantRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *UnblockTenantRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UnblockTenantRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// UnblockTenantRequestMultiError, or nil if none found. -func (m *UnblockTenantRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *UnblockTenantRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Id - - if len(errors) > 0 { - return UnblockTenantRequestMultiError(errors) - } - - return nil -} - -// UnblockTenantRequestMultiError is an error wrapping multiple validation -// errors returned by UnblockTenantRequest.ValidateAll() if the designated -// constraints aren't met. -type UnblockTenantRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UnblockTenantRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m UnblockTenantRequestMultiError) AllErrors() []error { return m } - -// UnblockTenantRequestValidationError is the validation error returned by -// UnblockTenantRequest.Validate if the designated constraints aren't met. -type UnblockTenantRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UnblockTenantRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UnblockTenantRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UnblockTenantRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UnblockTenantRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UnblockTenantRequestValidationError) ErrorName() string { - return "UnblockTenantRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e UnblockTenantRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sUnblockTenantRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UnblockTenantRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UnblockTenantRequestValidationError{} - -// Validate checks the field values on UnblockTenantResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *UnblockTenantResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UnblockTenantResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// UnblockTenantResponseMultiError, or nil if none found. -func (m *UnblockTenantResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *UnblockTenantResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Success - - if len(errors) > 0 { - return UnblockTenantResponseMultiError(errors) - } - - return nil -} - -// UnblockTenantResponseMultiError is an error wrapping multiple validation -// errors returned by UnblockTenantResponse.ValidateAll() if the designated -// constraints aren't met. -type UnblockTenantResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UnblockTenantResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m UnblockTenantResponseMultiError) AllErrors() []error { return m } - -// UnblockTenantResponseValidationError is the validation error returned by -// UnblockTenantResponse.Validate if the designated constraints aren't met. -type UnblockTenantResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UnblockTenantResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UnblockTenantResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UnblockTenantResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UnblockTenantResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UnblockTenantResponseValidationError) ErrorName() string { - return "UnblockTenantResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e UnblockTenantResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sUnblockTenantResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UnblockTenantResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UnblockTenantResponseValidationError{} - -// Validate checks the field values on TerminateTenantRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *TerminateTenantRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on TerminateTenantRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// TerminateTenantRequestMultiError, or nil if none found. -func (m *TerminateTenantRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *TerminateTenantRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Id - - if len(errors) > 0 { - return TerminateTenantRequestMultiError(errors) - } - - return nil -} - -// TerminateTenantRequestMultiError is an error wrapping multiple validation -// errors returned by TerminateTenantRequest.ValidateAll() if the designated -// constraints aren't met. -type TerminateTenantRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TerminateTenantRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TerminateTenantRequestMultiError) AllErrors() []error { return m } - -// TerminateTenantRequestValidationError is the validation error returned by -// TerminateTenantRequest.Validate if the designated constraints aren't met. -type TerminateTenantRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TerminateTenantRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TerminateTenantRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TerminateTenantRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TerminateTenantRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TerminateTenantRequestValidationError) ErrorName() string { - return "TerminateTenantRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e TerminateTenantRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTerminateTenantRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TerminateTenantRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TerminateTenantRequestValidationError{} - -// Validate checks the field values on TerminateTenantResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *TerminateTenantResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on TerminateTenantResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// TerminateTenantResponseMultiError, or nil if none found. -func (m *TerminateTenantResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *TerminateTenantResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Success - - if len(errors) > 0 { - return TerminateTenantResponseMultiError(errors) - } - - return nil -} - -// TerminateTenantResponseMultiError is an error wrapping multiple validation -// errors returned by TerminateTenantResponse.ValidateAll() if the designated -// constraints aren't met. -type TerminateTenantResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TerminateTenantResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TerminateTenantResponseMultiError) AllErrors() []error { return m } - -// TerminateTenantResponseValidationError is the validation error returned by -// TerminateTenantResponse.Validate if the designated constraints aren't met. -type TerminateTenantResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TerminateTenantResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TerminateTenantResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TerminateTenantResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TerminateTenantResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TerminateTenantResponseValidationError) ErrorName() string { - return "TerminateTenantResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e TerminateTenantResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTerminateTenantResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TerminateTenantResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TerminateTenantResponseValidationError{} - -// Validate checks the field values on SetTenantLabelsRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *SetTenantLabelsRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SetTenantLabelsRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// SetTenantLabelsRequestMultiError, or nil if none found. -func (m *SetTenantLabelsRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *SetTenantLabelsRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Id - - // no validation rules for Labels - - if len(errors) > 0 { - return SetTenantLabelsRequestMultiError(errors) - } - - return nil -} - -// SetTenantLabelsRequestMultiError is an error wrapping multiple validation -// errors returned by SetTenantLabelsRequest.ValidateAll() if the designated -// constraints aren't met. -type SetTenantLabelsRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SetTenantLabelsRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SetTenantLabelsRequestMultiError) AllErrors() []error { return m } - -// SetTenantLabelsRequestValidationError is the validation error returned by -// SetTenantLabelsRequest.Validate if the designated constraints aren't met. -type SetTenantLabelsRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SetTenantLabelsRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SetTenantLabelsRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SetTenantLabelsRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SetTenantLabelsRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SetTenantLabelsRequestValidationError) ErrorName() string { - return "SetTenantLabelsRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e SetTenantLabelsRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSetTenantLabelsRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SetTenantLabelsRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SetTenantLabelsRequestValidationError{} - -// Validate checks the field values on SetTenantLabelsResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *SetTenantLabelsResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SetTenantLabelsResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// SetTenantLabelsResponseMultiError, or nil if none found. -func (m *SetTenantLabelsResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *SetTenantLabelsResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Success - - if len(errors) > 0 { - return SetTenantLabelsResponseMultiError(errors) - } - - return nil -} - -// SetTenantLabelsResponseMultiError is an error wrapping multiple validation -// errors returned by SetTenantLabelsResponse.ValidateAll() if the designated -// constraints aren't met. -type SetTenantLabelsResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SetTenantLabelsResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SetTenantLabelsResponseMultiError) AllErrors() []error { return m } - -// SetTenantLabelsResponseValidationError is the validation error returned by -// SetTenantLabelsResponse.Validate if the designated constraints aren't met. -type SetTenantLabelsResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SetTenantLabelsResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SetTenantLabelsResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SetTenantLabelsResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SetTenantLabelsResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SetTenantLabelsResponseValidationError) ErrorName() string { - return "SetTenantLabelsResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e SetTenantLabelsResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSetTenantLabelsResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SetTenantLabelsResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SetTenantLabelsResponseValidationError{} - -// Validate checks the field values on RemoveTenantLabelsRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RemoveTenantLabelsRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RemoveTenantLabelsRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RemoveTenantLabelsRequestMultiError, or nil if none found. -func (m *RemoveTenantLabelsRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *RemoveTenantLabelsRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Id - - if len(errors) > 0 { - return RemoveTenantLabelsRequestMultiError(errors) - } - - return nil -} - -// RemoveTenantLabelsRequestMultiError is an error wrapping multiple validation -// errors returned by RemoveTenantLabelsRequest.ValidateAll() if the -// designated constraints aren't met. -type RemoveTenantLabelsRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RemoveTenantLabelsRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RemoveTenantLabelsRequestMultiError) AllErrors() []error { return m } - -// RemoveTenantLabelsRequestValidationError is the validation error returned by -// RemoveTenantLabelsRequest.Validate if the designated constraints aren't met. -type RemoveTenantLabelsRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RemoveTenantLabelsRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RemoveTenantLabelsRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RemoveTenantLabelsRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RemoveTenantLabelsRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RemoveTenantLabelsRequestValidationError) ErrorName() string { - return "RemoveTenantLabelsRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e RemoveTenantLabelsRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRemoveTenantLabelsRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RemoveTenantLabelsRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RemoveTenantLabelsRequestValidationError{} - -// Validate checks the field values on RemoveTenantLabelsResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RemoveTenantLabelsResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RemoveTenantLabelsResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RemoveTenantLabelsResponseMultiError, or nil if none found. -func (m *RemoveTenantLabelsResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *RemoveTenantLabelsResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Success - - if len(errors) > 0 { - return RemoveTenantLabelsResponseMultiError(errors) - } - - return nil -} - -// RemoveTenantLabelsResponseMultiError is an error wrapping multiple -// validation errors returned by RemoveTenantLabelsResponse.ValidateAll() if -// the designated constraints aren't met. -type RemoveTenantLabelsResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RemoveTenantLabelsResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RemoveTenantLabelsResponseMultiError) AllErrors() []error { return m } - -// RemoveTenantLabelsResponseValidationError is the validation error returned -// by RemoveTenantLabelsResponse.Validate if the designated constraints aren't met. -type RemoveTenantLabelsResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RemoveTenantLabelsResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RemoveTenantLabelsResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RemoveTenantLabelsResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RemoveTenantLabelsResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RemoveTenantLabelsResponseValidationError) ErrorName() string { - return "RemoveTenantLabelsResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e RemoveTenantLabelsResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRemoveTenantLabelsResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RemoveTenantLabelsResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RemoveTenantLabelsResponseValidationError{} - -// Validate checks the field values on SetTenantUserGroupsRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *SetTenantUserGroupsRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SetTenantUserGroupsRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// SetTenantUserGroupsRequestMultiError, or nil if none found. -func (m *SetTenantUserGroupsRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *SetTenantUserGroupsRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Id - - if len(errors) > 0 { - return SetTenantUserGroupsRequestMultiError(errors) - } - - return nil -} - -// SetTenantUserGroupsRequestMultiError is an error wrapping multiple -// validation errors returned by SetTenantUserGroupsRequest.ValidateAll() if -// the designated constraints aren't met. -type SetTenantUserGroupsRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SetTenantUserGroupsRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SetTenantUserGroupsRequestMultiError) AllErrors() []error { return m } - -// SetTenantUserGroupsRequestValidationError is the validation error returned -// by SetTenantUserGroupsRequest.Validate if the designated constraints aren't met. -type SetTenantUserGroupsRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SetTenantUserGroupsRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SetTenantUserGroupsRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SetTenantUserGroupsRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SetTenantUserGroupsRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SetTenantUserGroupsRequestValidationError) ErrorName() string { - return "SetTenantUserGroupsRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e SetTenantUserGroupsRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSetTenantUserGroupsRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SetTenantUserGroupsRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SetTenantUserGroupsRequestValidationError{} - -// Validate checks the field values on SetTenantUserGroupsResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *SetTenantUserGroupsResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SetTenantUserGroupsResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// SetTenantUserGroupsResponseMultiError, or nil if none found. -func (m *SetTenantUserGroupsResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *SetTenantUserGroupsResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Success - - if len(errors) > 0 { - return SetTenantUserGroupsResponseMultiError(errors) - } - - return nil -} - -// SetTenantUserGroupsResponseMultiError is an error wrapping multiple -// validation errors returned by SetTenantUserGroupsResponse.ValidateAll() if -// the designated constraints aren't met. -type SetTenantUserGroupsResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SetTenantUserGroupsResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SetTenantUserGroupsResponseMultiError) AllErrors() []error { return m } - -// SetTenantUserGroupsResponseValidationError is the validation error returned -// by SetTenantUserGroupsResponse.Validate if the designated constraints -// aren't met. -type SetTenantUserGroupsResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SetTenantUserGroupsResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SetTenantUserGroupsResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SetTenantUserGroupsResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SetTenantUserGroupsResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SetTenantUserGroupsResponseValidationError) ErrorName() string { - return "SetTenantUserGroupsResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e SetTenantUserGroupsResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSetTenantUserGroupsResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SetTenantUserGroupsResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SetTenantUserGroupsResponseValidationError{} - -// Validate checks the field values on GetTenantRequest with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *GetTenantRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetTenantRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GetTenantRequestMultiError, or nil if none found. -func (m *GetTenantRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *GetTenantRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Id - - if len(errors) > 0 { - return GetTenantRequestMultiError(errors) - } - - return nil -} - -// GetTenantRequestMultiError is an error wrapping multiple validation errors -// returned by GetTenantRequest.ValidateAll() if the designated constraints -// aren't met. -type GetTenantRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetTenantRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetTenantRequestMultiError) AllErrors() []error { return m } - -// GetTenantRequestValidationError is the validation error returned by -// GetTenantRequest.Validate if the designated constraints aren't met. -type GetTenantRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetTenantRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetTenantRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetTenantRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetTenantRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetTenantRequestValidationError) ErrorName() string { return "GetTenantRequestValidationError" } - -// Error satisfies the builtin error interface -func (e GetTenantRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetTenantRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetTenantRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetTenantRequestValidationError{} - -// Validate checks the field values on GetTenantResponse with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *GetTenantResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetTenantResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GetTenantResponseMultiError, or nil if none found. -func (m *GetTenantResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *GetTenantResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetTenant()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetTenantResponseValidationError{ - field: "Tenant", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetTenantResponseValidationError{ - field: "Tenant", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTenant()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetTenantResponseValidationError{ - field: "Tenant", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return GetTenantResponseMultiError(errors) - } - - return nil -} - -// GetTenantResponseMultiError is an error wrapping multiple validation errors -// returned by GetTenantResponse.ValidateAll() if the designated constraints -// aren't met. -type GetTenantResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetTenantResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetTenantResponseMultiError) AllErrors() []error { return m } - -// GetTenantResponseValidationError is the validation error returned by -// GetTenantResponse.Validate if the designated constraints aren't met. -type GetTenantResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetTenantResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetTenantResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetTenantResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetTenantResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetTenantResponseValidationError) ErrorName() string { - return "GetTenantResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e GetTenantResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetTenantResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetTenantResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetTenantResponseValidationError{} diff --git a/proto/kms/api/cmk/registry/tenant/v1/tenant.proto b/proto/kms/api/cmk/registry/tenant/v1/tenant.proto index 5bc359c..6db53c4 100644 --- a/proto/kms/api/cmk/registry/tenant/v1/tenant.proto +++ b/proto/kms/api/cmk/registry/tenant/v1/tenant.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package kms.api.cmk.registry.tenant.v1; +option go_package = "github.com/openkcm/api-sdk/proto/kms/api/cmk/registry/tenant/v1;tenantv1"; + service Service { rpc RegisterTenant(RegisterTenantRequest) returns (RegisterTenantResponse) {} rpc ListTenants(ListTenantsRequest) returns (ListTenantsResponse) {} diff --git a/proto/kms/api/cmk/registry/tenant/v1/tenant_grpc.pb.go b/proto/kms/api/cmk/registry/tenant/v1/tenant_grpc.pb.go index 5a181ab..ad160a6 100644 --- a/proto/kms/api/cmk/registry/tenant/v1/tenant_grpc.pb.go +++ b/proto/kms/api/cmk/registry/tenant/v1/tenant_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.6.1 -// - protoc (unknown) +// - protoc v7.34.1 // source: kms/api/cmk/registry/tenant/v1/tenant.proto package tenantv1 diff --git a/proto/kms/api/cmk/rpc/v1/error_details.pb.go b/proto/kms/api/cmk/rpc/v1/error_details.pb.go index b8ba559..31c4ceb 100644 --- a/proto/kms/api/cmk/rpc/v1/error_details.pb.go +++ b/proto/kms/api/cmk/rpc/v1/error_details.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc (unknown) +// protoc v7.34.1 // source: kms/api/cmk/rpc/v1/error_details.proto package rpcv1 @@ -138,8 +138,7 @@ const file_kms_api_cmk_rpc_v1_error_details_proto_rawDesc = "" + "\tViolation\x12\x12\n" + "\x04type\x18\x01 \x01(\tR\x04type\x12\x18\n" + "\asubject\x18\x02 \x01(\tR\asubject\x12 \n" + - "\vdescription\x18\x03 \x01(\tR\vdescriptionB\xd3\x01\n" + - "\x16com.kms.api.cmk.rpc.v1B\x11ErrorDetailsProtoP\x01Z9github.com/openkcm/api-sdk/proto/kms/api/cmk/rpc/v1;rpcv1\xa2\x02\x04KACR\xaa\x02\x12Kms.Api.Cmk.Rpc.V1\xca\x02\x12Kms\\Api\\Cmk\\Rpc\\V1\xe2\x02\x1eKms\\Api\\Cmk\\Rpc\\V1\\GPBMetadata\xea\x02\x16Kms::Api::Cmk::Rpc::V1b\x06proto3" + "\vdescription\x18\x03 \x01(\tR\vdescriptionB;Z9github.com/openkcm/api-sdk/proto/kms/api/cmk/rpc/v1;rpcv1b\x06proto3" var ( file_kms_api_cmk_rpc_v1_error_details_proto_rawDescOnce sync.Once diff --git a/proto/kms/api/cmk/rpc/v1/error_details.pb.validate.go b/proto/kms/api/cmk/rpc/v1/error_details.pb.validate.go deleted file mode 100644 index 743057a..0000000 --- a/proto/kms/api/cmk/rpc/v1/error_details.pb.validate.go +++ /dev/null @@ -1,281 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: kms/api/cmk/rpc/v1/error_details.proto - -package rpcv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on PreconditionFailure with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *PreconditionFailure) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PreconditionFailure with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// PreconditionFailureMultiError, or nil if none found. -func (m *PreconditionFailure) ValidateAll() error { - return m.validate(true) -} - -func (m *PreconditionFailure) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetViolations() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PreconditionFailureValidationError{ - field: fmt.Sprintf("Violations[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PreconditionFailureValidationError{ - field: fmt.Sprintf("Violations[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return PreconditionFailureValidationError{ - field: fmt.Sprintf("Violations[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return PreconditionFailureMultiError(errors) - } - - return nil -} - -// PreconditionFailureMultiError is an error wrapping multiple validation -// errors returned by PreconditionFailure.ValidateAll() if the designated -// constraints aren't met. -type PreconditionFailureMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PreconditionFailureMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m PreconditionFailureMultiError) AllErrors() []error { return m } - -// PreconditionFailureValidationError is the validation error returned by -// PreconditionFailure.Validate if the designated constraints aren't met. -type PreconditionFailureValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e PreconditionFailureValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e PreconditionFailureValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e PreconditionFailureValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e PreconditionFailureValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e PreconditionFailureValidationError) ErrorName() string { - return "PreconditionFailureValidationError" -} - -// Error satisfies the builtin error interface -func (e PreconditionFailureValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sPreconditionFailure.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = PreconditionFailureValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = PreconditionFailureValidationError{} - -// Validate checks the field values on PreconditionFailure_Violation with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *PreconditionFailure_Violation) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PreconditionFailure_Violation with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// PreconditionFailure_ViolationMultiError, or nil if none found. -func (m *PreconditionFailure_Violation) ValidateAll() error { - return m.validate(true) -} - -func (m *PreconditionFailure_Violation) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Type - - // no validation rules for Subject - - // no validation rules for Description - - if len(errors) > 0 { - return PreconditionFailure_ViolationMultiError(errors) - } - - return nil -} - -// PreconditionFailure_ViolationMultiError is an error wrapping multiple -// validation errors returned by PreconditionFailure_Violation.ValidateAll() -// if the designated constraints aren't met. -type PreconditionFailure_ViolationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PreconditionFailure_ViolationMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m PreconditionFailure_ViolationMultiError) AllErrors() []error { return m } - -// PreconditionFailure_ViolationValidationError is the validation error -// returned by PreconditionFailure_Violation.Validate if the designated -// constraints aren't met. -type PreconditionFailure_ViolationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e PreconditionFailure_ViolationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e PreconditionFailure_ViolationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e PreconditionFailure_ViolationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e PreconditionFailure_ViolationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e PreconditionFailure_ViolationValidationError) ErrorName() string { - return "PreconditionFailure_ViolationValidationError" -} - -// Error satisfies the builtin error interface -func (e PreconditionFailure_ViolationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sPreconditionFailure_Violation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = PreconditionFailure_ViolationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = PreconditionFailure_ViolationValidationError{} diff --git a/proto/kms/api/cmk/rpc/v1/error_details.proto b/proto/kms/api/cmk/rpc/v1/error_details.proto index 5c2649e..8cfc50f 100644 --- a/proto/kms/api/cmk/rpc/v1/error_details.proto +++ b/proto/kms/api/cmk/rpc/v1/error_details.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package kms.api.cmk.rpc.v1; +option go_package = "github.com/openkcm/api-sdk/proto/kms/api/cmk/rpc/v1;rpcv1"; + // PreconditionFailure describes what preconditions have failed. message PreconditionFailure { message Violation { diff --git a/proto/kms/api/cmk/sessionmanager/oidcmapping/v1/oidcmapping.pb.go b/proto/kms/api/cmk/sessionmanager/oidcmapping/v1/oidcmapping.pb.go index f8254c2..76ecb80 100644 --- a/proto/kms/api/cmk/sessionmanager/oidcmapping/v1/oidcmapping.pb.go +++ b/proto/kms/api/cmk/sessionmanager/oidcmapping/v1/oidcmapping.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc (unknown) +// protoc v7.34.1 // source: kms/api/cmk/sessionmanager/oidcmapping/v1/oidcmapping.proto package oidcmappingv1 @@ -499,8 +499,7 @@ const file_kms_api_cmk_sessionmanager_oidcmapping_v1_oidcmapping_proto_rawDesc = "\x10ApplyOIDCMapping\x12B.kms.api.cmk.sessionmanager.oidcmapping.v1.ApplyOIDCMappingRequest\x1aC.kms.api.cmk.sessionmanager.oidcmapping.v1.ApplyOIDCMappingResponse\"\x00\x12\xa0\x01\n" + "\x11RemoveOIDCMapping\x12C.kms.api.cmk.sessionmanager.oidcmapping.v1.RemoveOIDCMappingRequest\x1aD.kms.api.cmk.sessionmanager.oidcmapping.v1.RemoveOIDCMappingResponse\"\x00\x12\x9d\x01\n" + "\x10BlockOIDCMapping\x12B.kms.api.cmk.sessionmanager.oidcmapping.v1.BlockOIDCMappingRequest\x1aC.kms.api.cmk.sessionmanager.oidcmapping.v1.BlockOIDCMappingResponse\"\x00\x12\xa3\x01\n" + - "\x12UnblockOIDCMapping\x12D.kms.api.cmk.sessionmanager.oidcmapping.v1.UnblockOIDCMappingRequest\x1aE.kms.api.cmk.sessionmanager.oidcmapping.v1.UnblockOIDCMappingResponse\"\x00B\xe6\x02\n" + - "-com.kms.api.cmk.sessionmanager.oidcmapping.v1B\x10OidcmappingProtoP\x01ZXgithub.com/openkcm/api-sdk/proto/kms/api/cmk/sessionmanager/oidcmapping/v1;oidcmappingv1\xa2\x02\x05KACSO\xaa\x02)Kms.Api.Cmk.Sessionmanager.Oidcmapping.V1\xca\x02)Kms\\Api\\Cmk\\Sessionmanager\\Oidcmapping\\V1\xe2\x025Kms\\Api\\Cmk\\Sessionmanager\\Oidcmapping\\V1\\GPBMetadata\xea\x02.Kms::Api::Cmk::Sessionmanager::Oidcmapping::V1b\x06proto3" + "\x12UnblockOIDCMapping\x12D.kms.api.cmk.sessionmanager.oidcmapping.v1.UnblockOIDCMappingRequest\x1aE.kms.api.cmk.sessionmanager.oidcmapping.v1.UnblockOIDCMappingResponse\"\x00BZZXgithub.com/openkcm/api-sdk/proto/kms/api/cmk/sessionmanager/oidcmapping/v1;oidcmappingv1b\x06proto3" var ( file_kms_api_cmk_sessionmanager_oidcmapping_v1_oidcmapping_proto_rawDescOnce sync.Once diff --git a/proto/kms/api/cmk/sessionmanager/oidcmapping/v1/oidcmapping.pb.validate.go b/proto/kms/api/cmk/sessionmanager/oidcmapping/v1/oidcmapping.pb.validate.go deleted file mode 100644 index d6bf4db..0000000 --- a/proto/kms/api/cmk/sessionmanager/oidcmapping/v1/oidcmapping.pb.validate.go +++ /dev/null @@ -1,896 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: kms/api/cmk/sessionmanager/oidcmapping/v1/oidcmapping.proto - -package oidcmappingv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on ApplyOIDCMappingRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ApplyOIDCMappingRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ApplyOIDCMappingRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ApplyOIDCMappingRequestMultiError, or nil if none found. -func (m *ApplyOIDCMappingRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *ApplyOIDCMappingRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for TenantId - - // no validation rules for Issuer - - // no validation rules for Properties - - if m.JwksUri != nil { - // no validation rules for JwksUri - } - - if m.ClientId != nil { - // no validation rules for ClientId - } - - if len(errors) > 0 { - return ApplyOIDCMappingRequestMultiError(errors) - } - - return nil -} - -// ApplyOIDCMappingRequestMultiError is an error wrapping multiple validation -// errors returned by ApplyOIDCMappingRequest.ValidateAll() if the designated -// constraints aren't met. -type ApplyOIDCMappingRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ApplyOIDCMappingRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ApplyOIDCMappingRequestMultiError) AllErrors() []error { return m } - -// ApplyOIDCMappingRequestValidationError is the validation error returned by -// ApplyOIDCMappingRequest.Validate if the designated constraints aren't met. -type ApplyOIDCMappingRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ApplyOIDCMappingRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ApplyOIDCMappingRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ApplyOIDCMappingRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ApplyOIDCMappingRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ApplyOIDCMappingRequestValidationError) ErrorName() string { - return "ApplyOIDCMappingRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e ApplyOIDCMappingRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sApplyOIDCMappingRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ApplyOIDCMappingRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ApplyOIDCMappingRequestValidationError{} - -// Validate checks the field values on ApplyOIDCMappingResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ApplyOIDCMappingResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ApplyOIDCMappingResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ApplyOIDCMappingResponseMultiError, or nil if none found. -func (m *ApplyOIDCMappingResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *ApplyOIDCMappingResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Success - - if m.Message != nil { - // no validation rules for Message - } - - if len(errors) > 0 { - return ApplyOIDCMappingResponseMultiError(errors) - } - - return nil -} - -// ApplyOIDCMappingResponseMultiError is an error wrapping multiple validation -// errors returned by ApplyOIDCMappingResponse.ValidateAll() if the designated -// constraints aren't met. -type ApplyOIDCMappingResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ApplyOIDCMappingResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ApplyOIDCMappingResponseMultiError) AllErrors() []error { return m } - -// ApplyOIDCMappingResponseValidationError is the validation error returned by -// ApplyOIDCMappingResponse.Validate if the designated constraints aren't met. -type ApplyOIDCMappingResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ApplyOIDCMappingResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ApplyOIDCMappingResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ApplyOIDCMappingResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ApplyOIDCMappingResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ApplyOIDCMappingResponseValidationError) ErrorName() string { - return "ApplyOIDCMappingResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e ApplyOIDCMappingResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sApplyOIDCMappingResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ApplyOIDCMappingResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ApplyOIDCMappingResponseValidationError{} - -// Validate checks the field values on RemoveOIDCMappingRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RemoveOIDCMappingRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RemoveOIDCMappingRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RemoveOIDCMappingRequestMultiError, or nil if none found. -func (m *RemoveOIDCMappingRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *RemoveOIDCMappingRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for TenantId - - if len(errors) > 0 { - return RemoveOIDCMappingRequestMultiError(errors) - } - - return nil -} - -// RemoveOIDCMappingRequestMultiError is an error wrapping multiple validation -// errors returned by RemoveOIDCMappingRequest.ValidateAll() if the designated -// constraints aren't met. -type RemoveOIDCMappingRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RemoveOIDCMappingRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RemoveOIDCMappingRequestMultiError) AllErrors() []error { return m } - -// RemoveOIDCMappingRequestValidationError is the validation error returned by -// RemoveOIDCMappingRequest.Validate if the designated constraints aren't met. -type RemoveOIDCMappingRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RemoveOIDCMappingRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RemoveOIDCMappingRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RemoveOIDCMappingRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RemoveOIDCMappingRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RemoveOIDCMappingRequestValidationError) ErrorName() string { - return "RemoveOIDCMappingRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e RemoveOIDCMappingRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRemoveOIDCMappingRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RemoveOIDCMappingRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RemoveOIDCMappingRequestValidationError{} - -// Validate checks the field values on RemoveOIDCMappingResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *RemoveOIDCMappingResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RemoveOIDCMappingResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RemoveOIDCMappingResponseMultiError, or nil if none found. -func (m *RemoveOIDCMappingResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *RemoveOIDCMappingResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Success - - if m.Message != nil { - // no validation rules for Message - } - - if len(errors) > 0 { - return RemoveOIDCMappingResponseMultiError(errors) - } - - return nil -} - -// RemoveOIDCMappingResponseMultiError is an error wrapping multiple validation -// errors returned by RemoveOIDCMappingResponse.ValidateAll() if the -// designated constraints aren't met. -type RemoveOIDCMappingResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RemoveOIDCMappingResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RemoveOIDCMappingResponseMultiError) AllErrors() []error { return m } - -// RemoveOIDCMappingResponseValidationError is the validation error returned by -// RemoveOIDCMappingResponse.Validate if the designated constraints aren't met. -type RemoveOIDCMappingResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RemoveOIDCMappingResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RemoveOIDCMappingResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RemoveOIDCMappingResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RemoveOIDCMappingResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RemoveOIDCMappingResponseValidationError) ErrorName() string { - return "RemoveOIDCMappingResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e RemoveOIDCMappingResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRemoveOIDCMappingResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RemoveOIDCMappingResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RemoveOIDCMappingResponseValidationError{} - -// Validate checks the field values on BlockOIDCMappingRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *BlockOIDCMappingRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on BlockOIDCMappingRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// BlockOIDCMappingRequestMultiError, or nil if none found. -func (m *BlockOIDCMappingRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *BlockOIDCMappingRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for TenantId - - if len(errors) > 0 { - return BlockOIDCMappingRequestMultiError(errors) - } - - return nil -} - -// BlockOIDCMappingRequestMultiError is an error wrapping multiple validation -// errors returned by BlockOIDCMappingRequest.ValidateAll() if the designated -// constraints aren't met. -type BlockOIDCMappingRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m BlockOIDCMappingRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m BlockOIDCMappingRequestMultiError) AllErrors() []error { return m } - -// BlockOIDCMappingRequestValidationError is the validation error returned by -// BlockOIDCMappingRequest.Validate if the designated constraints aren't met. -type BlockOIDCMappingRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e BlockOIDCMappingRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e BlockOIDCMappingRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e BlockOIDCMappingRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e BlockOIDCMappingRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e BlockOIDCMappingRequestValidationError) ErrorName() string { - return "BlockOIDCMappingRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e BlockOIDCMappingRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sBlockOIDCMappingRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = BlockOIDCMappingRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = BlockOIDCMappingRequestValidationError{} - -// Validate checks the field values on BlockOIDCMappingResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *BlockOIDCMappingResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on BlockOIDCMappingResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// BlockOIDCMappingResponseMultiError, or nil if none found. -func (m *BlockOIDCMappingResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *BlockOIDCMappingResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Success - - if m.Message != nil { - // no validation rules for Message - } - - if len(errors) > 0 { - return BlockOIDCMappingResponseMultiError(errors) - } - - return nil -} - -// BlockOIDCMappingResponseMultiError is an error wrapping multiple validation -// errors returned by BlockOIDCMappingResponse.ValidateAll() if the designated -// constraints aren't met. -type BlockOIDCMappingResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m BlockOIDCMappingResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m BlockOIDCMappingResponseMultiError) AllErrors() []error { return m } - -// BlockOIDCMappingResponseValidationError is the validation error returned by -// BlockOIDCMappingResponse.Validate if the designated constraints aren't met. -type BlockOIDCMappingResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e BlockOIDCMappingResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e BlockOIDCMappingResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e BlockOIDCMappingResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e BlockOIDCMappingResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e BlockOIDCMappingResponseValidationError) ErrorName() string { - return "BlockOIDCMappingResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e BlockOIDCMappingResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sBlockOIDCMappingResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = BlockOIDCMappingResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = BlockOIDCMappingResponseValidationError{} - -// Validate checks the field values on UnblockOIDCMappingRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *UnblockOIDCMappingRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UnblockOIDCMappingRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// UnblockOIDCMappingRequestMultiError, or nil if none found. -func (m *UnblockOIDCMappingRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *UnblockOIDCMappingRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for TenantId - - if len(errors) > 0 { - return UnblockOIDCMappingRequestMultiError(errors) - } - - return nil -} - -// UnblockOIDCMappingRequestMultiError is an error wrapping multiple validation -// errors returned by UnblockOIDCMappingRequest.ValidateAll() if the -// designated constraints aren't met. -type UnblockOIDCMappingRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UnblockOIDCMappingRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m UnblockOIDCMappingRequestMultiError) AllErrors() []error { return m } - -// UnblockOIDCMappingRequestValidationError is the validation error returned by -// UnblockOIDCMappingRequest.Validate if the designated constraints aren't met. -type UnblockOIDCMappingRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UnblockOIDCMappingRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UnblockOIDCMappingRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UnblockOIDCMappingRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UnblockOIDCMappingRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UnblockOIDCMappingRequestValidationError) ErrorName() string { - return "UnblockOIDCMappingRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e UnblockOIDCMappingRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sUnblockOIDCMappingRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UnblockOIDCMappingRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UnblockOIDCMappingRequestValidationError{} - -// Validate checks the field values on UnblockOIDCMappingResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *UnblockOIDCMappingResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UnblockOIDCMappingResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// UnblockOIDCMappingResponseMultiError, or nil if none found. -func (m *UnblockOIDCMappingResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *UnblockOIDCMappingResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Success - - if m.Message != nil { - // no validation rules for Message - } - - if len(errors) > 0 { - return UnblockOIDCMappingResponseMultiError(errors) - } - - return nil -} - -// UnblockOIDCMappingResponseMultiError is an error wrapping multiple -// validation errors returned by UnblockOIDCMappingResponse.ValidateAll() if -// the designated constraints aren't met. -type UnblockOIDCMappingResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UnblockOIDCMappingResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m UnblockOIDCMappingResponseMultiError) AllErrors() []error { return m } - -// UnblockOIDCMappingResponseValidationError is the validation error returned -// by UnblockOIDCMappingResponse.Validate if the designated constraints aren't met. -type UnblockOIDCMappingResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UnblockOIDCMappingResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UnblockOIDCMappingResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UnblockOIDCMappingResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UnblockOIDCMappingResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UnblockOIDCMappingResponseValidationError) ErrorName() string { - return "UnblockOIDCMappingResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e UnblockOIDCMappingResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sUnblockOIDCMappingResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UnblockOIDCMappingResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UnblockOIDCMappingResponseValidationError{} diff --git a/proto/kms/api/cmk/sessionmanager/oidcmapping/v1/oidcmapping.proto b/proto/kms/api/cmk/sessionmanager/oidcmapping/v1/oidcmapping.proto index 8798f30..6898bce 100644 --- a/proto/kms/api/cmk/sessionmanager/oidcmapping/v1/oidcmapping.proto +++ b/proto/kms/api/cmk/sessionmanager/oidcmapping/v1/oidcmapping.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package kms.api.cmk.sessionmanager.oidcmapping.v1; +option go_package = "github.com/openkcm/api-sdk/proto/kms/api/cmk/sessionmanager/oidcmapping/v1;oidcmappingv1"; + service Service { rpc ApplyOIDCMapping(ApplyOIDCMappingRequest) returns (ApplyOIDCMappingResponse) {} rpc RemoveOIDCMapping(RemoveOIDCMappingRequest) returns (RemoveOIDCMappingResponse) {} diff --git a/proto/kms/api/cmk/sessionmanager/oidcmapping/v1/oidcmapping_grpc.pb.go b/proto/kms/api/cmk/sessionmanager/oidcmapping/v1/oidcmapping_grpc.pb.go index 7511861..1d17be4 100644 --- a/proto/kms/api/cmk/sessionmanager/oidcmapping/v1/oidcmapping_grpc.pb.go +++ b/proto/kms/api/cmk/sessionmanager/oidcmapping/v1/oidcmapping_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.6.1 -// - protoc (unknown) +// - protoc v7.34.1 // source: kms/api/cmk/sessionmanager/oidcmapping/v1/oidcmapping.proto package oidcmappingv1 diff --git a/proto/kms/api/cmk/sessionmanager/session/v1/session.pb.go b/proto/kms/api/cmk/sessionmanager/session/v1/session.pb.go index dfd96eb..6fab47a 100644 --- a/proto/kms/api/cmk/sessionmanager/session/v1/session.pb.go +++ b/proto/kms/api/cmk/sessionmanager/session/v1/session.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc (unknown) +// protoc v7.34.1 // source: kms/api/cmk/sessionmanager/session/v1/session.proto package sessionv1 @@ -301,8 +301,7 @@ const file_kms_api_cmk_sessionmanager_session_v1_session_proto_rawDesc = "" + "\aService\x12\x83\x01\n" + "\n" + "GetSession\x128.kms.api.cmk.sessionmanager.session.v1.GetSessionRequest\x1a9.kms.api.cmk.sessionmanager.session.v1.GetSessionResponse\"\x00\x12\x92\x01\n" + - "\x0fGetOIDCProvider\x12=.kms.api.cmk.sessionmanager.session.v1.GetOIDCProviderRequest\x1a>.kms.api.cmk.sessionmanager.session.v1.GetOIDCProviderResponse\"\x00B\xc6\x02\n" + - ")com.kms.api.cmk.sessionmanager.session.v1B\fSessionProtoP\x01ZPgithub.com/openkcm/api-sdk/proto/kms/api/cmk/sessionmanager/session/v1;sessionv1\xa2\x02\x05KACSS\xaa\x02%Kms.Api.Cmk.Sessionmanager.Session.V1\xca\x02%Kms\\Api\\Cmk\\Sessionmanager\\Session\\V1\xe2\x021Kms\\Api\\Cmk\\Sessionmanager\\Session\\V1\\GPBMetadata\xea\x02*Kms::Api::Cmk::Sessionmanager::Session::V1b\x06proto3" + "\x0fGetOIDCProvider\x12=.kms.api.cmk.sessionmanager.session.v1.GetOIDCProviderRequest\x1a>.kms.api.cmk.sessionmanager.session.v1.GetOIDCProviderResponse\"\x00BRZPgithub.com/openkcm/api-sdk/proto/kms/api/cmk/sessionmanager/session/v1;sessionv1b\x06proto3" var ( file_kms_api_cmk_sessionmanager_session_v1_session_proto_rawDescOnce sync.Once diff --git a/proto/kms/api/cmk/sessionmanager/session/v1/session.pb.validate.go b/proto/kms/api/cmk/sessionmanager/session/v1/session.pb.validate.go deleted file mode 100644 index 2818c80..0000000 --- a/proto/kms/api/cmk/sessionmanager/session/v1/session.pb.validate.go +++ /dev/null @@ -1,495 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: kms/api/cmk/sessionmanager/session/v1/session.proto - -package sessionv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on GetSessionRequest with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *GetSessionRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetSessionRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GetSessionRequestMultiError, or nil if none found. -func (m *GetSessionRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *GetSessionRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for SessionId - - // no validation rules for TenantId - - // no validation rules for Fingerprint - - if len(errors) > 0 { - return GetSessionRequestMultiError(errors) - } - - return nil -} - -// GetSessionRequestMultiError is an error wrapping multiple validation errors -// returned by GetSessionRequest.ValidateAll() if the designated constraints -// aren't met. -type GetSessionRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetSessionRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetSessionRequestMultiError) AllErrors() []error { return m } - -// GetSessionRequestValidationError is the validation error returned by -// GetSessionRequest.Validate if the designated constraints aren't met. -type GetSessionRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetSessionRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetSessionRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetSessionRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetSessionRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetSessionRequestValidationError) ErrorName() string { - return "GetSessionRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e GetSessionRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetSessionRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetSessionRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetSessionRequestValidationError{} - -// Validate checks the field values on GetSessionResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *GetSessionResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetSessionResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GetSessionResponseMultiError, or nil if none found. -func (m *GetSessionResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *GetSessionResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Valid - - // no validation rules for Issuer - - // no validation rules for Subject - - // no validation rules for GivenName - - // no validation rules for FamilyName - - // no validation rules for Email - - // no validation rules for AuthContext - - if len(errors) > 0 { - return GetSessionResponseMultiError(errors) - } - - return nil -} - -// GetSessionResponseMultiError is an error wrapping multiple validation errors -// returned by GetSessionResponse.ValidateAll() if the designated constraints -// aren't met. -type GetSessionResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetSessionResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetSessionResponseMultiError) AllErrors() []error { return m } - -// GetSessionResponseValidationError is the validation error returned by -// GetSessionResponse.Validate if the designated constraints aren't met. -type GetSessionResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetSessionResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetSessionResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetSessionResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetSessionResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetSessionResponseValidationError) ErrorName() string { - return "GetSessionResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e GetSessionResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetSessionResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetSessionResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetSessionResponseValidationError{} - -// Validate checks the field values on GetOIDCProviderRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *GetOIDCProviderRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetOIDCProviderRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GetOIDCProviderRequestMultiError, or nil if none found. -func (m *GetOIDCProviderRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *GetOIDCProviderRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for TenantId - - if len(errors) > 0 { - return GetOIDCProviderRequestMultiError(errors) - } - - return nil -} - -// GetOIDCProviderRequestMultiError is an error wrapping multiple validation -// errors returned by GetOIDCProviderRequest.ValidateAll() if the designated -// constraints aren't met. -type GetOIDCProviderRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetOIDCProviderRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetOIDCProviderRequestMultiError) AllErrors() []error { return m } - -// GetOIDCProviderRequestValidationError is the validation error returned by -// GetOIDCProviderRequest.Validate if the designated constraints aren't met. -type GetOIDCProviderRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetOIDCProviderRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetOIDCProviderRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetOIDCProviderRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetOIDCProviderRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetOIDCProviderRequestValidationError) ErrorName() string { - return "GetOIDCProviderRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e GetOIDCProviderRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetOIDCProviderRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetOIDCProviderRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetOIDCProviderRequestValidationError{} - -// Validate checks the field values on GetOIDCProviderResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *GetOIDCProviderResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetOIDCProviderResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GetOIDCProviderResponseMultiError, or nil if none found. -func (m *GetOIDCProviderResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *GetOIDCProviderResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetProvider()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetOIDCProviderResponseValidationError{ - field: "Provider", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetOIDCProviderResponseValidationError{ - field: "Provider", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetProvider()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetOIDCProviderResponseValidationError{ - field: "Provider", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return GetOIDCProviderResponseMultiError(errors) - } - - return nil -} - -// GetOIDCProviderResponseMultiError is an error wrapping multiple validation -// errors returned by GetOIDCProviderResponse.ValidateAll() if the designated -// constraints aren't met. -type GetOIDCProviderResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetOIDCProviderResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetOIDCProviderResponseMultiError) AllErrors() []error { return m } - -// GetOIDCProviderResponseValidationError is the validation error returned by -// GetOIDCProviderResponse.Validate if the designated constraints aren't met. -type GetOIDCProviderResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetOIDCProviderResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetOIDCProviderResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetOIDCProviderResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetOIDCProviderResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetOIDCProviderResponseValidationError) ErrorName() string { - return "GetOIDCProviderResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e GetOIDCProviderResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetOIDCProviderResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetOIDCProviderResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetOIDCProviderResponseValidationError{} diff --git a/proto/kms/api/cmk/sessionmanager/session/v1/session.proto b/proto/kms/api/cmk/sessionmanager/session/v1/session.proto index 3882a16..57bbbb1 100644 --- a/proto/kms/api/cmk/sessionmanager/session/v1/session.proto +++ b/proto/kms/api/cmk/sessionmanager/session/v1/session.proto @@ -4,6 +4,8 @@ package kms.api.cmk.sessionmanager.session.v1; import "kms/api/cmk/types/v1/oidc.proto"; +option go_package = "github.com/openkcm/api-sdk/proto/kms/api/cmk/sessionmanager/session/v1;sessionv1"; + service Service { // GetSession matches the fingerprint, tenant id, and returns a session // and its status. Additionally, the method checks whether the tenant is blocked. diff --git a/proto/kms/api/cmk/sessionmanager/session/v1/session_grpc.pb.go b/proto/kms/api/cmk/sessionmanager/session/v1/session_grpc.pb.go index d86adc2..95f414e 100644 --- a/proto/kms/api/cmk/sessionmanager/session/v1/session_grpc.pb.go +++ b/proto/kms/api/cmk/sessionmanager/session/v1/session_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.6.1 -// - protoc (unknown) +// - protoc v7.34.1 // source: kms/api/cmk/sessionmanager/session/v1/session.proto package sessionv1 diff --git a/proto/kms/api/cmk/types/v1/oidc.pb.go b/proto/kms/api/cmk/types/v1/oidc.pb.go index 9ec011d..a6869ce 100644 --- a/proto/kms/api/cmk/types/v1/oidc.pb.go +++ b/proto/kms/api/cmk/types/v1/oidc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc (unknown) +// protoc v7.34.1 // source: kms/api/cmk/types/v1/oidc.proto package typesv1 @@ -90,8 +90,7 @@ const file_kms_api_cmk_types_v1_oidc_proto_rawDesc = "" + "\n" + "issuer_url\x18\x01 \x01(\tR\tissuerUrl\x12\x19\n" + "\bjwks_uri\x18\x02 \x01(\tR\ajwksUri\x12\x1c\n" + - "\taudiences\x18\x03 \x03(\tR\taudiencesB\xd9\x01\n" + - "\x18com.kms.api.cmk.types.v1B\tOidcProtoP\x01Z=github.com/openkcm/api-sdk/proto/kms/api/cmk/types/v1;typesv1\xa2\x02\x04KACT\xaa\x02\x14Kms.Api.Cmk.Types.V1\xca\x02\x14Kms\\Api\\Cmk\\Types\\V1\xe2\x02 Kms\\Api\\Cmk\\Types\\V1\\GPBMetadata\xea\x02\x18Kms::Api::Cmk::Types::V1b\x06proto3" + "\taudiences\x18\x03 \x03(\tR\taudiencesB?Z=github.com/openkcm/api-sdk/proto/kms/api/cmk/types/v1;typesv1b\x06proto3" var ( file_kms_api_cmk_types_v1_oidc_proto_rawDescOnce sync.Once diff --git a/proto/kms/api/cmk/types/v1/oidc.pb.validate.go b/proto/kms/api/cmk/types/v1/oidc.pb.validate.go deleted file mode 100644 index 4cb169f..0000000 --- a/proto/kms/api/cmk/types/v1/oidc.pb.validate.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: kms/api/cmk/types/v1/oidc.proto - -package typesv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on OIDCProvider with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *OIDCProvider) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on OIDCProvider with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in OIDCProviderMultiError, or -// nil if none found. -func (m *OIDCProvider) ValidateAll() error { - return m.validate(true) -} - -func (m *OIDCProvider) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for IssuerUrl - - // no validation rules for JwksUri - - if len(errors) > 0 { - return OIDCProviderMultiError(errors) - } - - return nil -} - -// OIDCProviderMultiError is an error wrapping multiple validation errors -// returned by OIDCProvider.ValidateAll() if the designated constraints aren't met. -type OIDCProviderMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m OIDCProviderMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m OIDCProviderMultiError) AllErrors() []error { return m } - -// OIDCProviderValidationError is the validation error returned by -// OIDCProvider.Validate if the designated constraints aren't met. -type OIDCProviderValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e OIDCProviderValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e OIDCProviderValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e OIDCProviderValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e OIDCProviderValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e OIDCProviderValidationError) ErrorName() string { return "OIDCProviderValidationError" } - -// Error satisfies the builtin error interface -func (e OIDCProviderValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sOIDCProvider.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = OIDCProviderValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = OIDCProviderValidationError{} diff --git a/proto/kms/api/cmk/types/v1/oidc.proto b/proto/kms/api/cmk/types/v1/oidc.proto index ed7320a..8b303b5 100644 --- a/proto/kms/api/cmk/types/v1/oidc.proto +++ b/proto/kms/api/cmk/types/v1/oidc.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package kms.api.cmk.types.v1; +option go_package = "github.com/openkcm/api-sdk/proto/kms/api/cmk/types/v1;typesv1"; + message OIDCProvider { string issuer_url = 1; string jwks_uri = 2; diff --git a/proto/kms/api/cmk/types/v1/region.pb.go b/proto/kms/api/cmk/types/v1/region.pb.go index 5b602e6..55b28a4 100644 --- a/proto/kms/api/cmk/types/v1/region.pb.go +++ b/proto/kms/api/cmk/types/v1/region.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc (unknown) +// protoc v7.34.1 // source: kms/api/cmk/types/v1/region.proto package typesv1 @@ -82,8 +82,7 @@ const file_kms_api_cmk_types_v1_region_proto_rawDesc = "" + "\x12REGION_UNSPECIFIED\x10\x00\x12\r\n" + "\tREGION_EU\x10\x01\x12\r\n" + "\tREGION_US\x10\x02\x12\r\n" + - "\tREGION_JP\x10\x03B\xdb\x01\n" + - "\x18com.kms.api.cmk.types.v1B\vRegionProtoP\x01Z=github.com/openkcm/api-sdk/proto/kms/api/cmk/types/v1;typesv1\xa2\x02\x04KACT\xaa\x02\x14Kms.Api.Cmk.Types.V1\xca\x02\x14Kms\\Api\\Cmk\\Types\\V1\xe2\x02 Kms\\Api\\Cmk\\Types\\V1\\GPBMetadata\xea\x02\x18Kms::Api::Cmk::Types::V1b\x06proto3" + "\tREGION_JP\x10\x03B?Z=github.com/openkcm/api-sdk/proto/kms/api/cmk/types/v1;typesv1b\x06proto3" var ( file_kms_api_cmk_types_v1_region_proto_rawDescOnce sync.Once diff --git a/proto/kms/api/cmk/types/v1/region.pb.validate.go b/proto/kms/api/cmk/types/v1/region.pb.validate.go deleted file mode 100644 index 90f89c7..0000000 --- a/proto/kms/api/cmk/types/v1/region.pb.validate.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: kms/api/cmk/types/v1/region.proto - -package typesv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) diff --git a/proto/kms/api/cmk/types/v1/region.proto b/proto/kms/api/cmk/types/v1/region.proto index a7760ea..e171e20 100644 --- a/proto/kms/api/cmk/types/v1/region.proto +++ b/proto/kms/api/cmk/types/v1/region.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package kms.api.cmk.types.v1; +option go_package = "github.com/openkcm/api-sdk/proto/kms/api/cmk/types/v1;typesv1"; + enum Region { REGION_UNSPECIFIED = 0; REGION_EU = 1; diff --git a/proto/kms/api/cmk/types/v1/status.pb.go b/proto/kms/api/cmk/types/v1/status.pb.go index 0592a0c..3210995 100644 --- a/proto/kms/api/cmk/types/v1/status.pb.go +++ b/proto/kms/api/cmk/types/v1/status.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc (unknown) +// protoc v7.34.1 // source: kms/api/cmk/types/v1/status.proto package typesv1 @@ -86,8 +86,7 @@ const file_kms_api_cmk_types_v1_status_proto_rawDesc = "" + "\x10STATUS_AVAILABLE\x10\x01\x12\x15\n" + "\x11STATUS_PROCESSING\x10\x02\x12\x1e\n" + "\x1aSTATUS_TERMINATION_PENDING\x10\x03\x12\x15\n" + - "\x11STATUS_TERMINATED\x10\x04B\xdb\x01\n" + - "\x18com.kms.api.cmk.types.v1B\vStatusProtoP\x01Z=github.com/openkcm/api-sdk/proto/kms/api/cmk/types/v1;typesv1\xa2\x02\x04KACT\xaa\x02\x14Kms.Api.Cmk.Types.V1\xca\x02\x14Kms\\Api\\Cmk\\Types\\V1\xe2\x02 Kms\\Api\\Cmk\\Types\\V1\\GPBMetadata\xea\x02\x18Kms::Api::Cmk::Types::V1b\x06proto3" + "\x11STATUS_TERMINATED\x10\x04B?Z=github.com/openkcm/api-sdk/proto/kms/api/cmk/types/v1;typesv1b\x06proto3" var ( file_kms_api_cmk_types_v1_status_proto_rawDescOnce sync.Once diff --git a/proto/kms/api/cmk/types/v1/status.pb.validate.go b/proto/kms/api/cmk/types/v1/status.pb.validate.go deleted file mode 100644 index ac48df2..0000000 --- a/proto/kms/api/cmk/types/v1/status.pb.validate.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: kms/api/cmk/types/v1/status.proto - -package typesv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) diff --git a/proto/kms/api/cmk/types/v1/status.proto b/proto/kms/api/cmk/types/v1/status.proto index 052be48..28d21d0 100644 --- a/proto/kms/api/cmk/types/v1/status.proto +++ b/proto/kms/api/cmk/types/v1/status.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package kms.api.cmk.types.v1; +option go_package = "github.com/openkcm/api-sdk/proto/kms/api/cmk/types/v1;typesv1"; + enum Status { STATUS_UNSPECIFIED = 0; STATUS_AVAILABLE = 1; diff --git a/protofetch.lock b/protofetch.lock new file mode 100644 index 0000000..64a61e7 --- /dev/null +++ b/protofetch.lock @@ -0,0 +1,7 @@ +version = 2 + +[[dependencies]] +name = "protovalidate" +url = "github.com/bufbuild/protovalidate" +revision = "v1.1.1" +commit_hash = "b304b85d7f2f072190ca4315ded920fe2310251f" diff --git a/protofetch.toml b/protofetch.toml new file mode 100644 index 0000000..d6427bf --- /dev/null +++ b/protofetch.toml @@ -0,0 +1,8 @@ +name = "github.com/openkcm/api-sdk" +description = "API proto definitions and Go generated code used in the openkcm project" + +[protovalidate] +url = "github.com/bufbuild/protovalidate" +revision = "v1.1.1" +content_roots = ["/proto/protovalidate"] +allow_policies = ["buf/validate/*"] diff --git a/vendor-proto/buf/validate/validate.proto b/vendor-proto/buf/validate/validate.proto new file mode 100644 index 0000000..f0371d3 --- /dev/null +++ b/vendor-proto/buf/validate/validate.proto @@ -0,0 +1,5057 @@ +// Copyright 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +// [Protovalidate](https://protovalidate.com/) is the semantic validation library for Protobuf. +// It provides standard annotations to validate common rules on messages and fields, as well as the ability to use [CEL](https://cel.dev) to write custom rules. +// It's the next generation of [protoc-gen-validate](https://github.com/bufbuild/protoc-gen-validate). +// +// This package provides the options, messages, and enums that power Protovalidate. +// Apply its options to messages, fields, and oneofs in your Protobuf schemas to add validation rules: +// +// ```proto +// message User { +// string id = 1 [(buf.validate.field).string.uuid = true]; +// string first_name = 2 [(buf.validate.field).string.max_len = 64]; +// string last_name = 3 [(buf.validate.field).string.max_len = 64]; +// +// option (buf.validate.message).cel = { +// id: "first_name_requires_last_name" +// message: "last_name must be present if first_name is present" +// expression: "!has(this.first_name) || has(this.last_name)" +// }; +// } +// ``` +// +// These rules are enforced at runtime by language-specific libraries. +// See the [developer quickstart](https://protovalidate.com/quickstart/) to get started, or go directly to the runtime library for your language: +// [Go](https://github.com/bufbuild/protovalidate-go) +// [JavaScript/TypeScript](https://github.com/bufbuild/protovalidate-es), +// [Java](https://github.com/bufbuild/protovalidate-java), +// [Python](https://github.com/bufbuild/protovalidate-python), +// or [C++](https://github.com/bufbuild/protovalidate-cc). +package buf.validate; + +import "google/protobuf/descriptor.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"; +option java_multiple_files = true; +option java_outer_classname = "ValidateProto"; +option java_package = "build.buf.validate"; + +// MessageOptions is an extension to google.protobuf.MessageOptions. It allows +// the addition of validation rules at the message level. These rules can be +// applied to incoming messages to ensure they meet certain criteria before +// being processed. +extend google.protobuf.MessageOptions { + // Rules specify the validations to be performed on this message. By default, + // no validation is performed against a message. + optional MessageRules message = 1159; +} + +// OneofOptions is an extension to google.protobuf.OneofOptions. It allows +// the addition of validation rules on a oneof. These rules can be +// applied to incoming messages to ensure they meet certain criteria before +// being processed. +extend google.protobuf.OneofOptions { + // Rules specify the validations to be performed on this oneof. By default, + // no validation is performed against a oneof. + optional OneofRules oneof = 1159; +} + +// FieldOptions is an extension to google.protobuf.FieldOptions. It allows +// the addition of validation rules at the field level. These rules can be +// applied to incoming messages to ensure they meet certain criteria before +// being processed. +extend google.protobuf.FieldOptions { + // Rules specify the validations to be performed on this field. By default, + // no validation is performed against a field. + optional FieldRules field = 1159; + + // Specifies predefined rules. When extending a standard rule message, + // this adds additional CEL expressions that apply when the extension is used. + // + // ```proto + // extend buf.validate.Int32Rules { + // bool is_zero [(buf.validate.predefined).cel = { + // id: "int32.is_zero", + // message: "value must be zero", + // expression: "!rule || this == 0", + // }]; + // } + // + // message Foo { + // int32 reserved = 1 [(buf.validate.field).int32.(is_zero) = true]; + // } + // ``` + optional PredefinedRules predefined = 1160; +} + +// `Rule` represents a validation rule written in the Common Expression +// Language (CEL) syntax. Each Rule includes a unique identifier, an +// optional error message, and the CEL expression to evaluate. For more +// information, [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/). +// +// ```proto +// message Foo { +// option (buf.validate.message).cel = { +// id: "foo.bar" +// message: "bar must be greater than 0" +// expression: "this.bar > 0" +// }; +// int32 bar = 1; +// } +// ``` +message Rule { + // `id` is a string that serves as a machine-readable name for this Rule. + // It should be unique within its scope, which could be either a message or a field. + optional string id = 1; + + // `message` is an optional field that provides a human-readable error message + // for this Rule when the CEL expression evaluates to false. If a + // non-empty message is provided, any strings resulting from the CEL + // expression evaluation are ignored. + optional string message = 2; + + // `expression` is the actual CEL expression that will be evaluated for + // validation. This string must resolve to either a boolean or a string + // value. If the expression evaluates to false or a non-empty string, the + // validation is considered failed, and the message is rejected. + optional string expression = 3; +} + +// MessageRules represents validation rules that are applied to the entire message. +// It includes disabling options and a list of Rule messages representing Common Expression Language (CEL) validation rules. +message MessageRules { + // `cel_expression` is a repeated field CEL expressions. Each expression specifies a validation + // rule to be applied to this message. These rules are written in Common Expression Language (CEL) syntax. + // + // This is a simplified form of the `cel` Rule field, where only `expression` is set. This allows for + // simpler syntax when defining CEL Rules where `id` and `message` derived from the `expression`. `id` will + // be same as the `expression`. + // + // For more information, [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/). + // + // ```proto + // message MyMessage { + // // The field `foo` must be greater than 42. + // option (buf.validate.message).cel_expression = "this.foo > 42"; + // // The field `foo` must be less than 84. + // option (buf.validate.message).cel_expression = "this.foo < 84"; + // optional int32 foo = 1; + // } + // ``` + repeated string cel_expression = 5; + // `cel` is a repeated field of type Rule. Each Rule specifies a validation rule to be applied to this message. + // These rules are written in Common Expression Language (CEL) syntax. For more information, + // [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/). + // + // + // ```proto + // message MyMessage { + // // The field `foo` must be greater than 42. + // option (buf.validate.message).cel = { + // id: "my_message.value", + // message: "value must be greater than 42", + // expression: "this.foo > 42", + // }; + // optional int32 foo = 1; + // } + // ``` + repeated Rule cel = 3; + + // `oneof` is a repeated field of type MessageOneofRule that specifies a list of fields + // of which at most one can be present. If `required` is also specified, then exactly one + // of the specified fields _must_ be present. + // + // This will enforce oneof-like constraints with a few features not provided by + // actual Protobuf oneof declarations: + // 1. Repeated and map fields are allowed in this validation. In a Protobuf oneof, + // only scalar fields are allowed. + // 2. Fields with implicit presence are allowed. In a Protobuf oneof, all member + // fields have explicit presence. This means that, for the purpose of determining + // how many fields are set, explicitly setting such a field to its zero value is + // effectively the same as not setting it at all. + // 3. This will always generate validation errors for a message unmarshalled from + // serialized data that sets more than one field. With a Protobuf oneof, when + // multiple fields are present in the serialized form, earlier values are usually + // silently ignored when unmarshalling, with only the last field being set when + // unmarshalling completes. + // + // Note that adding a field to a `oneof` will also set the IGNORE_IF_ZERO_VALUE on the fields. This means + // only the field that is set will be validated and the unset fields are not validated according to the field rules. + // This behavior can be overridden by setting `ignore` against a field. + // + // ```proto + // message MyMessage { + // // Only one of `field1` or `field2` _can_ be present in this message. + // option (buf.validate.message).oneof = { fields: ["field1", "field2"] }; + // // Exactly one of `field3` or `field4` _must_ be present in this message. + // option (buf.validate.message).oneof = { fields: ["field3", "field4"], required: true }; + // string field1 = 1; + // bytes field2 = 2; + // bool field3 = 3; + // int32 field4 = 4; + // } + // ``` + repeated MessageOneofRule oneof = 4; + + reserved 1; + reserved "disabled"; +} + +message MessageOneofRule { + // A list of field names to include in the oneof. All field names must be + // defined in the message. At least one field must be specified, and + // duplicates are not permitted. + repeated string fields = 1; + // If true, one of the fields specified _must_ be set. + optional bool required = 2; +} + +// The `OneofRules` message type enables you to manage rules for +// oneof fields in your protobuf messages. +message OneofRules { + // If `required` is true, exactly one field of the oneof must be set. A + // validation error is returned if no fields in the oneof are set. Further rules + // should be placed on the fields themselves to ensure they are valid values, + // such as `min_len` or `gt`. + // + // ```proto + // message MyMessage { + // oneof value { + // // Either `a` or `b` must be set. If `a` is set, it must also be + // // non-empty; whereas if `b` is set, it can still be an empty string. + // option (buf.validate.oneof).required = true; + // string a = 1 [(buf.validate.field).string.min_len = 1]; + // string b = 2; + // } + // } + // ``` + optional bool required = 1; +} + +// FieldRules encapsulates the rules for each type of field. Depending on +// the field, the correct set should be used to ensure proper validations. +message FieldRules { + // `cel_expression` is a repeated field CEL expressions. Each expression specifies a validation + // rule to be applied to this message. These rules are written in Common Expression Language (CEL) syntax. + // + // This is a simplified form of the `cel` Rule field, where only `expression` is set. This allows for + // simpler syntax when defining CEL Rules where `id` and `message` derived from the `expression`. `id` will + // be same as the `expression`. + // + // For more information, [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/). + // + // ```proto + // message MyMessage { + // // The field `value` must be greater than 42. + // optional int32 value = 1 [(buf.validate.field).cel_expression = "this > 42"]; + // } + // ``` + repeated string cel_expression = 29; + // `cel` is a repeated field used to represent a textual expression + // in the Common Expression Language (CEL) syntax. For more information, + // [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/). + // + // ```proto + // message MyMessage { + // // The field `value` must be greater than 42. + // optional int32 value = 1 [(buf.validate.field).cel = { + // id: "my_message.value", + // message: "value must be greater than 42", + // expression: "this > 42", + // }]; + // } + // ``` + repeated Rule cel = 23; + // If `required` is true, the field must be set. A validation error is returned + // if the field is not set. + // + // ```proto + // syntax="proto3"; + // + // message FieldsWithPresence { + // // Requires any string to be set, including the empty string. + // optional string link = 1 [ + // (buf.validate.field).required = true + // ]; + // // Requires true or false to be set. + // optional bool disabled = 2 [ + // (buf.validate.field).required = true + // ]; + // // Requires a message to be set, including the empty message. + // SomeMessage msg = 4 [ + // (buf.validate.field).required = true + // ]; + // } + // ``` + // + // All fields in the example above track presence. By default, Protovalidate + // ignores rules on those fields if no value is set. `required` ensures that + // the fields are set and valid. + // + // Fields that don't track presence are always validated by Protovalidate, + // whether they are set or not. It is not necessary to add `required`. It + // can be added to indicate that the field cannot be the zero value. + // + // ```proto + // syntax="proto3"; + // + // message FieldsWithoutPresence { + // // `string.email` always applies, even to an empty string. + // string link = 1 [ + // (buf.validate.field).string.email = true + // ]; + // // `repeated.min_items` always applies, even to an empty list. + // repeated string labels = 2 [ + // (buf.validate.field).repeated.min_items = 1 + // ]; + // // `required`, for fields that don't track presence, indicates + // // the value of the field can't be the zero value. + // int32 zero_value_not_allowed = 3 [ + // (buf.validate.field).required = true + // ]; + // } + // ``` + // + // To learn which fields track presence, see the + // [Field Presence cheat sheet](https://protobuf.dev/programming-guides/field_presence/#cheat). + // + // Note: While field rules can be applied to repeated items, map keys, and map + // values, the elements are always considered to be set. Consequently, + // specifying `repeated.items.required` is redundant. + optional bool required = 25; + // Ignore validation rules on the field if its value matches the specified + // criteria. See the `Ignore` enum for details. + // + // ```proto + // message UpdateRequest { + // // The uri rule only applies if the field is not an empty string. + // string url = 1 [ + // (buf.validate.field).ignore = IGNORE_IF_ZERO_VALUE, + // (buf.validate.field).string.uri = true + // ]; + // } + // ``` + optional Ignore ignore = 27; + + oneof type { + // Scalar Field Types + FloatRules float = 1; + DoubleRules double = 2; + Int32Rules int32 = 3; + Int64Rules int64 = 4; + UInt32Rules uint32 = 5; + UInt64Rules uint64 = 6; + SInt32Rules sint32 = 7; + SInt64Rules sint64 = 8; + Fixed32Rules fixed32 = 9; + Fixed64Rules fixed64 = 10; + SFixed32Rules sfixed32 = 11; + SFixed64Rules sfixed64 = 12; + BoolRules bool = 13; + StringRules string = 14; + BytesRules bytes = 15; + + // Complex Field Types + EnumRules enum = 16; + RepeatedRules repeated = 18; + MapRules map = 19; + + // Well-Known Field Types + AnyRules any = 20; + DurationRules duration = 21; + FieldMaskRules field_mask = 28; + TimestampRules timestamp = 22; + } + + reserved 24, 26; + reserved "skipped", "ignore_empty"; +} + +// PredefinedRules are custom rules that can be re-used with +// multiple fields. +message PredefinedRules { + // `cel` is a repeated field used to represent a textual expression + // in the Common Expression Language (CEL) syntax. For more information, + // [see our documentation](https://buf.build/docs/protovalidate/schemas/predefined-rules/). + // + // ```proto + // message MyMessage { + // // The field `value` must be greater than 42. + // optional int32 value = 1 [(buf.validate.predefined).cel = { + // id: "my_message.value", + // message: "value must be greater than 42", + // expression: "this > 42", + // }]; + // } + // ``` + repeated Rule cel = 1; + + reserved 24, 26; + reserved "skipped", "ignore_empty"; +} + +// Specifies how `FieldRules.ignore` behaves, depending on the field's value, and +// whether the field tracks presence. +enum Ignore { + // Ignore rules if the field tracks presence and is unset. This is the default + // behavior. + // + // In proto3, only message fields, members of a Protobuf `oneof`, and fields + // with the `optional` label track presence. Consequently, the following fields + // are always validated, whether a value is set or not: + // + // ```proto + // syntax="proto3"; + // + // message RulesApply { + // string email = 1 [ + // (buf.validate.field).string.email = true + // ]; + // int32 age = 2 [ + // (buf.validate.field).int32.gt = 0 + // ]; + // repeated string labels = 3 [ + // (buf.validate.field).repeated.min_items = 1 + // ]; + // } + // ``` + // + // In contrast, the following fields track presence, and are only validated if + // a value is set: + // + // ```proto + // syntax="proto3"; + // + // message RulesApplyIfSet { + // optional string email = 1 [ + // (buf.validate.field).string.email = true + // ]; + // oneof ref { + // string reference = 2 [ + // (buf.validate.field).string.uuid = true + // ]; + // string name = 3 [ + // (buf.validate.field).string.min_len = 4 + // ]; + // } + // SomeMessage msg = 4 [ + // (buf.validate.field).cel = {/* ... */} + // ]; + // } + // ``` + // + // To ensure that such a field is set, add the `required` rule. + // + // To learn which fields track presence, see the + // [Field Presence cheat sheet](https://protobuf.dev/programming-guides/field_presence/#cheat). + IGNORE_UNSPECIFIED = 0; + + // Ignore rules if the field is unset, or set to the zero value. + // + // The zero value depends on the field type: + // - For strings, the zero value is the empty string. + // - For bytes, the zero value is empty bytes. + // - For bool, the zero value is false. + // - For numeric types, the zero value is zero. + // - For enums, the zero value is the first defined enum value. + // - For repeated fields, the zero is an empty list. + // - For map fields, the zero is an empty map. + // - For message fields, absence of the message (typically a null-value) is considered zero value. + // + // For fields that track presence (e.g. adding the `optional` label in proto3), + // this a no-op and behavior is the same as the default `IGNORE_UNSPECIFIED`. + IGNORE_IF_ZERO_VALUE = 1; + + // Always ignore rules, including the `required` rule. + // + // This is useful for ignoring the rules of a referenced message, or to + // temporarily ignore rules during development. + // + // ```proto + // message MyMessage { + // // The field's rules will always be ignored, including any validations + // // on value's fields. + // MyOtherMessage value = 1 [ + // (buf.validate.field).ignore = IGNORE_ALWAYS + // ]; + // } + // ``` + IGNORE_ALWAYS = 3; + + reserved 2; + reserved "IGNORE_EMPTY", "IGNORE_DEFAULT", "IGNORE_IF_DEFAULT_VALUE", "IGNORE_IF_UNPOPULATED"; +} + +// FloatRules describes the rules applied to `float` values. These +// rules may also be applied to the `google.protobuf.FloatValue` Well-Known-Type. +message FloatRules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MyFloat { + // // value must equal 42.0 + // float value = 1 [(buf.validate.field).float.const = 42.0]; + // } + // ``` + optional float const = 1 [(predefined).cel = { + id: "float.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + + oneof less_than { + // `lt` requires the field value to be less than the specified value (field < + // value). If the field value is equal to or greater than the specified value, + // an error message is generated. + // + // ```proto + // message MyFloat { + // // value must be less than 10.0 + // float value = 1 [(buf.validate.field).float.lt = 10.0]; + // } + // ``` + float lt = 2 [(predefined).cel = { + id: "float.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && (this.isNan() || this >= rules.lt)" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MyFloat { + // // value must be less than or equal to 10.0 + // float value = 1 [(buf.validate.field).float.lte = 10.0]; + // } + // ``` + float lte = 3 [(predefined).cel = { + id: "float.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && (this.isNan() || this > rules.lte)" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyFloat { + // // value must be greater than 5.0 [float.gt] + // float value = 1 [(buf.validate.field).float.gt = 5.0]; + // + // // value must be greater than 5 and less than 10.0 [float.gt_lt] + // float other_value = 2 [(buf.validate.field).float = { gt: 5.0, lt: 10.0 }]; + // + // // value must be greater than 10 or less than 5.0 [float.gt_lt_exclusive] + // float another_value = 3 [(buf.validate.field).float = { gt: 10.0, lt: 5.0 }]; + // } + // ``` + float gt = 4 [ + (predefined).cel = { + id: "float.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && (this.isNan() || this <= rules.gt)" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "float.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this.isNan() || this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "float.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (this.isNan() || (rules.lt <= this && this <= rules.gt))" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "float.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this.isNan() || this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "float.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (this.isNan() || (rules.lte < this && this <= rules.gt))" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyFloat { + // // value must be greater than or equal to 5.0 [float.gte] + // float value = 1 [(buf.validate.field).float.gte = 5.0]; + // + // // value must be greater than or equal to 5.0 and less than 10.0 [float.gte_lt] + // float other_value = 2 [(buf.validate.field).float = { gte: 5.0, lt: 10.0 }]; + // + // // value must be greater than or equal to 10.0 or less than 5.0 [float.gte_lt_exclusive] + // float another_value = 3 [(buf.validate.field).float = { gte: 10.0, lt: 5.0 }]; + // } + // ``` + float gte = 5 [ + (predefined).cel = { + id: "float.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && (this.isNan() || this < rules.gte)" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "float.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this.isNan() || this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "float.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (this.isNan() || (rules.lt <= this && this < rules.gte))" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "float.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this.isNan() || this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "float.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (this.isNan() || (rules.lte < this && this < rules.gte))" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message + // is generated. + // + // ```proto + // message MyFloat { + // // value must be in list [1.0, 2.0, 3.0] + // float value = 1 [(buf.validate.field).float = { in: [1.0, 2.0, 3.0] }]; + // } + // ``` + repeated float in = 6 [(predefined).cel = { + id: "float.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MyFloat { + // // value must not be in list [1.0, 2.0, 3.0] + // float value = 1 [(buf.validate.field).float = { not_in: [1.0, 2.0, 3.0] }]; + // } + // ``` + repeated float not_in = 7 [(predefined).cel = { + id: "float.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `finite` requires the field value to be finite. If the field value is + // infinite or NaN, an error message is generated. + optional bool finite = 8 [(predefined).cel = { + id: "float.finite" + expression: "rules.finite ? (this.isNan() || this.isInf() ? 'value must be finite' : '') : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyFloat { + // float value = 1 [ + // (buf.validate.field).float.example = 1.0, + // (buf.validate.field).float.example = inf + // ]; + // } + // ``` + repeated float example = 9 [(predefined).cel = { + id: "float.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// DoubleRules describes the rules applied to `double` values. These +// rules may also be applied to the `google.protobuf.DoubleValue` Well-Known-Type. +message DoubleRules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MyDouble { + // // value must equal 42.0 + // double value = 1 [(buf.validate.field).double.const = 42.0]; + // } + // ``` + optional double const = 1 [(predefined).cel = { + id: "double.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field < + // value). If the field value is equal to or greater than the specified + // value, an error message is generated. + // + // ```proto + // message MyDouble { + // // value must be less than 10.0 + // double value = 1 [(buf.validate.field).double.lt = 10.0]; + // } + // ``` + double lt = 2 [(predefined).cel = { + id: "double.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && (this.isNan() || this >= rules.lt)" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified value + // (field <= value). If the field value is greater than the specified value, + // an error message is generated. + // + // ```proto + // message MyDouble { + // // value must be less than or equal to 10.0 + // double value = 1 [(buf.validate.field).double.lte = 10.0]; + // } + // ``` + double lte = 3 [(predefined).cel = { + id: "double.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && (this.isNan() || this > rules.lte)" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or `lte`, + // the range is reversed, and the field value must be outside the specified + // range. If the field value doesn't meet the required conditions, an error + // message is generated. + // + // ```proto + // message MyDouble { + // // value must be greater than 5.0 [double.gt] + // double value = 1 [(buf.validate.field).double.gt = 5.0]; + // + // // value must be greater than 5 and less than 10.0 [double.gt_lt] + // double other_value = 2 [(buf.validate.field).double = { gt: 5.0, lt: 10.0 }]; + // + // // value must be greater than 10 or less than 5.0 [double.gt_lt_exclusive] + // double another_value = 3 [(buf.validate.field).double = { gt: 10.0, lt: 5.0 }]; + // } + // ``` + double gt = 4 [ + (predefined).cel = { + id: "double.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && (this.isNan() || this <= rules.gt)" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "double.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this.isNan() || this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "double.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (this.isNan() || (rules.lt <= this && this <= rules.gt))" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "double.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this.isNan() || this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "double.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (this.isNan() || (rules.lte < this && this <= rules.gt))" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyDouble { + // // value must be greater than or equal to 5.0 [double.gte] + // double value = 1 [(buf.validate.field).double.gte = 5.0]; + // + // // value must be greater than or equal to 5.0 and less than 10.0 [double.gte_lt] + // double other_value = 2 [(buf.validate.field).double = { gte: 5.0, lt: 10.0 }]; + // + // // value must be greater than or equal to 10.0 or less than 5.0 [double.gte_lt_exclusive] + // double another_value = 3 [(buf.validate.field).double = { gte: 10.0, lt: 5.0 }]; + // } + // ``` + double gte = 5 [ + (predefined).cel = { + id: "double.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && (this.isNan() || this < rules.gte)" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "double.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this.isNan() || this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "double.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (this.isNan() || (rules.lt <= this && this < rules.gte))" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "double.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this.isNan() || this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "double.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (this.isNan() || (rules.lte < this && this < rules.gte))" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message is + // generated. + // + // ```proto + // message MyDouble { + // // value must be in list [1.0, 2.0, 3.0] + // double value = 1 [(buf.validate.field).double = { in: [1.0, 2.0, 3.0] }]; + // } + // ``` + repeated double in = 6 [(predefined).cel = { + id: "double.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MyDouble { + // // value must not be in list [1.0, 2.0, 3.0] + // double value = 1 [(buf.validate.field).double = { not_in: [1.0, 2.0, 3.0] }]; + // } + // ``` + repeated double not_in = 7 [(predefined).cel = { + id: "double.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `finite` requires the field value to be finite. If the field value is + // infinite or NaN, an error message is generated. + optional bool finite = 8 [(predefined).cel = { + id: "double.finite" + expression: "rules.finite ? (this.isNan() || this.isInf() ? 'value must be finite' : '') : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyDouble { + // double value = 1 [ + // (buf.validate.field).double.example = 1.0, + // (buf.validate.field).double.example = inf + // ]; + // } + // ``` + repeated double example = 9 [(predefined).cel = { + id: "double.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// Int32Rules describes the rules applied to `int32` values. These +// rules may also be applied to the `google.protobuf.Int32Value` Well-Known-Type. +message Int32Rules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MyInt32 { + // // value must equal 42 + // int32 value = 1 [(buf.validate.field).int32.const = 42]; + // } + // ``` + optional int32 const = 1 [(predefined).cel = { + id: "int32.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field + // < value). If the field value is equal to or greater than the specified + // value, an error message is generated. + // + // ```proto + // message MyInt32 { + // // value must be less than 10 + // int32 value = 1 [(buf.validate.field).int32.lt = 10]; + // } + // ``` + int32 lt = 2 [(predefined).cel = { + id: "int32.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MyInt32 { + // // value must be less than or equal to 10 + // int32 value = 1 [(buf.validate.field).int32.lte = 10]; + // } + // ``` + int32 lte = 3 [(predefined).cel = { + id: "int32.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyInt32 { + // // value must be greater than 5 [int32.gt] + // int32 value = 1 [(buf.validate.field).int32.gt = 5]; + // + // // value must be greater than 5 and less than 10 [int32.gt_lt] + // int32 other_value = 2 [(buf.validate.field).int32 = { gt: 5, lt: 10 }]; + // + // // value must be greater than 10 or less than 5 [int32.gt_lt_exclusive] + // int32 another_value = 3 [(buf.validate.field).int32 = { gt: 10, lt: 5 }]; + // } + // ``` + int32 gt = 4 [ + (predefined).cel = { + id: "int32.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "int32.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "int32.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "int32.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "int32.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified value + // (exclusive). If the value of `gte` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyInt32 { + // // value must be greater than or equal to 5 [int32.gte] + // int32 value = 1 [(buf.validate.field).int32.gte = 5]; + // + // // value must be greater than or equal to 5 and less than 10 [int32.gte_lt] + // int32 other_value = 2 [(buf.validate.field).int32 = { gte: 5, lt: 10 }]; + // + // // value must be greater than or equal to 10 or less than 5 [int32.gte_lt_exclusive] + // int32 another_value = 3 [(buf.validate.field).int32 = { gte: 10, lt: 5 }]; + // } + // ``` + int32 gte = 5 [ + (predefined).cel = { + id: "int32.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "int32.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "int32.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "int32.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "int32.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message is + // generated. + // + // ```proto + // message MyInt32 { + // // value must be in list [1, 2, 3] + // int32 value = 1 [(buf.validate.field).int32 = { in: [1, 2, 3] }]; + // } + // ``` + repeated int32 in = 6 [(predefined).cel = { + id: "int32.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error message + // is generated. + // + // ```proto + // message MyInt32 { + // // value must not be in list [1, 2, 3] + // int32 value = 1 [(buf.validate.field).int32 = { not_in: [1, 2, 3] }]; + // } + // ``` + repeated int32 not_in = 7 [(predefined).cel = { + id: "int32.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyInt32 { + // int32 value = 1 [ + // (buf.validate.field).int32.example = 1, + // (buf.validate.field).int32.example = -10 + // ]; + // } + // ``` + repeated int32 example = 8 [(predefined).cel = { + id: "int32.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// Int64Rules describes the rules applied to `int64` values. These +// rules may also be applied to the `google.protobuf.Int64Value` Well-Known-Type. +message Int64Rules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MyInt64 { + // // value must equal 42 + // int64 value = 1 [(buf.validate.field).int64.const = 42]; + // } + // ``` + optional int64 const = 1 [(predefined).cel = { + id: "int64.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field < + // value). If the field value is equal to or greater than the specified value, + // an error message is generated. + // + // ```proto + // message MyInt64 { + // // value must be less than 10 + // int64 value = 1 [(buf.validate.field).int64.lt = 10]; + // } + // ``` + int64 lt = 2 [(predefined).cel = { + id: "int64.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MyInt64 { + // // value must be less than or equal to 10 + // int64 value = 1 [(buf.validate.field).int64.lte = 10]; + // } + // ``` + int64 lte = 3 [(predefined).cel = { + id: "int64.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyInt64 { + // // value must be greater than 5 [int64.gt] + // int64 value = 1 [(buf.validate.field).int64.gt = 5]; + // + // // value must be greater than 5 and less than 10 [int64.gt_lt] + // int64 other_value = 2 [(buf.validate.field).int64 = { gt: 5, lt: 10 }]; + // + // // value must be greater than 10 or less than 5 [int64.gt_lt_exclusive] + // int64 another_value = 3 [(buf.validate.field).int64 = { gt: 10, lt: 5 }]; + // } + // ``` + int64 gt = 4 [ + (predefined).cel = { + id: "int64.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "int64.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "int64.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "int64.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "int64.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyInt64 { + // // value must be greater than or equal to 5 [int64.gte] + // int64 value = 1 [(buf.validate.field).int64.gte = 5]; + // + // // value must be greater than or equal to 5 and less than 10 [int64.gte_lt] + // int64 other_value = 2 [(buf.validate.field).int64 = { gte: 5, lt: 10 }]; + // + // // value must be greater than or equal to 10 or less than 5 [int64.gte_lt_exclusive] + // int64 another_value = 3 [(buf.validate.field).int64 = { gte: 10, lt: 5 }]; + // } + // ``` + int64 gte = 5 [ + (predefined).cel = { + id: "int64.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "int64.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "int64.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "int64.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "int64.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message is + // generated. + // + // ```proto + // message MyInt64 { + // // value must be in list [1, 2, 3] + // int64 value = 1 [(buf.validate.field).int64 = { in: [1, 2, 3] }]; + // } + // ``` + repeated int64 in = 6 [(predefined).cel = { + id: "int64.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MyInt64 { + // // value must not be in list [1, 2, 3] + // int64 value = 1 [(buf.validate.field).int64 = { not_in: [1, 2, 3] }]; + // } + // ``` + repeated int64 not_in = 7 [(predefined).cel = { + id: "int64.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyInt64 { + // int64 value = 1 [ + // (buf.validate.field).int64.example = 1, + // (buf.validate.field).int64.example = -10 + // ]; + // } + // ``` + repeated int64 example = 9 [(predefined).cel = { + id: "int64.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// UInt32Rules describes the rules applied to `uint32` values. These +// rules may also be applied to the `google.protobuf.UInt32Value` Well-Known-Type. +message UInt32Rules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MyUInt32 { + // // value must equal 42 + // uint32 value = 1 [(buf.validate.field).uint32.const = 42]; + // } + // ``` + optional uint32 const = 1 [(predefined).cel = { + id: "uint32.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field < + // value). If the field value is equal to or greater than the specified value, + // an error message is generated. + // + // ```proto + // message MyUInt32 { + // // value must be less than 10 + // uint32 value = 1 [(buf.validate.field).uint32.lt = 10]; + // } + // ``` + uint32 lt = 2 [(predefined).cel = { + id: "uint32.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MyUInt32 { + // // value must be less than or equal to 10 + // uint32 value = 1 [(buf.validate.field).uint32.lte = 10]; + // } + // ``` + uint32 lte = 3 [(predefined).cel = { + id: "uint32.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyUInt32 { + // // value must be greater than 5 [uint32.gt] + // uint32 value = 1 [(buf.validate.field).uint32.gt = 5]; + // + // // value must be greater than 5 and less than 10 [uint32.gt_lt] + // uint32 other_value = 2 [(buf.validate.field).uint32 = { gt: 5, lt: 10 }]; + // + // // value must be greater than 10 or less than 5 [uint32.gt_lt_exclusive] + // uint32 another_value = 3 [(buf.validate.field).uint32 = { gt: 10, lt: 5 }]; + // } + // ``` + uint32 gt = 4 [ + (predefined).cel = { + id: "uint32.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "uint32.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "uint32.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "uint32.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "uint32.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyUInt32 { + // // value must be greater than or equal to 5 [uint32.gte] + // uint32 value = 1 [(buf.validate.field).uint32.gte = 5]; + // + // // value must be greater than or equal to 5 and less than 10 [uint32.gte_lt] + // uint32 other_value = 2 [(buf.validate.field).uint32 = { gte: 5, lt: 10 }]; + // + // // value must be greater than or equal to 10 or less than 5 [uint32.gte_lt_exclusive] + // uint32 another_value = 3 [(buf.validate.field).uint32 = { gte: 10, lt: 5 }]; + // } + // ``` + uint32 gte = 5 [ + (predefined).cel = { + id: "uint32.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "uint32.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "uint32.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "uint32.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "uint32.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message is + // generated. + // + // ```proto + // message MyUInt32 { + // // value must be in list [1, 2, 3] + // uint32 value = 1 [(buf.validate.field).uint32 = { in: [1, 2, 3] }]; + // } + // ``` + repeated uint32 in = 6 [(predefined).cel = { + id: "uint32.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MyUInt32 { + // // value must not be in list [1, 2, 3] + // uint32 value = 1 [(buf.validate.field).uint32 = { not_in: [1, 2, 3] }]; + // } + // ``` + repeated uint32 not_in = 7 [(predefined).cel = { + id: "uint32.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyUInt32 { + // uint32 value = 1 [ + // (buf.validate.field).uint32.example = 1, + // (buf.validate.field).uint32.example = 10 + // ]; + // } + // ``` + repeated uint32 example = 8 [(predefined).cel = { + id: "uint32.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// UInt64Rules describes the rules applied to `uint64` values. These +// rules may also be applied to the `google.protobuf.UInt64Value` Well-Known-Type. +message UInt64Rules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MyUInt64 { + // // value must equal 42 + // uint64 value = 1 [(buf.validate.field).uint64.const = 42]; + // } + // ``` + optional uint64 const = 1 [(predefined).cel = { + id: "uint64.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field < + // value). If the field value is equal to or greater than the specified value, + // an error message is generated. + // + // ```proto + // message MyUInt64 { + // // value must be less than 10 + // uint64 value = 1 [(buf.validate.field).uint64.lt = 10]; + // } + // ``` + uint64 lt = 2 [(predefined).cel = { + id: "uint64.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MyUInt64 { + // // value must be less than or equal to 10 + // uint64 value = 1 [(buf.validate.field).uint64.lte = 10]; + // } + // ``` + uint64 lte = 3 [(predefined).cel = { + id: "uint64.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyUInt64 { + // // value must be greater than 5 [uint64.gt] + // uint64 value = 1 [(buf.validate.field).uint64.gt = 5]; + // + // // value must be greater than 5 and less than 10 [uint64.gt_lt] + // uint64 other_value = 2 [(buf.validate.field).uint64 = { gt: 5, lt: 10 }]; + // + // // value must be greater than 10 or less than 5 [uint64.gt_lt_exclusive] + // uint64 another_value = 3 [(buf.validate.field).uint64 = { gt: 10, lt: 5 }]; + // } + // ``` + uint64 gt = 4 [ + (predefined).cel = { + id: "uint64.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "uint64.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "uint64.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "uint64.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "uint64.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyUInt64 { + // // value must be greater than or equal to 5 [uint64.gte] + // uint64 value = 1 [(buf.validate.field).uint64.gte = 5]; + // + // // value must be greater than or equal to 5 and less than 10 [uint64.gte_lt] + // uint64 other_value = 2 [(buf.validate.field).uint64 = { gte: 5, lt: 10 }]; + // + // // value must be greater than or equal to 10 or less than 5 [uint64.gte_lt_exclusive] + // uint64 another_value = 3 [(buf.validate.field).uint64 = { gte: 10, lt: 5 }]; + // } + // ``` + uint64 gte = 5 [ + (predefined).cel = { + id: "uint64.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "uint64.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "uint64.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "uint64.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "uint64.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message is + // generated. + // + // ```proto + // message MyUInt64 { + // // value must be in list [1, 2, 3] + // uint64 value = 1 [(buf.validate.field).uint64 = { in: [1, 2, 3] }]; + // } + // ``` + repeated uint64 in = 6 [(predefined).cel = { + id: "uint64.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MyUInt64 { + // // value must not be in list [1, 2, 3] + // uint64 value = 1 [(buf.validate.field).uint64 = { not_in: [1, 2, 3] }]; + // } + // ``` + repeated uint64 not_in = 7 [(predefined).cel = { + id: "uint64.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyUInt64 { + // uint64 value = 1 [ + // (buf.validate.field).uint64.example = 1, + // (buf.validate.field).uint64.example = -10 + // ]; + // } + // ``` + repeated uint64 example = 8 [(predefined).cel = { + id: "uint64.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// SInt32Rules describes the rules applied to `sint32` values. +message SInt32Rules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MySInt32 { + // // value must equal 42 + // sint32 value = 1 [(buf.validate.field).sint32.const = 42]; + // } + // ``` + optional sint32 const = 1 [(predefined).cel = { + id: "sint32.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field + // < value). If the field value is equal to or greater than the specified + // value, an error message is generated. + // + // ```proto + // message MySInt32 { + // // value must be less than 10 + // sint32 value = 1 [(buf.validate.field).sint32.lt = 10]; + // } + // ``` + sint32 lt = 2 [(predefined).cel = { + id: "sint32.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MySInt32 { + // // value must be less than or equal to 10 + // sint32 value = 1 [(buf.validate.field).sint32.lte = 10]; + // } + // ``` + sint32 lte = 3 [(predefined).cel = { + id: "sint32.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MySInt32 { + // // value must be greater than 5 [sint32.gt] + // sint32 value = 1 [(buf.validate.field).sint32.gt = 5]; + // + // // value must be greater than 5 and less than 10 [sint32.gt_lt] + // sint32 other_value = 2 [(buf.validate.field).sint32 = { gt: 5, lt: 10 }]; + // + // // value must be greater than 10 or less than 5 [sint32.gt_lt_exclusive] + // sint32 another_value = 3 [(buf.validate.field).sint32 = { gt: 10, lt: 5 }]; + // } + // ``` + sint32 gt = 4 [ + (predefined).cel = { + id: "sint32.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "sint32.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sint32.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sint32.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "sint32.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MySInt32 { + // // value must be greater than or equal to 5 [sint32.gte] + // sint32 value = 1 [(buf.validate.field).sint32.gte = 5]; + // + // // value must be greater than or equal to 5 and less than 10 [sint32.gte_lt] + // sint32 other_value = 2 [(buf.validate.field).sint32 = { gte: 5, lt: 10 }]; + // + // // value must be greater than or equal to 10 or less than 5 [sint32.gte_lt_exclusive] + // sint32 another_value = 3 [(buf.validate.field).sint32 = { gte: 10, lt: 5 }]; + // } + // ``` + sint32 gte = 5 [ + (predefined).cel = { + id: "sint32.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "sint32.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sint32.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sint32.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "sint32.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message is + // generated. + // + // ```proto + // message MySInt32 { + // // value must be in list [1, 2, 3] + // sint32 value = 1 [(buf.validate.field).sint32 = { in: [1, 2, 3] }]; + // } + // ``` + repeated sint32 in = 6 [(predefined).cel = { + id: "sint32.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MySInt32 { + // // value must not be in list [1, 2, 3] + // sint32 value = 1 [(buf.validate.field).sint32 = { not_in: [1, 2, 3] }]; + // } + // ``` + repeated sint32 not_in = 7 [(predefined).cel = { + id: "sint32.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MySInt32 { + // sint32 value = 1 [ + // (buf.validate.field).sint32.example = 1, + // (buf.validate.field).sint32.example = -10 + // ]; + // } + // ``` + repeated sint32 example = 8 [(predefined).cel = { + id: "sint32.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// SInt64Rules describes the rules applied to `sint64` values. +message SInt64Rules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MySInt64 { + // // value must equal 42 + // sint64 value = 1 [(buf.validate.field).sint64.const = 42]; + // } + // ``` + optional sint64 const = 1 [(predefined).cel = { + id: "sint64.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field + // < value). If the field value is equal to or greater than the specified + // value, an error message is generated. + // + // ```proto + // message MySInt64 { + // // value must be less than 10 + // sint64 value = 1 [(buf.validate.field).sint64.lt = 10]; + // } + // ``` + sint64 lt = 2 [(predefined).cel = { + id: "sint64.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MySInt64 { + // // value must be less than or equal to 10 + // sint64 value = 1 [(buf.validate.field).sint64.lte = 10]; + // } + // ``` + sint64 lte = 3 [(predefined).cel = { + id: "sint64.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MySInt64 { + // // value must be greater than 5 [sint64.gt] + // sint64 value = 1 [(buf.validate.field).sint64.gt = 5]; + // + // // value must be greater than 5 and less than 10 [sint64.gt_lt] + // sint64 other_value = 2 [(buf.validate.field).sint64 = { gt: 5, lt: 10 }]; + // + // // value must be greater than 10 or less than 5 [sint64.gt_lt_exclusive] + // sint64 another_value = 3 [(buf.validate.field).sint64 = { gt: 10, lt: 5 }]; + // } + // ``` + sint64 gt = 4 [ + (predefined).cel = { + id: "sint64.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "sint64.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sint64.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sint64.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "sint64.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MySInt64 { + // // value must be greater than or equal to 5 [sint64.gte] + // sint64 value = 1 [(buf.validate.field).sint64.gte = 5]; + // + // // value must be greater than or equal to 5 and less than 10 [sint64.gte_lt] + // sint64 other_value = 2 [(buf.validate.field).sint64 = { gte: 5, lt: 10 }]; + // + // // value must be greater than or equal to 10 or less than 5 [sint64.gte_lt_exclusive] + // sint64 another_value = 3 [(buf.validate.field).sint64 = { gte: 10, lt: 5 }]; + // } + // ``` + sint64 gte = 5 [ + (predefined).cel = { + id: "sint64.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "sint64.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sint64.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sint64.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "sint64.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message + // is generated. + // + // ```proto + // message MySInt64 { + // // value must be in list [1, 2, 3] + // sint64 value = 1 [(buf.validate.field).sint64 = { in: [1, 2, 3] }]; + // } + // ``` + repeated sint64 in = 6 [(predefined).cel = { + id: "sint64.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MySInt64 { + // // value must not be in list [1, 2, 3] + // sint64 value = 1 [(buf.validate.field).sint64 = { not_in: [1, 2, 3] }]; + // } + // ``` + repeated sint64 not_in = 7 [(predefined).cel = { + id: "sint64.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MySInt64 { + // sint64 value = 1 [ + // (buf.validate.field).sint64.example = 1, + // (buf.validate.field).sint64.example = -10 + // ]; + // } + // ``` + repeated sint64 example = 8 [(predefined).cel = { + id: "sint64.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// Fixed32Rules describes the rules applied to `fixed32` values. +message Fixed32Rules { + // `const` requires the field value to exactly match the specified value. + // If the field value doesn't match, an error message is generated. + // + // ```proto + // message MyFixed32 { + // // value must equal 42 + // fixed32 value = 1 [(buf.validate.field).fixed32.const = 42]; + // } + // ``` + optional fixed32 const = 1 [(predefined).cel = { + id: "fixed32.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field < + // value). If the field value is equal to or greater than the specified value, + // an error message is generated. + // + // ```proto + // message MyFixed32 { + // // value must be less than 10 + // fixed32 value = 1 [(buf.validate.field).fixed32.lt = 10]; + // } + // ``` + fixed32 lt = 2 [(predefined).cel = { + id: "fixed32.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MyFixed32 { + // // value must be less than or equal to 10 + // fixed32 value = 1 [(buf.validate.field).fixed32.lte = 10]; + // } + // ``` + fixed32 lte = 3 [(predefined).cel = { + id: "fixed32.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyFixed32 { + // // value must be greater than 5 [fixed32.gt] + // fixed32 value = 1 [(buf.validate.field).fixed32.gt = 5]; + // + // // value must be greater than 5 and less than 10 [fixed32.gt_lt] + // fixed32 other_value = 2 [(buf.validate.field).fixed32 = { gt: 5, lt: 10 }]; + // + // // value must be greater than 10 or less than 5 [fixed32.gt_lt_exclusive] + // fixed32 another_value = 3 [(buf.validate.field).fixed32 = { gt: 10, lt: 5 }]; + // } + // ``` + fixed32 gt = 4 [ + (predefined).cel = { + id: "fixed32.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "fixed32.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "fixed32.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "fixed32.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "fixed32.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyFixed32 { + // // value must be greater than or equal to 5 [fixed32.gte] + // fixed32 value = 1 [(buf.validate.field).fixed32.gte = 5]; + // + // // value must be greater than or equal to 5 and less than 10 [fixed32.gte_lt] + // fixed32 other_value = 2 [(buf.validate.field).fixed32 = { gte: 5, lt: 10 }]; + // + // // value must be greater than or equal to 10 or less than 5 [fixed32.gte_lt_exclusive] + // fixed32 another_value = 3 [(buf.validate.field).fixed32 = { gte: 10, lt: 5 }]; + // } + // ``` + fixed32 gte = 5 [ + (predefined).cel = { + id: "fixed32.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "fixed32.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "fixed32.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "fixed32.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "fixed32.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message + // is generated. + // + // ```proto + // message MyFixed32 { + // // value must be in list [1, 2, 3] + // fixed32 value = 1 [(buf.validate.field).fixed32 = { in: [1, 2, 3] }]; + // } + // ``` + repeated fixed32 in = 6 [(predefined).cel = { + id: "fixed32.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MyFixed32 { + // // value must not be in list [1, 2, 3] + // fixed32 value = 1 [(buf.validate.field).fixed32 = { not_in: [1, 2, 3] }]; + // } + // ``` + repeated fixed32 not_in = 7 [(predefined).cel = { + id: "fixed32.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyFixed32 { + // fixed32 value = 1 [ + // (buf.validate.field).fixed32.example = 1, + // (buf.validate.field).fixed32.example = 2 + // ]; + // } + // ``` + repeated fixed32 example = 8 [(predefined).cel = { + id: "fixed32.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// Fixed64Rules describes the rules applied to `fixed64` values. +message Fixed64Rules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MyFixed64 { + // // value must equal 42 + // fixed64 value = 1 [(buf.validate.field).fixed64.const = 42]; + // } + // ``` + optional fixed64 const = 1 [(predefined).cel = { + id: "fixed64.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field < + // value). If the field value is equal to or greater than the specified value, + // an error message is generated. + // + // ```proto + // message MyFixed64 { + // // value must be less than 10 + // fixed64 value = 1 [(buf.validate.field).fixed64.lt = 10]; + // } + // ``` + fixed64 lt = 2 [(predefined).cel = { + id: "fixed64.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MyFixed64 { + // // value must be less than or equal to 10 + // fixed64 value = 1 [(buf.validate.field).fixed64.lte = 10]; + // } + // ``` + fixed64 lte = 3 [(predefined).cel = { + id: "fixed64.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyFixed64 { + // // value must be greater than 5 [fixed64.gt] + // fixed64 value = 1 [(buf.validate.field).fixed64.gt = 5]; + // + // // value must be greater than 5 and less than 10 [fixed64.gt_lt] + // fixed64 other_value = 2 [(buf.validate.field).fixed64 = { gt: 5, lt: 10 }]; + // + // // value must be greater than 10 or less than 5 [fixed64.gt_lt_exclusive] + // fixed64 another_value = 3 [(buf.validate.field).fixed64 = { gt: 10, lt: 5 }]; + // } + // ``` + fixed64 gt = 4 [ + (predefined).cel = { + id: "fixed64.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "fixed64.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "fixed64.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "fixed64.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "fixed64.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyFixed64 { + // // value must be greater than or equal to 5 [fixed64.gte] + // fixed64 value = 1 [(buf.validate.field).fixed64.gte = 5]; + // + // // value must be greater than or equal to 5 and less than 10 [fixed64.gte_lt] + // fixed64 other_value = 2 [(buf.validate.field).fixed64 = { gte: 5, lt: 10 }]; + // + // // value must be greater than or equal to 10 or less than 5 [fixed64.gte_lt_exclusive] + // fixed64 another_value = 3 [(buf.validate.field).fixed64 = { gte: 10, lt: 5 }]; + // } + // ``` + fixed64 gte = 5 [ + (predefined).cel = { + id: "fixed64.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "fixed64.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "fixed64.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "fixed64.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "fixed64.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message is + // generated. + // + // ```proto + // message MyFixed64 { + // // value must be in list [1, 2, 3] + // fixed64 value = 1 [(buf.validate.field).fixed64 = { in: [1, 2, 3] }]; + // } + // ``` + repeated fixed64 in = 6 [(predefined).cel = { + id: "fixed64.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MyFixed64 { + // // value must not be in list [1, 2, 3] + // fixed64 value = 1 [(buf.validate.field).fixed64 = { not_in: [1, 2, 3] }]; + // } + // ``` + repeated fixed64 not_in = 7 [(predefined).cel = { + id: "fixed64.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyFixed64 { + // fixed64 value = 1 [ + // (buf.validate.field).fixed64.example = 1, + // (buf.validate.field).fixed64.example = 2 + // ]; + // } + // ``` + repeated fixed64 example = 8 [(predefined).cel = { + id: "fixed64.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// SFixed32Rules describes the rules applied to `fixed32` values. +message SFixed32Rules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MySFixed32 { + // // value must equal 42 + // sfixed32 value = 1 [(buf.validate.field).sfixed32.const = 42]; + // } + // ``` + optional sfixed32 const = 1 [(predefined).cel = { + id: "sfixed32.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field < + // value). If the field value is equal to or greater than the specified value, + // an error message is generated. + // + // ```proto + // message MySFixed32 { + // // value must be less than 10 + // sfixed32 value = 1 [(buf.validate.field).sfixed32.lt = 10]; + // } + // ``` + sfixed32 lt = 2 [(predefined).cel = { + id: "sfixed32.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MySFixed32 { + // // value must be less than or equal to 10 + // sfixed32 value = 1 [(buf.validate.field).sfixed32.lte = 10]; + // } + // ``` + sfixed32 lte = 3 [(predefined).cel = { + id: "sfixed32.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MySFixed32 { + // // value must be greater than 5 [sfixed32.gt] + // sfixed32 value = 1 [(buf.validate.field).sfixed32.gt = 5]; + // + // // value must be greater than 5 and less than 10 [sfixed32.gt_lt] + // sfixed32 other_value = 2 [(buf.validate.field).sfixed32 = { gt: 5, lt: 10 }]; + // + // // value must be greater than 10 or less than 5 [sfixed32.gt_lt_exclusive] + // sfixed32 another_value = 3 [(buf.validate.field).sfixed32 = { gt: 10, lt: 5 }]; + // } + // ``` + sfixed32 gt = 4 [ + (predefined).cel = { + id: "sfixed32.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "sfixed32.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sfixed32.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sfixed32.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "sfixed32.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MySFixed32 { + // // value must be greater than or equal to 5 [sfixed32.gte] + // sfixed32 value = 1 [(buf.validate.field).sfixed32.gte = 5]; + // + // // value must be greater than or equal to 5 and less than 10 [sfixed32.gte_lt] + // sfixed32 other_value = 2 [(buf.validate.field).sfixed32 = { gte: 5, lt: 10 }]; + // + // // value must be greater than or equal to 10 or less than 5 [sfixed32.gte_lt_exclusive] + // sfixed32 another_value = 3 [(buf.validate.field).sfixed32 = { gte: 10, lt: 5 }]; + // } + // ``` + sfixed32 gte = 5 [ + (predefined).cel = { + id: "sfixed32.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "sfixed32.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sfixed32.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sfixed32.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "sfixed32.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message is + // generated. + // + // ```proto + // message MySFixed32 { + // // value must be in list [1, 2, 3] + // sfixed32 value = 1 [(buf.validate.field).sfixed32 = { in: [1, 2, 3] }]; + // } + // ``` + repeated sfixed32 in = 6 [(predefined).cel = { + id: "sfixed32.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MySFixed32 { + // // value must not be in list [1, 2, 3] + // sfixed32 value = 1 [(buf.validate.field).sfixed32 = { not_in: [1, 2, 3] }]; + // } + // ``` + repeated sfixed32 not_in = 7 [(predefined).cel = { + id: "sfixed32.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MySFixed32 { + // sfixed32 value = 1 [ + // (buf.validate.field).sfixed32.example = 1, + // (buf.validate.field).sfixed32.example = 2 + // ]; + // } + // ``` + repeated sfixed32 example = 8 [(predefined).cel = { + id: "sfixed32.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// SFixed64Rules describes the rules applied to `fixed64` values. +message SFixed64Rules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MySFixed64 { + // // value must equal 42 + // sfixed64 value = 1 [(buf.validate.field).sfixed64.const = 42]; + // } + // ``` + optional sfixed64 const = 1 [(predefined).cel = { + id: "sfixed64.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field < + // value). If the field value is equal to or greater than the specified value, + // an error message is generated. + // + // ```proto + // message MySFixed64 { + // // value must be less than 10 + // sfixed64 value = 1 [(buf.validate.field).sfixed64.lt = 10]; + // } + // ``` + sfixed64 lt = 2 [(predefined).cel = { + id: "sfixed64.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MySFixed64 { + // // value must be less than or equal to 10 + // sfixed64 value = 1 [(buf.validate.field).sfixed64.lte = 10]; + // } + // ``` + sfixed64 lte = 3 [(predefined).cel = { + id: "sfixed64.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MySFixed64 { + // // value must be greater than 5 [sfixed64.gt] + // sfixed64 value = 1 [(buf.validate.field).sfixed64.gt = 5]; + // + // // value must be greater than 5 and less than 10 [sfixed64.gt_lt] + // sfixed64 other_value = 2 [(buf.validate.field).sfixed64 = { gt: 5, lt: 10 }]; + // + // // value must be greater than 10 or less than 5 [sfixed64.gt_lt_exclusive] + // sfixed64 another_value = 3 [(buf.validate.field).sfixed64 = { gt: 10, lt: 5 }]; + // } + // ``` + sfixed64 gt = 4 [ + (predefined).cel = { + id: "sfixed64.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "sfixed64.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sfixed64.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sfixed64.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "sfixed64.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MySFixed64 { + // // value must be greater than or equal to 5 [sfixed64.gte] + // sfixed64 value = 1 [(buf.validate.field).sfixed64.gte = 5]; + // + // // value must be greater than or equal to 5 and less than 10 [sfixed64.gte_lt] + // sfixed64 other_value = 2 [(buf.validate.field).sfixed64 = { gte: 5, lt: 10 }]; + // + // // value must be greater than or equal to 10 or less than 5 [sfixed64.gte_lt_exclusive] + // sfixed64 another_value = 3 [(buf.validate.field).sfixed64 = { gte: 10, lt: 5 }]; + // } + // ``` + sfixed64 gte = 5 [ + (predefined).cel = { + id: "sfixed64.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "sfixed64.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sfixed64.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sfixed64.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "sfixed64.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message is + // generated. + // + // ```proto + // message MySFixed64 { + // // value must be in list [1, 2, 3] + // sfixed64 value = 1 [(buf.validate.field).sfixed64 = { in: [1, 2, 3] }]; + // } + // ``` + repeated sfixed64 in = 6 [(predefined).cel = { + id: "sfixed64.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MySFixed64 { + // // value must not be in list [1, 2, 3] + // sfixed64 value = 1 [(buf.validate.field).sfixed64 = { not_in: [1, 2, 3] }]; + // } + // ``` + repeated sfixed64 not_in = 7 [(predefined).cel = { + id: "sfixed64.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MySFixed64 { + // sfixed64 value = 1 [ + // (buf.validate.field).sfixed64.example = 1, + // (buf.validate.field).sfixed64.example = 2 + // ]; + // } + // ``` + repeated sfixed64 example = 8 [(predefined).cel = { + id: "sfixed64.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// BoolRules describes the rules applied to `bool` values. These rules +// may also be applied to the `google.protobuf.BoolValue` Well-Known-Type. +message BoolRules { + // `const` requires the field value to exactly match the specified boolean value. + // If the field value doesn't match, an error message is generated. + // + // ```proto + // message MyBool { + // // value must equal true + // bool value = 1 [(buf.validate.field).bool.const = true]; + // } + // ``` + optional bool const = 1 [(predefined).cel = { + id: "bool.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyBool { + // bool value = 1 [ + // (buf.validate.field).bool.example = 1, + // (buf.validate.field).bool.example = 2 + // ]; + // } + // ``` + repeated bool example = 2 [(predefined).cel = { + id: "bool.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// StringRules describes the rules applied to `string` values These +// rules may also be applied to the `google.protobuf.StringValue` Well-Known-Type. +message StringRules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MyString { + // // value must equal `hello` + // string value = 1 [(buf.validate.field).string.const = "hello"]; + // } + // ``` + optional string const = 1 [(predefined).cel = { + id: "string.const" + expression: "this != getField(rules, 'const') ? 'value must equal `%s`'.format([getField(rules, 'const')]) : ''" + }]; + + // `len` dictates that the field value must have the specified + // number of characters (Unicode code points), which may differ from the number + // of bytes in the string. If the field value does not meet the specified + // length, an error message will be generated. + // + // ```proto + // message MyString { + // // value length must be 5 characters + // string value = 1 [(buf.validate.field).string.len = 5]; + // } + // ``` + optional uint64 len = 19 [(predefined).cel = { + id: "string.len" + expression: "uint(this.size()) != rules.len ? 'value length must be %s characters'.format([rules.len]) : ''" + }]; + + // `min_len` specifies that the field value must have at least the specified + // number of characters (Unicode code points), which may differ from the number + // of bytes in the string. If the field value contains fewer characters, an error + // message will be generated. + // + // ```proto + // message MyString { + // // value length must be at least 3 characters + // string value = 1 [(buf.validate.field).string.min_len = 3]; + // } + // ``` + optional uint64 min_len = 2 [(predefined).cel = { + id: "string.min_len" + expression: "uint(this.size()) < rules.min_len ? 'value length must be at least %s characters'.format([rules.min_len]) : ''" + }]; + + // `max_len` specifies that the field value must have no more than the specified + // number of characters (Unicode code points), which may differ from the + // number of bytes in the string. If the field value contains more characters, + // an error message will be generated. + // + // ```proto + // message MyString { + // // value length must be at most 10 characters + // string value = 1 [(buf.validate.field).string.max_len = 10]; + // } + // ``` + optional uint64 max_len = 3 [(predefined).cel = { + id: "string.max_len" + expression: "uint(this.size()) > rules.max_len ? 'value length must be at most %s characters'.format([rules.max_len]) : ''" + }]; + + // `len_bytes` dictates that the field value must have the specified number of + // bytes. If the field value does not match the specified length in bytes, + // an error message will be generated. + // + // ```proto + // message MyString { + // // value length must be 6 bytes + // string value = 1 [(buf.validate.field).string.len_bytes = 6]; + // } + // ``` + optional uint64 len_bytes = 20 [(predefined).cel = { + id: "string.len_bytes" + expression: "uint(bytes(this).size()) != rules.len_bytes ? 'value length must be %s bytes'.format([rules.len_bytes]) : ''" + }]; + + // `min_bytes` specifies that the field value must have at least the specified + // number of bytes. If the field value contains fewer bytes, an error message + // will be generated. + // + // ```proto + // message MyString { + // // value length must be at least 4 bytes + // string value = 1 [(buf.validate.field).string.min_bytes = 4]; + // } + // + // ``` + optional uint64 min_bytes = 4 [(predefined).cel = { + id: "string.min_bytes" + expression: "uint(bytes(this).size()) < rules.min_bytes ? 'value length must be at least %s bytes'.format([rules.min_bytes]) : ''" + }]; + + // `max_bytes` specifies that the field value must have no more than the + //specified number of bytes. If the field value contains more bytes, an + // error message will be generated. + // + // ```proto + // message MyString { + // // value length must be at most 8 bytes + // string value = 1 [(buf.validate.field).string.max_bytes = 8]; + // } + // ``` + optional uint64 max_bytes = 5 [(predefined).cel = { + id: "string.max_bytes" + expression: "uint(bytes(this).size()) > rules.max_bytes ? 'value length must be at most %s bytes'.format([rules.max_bytes]) : ''" + }]; + + // `pattern` specifies that the field value must match the specified + // regular expression (RE2 syntax), with the expression provided without any + // delimiters. If the field value doesn't match the regular expression, an + // error message will be generated. + // + // ```proto + // message MyString { + // // value does not match regex pattern `^[a-zA-Z]//$` + // string value = 1 [(buf.validate.field).string.pattern = "^[a-zA-Z]//$"]; + // } + // ``` + optional string pattern = 6 [(predefined).cel = { + id: "string.pattern" + expression: "!this.matches(rules.pattern) ? 'value does not match regex pattern `%s`'.format([rules.pattern]) : ''" + }]; + + // `prefix` specifies that the field value must have the + //specified substring at the beginning of the string. If the field value + // doesn't start with the specified prefix, an error message will be + // generated. + // + // ```proto + // message MyString { + // // value does not have prefix `pre` + // string value = 1 [(buf.validate.field).string.prefix = "pre"]; + // } + // ``` + optional string prefix = 7 [(predefined).cel = { + id: "string.prefix" + expression: "!this.startsWith(rules.prefix) ? 'value does not have prefix `%s`'.format([rules.prefix]) : ''" + }]; + + // `suffix` specifies that the field value must have the + //specified substring at the end of the string. If the field value doesn't + // end with the specified suffix, an error message will be generated. + // + // ```proto + // message MyString { + // // value does not have suffix `post` + // string value = 1 [(buf.validate.field).string.suffix = "post"]; + // } + // ``` + optional string suffix = 8 [(predefined).cel = { + id: "string.suffix" + expression: "!this.endsWith(rules.suffix) ? 'value does not have suffix `%s`'.format([rules.suffix]) : ''" + }]; + + // `contains` specifies that the field value must have the + //specified substring anywhere in the string. If the field value doesn't + // contain the specified substring, an error message will be generated. + // + // ```proto + // message MyString { + // // value does not contain substring `inside`. + // string value = 1 [(buf.validate.field).string.contains = "inside"]; + // } + // ``` + optional string contains = 9 [(predefined).cel = { + id: "string.contains" + expression: "!this.contains(rules.contains) ? 'value does not contain substring `%s`'.format([rules.contains]) : ''" + }]; + + // `not_contains` specifies that the field value must not have the + //specified substring anywhere in the string. If the field value contains + // the specified substring, an error message will be generated. + // + // ```proto + // message MyString { + // // value contains substring `inside`. + // string value = 1 [(buf.validate.field).string.not_contains = "inside"]; + // } + // ``` + optional string not_contains = 23 [(predefined).cel = { + id: "string.not_contains" + expression: "this.contains(rules.not_contains) ? 'value contains substring `%s`'.format([rules.not_contains]) : ''" + }]; + + // `in` specifies that the field value must be equal to one of the specified + // values. If the field value isn't one of the specified values, an error + // message will be generated. + // + // ```proto + // message MyString { + // // value must be in list ["apple", "banana"] + // string value = 1 [(buf.validate.field).string.in = "apple", (buf.validate.field).string.in = "banana"]; + // } + // ``` + repeated string in = 10 [(predefined).cel = { + id: "string.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` specifies that the field value cannot be equal to any + // of the specified values. If the field value is one of the specified values, + // an error message will be generated. + // ```proto + // message MyString { + // // value must not be in list ["orange", "grape"] + // string value = 1 [(buf.validate.field).string.not_in = "orange", (buf.validate.field).string.not_in = "grape"]; + // } + // ``` + repeated string not_in = 11 [(predefined).cel = { + id: "string.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `WellKnown` rules provide advanced rules against common string + // patterns. + oneof well_known { + // `email` specifies that the field value must be a valid email address, for + // example "foo@example.com". + // + // Conforms to the definition for a valid email address from the [HTML standard](https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address). + // Note that this standard willfully deviates from [RFC 5322](https://datatracker.ietf.org/doc/html/rfc5322), + // which allows many unexpected forms of email addresses and will easily match + // a typographical error. + // + // If the field value isn't a valid email address, an error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid email address + // string value = 1 [(buf.validate.field).string.email = true]; + // } + // ``` + bool email = 12 [ + (predefined).cel = { + id: "string.email" + message: "value must be a valid email address" + expression: "!rules.email || this == '' || this.isEmail()" + }, + (predefined).cel = { + id: "string.email_empty" + message: "value is empty, which is not a valid email address" + expression: "!rules.email || this != ''" + } + ]; + + // `hostname` specifies that the field value must be a valid hostname, for + // example "foo.example.com". + // + // A valid hostname follows the rules below: + // - The name consists of one or more labels, separated by a dot ("."). + // - Each label can be 1 to 63 alphanumeric characters. + // - A label can contain hyphens ("-"), but must not start or end with a hyphen. + // - The right-most label must not be digits only. + // - The name can have a trailing dot—for example, "foo.example.com.". + // - The name can be 253 characters at most, excluding the optional trailing dot. + // + // If the field value isn't a valid hostname, an error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid hostname + // string value = 1 [(buf.validate.field).string.hostname = true]; + // } + // ``` + bool hostname = 13 [ + (predefined).cel = { + id: "string.hostname" + message: "value must be a valid hostname" + expression: "!rules.hostname || this == '' || this.isHostname()" + }, + (predefined).cel = { + id: "string.hostname_empty" + message: "value is empty, which is not a valid hostname" + expression: "!rules.hostname || this != ''" + } + ]; + + // `ip` specifies that the field value must be a valid IP (v4 or v6) address. + // + // IPv4 addresses are expected in the dotted decimal format—for example, "192.168.5.21". + // IPv6 addresses are expected in their text representation—for example, "::1", + // or "2001:0DB8:ABCD:0012::0". + // + // Both formats are well-defined in the internet standard [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986). + // Zone identifiers for IPv6 addresses (for example, "fe80::a%en1") are supported. + // + // If the field value isn't a valid IP address, an error message will be + // generated. + // + // ```proto + // message MyString { + // // value must be a valid IP address + // string value = 1 [(buf.validate.field).string.ip = true]; + // } + // ``` + bool ip = 14 [ + (predefined).cel = { + id: "string.ip" + message: "value must be a valid IP address" + expression: "!rules.ip || this == '' || this.isIp()" + }, + (predefined).cel = { + id: "string.ip_empty" + message: "value is empty, which is not a valid IP address" + expression: "!rules.ip || this != ''" + } + ]; + + // `ipv4` specifies that the field value must be a valid IPv4 address—for + // example "192.168.5.21". If the field value isn't a valid IPv4 address, an + // error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid IPv4 address + // string value = 1 [(buf.validate.field).string.ipv4 = true]; + // } + // ``` + bool ipv4 = 15 [ + (predefined).cel = { + id: "string.ipv4" + message: "value must be a valid IPv4 address" + expression: "!rules.ipv4 || this == '' || this.isIp(4)" + }, + (predefined).cel = { + id: "string.ipv4_empty" + message: "value is empty, which is not a valid IPv4 address" + expression: "!rules.ipv4 || this != ''" + } + ]; + + // `ipv6` specifies that the field value must be a valid IPv6 address—for + // example "::1", or "d7a:115c:a1e0:ab12:4843:cd96:626b:430b". If the field + // value is not a valid IPv6 address, an error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid IPv6 address + // string value = 1 [(buf.validate.field).string.ipv6 = true]; + // } + // ``` + bool ipv6 = 16 [ + (predefined).cel = { + id: "string.ipv6" + message: "value must be a valid IPv6 address" + expression: "!rules.ipv6 || this == '' || this.isIp(6)" + }, + (predefined).cel = { + id: "string.ipv6_empty" + message: "value is empty, which is not a valid IPv6 address" + expression: "!rules.ipv6 || this != ''" + } + ]; + + // `uri` specifies that the field value must be a valid URI, for example + // "https://example.com/foo/bar?baz=quux#frag". + // + // URI is defined in the internet standard [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986). + // Zone Identifiers in IPv6 address literals are supported ([RFC 6874](https://datatracker.ietf.org/doc/html/rfc6874)). + // + // If the field value isn't a valid URI, an error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid URI + // string value = 1 [(buf.validate.field).string.uri = true]; + // } + // ``` + bool uri = 17 [ + (predefined).cel = { + id: "string.uri" + message: "value must be a valid URI" + expression: "!rules.uri || this == '' || this.isUri()" + }, + (predefined).cel = { + id: "string.uri_empty" + message: "value is empty, which is not a valid URI" + expression: "!rules.uri || this != ''" + } + ]; + + // `uri_ref` specifies that the field value must be a valid URI Reference—either + // a URI such as "https://example.com/foo/bar?baz=quux#frag", or a Relative + // Reference such as "./foo/bar?query". + // + // URI, URI Reference, and Relative Reference are defined in the internet + // standard [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986). Zone + // Identifiers in IPv6 address literals are supported ([RFC 6874](https://datatracker.ietf.org/doc/html/rfc6874)). + // + // If the field value isn't a valid URI Reference, an error message will be + // generated. + // + // ```proto + // message MyString { + // // value must be a valid URI Reference + // string value = 1 [(buf.validate.field).string.uri_ref = true]; + // } + // ``` + bool uri_ref = 18 [(predefined).cel = { + id: "string.uri_ref" + message: "value must be a valid URI Reference" + expression: "!rules.uri_ref || this.isUriRef()" + }]; + + // `address` specifies that the field value must be either a valid hostname + // (for example, "example.com"), or a valid IP (v4 or v6) address (for example, + // "192.168.0.1", or "::1"). If the field value isn't a valid hostname or IP, + // an error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid hostname, or ip address + // string value = 1 [(buf.validate.field).string.address = true]; + // } + // ``` + bool address = 21 [ + (predefined).cel = { + id: "string.address" + message: "value must be a valid hostname, or ip address" + expression: "!rules.address || this == '' || this.isHostname() || this.isIp()" + }, + (predefined).cel = { + id: "string.address_empty" + message: "value is empty, which is not a valid hostname, or ip address" + expression: "!rules.address || this != ''" + } + ]; + + // `uuid` specifies that the field value must be a valid UUID as defined by + // [RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122#section-4.1.2). If the + // field value isn't a valid UUID, an error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid UUID + // string value = 1 [(buf.validate.field).string.uuid = true]; + // } + // ``` + bool uuid = 22 [ + (predefined).cel = { + id: "string.uuid" + message: "value must be a valid UUID" + expression: "!rules.uuid || this == '' || this.matches('^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$')" + }, + (predefined).cel = { + id: "string.uuid_empty" + message: "value is empty, which is not a valid UUID" + expression: "!rules.uuid || this != ''" + } + ]; + + // `tuuid` (trimmed UUID) specifies that the field value must be a valid UUID as + // defined by [RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122#section-4.1.2) with all dashes + // omitted. If the field value isn't a valid UUID without dashes, an error message + // will be generated. + // + // ```proto + // message MyString { + // // value must be a valid trimmed UUID + // string value = 1 [(buf.validate.field).string.tuuid = true]; + // } + // ``` + bool tuuid = 33 [ + (predefined).cel = { + id: "string.tuuid" + message: "value must be a valid trimmed UUID" + expression: "!rules.tuuid || this == '' || this.matches('^[0-9a-fA-F]{32}$')" + }, + (predefined).cel = { + id: "string.tuuid_empty" + message: "value is empty, which is not a valid trimmed UUID" + expression: "!rules.tuuid || this != ''" + } + ]; + + // `ip_with_prefixlen` specifies that the field value must be a valid IP + // (v4 or v6) address with prefix length—for example, "192.168.5.21/16" or + // "2001:0DB8:ABCD:0012::F1/64". If the field value isn't a valid IP with + // prefix length, an error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid IP with prefix length + // string value = 1 [(buf.validate.field).string.ip_with_prefixlen = true]; + // } + // ``` + bool ip_with_prefixlen = 26 [ + (predefined).cel = { + id: "string.ip_with_prefixlen" + message: "value must be a valid IP prefix" + expression: "!rules.ip_with_prefixlen || this == '' || this.isIpPrefix()" + }, + (predefined).cel = { + id: "string.ip_with_prefixlen_empty" + message: "value is empty, which is not a valid IP prefix" + expression: "!rules.ip_with_prefixlen || this != ''" + } + ]; + + // `ipv4_with_prefixlen` specifies that the field value must be a valid + // IPv4 address with prefix length—for example, "192.168.5.21/16". If the + // field value isn't a valid IPv4 address with prefix length, an error + // message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid IPv4 address with prefix length + // string value = 1 [(buf.validate.field).string.ipv4_with_prefixlen = true]; + // } + // ``` + bool ipv4_with_prefixlen = 27 [ + (predefined).cel = { + id: "string.ipv4_with_prefixlen" + message: "value must be a valid IPv4 address with prefix length" + expression: "!rules.ipv4_with_prefixlen || this == '' || this.isIpPrefix(4)" + }, + (predefined).cel = { + id: "string.ipv4_with_prefixlen_empty" + message: "value is empty, which is not a valid IPv4 address with prefix length" + expression: "!rules.ipv4_with_prefixlen || this != ''" + } + ]; + + // `ipv6_with_prefixlen` specifies that the field value must be a valid + // IPv6 address with prefix length—for example, "2001:0DB8:ABCD:0012::F1/64". + // If the field value is not a valid IPv6 address with prefix length, + // an error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid IPv6 address prefix length + // string value = 1 [(buf.validate.field).string.ipv6_with_prefixlen = true]; + // } + // ``` + bool ipv6_with_prefixlen = 28 [ + (predefined).cel = { + id: "string.ipv6_with_prefixlen" + message: "value must be a valid IPv6 address with prefix length" + expression: "!rules.ipv6_with_prefixlen || this == '' || this.isIpPrefix(6)" + }, + (predefined).cel = { + id: "string.ipv6_with_prefixlen_empty" + message: "value is empty, which is not a valid IPv6 address with prefix length" + expression: "!rules.ipv6_with_prefixlen || this != ''" + } + ]; + + // `ip_prefix` specifies that the field value must be a valid IP (v4 or v6) + // prefix—for example, "192.168.0.0/16" or "2001:0DB8:ABCD:0012::0/64". + // + // The prefix must have all zeros for the unmasked bits. For example, + // "2001:0DB8:ABCD:0012::0/64" designates the left-most 64 bits for the + // prefix, and the remaining 64 bits must be zero. + // + // If the field value isn't a valid IP prefix, an error message will be + // generated. + // + // ```proto + // message MyString { + // // value must be a valid IP prefix + // string value = 1 [(buf.validate.field).string.ip_prefix = true]; + // } + // ``` + bool ip_prefix = 29 [ + (predefined).cel = { + id: "string.ip_prefix" + message: "value must be a valid IP prefix" + expression: "!rules.ip_prefix || this == '' || this.isIpPrefix(true)" + }, + (predefined).cel = { + id: "string.ip_prefix_empty" + message: "value is empty, which is not a valid IP prefix" + expression: "!rules.ip_prefix || this != ''" + } + ]; + + // `ipv4_prefix` specifies that the field value must be a valid IPv4 + // prefix, for example "192.168.0.0/16". + // + // The prefix must have all zeros for the unmasked bits. For example, + // "192.168.0.0/16" designates the left-most 16 bits for the prefix, + // and the remaining 16 bits must be zero. + // + // If the field value isn't a valid IPv4 prefix, an error message + // will be generated. + // + // ```proto + // message MyString { + // // value must be a valid IPv4 prefix + // string value = 1 [(buf.validate.field).string.ipv4_prefix = true]; + // } + // ``` + bool ipv4_prefix = 30 [ + (predefined).cel = { + id: "string.ipv4_prefix" + message: "value must be a valid IPv4 prefix" + expression: "!rules.ipv4_prefix || this == '' || this.isIpPrefix(4, true)" + }, + (predefined).cel = { + id: "string.ipv4_prefix_empty" + message: "value is empty, which is not a valid IPv4 prefix" + expression: "!rules.ipv4_prefix || this != ''" + } + ]; + + // `ipv6_prefix` specifies that the field value must be a valid IPv6 prefix—for + // example, "2001:0DB8:ABCD:0012::0/64". + // + // The prefix must have all zeros for the unmasked bits. For example, + // "2001:0DB8:ABCD:0012::0/64" designates the left-most 64 bits for the + // prefix, and the remaining 64 bits must be zero. + // + // If the field value is not a valid IPv6 prefix, an error message will be + // generated. + // + // ```proto + // message MyString { + // // value must be a valid IPv6 prefix + // string value = 1 [(buf.validate.field).string.ipv6_prefix = true]; + // } + // ``` + bool ipv6_prefix = 31 [ + (predefined).cel = { + id: "string.ipv6_prefix" + message: "value must be a valid IPv6 prefix" + expression: "!rules.ipv6_prefix || this == '' || this.isIpPrefix(6, true)" + }, + (predefined).cel = { + id: "string.ipv6_prefix_empty" + message: "value is empty, which is not a valid IPv6 prefix" + expression: "!rules.ipv6_prefix || this != ''" + } + ]; + + // `host_and_port` specifies that the field value must be valid host/port + // pair—for example, "example.com:8080". + // + // The host can be one of: + //- An IPv4 address in dotted decimal format—for example, "192.168.5.21". + //- An IPv6 address enclosed in square brackets—for example, "[2001:0DB8:ABCD:0012::F1]". + //- A hostname—for example, "example.com". + // + // The port is separated by a colon. It must be non-empty, with a decimal number + // in the range of 0-65535, inclusive. + bool host_and_port = 32 [ + (predefined).cel = { + id: "string.host_and_port" + message: "value must be a valid host (hostname or IP address) and port pair" + expression: "!rules.host_and_port || this == '' || this.isHostAndPort(true)" + }, + (predefined).cel = { + id: "string.host_and_port_empty" + message: "value is empty, which is not a valid host and port pair" + expression: "!rules.host_and_port || this != ''" + } + ]; + + // `ulid` specifies that the field value must be a valid ULID (Universally Unique + // Lexicographically Sortable Identifier) as defined by the [ULID specification](https://github.com/ulid/spec). + // If the field value isn't a valid ULID, an error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid ULID + // string value = 1 [(buf.validate.field).string.ulid = true]; + // } + // ``` + bool ulid = 35 [ + (predefined).cel = { + id: "string.ulid" + message: "value must be a valid ULID" + expression: "!rules.ulid || this == '' || this.matches('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$')" + }, + (predefined).cel = { + id: "string.ulid_empty" + message: "value is empty, which is not a valid ULID" + expression: "!rules.ulid || this != ''" + } + ]; + + // `well_known_regex` specifies a common well-known pattern + // defined as a regex. If the field value doesn't match the well-known + // regex, an error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid HTTP header value + // string value = 1 [(buf.validate.field).string.well_known_regex = KNOWN_REGEX_HTTP_HEADER_VALUE]; + // } + // ``` + // + // #### KnownRegex + // + // `well_known_regex` contains some well-known patterns. + // + // | Name | Number | Description | + // |-------------------------------|--------|-------------------------------------------| + // | KNOWN_REGEX_UNSPECIFIED | 0 | | + // | KNOWN_REGEX_HTTP_HEADER_NAME | 1 | HTTP header name as defined by [RFC 7230](https://datatracker.ietf.org/doc/html/rfc7230#section-3.2) | + // | KNOWN_REGEX_HTTP_HEADER_VALUE | 2 | HTTP header value as defined by [RFC 7230](https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.4) | + KnownRegex well_known_regex = 24 [ + (predefined).cel = { + id: "string.well_known_regex.header_name" + message: "value must be a valid HTTP header name" + expression: + "rules.well_known_regex != 1 || this == '' || this.matches(!has(rules.strict) || rules.strict ?" + "'^:?[0-9a-zA-Z!#$%&\\'*+-.^_|~\\x60]+$' :" + "'^[^\\u0000\\u000A\\u000D]+$')" + }, + (predefined).cel = { + id: "string.well_known_regex.header_name_empty" + message: "value is empty, which is not a valid HTTP header name" + expression: "rules.well_known_regex != 1 || this != ''" + }, + (predefined).cel = { + id: "string.well_known_regex.header_value" + message: "value must be a valid HTTP header value" + expression: + "rules.well_known_regex != 2 || this.matches(!has(rules.strict) || rules.strict ?" + "'^[^\\u0000-\\u0008\\u000A-\\u001F\\u007F]*$' :" + "'^[^\\u0000\\u000A\\u000D]*$')" + } + ]; + } + + // This applies to regexes `HTTP_HEADER_NAME` and `HTTP_HEADER_VALUE` to + // enable strict header validation. By default, this is true, and HTTP header + // validations are [RFC-compliant](https://datatracker.ietf.org/doc/html/rfc7230#section-3). Setting to false will enable looser + // validations that only disallow `\r\n\0` characters, which can be used to + // bypass header matching rules. + // + // ```proto + // message MyString { + // // The field `value` must have be a valid HTTP headers, but not enforced with strict rules. + // string value = 1 [(buf.validate.field).string.strict = false]; + // } + // ``` + optional bool strict = 25; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyString { + // string value = 1 [ + // (buf.validate.field).string.example = "hello", + // (buf.validate.field).string.example = "world" + // ]; + // } + // ``` + repeated string example = 34 [(predefined).cel = { + id: "string.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// KnownRegex contains some well-known patterns. +enum KnownRegex { + KNOWN_REGEX_UNSPECIFIED = 0; + + // HTTP header name as defined by [RFC 7230](https://datatracker.ietf.org/doc/html/rfc7230#section-3.2). + KNOWN_REGEX_HTTP_HEADER_NAME = 1; + + // HTTP header value as defined by [RFC 7230](https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.4). + KNOWN_REGEX_HTTP_HEADER_VALUE = 2; +} + +// BytesRules describe the rules applied to `bytes` values. These rules +// may also be applied to the `google.protobuf.BytesValue` Well-Known-Type. +message BytesRules { + // `const` requires the field value to exactly match the specified bytes + // value. If the field value doesn't match, an error message is generated. + // + // ```proto + // message MyBytes { + // // value must be "\x01\x02\x03\x04" + // bytes value = 1 [(buf.validate.field).bytes.const = "\x01\x02\x03\x04"]; + // } + // ``` + optional bytes const = 1 [(predefined).cel = { + id: "bytes.const" + expression: "this != getField(rules, 'const') ? 'value must be %x'.format([getField(rules, 'const')]) : ''" + }]; + + // `len` requires the field value to have the specified length in bytes. + // If the field value doesn't match, an error message is generated. + // + // ```proto + // message MyBytes { + // // value length must be 4 bytes. + // optional bytes value = 1 [(buf.validate.field).bytes.len = 4]; + // } + // ``` + optional uint64 len = 13 [(predefined).cel = { + id: "bytes.len" + expression: "uint(this.size()) != rules.len ? 'value length must be %s bytes'.format([rules.len]) : ''" + }]; + + // `min_len` requires the field value to have at least the specified minimum + // length in bytes. + // If the field value doesn't meet the requirement, an error message is generated. + // + // ```proto + // message MyBytes { + // // value length must be at least 2 bytes. + // optional bytes value = 1 [(buf.validate.field).bytes.min_len = 2]; + // } + // ``` + optional uint64 min_len = 2 [(predefined).cel = { + id: "bytes.min_len" + expression: "uint(this.size()) < rules.min_len ? 'value length must be at least %s bytes'.format([rules.min_len]) : ''" + }]; + + // `max_len` requires the field value to have at most the specified maximum + // length in bytes. + // If the field value exceeds the requirement, an error message is generated. + // + // ```proto + // message MyBytes { + // // value must be at most 6 bytes. + // optional bytes value = 1 [(buf.validate.field).bytes.max_len = 6]; + // } + // ``` + optional uint64 max_len = 3 [(predefined).cel = { + id: "bytes.max_len" + expression: "uint(this.size()) > rules.max_len ? 'value must be at most %s bytes'.format([rules.max_len]) : ''" + }]; + + // `pattern` requires the field value to match the specified regular + // expression ([RE2 syntax](https://github.com/google/re2/wiki/Syntax)). + // The value of the field must be valid UTF-8 or validation will fail with a + // runtime error. + // If the field value doesn't match the pattern, an error message is generated. + // + // ```proto + // message MyBytes { + // // value must match regex pattern "^[a-zA-Z0-9]+$". + // optional bytes value = 1 [(buf.validate.field).bytes.pattern = "^[a-zA-Z0-9]+$"]; + // } + // ``` + optional string pattern = 4 [(predefined).cel = { + id: "bytes.pattern" + expression: "!string(this).matches(rules.pattern) ? 'value must match regex pattern `%s`'.format([rules.pattern]) : ''" + }]; + + // `prefix` requires the field value to have the specified bytes at the + // beginning of the string. + // If the field value doesn't meet the requirement, an error message is generated. + // + // ```proto + // message MyBytes { + // // value does not have prefix \x01\x02 + // optional bytes value = 1 [(buf.validate.field).bytes.prefix = "\x01\x02"]; + // } + // ``` + optional bytes prefix = 5 [(predefined).cel = { + id: "bytes.prefix" + expression: "!this.startsWith(rules.prefix) ? 'value does not have prefix %x'.format([rules.prefix]) : ''" + }]; + + // `suffix` requires the field value to have the specified bytes at the end + // of the string. + // If the field value doesn't meet the requirement, an error message is generated. + // + // ```proto + // message MyBytes { + // // value does not have suffix \x03\x04 + // optional bytes value = 1 [(buf.validate.field).bytes.suffix = "\x03\x04"]; + // } + // ``` + optional bytes suffix = 6 [(predefined).cel = { + id: "bytes.suffix" + expression: "!this.endsWith(rules.suffix) ? 'value does not have suffix %x'.format([rules.suffix]) : ''" + }]; + + // `contains` requires the field value to have the specified bytes anywhere in + // the string. + // If the field value doesn't meet the requirement, an error message is generated. + // + // ```proto + // message MyBytes { + // // value does not contain \x02\x03 + // optional bytes value = 1 [(buf.validate.field).bytes.contains = "\x02\x03"]; + // } + // ``` + optional bytes contains = 7 [(predefined).cel = { + id: "bytes.contains" + expression: "!this.contains(rules.contains) ? 'value does not contain %x'.format([rules.contains]) : ''" + }]; + + // `in` requires the field value to be equal to one of the specified + // values. If the field value doesn't match any of the specified values, an + // error message is generated. + // + // ```proto + // message MyBytes { + // // value must in ["\x01\x02", "\x02\x03", "\x03\x04"] + // optional bytes value = 1 [(buf.validate.field).bytes.in = {"\x01\x02", "\x02\x03", "\x03\x04"}]; + // } + // ``` + repeated bytes in = 8 [(predefined).cel = { + id: "bytes.in" + expression: "getField(rules, 'in').size() > 0 && !(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to be not equal to any of the specified + // values. + // If the field value matches any of the specified values, an error message is + // generated. + // + // ```proto + // message MyBytes { + // // value must not in ["\x01\x02", "\x02\x03", "\x03\x04"] + // optional bytes value = 1 [(buf.validate.field).bytes.not_in = {"\x01\x02", "\x02\x03", "\x03\x04"}]; + // } + // ``` + repeated bytes not_in = 9 [(predefined).cel = { + id: "bytes.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // WellKnown rules provide advanced rules against common byte + // patterns + oneof well_known { + // `ip` ensures that the field `value` is a valid IP address (v4 or v6) in byte format. + // If the field value doesn't meet this rule, an error message is generated. + // + // ```proto + // message MyBytes { + // // value must be a valid IP address + // optional bytes value = 1 [(buf.validate.field).bytes.ip = true]; + // } + // ``` + bool ip = 10 [ + (predefined).cel = { + id: "bytes.ip" + message: "value must be a valid IP address" + expression: "!rules.ip || this.size() == 0 || this.size() == 4 || this.size() == 16" + }, + (predefined).cel = { + id: "bytes.ip_empty" + message: "value is empty, which is not a valid IP address" + expression: "!rules.ip || this.size() != 0" + } + ]; + + // `ipv4` ensures that the field `value` is a valid IPv4 address in byte format. + // If the field value doesn't meet this rule, an error message is generated. + // + // ```proto + // message MyBytes { + // // value must be a valid IPv4 address + // optional bytes value = 1 [(buf.validate.field).bytes.ipv4 = true]; + // } + // ``` + bool ipv4 = 11 [ + (predefined).cel = { + id: "bytes.ipv4" + message: "value must be a valid IPv4 address" + expression: "!rules.ipv4 || this.size() == 0 || this.size() == 4" + }, + (predefined).cel = { + id: "bytes.ipv4_empty" + message: "value is empty, which is not a valid IPv4 address" + expression: "!rules.ipv4 || this.size() != 0" + } + ]; + + // `ipv6` ensures that the field `value` is a valid IPv6 address in byte format. + // If the field value doesn't meet this rule, an error message is generated. + // ```proto + // message MyBytes { + // // value must be a valid IPv6 address + // optional bytes value = 1 [(buf.validate.field).bytes.ipv6 = true]; + // } + // ``` + bool ipv6 = 12 [ + (predefined).cel = { + id: "bytes.ipv6" + message: "value must be a valid IPv6 address" + expression: "!rules.ipv6 || this.size() == 0 || this.size() == 16" + }, + (predefined).cel = { + id: "bytes.ipv6_empty" + message: "value is empty, which is not a valid IPv6 address" + expression: "!rules.ipv6 || this.size() != 0" + } + ]; + + // `uuid` ensures that the field `value` encodes the 128-bit UUID data as + // defined by [RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122#section-4.1.2). + // The field must contain exactly 16 bytes + // representing the UUID. If the field value isn't a valid UUID, an error + // message will be generated. + // + // ```proto + // message MyBytes { + // // value must be a valid UUID + // optional bytes value = 1 [(buf.validate.field).bytes.uuid = true]; + // } + // ``` + bool uuid = 15 [ + (predefined).cel = { + id: "bytes.uuid" + message: "value must be a valid UUID" + expression: "!rules.uuid || this.size() == 0 || this.size() == 16" + }, + (predefined).cel = { + id: "bytes.uuid_empty" + message: "value is empty, which is not a valid UUID" + expression: "!rules.uuid || this.size() != 0" + } + ]; + } + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyBytes { + // bytes value = 1 [ + // (buf.validate.field).bytes.example = "\x01\x02", + // (buf.validate.field).bytes.example = "\x02\x03" + // ]; + // } + // ``` + repeated bytes example = 14 [(predefined).cel = { + id: "bytes.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// EnumRules describe the rules applied to `enum` values. +message EnumRules { + // `const` requires the field value to exactly match the specified enum value. + // If the field value doesn't match, an error message is generated. + // + // ```proto + // enum MyEnum { + // MY_ENUM_UNSPECIFIED = 0; + // MY_ENUM_VALUE1 = 1; + // MY_ENUM_VALUE2 = 2; + // } + // + // message MyMessage { + // // The field `value` must be exactly MY_ENUM_VALUE1. + // MyEnum value = 1 [(buf.validate.field).enum.const = 1]; + // } + // ``` + optional int32 const = 1 [(predefined).cel = { + id: "enum.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + + // `defined_only` requires the field value to be one of the defined values for + // this enum, failing on any undefined value. + // + // ```proto + // enum MyEnum { + // MY_ENUM_UNSPECIFIED = 0; + // MY_ENUM_VALUE1 = 1; + // MY_ENUM_VALUE2 = 2; + // } + // + // message MyMessage { + // // The field `value` must be a defined value of MyEnum. + // MyEnum value = 1 [(buf.validate.field).enum.defined_only = true]; + // } + // ``` + optional bool defined_only = 2; + + // `in` requires the field value to be equal to one of the + //specified enum values. If the field value doesn't match any of the + //specified values, an error message is generated. + // + // ```proto + // enum MyEnum { + // MY_ENUM_UNSPECIFIED = 0; + // MY_ENUM_VALUE1 = 1; + // MY_ENUM_VALUE2 = 2; + // } + // + // message MyMessage { + // // The field `value` must be equal to one of the specified values. + // MyEnum value = 1 [(buf.validate.field).enum = { in: [1, 2]}]; + // } + // ``` + repeated int32 in = 3 [(predefined).cel = { + id: "enum.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to be not equal to any of the + //specified enum values. If the field value matches one of the specified + // values, an error message is generated. + // + // ```proto + // enum MyEnum { + // MY_ENUM_UNSPECIFIED = 0; + // MY_ENUM_VALUE1 = 1; + // MY_ENUM_VALUE2 = 2; + // } + // + // message MyMessage { + // // The field `value` must not be equal to any of the specified values. + // MyEnum value = 1 [(buf.validate.field).enum = { not_in: [1, 2]}]; + // } + // ``` + repeated int32 not_in = 4 [(predefined).cel = { + id: "enum.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // enum MyEnum { + // MY_ENUM_UNSPECIFIED = 0; + // MY_ENUM_VALUE1 = 1; + // MY_ENUM_VALUE2 = 2; + // } + // + // message MyMessage { + // (buf.validate.field).enum.example = 1, + // (buf.validate.field).enum.example = 2 + // } + // ``` + repeated int32 example = 5 [(predefined).cel = { + id: "enum.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// RepeatedRules describe the rules applied to `repeated` values. +message RepeatedRules { + // `min_items` requires that this field must contain at least the specified + // minimum number of items. + // + // Note that `min_items = 1` is equivalent to setting a field as `required`. + // + // ```proto + // message MyRepeated { + // // value must contain at least 2 items + // repeated string value = 1 [(buf.validate.field).repeated.min_items = 2]; + // } + // ``` + optional uint64 min_items = 1 [(predefined).cel = { + id: "repeated.min_items" + expression: "uint(this.size()) < rules.min_items ? 'value must contain at least %d item(s)'.format([rules.min_items]) : ''" + }]; + + // `max_items` denotes that this field must not exceed a + // certain number of items as the upper limit. If the field contains more + // items than specified, an error message will be generated, requiring the + // field to maintain no more than the specified number of items. + // + // ```proto + // message MyRepeated { + // // value must contain no more than 3 item(s) + // repeated string value = 1 [(buf.validate.field).repeated.max_items = 3]; + // } + // ``` + optional uint64 max_items = 2 [(predefined).cel = { + id: "repeated.max_items" + expression: "uint(this.size()) > rules.max_items ? 'value must contain no more than %s item(s)'.format([rules.max_items]) : ''" + }]; + + // `unique` indicates that all elements in this field must + // be unique. This rule is strictly applicable to scalar and enum + // types, with message types not being supported. + // + // ```proto + // message MyRepeated { + // // repeated value must contain unique items + // repeated string value = 1 [(buf.validate.field).repeated.unique = true]; + // } + // ``` + optional bool unique = 3 [(predefined).cel = { + id: "repeated.unique" + message: "repeated value must contain unique items" + expression: "!rules.unique || this.unique()" + }]; + + // `items` details the rules to be applied to each item + // in the field. Even for repeated message fields, validation is executed + // against each item unless `ignore` is specified. + // + // ```proto + // message MyRepeated { + // // The items in the field `value` must follow the specified rules. + // repeated string value = 1 [(buf.validate.field).repeated.items = { + // string: { + // min_len: 3 + // max_len: 10 + // } + // }]; + // } + // ``` + // + // Note that the `required` rule does not apply. Repeated items + // cannot be unset. + optional FieldRules items = 4; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// MapRules describe the rules applied to `map` values. +message MapRules { + // Specifies the minimum number of key-value pairs allowed. If the field has + // fewer key-value pairs than specified, an error message is generated. + // + // ```proto + // message MyMap { + // // The field `value` must have at least 2 key-value pairs. + // map value = 1 [(buf.validate.field).map.min_pairs = 2]; + // } + // ``` + optional uint64 min_pairs = 1 [(predefined).cel = { + id: "map.min_pairs" + expression: "uint(this.size()) < rules.min_pairs ? 'map must be at least %d entries'.format([rules.min_pairs]) : ''" + }]; + + // Specifies the maximum number of key-value pairs allowed. If the field has + // more key-value pairs than specified, an error message is generated. + // + // ```proto + // message MyMap { + // // The field `value` must have at most 3 key-value pairs. + // map value = 1 [(buf.validate.field).map.max_pairs = 3]; + // } + // ``` + optional uint64 max_pairs = 2 [(predefined).cel = { + id: "map.max_pairs" + expression: "uint(this.size()) > rules.max_pairs ? 'map must be at most %d entries'.format([rules.max_pairs]) : ''" + }]; + + // Specifies the rules to be applied to each key in the field. + // + // ```proto + // message MyMap { + // // The keys in the field `value` must follow the specified rules. + // map value = 1 [(buf.validate.field).map.keys = { + // string: { + // min_len: 3 + // max_len: 10 + // } + // }]; + // } + // ``` + // + // Note that the `required` rule does not apply. Map keys cannot be unset. + optional FieldRules keys = 4; + + // Specifies the rules to be applied to the value of each key in the + // field. Message values will still have their validations evaluated unless + // `ignore` is specified. + // + // ```proto + // message MyMap { + // // The values in the field `value` must follow the specified rules. + // map value = 1 [(buf.validate.field).map.values = { + // string: { + // min_len: 5 + // max_len: 20 + // } + // }]; + // } + // ``` + // Note that the `required` rule does not apply. Map values cannot be unset. + optional FieldRules values = 5; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// AnyRules describe rules applied exclusively to the `google.protobuf.Any` well-known type. +message AnyRules { + // `in` requires the field's `type_url` to be equal to one of the + //specified values. If it doesn't match any of the specified values, an error + // message is generated. + // + // ```proto + // message MyAny { + // // The `value` field must have a `type_url` equal to one of the specified values. + // google.protobuf.Any value = 1 [(buf.validate.field).any = { + // in: ["type.googleapis.com/MyType1", "type.googleapis.com/MyType2"] + // }]; + // } + // ``` + repeated string in = 2; + + // requires the field's type_url to be not equal to any of the specified values. If it matches any of the specified values, an error message is generated. + // + // ```proto + // message MyAny { + // // The `value` field must not have a `type_url` equal to any of the specified values. + // google.protobuf.Any value = 1 [(buf.validate.field).any = { + // not_in: ["type.googleapis.com/ForbiddenType1", "type.googleapis.com/ForbiddenType2"] + // }]; + // } + // ``` + repeated string not_in = 3; +} + +// DurationRules describe the rules applied exclusively to the `google.protobuf.Duration` well-known type. +message DurationRules { + // `const` dictates that the field must match the specified value of the `google.protobuf.Duration` type exactly. + // If the field's value deviates from the specified value, an error message + // will be generated. + // + // ```proto + // message MyDuration { + // // value must equal 5s + // google.protobuf.Duration value = 1 [(buf.validate.field).duration.const = "5s"]; + // } + // ``` + optional google.protobuf.Duration const = 2 [(predefined).cel = { + id: "duration.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` stipulates that the field must be less than the specified value of the `google.protobuf.Duration` type, + // exclusive. If the field's value is greater than or equal to the specified + // value, an error message will be generated. + // + // ```proto + // message MyDuration { + // // value must be less than 5s + // google.protobuf.Duration value = 1 [(buf.validate.field).duration.lt = "5s"]; + // } + // ``` + google.protobuf.Duration lt = 3 [(predefined).cel = { + id: "duration.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` indicates that the field must be less than or equal to the specified + // value of the `google.protobuf.Duration` type, inclusive. If the field's value is greater than the specified value, + // an error message will be generated. + // + // ```proto + // message MyDuration { + // // value must be less than or equal to 10s + // google.protobuf.Duration value = 1 [(buf.validate.field).duration.lte = "10s"]; + // } + // ``` + google.protobuf.Duration lte = 4 [(predefined).cel = { + id: "duration.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the duration field value to be greater than the specified + // value (exclusive). If the value of `gt` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyDuration { + // // duration must be greater than 5s [duration.gt] + // google.protobuf.Duration value = 1 [(buf.validate.field).duration.gt = { seconds: 5 }]; + // + // // duration must be greater than 5s and less than 10s [duration.gt_lt] + // google.protobuf.Duration another_value = 2 [(buf.validate.field).duration = { gt: { seconds: 5 }, lt: { seconds: 10 } }]; + // + // // duration must be greater than 10s or less than 5s [duration.gt_lt_exclusive] + // google.protobuf.Duration other_value = 3 [(buf.validate.field).duration = { gt: { seconds: 10 }, lt: { seconds: 5 } }]; + // } + // ``` + google.protobuf.Duration gt = 5 [ + (predefined).cel = { + id: "duration.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "duration.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "duration.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "duration.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "duration.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the duration field value to be greater than or equal to the + // specified value (exclusive). If the value of `gte` is larger than a + // specified `lt` or `lte`, the range is reversed, and the field value must + // be outside the specified range. If the field value doesn't meet the + // required conditions, an error message is generated. + // + // ```proto + // message MyDuration { + // // duration must be greater than or equal to 5s [duration.gte] + // google.protobuf.Duration value = 1 [(buf.validate.field).duration.gte = { seconds: 5 }]; + // + // // duration must be greater than or equal to 5s and less than 10s [duration.gte_lt] + // google.protobuf.Duration another_value = 2 [(buf.validate.field).duration = { gte: { seconds: 5 }, lt: { seconds: 10 } }]; + // + // // duration must be greater than or equal to 10s or less than 5s [duration.gte_lt_exclusive] + // google.protobuf.Duration other_value = 3 [(buf.validate.field).duration = { gte: { seconds: 10 }, lt: { seconds: 5 } }]; + // } + // ``` + google.protobuf.Duration gte = 6 [ + (predefined).cel = { + id: "duration.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "duration.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "duration.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "duration.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "duration.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` asserts that the field must be equal to one of the specified values of the `google.protobuf.Duration` type. + // If the field's value doesn't correspond to any of the specified values, + // an error message will be generated. + // + // ```proto + // message MyDuration { + // // value must be in list [1s, 2s, 3s] + // google.protobuf.Duration value = 1 [(buf.validate.field).duration.in = ["1s", "2s", "3s"]]; + // } + // ``` + repeated google.protobuf.Duration in = 7 [(predefined).cel = { + id: "duration.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` denotes that the field must not be equal to + // any of the specified values of the `google.protobuf.Duration` type. + // If the field's value matches any of these values, an error message will be + // generated. + // + // ```proto + // message MyDuration { + // // value must not be in list [1s, 2s, 3s] + // google.protobuf.Duration value = 1 [(buf.validate.field).duration.not_in = ["1s", "2s", "3s"]]; + // } + // ``` + repeated google.protobuf.Duration not_in = 8 [(predefined).cel = { + id: "duration.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyDuration { + // google.protobuf.Duration value = 1 [ + // (buf.validate.field).duration.example = { seconds: 1 }, + // (buf.validate.field).duration.example = { seconds: 2 }, + // ]; + // } + // ``` + repeated google.protobuf.Duration example = 9 [(predefined).cel = { + id: "duration.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// FieldMaskRules describe rules applied exclusively to the `google.protobuf.FieldMask` well-known type. +message FieldMaskRules { + // `const` dictates that the field must match the specified value of the `google.protobuf.FieldMask` type exactly. + // If the field's value deviates from the specified value, an error message + // will be generated. + // + // ```proto + // message MyFieldMask { + // // value must equal ["a"] + // google.protobuf.FieldMask value = 1 [(buf.validate.field).field_mask.const = { + // paths: ["a"] + // }]; + // } + // ``` + optional google.protobuf.FieldMask const = 1 [(predefined).cel = { + id: "field_mask.const" + expression: "this.paths != getField(rules, 'const').paths ? 'value must equal paths %s'.format([getField(rules, 'const').paths]) : ''" + }]; + + // `in` requires the field value to only contain paths matching specified + // values or their subpaths. + // If any of the field value's paths doesn't match the rule, + // an error message is generated. + // See: https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask + // + // ```proto + // message MyFieldMask { + // // The `value` FieldMask must only contain paths listed in `in`. + // google.protobuf.FieldMask value = 1 [(buf.validate.field).field_mask = { + // in: ["a", "b", "c.a"] + // }]; + // } + // ``` + repeated string in = 2 [(predefined).cel = { + id: "field_mask.in" + expression: "!this.paths.all(p, p in getField(rules, 'in') || getField(rules, 'in').exists(f, p.startsWith(f+'.'))) ? 'value must only contain paths in %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not contain paths matching specified + // values or their subpaths. + // If any of the field value's paths matches the rule, + // an error message is generated. + // See: https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask + // + // ```proto + // message MyFieldMask { + // // The `value` FieldMask shall not contain paths listed in `not_in`. + // google.protobuf.FieldMask value = 1 [(buf.validate.field).field_mask = { + // not_in: ["forbidden", "immutable", "c.a"] + // }]; + // } + // ``` + repeated string not_in = 3 [(predefined).cel = { + id: "field_mask.not_in" + expression: "!this.paths.all(p, !(p in getField(rules, 'not_in') || getField(rules, 'not_in').exists(f, p.startsWith(f+'.')))) ? 'value must not contain any paths in %s'.format([getField(rules, 'not_in')]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyFieldMask { + // google.protobuf.FieldMask value = 1 [ + // (buf.validate.field).field_mask.example = { paths: ["a", "b"] }, + // (buf.validate.field).field_mask.example = { paths: ["c.a", "d"] }, + // ]; + // } + // ``` + repeated google.protobuf.FieldMask example = 4 [(predefined).cel = { + id: "field_mask.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// TimestampRules describe the rules applied exclusively to the `google.protobuf.Timestamp` well-known type. +message TimestampRules { + // `const` dictates that this field, of the `google.protobuf.Timestamp` type, must exactly match the specified value. If the field value doesn't correspond to the specified timestamp, an error message will be generated. + // + // ```proto + // message MyTimestamp { + // // value must equal 2023-05-03T10:00:00Z + // google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.const = {seconds: 1727998800}]; + // } + // ``` + optional google.protobuf.Timestamp const = 2 [(predefined).cel = { + id: "timestamp.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // requires the duration field value to be less than the specified value (field < value). If the field value doesn't meet the required conditions, an error message is generated. + // + // ```proto + // message MyDuration { + // // duration must be less than 'P3D' [duration.lt] + // google.protobuf.Duration value = 1 [(buf.validate.field).duration.lt = { seconds: 259200 }]; + // } + // ``` + google.protobuf.Timestamp lt = 3 [(predefined).cel = { + id: "timestamp.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // requires the timestamp field value to be less than or equal to the specified value (field <= value). If the field value doesn't meet the required conditions, an error message is generated. + // + // ```proto + // message MyTimestamp { + // // timestamp must be less than or equal to '2023-05-14T00:00:00Z' [timestamp.lte] + // google.protobuf.Timestamp value = 1 [(buf.validate.field).timestamp.lte = { seconds: 1678867200 }]; + // } + // ``` + google.protobuf.Timestamp lte = 4 [(predefined).cel = { + id: "timestamp.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + + // `lt_now` specifies that this field, of the `google.protobuf.Timestamp` type, must be less than the current time. `lt_now` can only be used with the `within` rule. + // + // ```proto + // message MyTimestamp { + // // value must be less than now + // google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.lt_now = true]; + // } + // ``` + bool lt_now = 7 [(predefined).cel = { + id: "timestamp.lt_now" + expression: "(rules.lt_now && this > now) ? 'value must be less than now' : ''" + }]; + } + oneof greater_than { + // `gt` requires the timestamp field value to be greater than the specified + // value (exclusive). If the value of `gt` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyTimestamp { + // // timestamp must be greater than '2023-01-01T00:00:00Z' [timestamp.gt] + // google.protobuf.Timestamp value = 1 [(buf.validate.field).timestamp.gt = { seconds: 1672444800 }]; + // + // // timestamp must be greater than '2023-01-01T00:00:00Z' and less than '2023-01-02T00:00:00Z' [timestamp.gt_lt] + // google.protobuf.Timestamp another_value = 2 [(buf.validate.field).timestamp = { gt: { seconds: 1672444800 }, lt: { seconds: 1672531200 } }]; + // + // // timestamp must be greater than '2023-01-02T00:00:00Z' or less than '2023-01-01T00:00:00Z' [timestamp.gt_lt_exclusive] + // google.protobuf.Timestamp other_value = 3 [(buf.validate.field).timestamp = { gt: { seconds: 1672531200 }, lt: { seconds: 1672444800 } }]; + // } + // ``` + google.protobuf.Timestamp gt = 5 [ + (predefined).cel = { + id: "timestamp.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "timestamp.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "timestamp.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "timestamp.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "timestamp.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the timestamp field value to be greater than or equal to the + // specified value (exclusive). If the value of `gte` is larger than a + // specified `lt` or `lte`, the range is reversed, and the field value + // must be outside the specified range. If the field value doesn't meet + // the required conditions, an error message is generated. + // + // ```proto + // message MyTimestamp { + // // timestamp must be greater than or equal to '2023-01-01T00:00:00Z' [timestamp.gte] + // google.protobuf.Timestamp value = 1 [(buf.validate.field).timestamp.gte = { seconds: 1672444800 }]; + // + // // timestamp must be greater than or equal to '2023-01-01T00:00:00Z' and less than '2023-01-02T00:00:00Z' [timestamp.gte_lt] + // google.protobuf.Timestamp another_value = 2 [(buf.validate.field).timestamp = { gte: { seconds: 1672444800 }, lt: { seconds: 1672531200 } }]; + // + // // timestamp must be greater than or equal to '2023-01-02T00:00:00Z' or less than '2023-01-01T00:00:00Z' [timestamp.gte_lt_exclusive] + // google.protobuf.Timestamp other_value = 3 [(buf.validate.field).timestamp = { gte: { seconds: 1672531200 }, lt: { seconds: 1672444800 } }]; + // } + // ``` + google.protobuf.Timestamp gte = 6 [ + (predefined).cel = { + id: "timestamp.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "timestamp.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "timestamp.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "timestamp.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "timestamp.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + + // `gt_now` specifies that this field, of the `google.protobuf.Timestamp` type, must be greater than the current time. `gt_now` can only be used with the `within` rule. + // + // ```proto + // message MyTimestamp { + // // value must be greater than now + // google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.gt_now = true]; + // } + // ``` + bool gt_now = 8 [(predefined).cel = { + id: "timestamp.gt_now" + expression: "(rules.gt_now && this < now) ? 'value must be greater than now' : ''" + }]; + } + + // `within` specifies that this field, of the `google.protobuf.Timestamp` type, must be within the specified duration of the current time. If the field value isn't within the duration, an error message is generated. + // + // ```proto + // message MyTimestamp { + // // value must be within 1 hour of now + // google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.within = {seconds: 3600}]; + // } + // ``` + optional google.protobuf.Duration within = 9 [(predefined).cel = { + id: "timestamp.within" + expression: "this < now-rules.within || this > now+rules.within ? 'value must be within %s of now'.format([rules.within]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyTimestamp { + // google.protobuf.Timestamp value = 1 [ + // (buf.validate.field).timestamp.example = { seconds: 1672444800 }, + // (buf.validate.field).timestamp.example = { seconds: 1672531200 }, + // ]; + // } + // ``` + repeated google.protobuf.Timestamp example = 10 [(predefined).cel = { + id: "timestamp.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// `Violations` is a collection of `Violation` messages. This message type is returned by +// Protovalidate when a proto message fails to meet the requirements set by the `Rule` validation rules. +// Each individual violation is represented by a `Violation` message. +message Violations { + // `violations` is a repeated field that contains all the `Violation` messages corresponding to the violations detected. + repeated Violation violations = 1; +} + +// `Violation` represents a single instance where a validation rule, expressed +// as a `Rule`, was not met. It provides information about the field that +// caused the violation, the specific rule that wasn't fulfilled, and a +// human-readable error message. +// +// For example, consider the following message: +// +// ```proto +// message User { +// int32 age = 1 [(buf.validate.field).cel = { +// id: "user.age", +// expression: "this < 18 ? 'User must be at least 18 years old' : ''", +// }]; +// } +// ``` +// +// It could produce the following violation: +// +// ```json +// { +// "ruleId": "user.age", +// "message": "User must be at least 18 years old", +// "field": { +// "elements": [ +// { +// "fieldNumber": 1, +// "fieldName": "age", +// "fieldType": "TYPE_INT32" +// } +// ] +// }, +// "rule": { +// "elements": [ +// { +// "fieldNumber": 23, +// "fieldName": "cel", +// "fieldType": "TYPE_MESSAGE", +// "index": "0" +// } +// ] +// } +// } +// ``` +message Violation { + // `field` is a machine-readable path to the field that failed validation. + // This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation. + // + // For example, consider the following message: + // + // ```proto + // message Message { + // bool a = 1 [(buf.validate.field).required = true]; + // } + // ``` + // + // It could produce the following violation: + // + // ```textproto + // violation { + // field { element { field_number: 1, field_name: "a", field_type: 8 } } + // ... + // } + // ``` + optional FieldPath field = 5; + + // `rule` is a machine-readable path that points to the specific rule that failed validation. + // This will be a nested field starting from the FieldRules of the field that failed validation. + // For custom rules, this will provide the path of the rule, e.g. `cel[0]`. + // + // For example, consider the following message: + // + // ```proto + // message Message { + // bool a = 1 [(buf.validate.field).required = true]; + // bool b = 2 [(buf.validate.field).cel = { + // id: "custom_rule", + // expression: "!this ? 'b must be true': ''" + // }] + // } + // ``` + // + // It could produce the following violations: + // + // ```textproto + // violation { + // rule { element { field_number: 25, field_name: "required", field_type: 8 } } + // ... + // } + // violation { + // rule { element { field_number: 23, field_name: "cel", field_type: 11, index: 0 } } + // ... + // } + // ``` + optional FieldPath rule = 6; + + // `rule_id` is the unique identifier of the `Rule` that was not fulfilled. + // This is the same `id` that was specified in the `Rule` message, allowing easy tracing of which rule was violated. + optional string rule_id = 2; + + // `message` is a human-readable error message that describes the nature of the violation. + // This can be the default error message from the violated `Rule`, or it can be a custom message that gives more context about the violation. + optional string message = 3; + + // `for_key` indicates whether the violation was caused by a map key, rather than a value. + optional bool for_key = 4; + + reserved 1; + reserved "field_path"; +} + +// `FieldPath` provides a path to a nested protobuf field. +// +// This message provides enough information to render a dotted field path even without protobuf descriptors. +// It also provides enough information to resolve a nested field through unknown wire data. +message FieldPath { + // `elements` contains each element of the path, starting from the root and recursing downward. + repeated FieldPathElement elements = 1; +} + +// `FieldPathElement` provides enough information to nest through a single protobuf field. +// +// If the selected field is a map or repeated field, the `subscript` value selects a specific element from it. +// A path that refers to a value nested under a map key or repeated field index will have a `subscript` value. +// The `field_type` field allows unambiguous resolution of a field even if descriptors are not available. +message FieldPathElement { + // `field_number` is the field number this path element refers to. + optional int32 field_number = 1; + + // `field_name` contains the field name this path element refers to. + // This can be used to display a human-readable path even if the field number is unknown. + optional string field_name = 2; + + // `field_type` specifies the type of this field. When using reflection, this value is not needed. + // + // This value is provided to make it possible to traverse unknown fields through wire data. + // When traversing wire data, be mindful of both packed[1] and delimited[2] encoding schemes. + // + // [1]: https://protobuf.dev/programming-guides/encoding/#packed + // [2]: https://protobuf.dev/programming-guides/encoding/#groups + // + // N.B.: Although groups are deprecated, the corresponding delimited encoding scheme is not, and + // can be explicitly used in Protocol Buffers 2023 Edition. + optional google.protobuf.FieldDescriptorProto.Type field_type = 3; + + // `key_type` specifies the map key type of this field. This value is useful when traversing + // unknown fields through wire data: specifically, it allows handling the differences between + // different integer encodings. + optional google.protobuf.FieldDescriptorProto.Type key_type = 4; + + // `value_type` specifies map value type of this field. This is useful if you want to display a + // value inside unknown fields through wire data. + optional google.protobuf.FieldDescriptorProto.Type value_type = 5; + + // `subscript` contains a repeated index or map key, if this path element nests into a repeated or map field. + oneof subscript { + // `index` specifies a 0-based index into a repeated field. + uint64 index = 6; + + // `bool_key` specifies a map key of type bool. + bool bool_key = 7; + + // `int_key` specifies a map key of type int32, int64, sint32, sint64, sfixed32 or sfixed64. + int64 int_key = 8; + + // `uint_key` specifies a map key of type uint32, uint64, fixed32 or fixed64. + uint64 uint_key = 9; + + // `string_key` specifies a map key of type string. + string string_key = 10; + } +}