diff --git a/.make/protos/go.make b/.make/protos/go.make index e12ba33555..e4ae20ff57 100644 --- a/.make/protos/go.make +++ b/.make/protos/go.make @@ -16,10 +16,9 @@ GO_PROTO_TYPES := any duration empty field_mask struct timestamp wrappers GO_PROTO_TYPE_CONVERSIONS = $(subst $(SPACE),$(COMMA),$(foreach type,$(GO_PROTO_TYPES),Mgoogle/protobuf/$(type).proto=github.com/gogo/protobuf/types)) GO_PROTOC_FLAGS ?= \ - --fieldmask_out=$(PROTOC_OUT) \ + --fieldmask_out=lang=gogo,$(GO_PROTO_TYPE_CONVERSIONS):$(PROTOC_OUT) \ --gogottn_out=plugins=grpc,$(GO_PROTO_TYPE_CONVERSIONS):$(PROTOC_OUT) \ - --grpc-gateway_out=$(GO_PROTO_TYPE_CONVERSIONS):$(PROTOC_OUT) \ - --govalidators_out=gogoimport=true:$(PROTOC_OUT) + --grpc-gateway_out=$(GO_PROTO_TYPE_CONVERSIONS):$(PROTOC_OUT) go.protos: $(wildcard api/*.proto) $(PROTOC) $(GO_PROTOC_FLAGS) $(API_PROTO_FILES) 2>&1 | grep -vE ' protoc-gen-gogo: WARNING: failed finding publicly imported dependency for \.ttn\.lorawan\.v3\..* used in' || true diff --git a/.make/protos/main.make b/.make/protos/main.make index 9a57fdd210..86237773cb 100644 --- a/.make/protos/main.make +++ b/.make/protos/main.make @@ -18,7 +18,7 @@ API_PROTO_FILES = $(PWD)/api/'*.proto' PROTOC_OUT ?= /out -PROTOC_DOCKER_IMAGE ?= thethingsindustries/protoc:3.0.26 +PROTOC_DOCKER_IMAGE ?= thethingsindustries/protoc:3.1.0 PROTOC_DOCKER_ARGS = run --user `id -u` --rm \ --mount type=bind,src=$(PWD)/api,dst=$(PWD)/api \ --mount type=bind,src=$(PWD)/pkg/ttnpb,dst=$(PROTOC_OUT)/go.thethings.network/lorawan-stack/pkg/ttnpb \ diff --git a/api/api.md b/api/api.md index f0d6aeb94a..5bd9bb0c7a 100644 --- a/api/api.md +++ b/api/api.md @@ -1333,7 +1333,7 @@ PeerInfo | ----- | ---- | ----- | ----------- | | grpc_port | [uint32](#uint32) | | Port on which the gRPC server is exposed. | | tls | [bool](#bool) | | Indicates whether the gRPC server uses TLS. | -| roles | [PeerInfo.Role](#ttn.lorawan.v3.PeerInfo.Role) | repeated | Roles of the peer () | +| roles | [PeerInfo.Role](#ttn.lorawan.v3.PeerInfo.Role) | repeated | Roles of the peer. | | tags | [PeerInfo.TagsEntry](#ttn.lorawan.v3.PeerInfo.TagsEntry) | repeated | Tags of the peer | @@ -1543,7 +1543,7 @@ SDKs are responsible for combining (if desired) the three. | last_rj_count_1 | [uint32](#uint32) | | Last Rejoin counter value used (type 1). Stored in Join Server. | | last_dev_status_received_at | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | Time when last DevStatus MAC command was received. Stored in Network Server. | | power_state | [PowerState](#ttn.lorawan.v3.PowerState) | | The power state of the device; whether it is battery-powered or connected to an external power source. Received via the DevStatus MAC command at status_received_at. Stored in Network Server. | -| battery_percentage | [float](#float) | | Latest-known battery percentage of the device. Received via the DevStatus MAC command at last_dev_status_received_at or earlier. Stored in Network Server. | +| battery_percentage | [google.protobuf.FloatValue](#google.protobuf.FloatValue) | | Latest-known battery percentage of the device. Received via the DevStatus MAC command at last_dev_status_received_at or earlier. Stored in Network Server. | | downlink_margin | [int32](#int32) | | Demodulation signal-to-noise ratio (dB). Received via the DevStatus MAC command at last_dev_status_received_at. Stored in Network Server. | | recent_adr_uplinks | [UplinkMessage](#ttn.lorawan.v3.UplinkMessage) | repeated | Recent uplink messages with ADR bit set to 1 sorted by time. Stored in Network Server. The field is reset each time an uplink message carrying MACPayload is received with ADR bit set to 0. The number of messages stored is in the range [0,20]; | | recent_uplinks | [UplinkMessage](#ttn.lorawan.v3.UplinkMessage) | repeated | Recent uplink messages sorted by time. Stored in Network Server. The number of messages stored may depend on configuration. | @@ -1784,12 +1784,12 @@ This is used internally by the Network Server and is read only. | class_b_timeout | [google.protobuf.Duration](#google.protobuf.Duration) | | Maximum delay for the device to answer a MAC request or a confirmed downlink frame. If unset, the default value from Network Server configuration will be used. | | ping_slot_periodicity | [MACSettings.PingSlotPeriodValue](#ttn.lorawan.v3.MACSettings.PingSlotPeriodValue) | | Periodicity of the class B ping slot. If unset, the default value from Network Server configuration will be used. | | ping_slot_data_rate_index | [MACSettings.DataRateIndexValue](#ttn.lorawan.v3.MACSettings.DataRateIndexValue) | | Data rate index of the class B ping slot. If unset, the default value from Network Server configuration will be used. | -| ping_slot_frequency | [uint64](#uint64) | | Frequency of the class B ping slot (Hz). If unset, the default value from Network Server configuration will be used. | +| ping_slot_frequency | [google.protobuf.UInt64Value](#google.protobuf.UInt64Value) | | Frequency of the class B ping slot (Hz). If unset, the default value from Network Server configuration will be used. | | class_c_timeout | [google.protobuf.Duration](#google.protobuf.Duration) | | Maximum delay for the device to answer a MAC request or a confirmed downlink frame. If unset, the default value from Network Server configuration will be used. | | rx1_delay | [MACSettings.RxDelayValue](#ttn.lorawan.v3.MACSettings.RxDelayValue) | | Class A Rx1 delay. If unset, the default value from Network Server configuration or regional parameters specification will be used. | | rx1_data_rate_offset | [google.protobuf.UInt32Value](#google.protobuf.UInt32Value) | | Rx1 data rate offset. If unset, the default value from Network Server configuration will be used. | | rx2_data_rate_index | [MACSettings.DataRateIndexValue](#ttn.lorawan.v3.MACSettings.DataRateIndexValue) | | Data rate index for Rx2. If unset, the default value from Network Server configuration or regional parameters specification will be used. | -| rx2_frequency | [uint64](#uint64) | | Frequency for Rx2 (Hz). If unset, the default value from Network Server configuration or regional parameters specification will be used. | +| rx2_frequency | [google.protobuf.UInt64Value](#google.protobuf.UInt64Value) | | Frequency for Rx2 (Hz). If unset, the default value from Network Server configuration or regional parameters specification will be used. | | factory_preset_frequencies | [uint64](#uint64) | repeated | List of factory-preset frequencies. If unset, the default value from Network Server configuration or regional parameters specification will be used. | | max_duty_cycle | [MACSettings.AggregatedDutyCycleValue](#ttn.lorawan.v3.MACSettings.AggregatedDutyCycleValue) | | Maximum uplink duty cycle (of all channels). | | supports_32_bit_f_cnt | [google.protobuf.BoolValue](#google.protobuf.BoolValue) | | Whether the device supports 32-bit frame counters. If unset, the default value from Network Server configuration will be used. | @@ -1801,7 +1801,7 @@ This is used internally by the Network Server and is read only. | desired_rx1_delay | [MACSettings.RxDelayValue](#ttn.lorawan.v3.MACSettings.RxDelayValue) | | The Rx1 delay Network Server should configure device to use via MAC commands or Join-Accept. If unset, the default value from Network Server configuration or regional parameters specification will be used. | | desired_rx1_data_rate_offset | [google.protobuf.UInt32Value](#google.protobuf.UInt32Value) | | The Rx1 data rate offset Network Server should configure device to use via MAC commands or Join-Accept. If unset, the default value from Network Server configuration will be used. | | desired_rx2_data_rate_index | [MACSettings.DataRateIndexValue](#ttn.lorawan.v3.MACSettings.DataRateIndexValue) | | The Rx2 data rate index Network Server should configure device to use via MAC commands or Join-Accept. If unset, the default value from frequency plan, Network Server configuration or regional parameters specification will be used. | -| desired_rx2_frequency | [uint64](#uint64) | | The Rx2 frequency index Network Server should configure device to use via MAC commands. If unset, the default value from frequency plan, Network Server configuration or regional parameters specification will be used. | +| desired_rx2_frequency | [google.protobuf.UInt64Value](#google.protobuf.UInt64Value) | | The Rx2 frequency index Network Server should configure device to use via MAC commands. If unset, the default value from frequency plan, Network Server configuration or regional parameters specification will be used. | @@ -3156,7 +3156,7 @@ OrganizationOrUserIdentifiers contains either organization or user identifiers. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | payload_request | [CryptoServicePayloadRequest](#ttn.lorawan.v3.CryptoServicePayloadRequest) | | | -| join_request_type | [uint32](#uint32) | | | +| join_request_type | [RejoinType](#ttn.lorawan.v3.RejoinType) | | | | dev_nonce | [bytes](#bytes) | | | @@ -3822,7 +3822,7 @@ Only the components for which the keys were meant, will have the key-encryption- | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| rejoin_type | [uint32](#uint32) | | | +| rejoin_type | [RejoinType](#ttn.lorawan.v3.RejoinType) | | | | data_rate_index | [DataRateIndex](#ttn.lorawan.v3.DataRateIndex) | | | | max_retries | [uint32](#uint32) | | | | period_exponent | [RejoinPeriodExponent](#ttn.lorawan.v3.RejoinPeriodExponent) | | Exponent e that configures the rejoin period = 32 * 2^e + rand(0,32) seconds. | @@ -5752,7 +5752,7 @@ where the user or organization is collaborator on. | ----- | ---- | ----- | ----------- | | frequency | [uint64](#uint64) | | Frequency (Hz). | | radio | [uint32](#uint32) | | | -| bandwidth | [uint32](#uint32) | | | +| bandwidth | [uint32](#uint32) | | Bandwidth (Hz). | | spreading_factor | [uint32](#uint32) | | | diff --git a/api/api.swagger.json b/api/api.swagger.json index 829c11af17..d35afdb530 100644 --- a/api/api.swagger.json +++ b/api/api.swagger.json @@ -4472,7 +4472,8 @@ }, "bandwidth": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "Bandwidth (Hz)." }, "spreading_factor": { "type": "integer", @@ -4619,8 +4620,7 @@ "type": "object", "properties": { "rejoin_type": { - "type": "integer", - "format": "int64" + "$ref": "#/definitions/v3RejoinType" }, "data_rate_index": { "$ref": "#/definitions/v3DataRateIndex" diff --git a/api/application.proto b/api/application.proto index 15c58ad420..af352bd917 100644 --- a/api/application.proto +++ b/api/application.proto @@ -15,6 +15,7 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; import "google/api/annotations.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; @@ -28,7 +29,7 @@ option go_package = "go.thethings.network/lorawan-stack/pkg/ttnpb"; // Application is the message that defines an Application in the network. message Application { - ApplicationIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + ApplicationIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.Timestamp created_at = 2 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; @@ -43,7 +44,7 @@ message Applications { } message GetApplicationRequest { - ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false]; } @@ -64,28 +65,28 @@ message ListApplicationsRequest { } message CreateApplicationRequest { - Application application = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + Application application = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; // Collaborator to grant all rights on the newly created application. - OrganizationOrUserIdentifiers collaborator = 2 [(gogoproto.nullable) = false]; + OrganizationOrUserIdentifiers collaborator = 2 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; } message UpdateApplicationRequest { - Application application = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + Application application = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false]; } message CreateApplicationAPIKeyRequest { - ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; string name = 2; repeated Right rights = 3; } message UpdateApplicationAPIKeyRequest { - ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - APIKey api_key = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; + APIKey api_key = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; } message SetApplicationCollaboratorRequest { - ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - Collaborator collaborator = 2 [(gogoproto.nullable) = false]; + ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; + Collaborator collaborator = 2 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; } diff --git a/api/applicationserver.proto b/api/applicationserver.proto index a2102179f0..671ed3c081 100644 --- a/api/applicationserver.proto +++ b/api/applicationserver.proto @@ -15,7 +15,7 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; -import "github.com/mwitkow/go-proto-validators/validator.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; @@ -33,26 +33,26 @@ message ApplicationLink { // The typical format of the address is "host:port". If the port is omitted, // the normal port inference (with DNS lookup, otherwise defaults) is used. // Leave empty when linking to a cluster Network Server. - string network_server_address = 1 [(validator.field) = {regex: "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"}]; - string api_key = 2 [(gogoproto.customname) = "APIKey", (validator.field) = {string_not_empty: true}]; + string network_server_address = 1 [(validate.rules).string.pattern = "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"]; + string api_key = 2 [(gogoproto.customname) = "APIKey", (validate.rules).string.min_len = 1]; MessagePayloadFormatters default_formatters = 3; } message GetApplicationLinkRequest { - ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false]; } message SetApplicationLinkRequest { - ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - ApplicationLink link = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; + ApplicationLink link = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.FieldMask field_mask = 3 [(gogoproto.nullable) = false]; } // Link stats as monitored by the Application Server. message ApplicationLinkStats { google.protobuf.Timestamp linked_at = 1 [(gogoproto.stdtime) = true]; - string network_server_address = 2; + string network_server_address = 2 [(validate.rules).string.pattern = "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"]; // Timestamp when the last upstream message has been received from a Network Server. // This can be a join-accept, uplink message or downlink message event. google.protobuf.Timestamp last_up_received_at = 3 [(gogoproto.stdtime) = true]; diff --git a/api/applicationserver_web.proto b/api/applicationserver_web.proto index 172b5279c5..58e95a4726 100644 --- a/api/applicationserver_web.proto +++ b/api/applicationserver_web.proto @@ -15,7 +15,7 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; -import "github.com/mwitkow/go-proto-validators/validator.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; @@ -27,12 +27,12 @@ package ttn.lorawan.v3; option go_package = "go.thethings.network/lorawan-stack/pkg/ttnpb"; message ApplicationWebhookIdentifiers { - ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - string webhook_id = 2 [(gogoproto.customname) = "WebhookID", (validator.field) = {regex: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , length_lt: 37}]; + ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; + string webhook_id = 2 [(gogoproto.customname) = "WebhookID", (validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , max_len: 36}]; } message ApplicationWebhook { - ApplicationWebhookIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + ApplicationWebhookIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.Timestamp created_at = 2 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; @@ -68,17 +68,17 @@ message ApplicationWebhookFormats { } message GetApplicationWebhookRequest { - ApplicationWebhookIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + ApplicationWebhookIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false]; } message ListApplicationWebhooksRequest { - ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false]; } message SetApplicationWebhookRequest { - ApplicationWebhook webhook = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + ApplicationWebhook webhook = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false]; } diff --git a/api/client.proto b/api/client.proto index 60763071f2..4b5cba04e5 100644 --- a/api/client.proto +++ b/api/client.proto @@ -15,6 +15,7 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "lorawan-stack/api/contact_info.proto"; @@ -40,7 +41,7 @@ enum GrantType { // An OAuth client on the network. message Client { - ClientIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + ClientIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.Timestamp created_at = 2 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; @@ -57,7 +58,7 @@ message Client { repeated string redirect_uris = 9 [(gogoproto.customname) = "RedirectURIs"]; // The reviewing state of the client. // This field can only be modified by admins. - State state = 10; + State state = 10 [(validate.rules).enum.defined_only = true]; // If set, the authorization page will be skipped. // This field can only be modified by admins. bool skip_authorization = 11; @@ -78,7 +79,7 @@ message Clients { } message GetClientRequest { - ClientIdentifiers client_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + ClientIdentifiers client_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false]; } @@ -99,17 +100,17 @@ message ListClientsRequest { } message CreateClientRequest { - Client client = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + Client client = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; // Collaborator to grant all rights on the newly created client. - OrganizationOrUserIdentifiers collaborator = 2 [(gogoproto.nullable) = false]; + OrganizationOrUserIdentifiers collaborator = 2 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; } message UpdateClientRequest { - Client client = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + Client client = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false]; } message SetClientCollaboratorRequest { - ClientIdentifiers client_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - Collaborator collaborator = 2 [(gogoproto.nullable) = false]; + ClientIdentifiers client_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; + Collaborator collaborator = 2 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; } diff --git a/api/cluster.proto b/api/cluster.proto index 482cc63e55..329081b23f 100644 --- a/api/cluster.proto +++ b/api/cluster.proto @@ -15,6 +15,7 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; package ttn.lorawan.v3; @@ -26,7 +27,7 @@ message PeerInfo { uint32 grpc_port = 1 [(gogoproto.customname) = "GRPCPort"]; // Indicates whether the gRPC server uses TLS. bool tls = 2 [(gogoproto.customname) = "TLS"]; - // Roles of the peer () + // Roles of the peer. repeated Role roles = 3; enum Role { diff --git a/api/end_device.proto b/api/end_device.proto index 735321ca1c..41430d72ae 100644 --- a/api/end_device.proto +++ b/api/end_device.proto @@ -15,7 +15,7 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; -import "github.com/mwitkow/go-proto-validators/validator.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; import "google/api/annotations.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/field_mask.proto"; @@ -39,7 +39,7 @@ message Session { // Device Address, issued by the Network Server or chosen by device manufacturer in case of testing range (beginning with 00-03). // Known by Network Server, Application Server and Join Server. Owned by Network Server. bytes dev_addr = 2 [(gogoproto.customtype) = "go.thethings.network/lorawan-stack/pkg/types.DevAddr", (gogoproto.nullable) = false]; - SessionKeys keys = 3 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + SessionKeys keys = 3 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; // Last uplink frame counter value used. Network Server only. Application Server assumes the Network Server checked it. uint32 last_f_cnt_up = 4; // Last network downlink frame counter value used. Network Server only. @@ -64,52 +64,52 @@ message MACParameters { // Downlink dwell time is set (400ms). bool downlink_dwell_time = 3; // ADR: data rate index to use. - DataRateIndex adr_data_rate_index = 4 [(gogoproto.customname) = "ADRDataRateIndex"]; + DataRateIndex adr_data_rate_index = 4 [(gogoproto.customname) = "ADRDataRateIndex", (validate.rules).enum.defined_only = true]; // ADR: transmission power index to use. - uint32 adr_tx_power_index = 5 [(gogoproto.customname) = "ADRTxPowerIndex"]; + uint32 adr_tx_power_index = 5 [(gogoproto.customname) = "ADRTxPowerIndex", (validate.rules).uint32.lte = 15]; // ADR: number of retransmissions. - uint32 adr_nb_trans = 6 [(gogoproto.customname) = "ADRNbTrans"]; + uint32 adr_nb_trans = 6 [(gogoproto.customname) = "ADRNbTrans", (validate.rules).uint32.lte = 15]; // ADR: number of messages to wait before setting ADRAckReq. - uint32 adr_ack_limit = 7 [(gogoproto.customname) = "ADRAckLimit"]; + uint32 adr_ack_limit = 7 [(gogoproto.customname) = "ADRAckLimit", (validate.rules).uint32 = {gte: 1, lte: 32768}]; // ADR: number of messages to wait after setting ADRAckReq and before changing TxPower or DataRate. - uint32 adr_ack_delay = 8 [(gogoproto.customname) = "ADRAckDelay"]; + uint32 adr_ack_delay = 8 [(gogoproto.customname) = "ADRAckDelay", (validate.rules).uint32 = {gte: 1, lte: 32768}]; // Rx1 delay (Rx2 delay is Rx1 delay + 1 second). - RxDelay rx1_delay = 9; + RxDelay rx1_delay = 9 [(validate.rules).enum.defined_only = true]; // Data rate offset for Rx1. - uint32 rx1_data_rate_offset = 10; + uint32 rx1_data_rate_offset = 10 [(validate.rules).uint32.lte = 7]; // Data rate index for Rx2. - DataRateIndex rx2_data_rate_index = 11; + DataRateIndex rx2_data_rate_index = 11 [(validate.rules).enum.defined_only = true]; // Frequency for Rx2 (Hz). - uint64 rx2_frequency = 12; + uint64 rx2_frequency = 12 [(validate.rules).uint64.gte = 100000]; // Maximum uplink duty cycle (of all channels). - AggregatedDutyCycle max_duty_cycle = 13; + AggregatedDutyCycle max_duty_cycle = 13 [(validate.rules).enum.defined_only = true]; // Time within which a rejoin-request must be sent. - RejoinTimeExponent rejoin_time_periodicity = 14; + RejoinTimeExponent rejoin_time_periodicity = 14 [(validate.rules).enum.defined_only = true]; // Message count within which a rejoin-request must be sent. - RejoinCountExponent rejoin_count_periodicity = 15; + RejoinCountExponent rejoin_count_periodicity = 15 [(validate.rules).enum.defined_only = true]; // Frequency of the class B ping slot (Hz). - uint64 ping_slot_frequency = 16; + uint64 ping_slot_frequency = 16 [(validate.rules).uint64 = {lte: 0, gte: 100000}]; // Data rate index of the class B ping slot. - DataRateIndex ping_slot_data_rate_index = 17; + DataRateIndex ping_slot_data_rate_index = 17 [(validate.rules).enum.defined_only = true]; // Frequency of the class B beacon (Hz). - uint64 beacon_frequency = 18; + uint64 beacon_frequency = 18 [(validate.rules).uint64 = {lte: 0, gte: 100000}]; message Channel { option (gogoproto.populate) = false; // Uplink frequency of the channel (Hz). - uint64 uplink_frequency = 1; + uint64 uplink_frequency = 1 [(validate.rules).uint64.gte = 100000]; // Downlink frequency of the channel (Hz). - uint64 downlink_frequency = 2; + uint64 downlink_frequency = 2 [(validate.rules).uint64.gte = 100000]; // Index of the minimum data rate for uplink. - DataRateIndex min_data_rate_index = 3; + DataRateIndex min_data_rate_index = 3 [(validate.rules).enum.defined_only = true]; // Index of the maximum data rate for uplink. - DataRateIndex max_data_rate_index = 4; + DataRateIndex max_data_rate_index = 4 [(validate.rules).enum.defined_only = true]; // Channel can be used by device for uplink. bool enable_uplink = 5; } // Configured uplink channels and optionally Rx1 frequency. - repeated Channel channels = 19; + repeated Channel channels = 19 [(validate.rules).repeated.min_items = 1]; } message EndDeviceBrand { @@ -128,8 +128,8 @@ message EndDeviceModel { // Identifies an end device model with version information. message EndDeviceVersionIdentifiers { - string brand_id = 1 [(gogoproto.customname) = "BrandID", (validator.field) = {regex: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$", length_lt: 37}]; - string model_id = 2 [(gogoproto.customname) = "ModelID", (validator.field) = {regex: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$", length_lt: 37}]; + string brand_id = 1 [(gogoproto.customname) = "BrandID", (validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$", max_len: 36}]; + string model_id = 2 [(gogoproto.customname) = "ModelID", (validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$", max_len: 36}]; string hardware_version = 3; string firmware_version = 4; } @@ -139,12 +139,12 @@ message EndDeviceVersion { option (gogoproto.populate) = false; // Version identifiers. - EndDeviceVersionIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + EndDeviceVersionIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; // LoRaWAN MAC version. - MACVersion lorawan_version = 2 [(gogoproto.customname) = "LoRaWANVersion"]; + MACVersion lorawan_version = 2 [(gogoproto.customname) = "LoRaWANVersion", (validate.rules).enum.defined_only = true]; // LoRaWAN PHY version. - PHYVersion lorawan_phy_version = 3 [(gogoproto.customname) = "LoRaWANPHYVersion"]; + PHYVersion lorawan_phy_version = 3 [(gogoproto.customname) = "LoRaWANPHYVersion", (validate.rules).enum.defined_only = true]; // ID of the frequency plan used by this device. string frequency_plan_id = 4 [(gogoproto.customname) = "FrequencyPlanID"]; @@ -167,21 +167,21 @@ message EndDeviceVersion { bool resets_join_nonces = 12; // Default formatters defining the payload formats for this end device. - MessagePayloadFormatters default_formatters = 13 [(gogoproto.nullable) = false]; + MessagePayloadFormatters default_formatters = 13 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; } message MACSettings { message DataRateIndexValue { - DataRateIndex value = 1; + DataRateIndex value = 1 [(validate.rules).enum.defined_only = true]; } message PingSlotPeriodValue { - PingSlotPeriod value = 1; + PingSlotPeriod value = 1 [(validate.rules).enum.defined_only = true]; } message AggregatedDutyCycleValue { - AggregatedDutyCycle value = 1; + AggregatedDutyCycle value = 1 [(validate.rules).enum.defined_only = true]; } message RxDelayValue { - RxDelay value = 1; + RxDelay value = 1 [(validate.rules).enum.defined_only = true]; } // Maximum delay for the device to answer a MAC request or a confirmed downlink frame. @@ -195,7 +195,7 @@ message MACSettings { DataRateIndexValue ping_slot_data_rate_index = 3; // Frequency of the class B ping slot (Hz). // If unset, the default value from Network Server configuration will be used. - uint64 ping_slot_frequency = 4; + google.protobuf.UInt64Value ping_slot_frequency = 4 [(validate.rules).uint64.gte = 100000]; // Maximum delay for the device to answer a MAC request or a confirmed downlink frame. // If unset, the default value from Network Server configuration will be used. @@ -206,13 +206,13 @@ message MACSettings { RxDelayValue rx1_delay = 6; // Rx1 data rate offset. // If unset, the default value from Network Server configuration will be used. - google.protobuf.UInt32Value rx1_data_rate_offset = 7; + google.protobuf.UInt32Value rx1_data_rate_offset = 7 [(validate.rules).uint32.lte = 7]; // Data rate index for Rx2. // If unset, the default value from Network Server configuration or regional parameters specification will be used. DataRateIndexValue rx2_data_rate_index = 8; // Frequency for Rx2 (Hz). // If unset, the default value from Network Server configuration or regional parameters specification will be used. - uint64 rx2_frequency = 9; + google.protobuf.UInt64Value rx2_frequency = 9 [(validate.rules).uint64.gte = 100000]; // List of factory-preset frequencies. // If unset, the default value from Network Server configuration or regional parameters specification will be used. repeated uint64 factory_preset_frequencies = 10; @@ -252,7 +252,7 @@ message MACSettings { DataRateIndexValue desired_rx2_data_rate_index = 20; // The Rx2 frequency index Network Server should configure device to use via MAC commands. // If unset, the default value from frequency plan, Network Server configuration or regional parameters specification will be used. - uint64 desired_rx2_frequency = 21; + google.protobuf.UInt64Value desired_rx2_frequency = 21 [(validate.rules).uint64.gte = 100000]; } // MACState represents the state of MAC layer of the device. @@ -262,23 +262,23 @@ message MACState { option (gogoproto.populate) = false; // Current LoRaWAN MAC parameters. - MACParameters current_parameters = 1 [(gogoproto.nullable) = false]; + MACParameters current_parameters = 1 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; // Desired LoRaWAN MAC parameters. - MACParameters desired_parameters = 2 [(gogoproto.nullable) = false]; + MACParameters desired_parameters = 2 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; // Currently active LoRaWAN device class // - Device class is A by default // - If device sets ClassB bit in uplink, this will be set to B // - If device sent DeviceModeInd MAC message, this will be set to that value - Class device_class = 3; + Class device_class = 3 [(validate.rules).enum.defined_only = true]; // LoRaWAN MAC version. - MACVersion lorawan_version = 4 [(gogoproto.customname) = "LoRaWANVersion"]; + MACVersion lorawan_version = 4 [(gogoproto.customname) = "LoRaWANVersion", (validate.rules).enum.defined_only = true]; // Time when the last confirmed downlink message or MAC command was scheduled. google.protobuf.Timestamp last_confirmed_downlink_at = 5 [(gogoproto.stdtime) = true]; // Frame counter value of last uplink containing DevStatusAns. uint32 last_dev_status_f_cnt_up = 6; // Periodicity of the class B ping slot. - PingSlotPeriod ping_slot_periodicity = 7; + PingSlotPeriod ping_slot_periodicity = 7 [(validate.rules).enum.defined_only = true]; // A confirmed application downlink, for which an acknowledgment is expected to arrive. ApplicationDownlink pending_application_downlink = 8; // Queued MAC responses. @@ -290,11 +290,11 @@ message MACState { message JoinAccept { // Payload of the join-accept received from Join Server. - bytes payload = 1 [(validator.field) = { length_gt: 11, length_lt: 29 }]; + bytes payload = 1 [(validate.rules).bytes = {min_len: 17, max_len: 33}]; // JoinRequest sent to Join Server. - JoinRequest request = 2 [(gogoproto.nullable) = false]; + JoinRequest request = 2 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; // Network session keys associated with the join. - SessionKeys keys = 3 [(gogoproto.nullable) = false]; + SessionKeys keys = 3 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; } // Queued join-accept. // Set each time a (re-)join request accept is received from Join Server and removed each time a downlink is scheduled. @@ -321,7 +321,7 @@ enum PowerState { message EndDevice { option (gogoproto.populate) = false; - EndDeviceIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + EndDeviceIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.Timestamp created_at = 2 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; @@ -344,21 +344,21 @@ message EndDevice { // the normal port inference (with DNS lookup, otherwise defaults) is used. // The connection shall be established with transport layer security (TLS). // Custom certificate authorities may be configured out-of-band. - string network_server_address = 9 [(validator.field) = {regex: "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"}]; + string network_server_address = 9 [(validate.rules).string.pattern = "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"]; // The address of the Application Server where this device is supposed to be registered. // Stored in Entity Registry and Join Server. // The typical format of the address is "host:port". If the port is omitted, // the normal port inference (with DNS lookup, otherwise defaults) is used. // The connection shall be established with transport layer security (TLS). // Custom certificate authorities may be configured out-of-band. - string application_server_address = 10 [(validator.field) = {regex: "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"}]; + string application_server_address = 10 [(validate.rules).string.pattern = "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"]; // The address of the Join Server where this device is supposed to be registered. // Stored in Entity Registry. // The typical format of the address is "host:port". If the port is omitted, // the normal port inference (with DNS lookup, otherwise defaults) is used. // The connection shall be established with transport layer security (TLS). // Custom certificate authorities may be configured out-of-band. - string join_server_address = 11 [(validator.field) = {regex: "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"}]; + string join_server_address = 11 [(validate.rules).string.pattern = "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"]; // Location of the device. Stored in Entity Registry. map locations = 12; @@ -371,10 +371,10 @@ message EndDevice { bool supports_class_c = 14; // LoRaWAN MAC version. Stored in Network Server. // Copied on creation from template identified by version_ids, if any or from the home Network Server device profile, if any. - MACVersion lorawan_version = 15 [(gogoproto.customname) = "LoRaWANVersion"]; + MACVersion lorawan_version = 15 [(gogoproto.customname) = "LoRaWANVersion", (validate.rules).enum.defined_only = true]; // LoRaWAN PHY version. Stored in Network Server. // Copied on creation from template identified by version_ids, if any or from the home Network Server device profile, if any. - PHYVersion lorawan_phy_version = 16 [(gogoproto.customname) = "LoRaWANPHYVersion"]; + PHYVersion lorawan_phy_version = 16 [(gogoproto.customname) = "LoRaWANPHYVersion", (validate.rules).enum.defined_only = true]; // ID of the frequency plan used by this device. // Copied on creation from template identified by version_ids, if any or from the home Network Server device profile, if any. string frequency_plan_id = 17 [(gogoproto.customname) = "FrequencyPlanID"]; @@ -429,11 +429,11 @@ message EndDevice { // The power state of the device; whether it is battery-powered or connected to an external power source. // Received via the DevStatus MAC command at status_received_at. // Stored in Network Server. - PowerState power_state = 34; + PowerState power_state = 34 [(validate.rules).enum.defined_only = true]; // Latest-known battery percentage of the device. // Received via the DevStatus MAC command at last_dev_status_received_at or earlier. // Stored in Network Server. - float battery_percentage = 35; + google.protobuf.FloatValue battery_percentage = 35 [(validate.rules).float = {gte: 0, lte: 1}]; // Demodulation signal-to-noise ratio (dB). // Received via the DevStatus MAC command at last_dev_status_received_at. // Stored in Network Server. @@ -458,7 +458,7 @@ message EndDevice { MessagePayloadFormatters formatters = 41; // ID of the provisioner. Stored in Join Server. - string provisioner_id = 42 [(gogoproto.customname) = "ProvisionerID", (validator.field) = {regex: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$", length_lt: 37}]; + string provisioner_id = 42 [(gogoproto.customname) = "ProvisionerID", (validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$", max_len: 36}]; // Vendor-specific provisioning data. Stored in Join Server. google.protobuf.Struct provisioning_data = 43; } @@ -468,21 +468,21 @@ message EndDevices { } message CreateEndDeviceRequest { - EndDevice end_device = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + EndDevice end_device = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; } message UpdateEndDeviceRequest { - EndDevice end_device = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + EndDevice end_device = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false]; } message GetEndDeviceRequest { - EndDeviceIdentifiers end_device_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + EndDeviceIdentifiers end_device_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false]; } message ListEndDevicesRequest { - ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false]; // Order the results by this field path (must be present in the field mask). // Default ordering is by ID. Prepend with a minus (-) to reverse the order. @@ -494,6 +494,6 @@ message ListEndDevicesRequest { } message SetEndDeviceRequest { - EndDevice end_device = 1 [(gogoproto.nullable) = false]; + EndDevice end_device = 1 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false]; } diff --git a/api/events.proto b/api/events.proto index b4d8426a6e..fc248ab85e 100644 --- a/api/events.proto +++ b/api/events.proto @@ -15,6 +15,7 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; import "google/api/annotations.proto"; import "google/protobuf/any.proto"; import "google/protobuf/timestamp.proto"; @@ -26,7 +27,7 @@ option go_package = "go.thethings.network/lorawan-stack/pkg/ttnpb"; message Event { string name = 1; - google.protobuf.Timestamp time = 2 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp time = 2 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true, (validate.rules).message.required = true]; CombinedIdentifiers identifiers = 3; google.protobuf.Any data = 4; repeated string correlation_ids = 5 [(gogoproto.customname) = "CorrelationIDs"]; @@ -35,7 +36,7 @@ message Event { } message StreamEventsRequest { - CombinedIdentifiers identifiers = 1 [(gogoproto.nullable) = false]; + CombinedIdentifiers identifiers = 1 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; // If greater than zero, this will return historical events, up to this maximum when the stream starts. // If used in combination with "after", the limit that is reached first, is used. // The availability of historical events depends on server support and retention policy. diff --git a/api/gateway.proto b/api/gateway.proto index 1a0034e09f..1886220792 100644 --- a/api/gateway.proto +++ b/api/gateway.proto @@ -15,7 +15,7 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; -import "github.com/mwitkow/go-proto-validators/validator.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; @@ -70,7 +70,7 @@ message GatewayVersion { option (gogoproto.populate) = false; // Version identifiers. - GatewayVersionIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + GatewayVersionIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; // Photos contains file names of gateway photos. repeated string photos = 2; @@ -80,7 +80,7 @@ message GatewayVersion { // Gateway is the message that defines a gateway on the network. message Gateway { - GatewayIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + GatewayIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.Timestamp created_at = 2 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; @@ -89,14 +89,14 @@ message Gateway { map attributes = 6; repeated ContactInfo contact_info = 7; - GatewayVersionIdentifiers version_ids = 8 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + GatewayVersionIdentifiers version_ids = 8 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; // The address of the Gateway Server to connect to. // The typical format of the address is "host:port". If the port is omitted, // the normal port inference (with DNS lookup, otherwise defaults) is used. // The connection shall be established with transport layer security (TLS). // Custom certificate authorities may be configured out-of-band. - string gateway_server_address = 9 [(validator.field) = {regex: "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"}]; + string gateway_server_address = 9 [(validate.rules).string.pattern = "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"]; bool auto_update = 10; string update_channel = 11; string frequency_plan_id = 12 [(gogoproto.customname) = "FrequencyPlanID"]; @@ -113,7 +113,7 @@ message Gateway { // Enforcing gateway duty cycle is recommended for all gateways to respect spectrum regulations. Disable enforcing the // duty cycle only in controlled research and development environments. bool enforce_duty_cycle = 17; - DownlinkPathConstraint downlink_path_constraint = 18; + DownlinkPathConstraint downlink_path_constraint = 18 [(validate.rules).enum.defined_only = true]; } message Gateways { @@ -121,7 +121,7 @@ message Gateways { } message GetGatewayRequest { - GatewayIdentifiers gateway_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + GatewayIdentifiers gateway_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false]; } @@ -146,30 +146,30 @@ message ListGatewaysRequest { } message CreateGatewayRequest { - Gateway gateway = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + Gateway gateway = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; // Collaborator to grant all rights on the newly created gateway. - OrganizationOrUserIdentifiers collaborator = 2 [(gogoproto.nullable) = false]; + OrganizationOrUserIdentifiers collaborator = 2 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; } message UpdateGatewayRequest { - Gateway gateway = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + Gateway gateway = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false]; } message CreateGatewayAPIKeyRequest { - GatewayIdentifiers gateway_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + GatewayIdentifiers gateway_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; string name = 2; repeated Right rights = 3; } message UpdateGatewayAPIKeyRequest { - GatewayIdentifiers gateway_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - APIKey api_key = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + GatewayIdentifiers gateway_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; + APIKey api_key = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; } message SetGatewayCollaboratorRequest { - GatewayIdentifiers gateway_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - Collaborator collaborator = 2 [(gogoproto.nullable) = false]; + GatewayIdentifiers gateway_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; + Collaborator collaborator = 2 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; } // GatewayAntenna is the message that defines a gateway antenna. @@ -177,13 +177,13 @@ message GatewayAntenna { // gain is the antenna gain relative to this gateway, in dBi. float gain = 1; // location is the antenna's location. - Location location = 2 [(gogoproto.nullable) = false]; + Location location = 2 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; map attributes = 3; } message GatewayStatus { // Current time of the gateway - google.protobuf.Timestamp time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true, (validate.rules).message.required = true]; // Boot time of the gateway // - can be left out to save bandwidth; old value will be kept google.protobuf.Timestamp boot_time = 2 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; diff --git a/api/identifiers.proto b/api/identifiers.proto index 39b2f5bcc8..6e86bf64b8 100644 --- a/api/identifiers.proto +++ b/api/identifiers.proto @@ -15,7 +15,7 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; -import "github.com/mwitkow/go-proto-validators/validator.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; package ttn.lorawan.v3; @@ -25,20 +25,20 @@ option go_package = "go.thethings.network/lorawan-stack/pkg/ttnpb"; message ApplicationIdentifiers { option (gogoproto.populate) = false; - string application_id = 1 [(gogoproto.customname) = "ApplicationID", (validator.field) = {regex: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , length_lt: 37}]; + string application_id = 1 [(gogoproto.customname) = "ApplicationID", (validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , max_len: 36}]; } message ClientIdentifiers { option (gogoproto.populate) = false; - string client_id = 1 [(gogoproto.customname) = "ClientID", (validator.field) = {regex: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , length_lt: 37}]; + string client_id = 1 [(gogoproto.customname) = "ClientID", (validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , max_len: 36}]; } message EndDeviceIdentifiers { option (gogoproto.populate) = false; - string device_id = 1 [(gogoproto.customname) = "DeviceID", (validator.field) = {regex: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , length_lt: 37}]; - ApplicationIdentifiers application_ids = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + string device_id = 1 [(gogoproto.customname) = "DeviceID", (validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , max_len: 36}]; + ApplicationIdentifiers application_ids = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; // The LoRaWAN DevEUI. bytes dev_eui = 4 [(gogoproto.customtype) = "go.thethings.network/lorawan-stack/pkg/types.EUI64", (gogoproto.customname) = "DevEUI"]; // The LoRaWAN JoinEUI (or AppEUI for LoRaWAN 1.0 end devices). @@ -50,7 +50,7 @@ message EndDeviceIdentifiers { message GatewayIdentifiers { option (gogoproto.populate) = false; - string gateway_id = 1 [(gogoproto.customname) = "GatewayID", (validator.field) = {regex: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , length_lt: 37}]; + string gateway_id = 1 [(gogoproto.customname) = "GatewayID", (validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , max_len: 36}]; // Secondary identifier, which can only be used in specific requests. bytes eui = 2 [(gogoproto.customtype) = "go.thethings.network/lorawan-stack/pkg/types.EUI64", (gogoproto.customname) = "EUI"]; @@ -60,14 +60,14 @@ message OrganizationIdentifiers { option (gogoproto.populate) = false; // This ID shares namespace with user IDs. - string organization_id = 1 [(gogoproto.customname) = "OrganizationID", (validator.field) = {regex: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , length_lt: 37}]; + string organization_id = 1 [(gogoproto.customname) = "OrganizationID", (validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , max_len: 36}]; } message UserIdentifiers { option (gogoproto.populate) = false; // This ID shares namespace with organization IDs. - string user_id = 1 [(gogoproto.customname) = "UserID", (validator.field) = {regex: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , length_lt: 37}]; + string user_id = 1 [(gogoproto.customname) = "UserID", (validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , max_len: 36}]; // Secondary identifier, which can only be used in specific requests. string email = 2; diff --git a/api/identityserver.proto b/api/identityserver.proto index 910ab604fe..318b595146 100644 --- a/api/identityserver.proto +++ b/api/identityserver.proto @@ -15,6 +15,7 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; import "lorawan-stack/api/identifiers.proto"; @@ -27,8 +28,8 @@ option go_package = "go.thethings.network/lorawan-stack/pkg/ttnpb"; message AuthInfoResponse { message APIKeyAccess { - APIKey api_key = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - EntityIdentifiers entity_ids = 2 [(gogoproto.customname) = "EntityIDs", (gogoproto.nullable) = false]; + APIKey api_key = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; + EntityIdentifiers entity_ids = 2 [(gogoproto.customname) = "EntityIDs", (gogoproto.nullable) = false, (validate.rules).message.required = true]; } oneof access_method { AuthInfoResponse.APIKeyAccess api_key = 1 [(gogoproto.customname) = "APIKey"]; diff --git a/api/join.proto b/api/join.proto index f2fae72bdd..ff3ba3cf11 100644 --- a/api/join.proto +++ b/api/join.proto @@ -15,7 +15,7 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; -import "github.com/mwitkow/go-proto-validators/validator.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; import "google/protobuf/duration.proto"; import "lorawan-stack/api/keys.proto"; import "lorawan-stack/api/lorawan.proto"; @@ -27,13 +27,13 @@ option go_package = "go.thethings.network/lorawan-stack/pkg/ttnpb"; message JoinRequest { option (gogoproto.populate) = false; - bytes raw_payload = 1 [(validator.field) = { length_eq: 23 }]; + bytes raw_payload = 1 [(validate.rules).bytes.len = 23]; Message payload = 2; bytes dev_addr = 3 [(gogoproto.nullable) = false, (gogoproto.customtype) = "go.thethings.network/lorawan-stack/pkg/types.DevAddr"]; MACVersion selected_mac_version = 4 [(gogoproto.customname) = "SelectedMACVersion"]; bytes net_id = 5 [(gogoproto.nullable) = false, (gogoproto.customname) = "NetID", (gogoproto.customtype) = "go.thethings.network/lorawan-stack/pkg/types.NetID"]; - DLSettings downlink_settings = 6 [(gogoproto.nullable) = false]; - RxDelay rx_delay = 7; + DLSettings downlink_settings = 6 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; + RxDelay rx_delay = 7 [(validate.rules).enum.defined_only = true]; // Optional CFList. CFList cf_list = 8 [(gogoproto.customname) = "CFList"]; reserved 9; // Reserved for CFListType. @@ -41,8 +41,8 @@ message JoinRequest { } message JoinResponse { - bytes raw_payload = 1 [(validator.field) = { length_gt:16, length_lt: 34 }]; - SessionKeys session_keys = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + bytes raw_payload = 1 [(validate.rules).bytes = {min_len: 17, max_len: 33}]; + SessionKeys session_keys = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.Duration lifetime = 3 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; repeated string correlation_ids = 4 [(gogoproto.customname) = "CorrelationIDs"]; } diff --git a/api/joinserver.proto b/api/joinserver.proto index dd78b8e380..037a4321b7 100644 --- a/api/joinserver.proto +++ b/api/joinserver.proto @@ -15,7 +15,7 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; -import "github.com/mwitkow/go-proto-validators/validator.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/struct.proto"; @@ -38,11 +38,11 @@ message SessionKeyRequest { message NwkSKeysResponse { // The (encrypted) Forwarding Network Session Integrity Key (or Network Session Key in 1.0 compatibility mode). - KeyEnvelope f_nwk_s_int_key = 1 [(gogoproto.nullable) = false]; + KeyEnvelope f_nwk_s_int_key = 1 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; // The (encrypted) Serving Network Session Integrity Key. - KeyEnvelope s_nwk_s_int_key = 2 [(gogoproto.nullable) = false]; + KeyEnvelope s_nwk_s_int_key = 2 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; // The (encrypted) Network Session Encryption Key. - KeyEnvelope nwk_s_enc_key = 3 [(gogoproto.nullable) = false]; + KeyEnvelope nwk_s_enc_key = 3 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; } // The NsJs service connects a Network Server to a Join Server. @@ -53,7 +53,7 @@ service NsJs { message AppSKeyResponse { // The (encrypted) Application Session Key. - KeyEnvelope app_s_key = 1 [(gogoproto.nullable) = false]; + KeyEnvelope app_s_key = 1 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; } // The AsJs service connects an Application Server to a Join Server. @@ -62,10 +62,10 @@ service AsJs { } message CryptoServicePayloadRequest { - EndDeviceIdentifiers ids = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; - MACVersion lorawan_version = 2 [(gogoproto.customname) = "LoRaWANVersion"]; + EndDeviceIdentifiers ids = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true, (validate.rules).message.required = true]; + MACVersion lorawan_version = 2 [(gogoproto.customname) = "LoRaWANVersion", (validate.rules).enum.defined_only = true]; bytes payload = 3; - string provisioner_id = 4 [(gogoproto.customname) = "ProvisionerID", (validator.field) = {regex: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$", length_lt: 37}]; + string provisioner_id = 4 [(gogoproto.customname) = "ProvisionerID", (validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$", max_len: 36}]; google.protobuf.Struct provisioning_data = 5; } @@ -74,24 +74,24 @@ message CryptoServicePayloadResponse { } message JoinAcceptMICRequest { - CryptoServicePayloadRequest payload_request = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; - uint32 join_request_type = 2; + CryptoServicePayloadRequest payload_request = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true, (validate.rules).message.required = true]; + RejoinType join_request_type = 2 [(validate.rules).enum.defined_only = true]; bytes dev_nonce = 3 [(gogoproto.nullable) = false, (gogoproto.customtype) = "go.thethings.network/lorawan-stack/pkg/types.DevNonce"]; } message DeriveSessionKeysRequest { - EndDeviceIdentifiers ids = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; - MACVersion lorawan_version = 2 [(gogoproto.customname) = "LoRaWANVersion"]; + EndDeviceIdentifiers ids = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true, (validate.rules).message.required = true]; + MACVersion lorawan_version = 2 [(gogoproto.customname) = "LoRaWANVersion", (validate.rules).enum.defined_only = true]; bytes join_nonce = 3 [(gogoproto.nullable) = false, (gogoproto.customtype) = "go.thethings.network/lorawan-stack/pkg/types.JoinNonce"]; bytes dev_nonce = 4 [(gogoproto.nullable) = false, (gogoproto.customtype) = "go.thethings.network/lorawan-stack/pkg/types.DevNonce"]; bytes net_id = 5 [(gogoproto.nullable) = false, (gogoproto.customname) = "NetID", (gogoproto.customtype) = "go.thethings.network/lorawan-stack/pkg/types.NetID"]; - string provisioner_id = 6 [(gogoproto.customname) = "ProvisionerID", (validator.field) = {regex: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$", length_lt: 37}]; + string provisioner_id = 6 [(gogoproto.customname) = "ProvisionerID", (validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$", max_len: 36}]; google.protobuf.Struct provisioning_data = 7; } message GetRootKeysRequest { - EndDeviceIdentifiers ids = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; - string provisioner_id = 2 [(gogoproto.customname) = "ProvisionerID", (validator.field) = {regex: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$", length_lt: 37}]; + EndDeviceIdentifiers ids = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true, (validate.rules).message.required = true]; + string provisioner_id = 2 [(gogoproto.customname) = "ProvisionerID", (validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$", max_len: 36}]; google.protobuf.Struct provisioning_data = 3; } @@ -116,7 +116,7 @@ service ApplicationCryptoService { message ProvisionEndDevicesRequest { ApplicationIdentifiers application_ids = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; // ID of the provisioner service as configured in the Join Server. - string provisioner_id = 2 [(gogoproto.customname) = "ProvisionerID", (validator.field) = {regex: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$", length_lt: 37}]; + string provisioner_id = 2 [(gogoproto.customname) = "ProvisionerID", (validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$", max_len: 36}]; // Vendor-specific provisioning data. bytes provisioning_data = 3; diff --git a/api/keys.proto b/api/keys.proto index 294f503f87..40ca3a242d 100644 --- a/api/keys.proto +++ b/api/keys.proto @@ -15,7 +15,6 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; -import "github.com/mwitkow/go-proto-validators/validator.proto"; package ttn.lorawan.v3; diff --git a/api/lorawan.proto b/api/lorawan.proto index 7cdff5498a..fc10ec1c92 100644 --- a/api/lorawan.proto +++ b/api/lorawan.proto @@ -15,7 +15,7 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; -import "github.com/mwitkow/go-proto-validators/validator.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; import "lorawan-stack/api/identifiers.proto"; @@ -27,8 +27,8 @@ option go_package = "go.thethings.network/lorawan-stack/pkg/ttnpb"; message Message { option (gogoproto.populate) = false; - MHDR m_hdr = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - bytes mic = 2 [(gogoproto.customname) = "MIC"]; + MHDR m_hdr = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; + bytes mic = 2 [(gogoproto.customname) = "MIC", (validate.rules).bytes.len = 4]; // Payload represents either MACPayload, RejoinRequestPayload, JoinRequestPayload or JoinAcceptPayload // - MACPayload length is in range [7:M] bytes, where M is PHY specific. @@ -36,6 +36,8 @@ message Message { // - JoinAcceptPayload length is either 12 or 28 bytes. // - RejoinRequestPayload length is 14 for Type 0 and 2, 19 for Type 1. oneof Payload { + option (validate.required) = true; + MACPayload mac_payload = 3 [(gogoproto.customname) = "MACPayload"]; JoinRequestPayload join_request_payload = 4; JoinAcceptPayload join_accept_payload = 5; @@ -107,15 +109,15 @@ enum DataRateIndex { } message MHDR { - MType m_type = 1; - Major major = 2; + MType m_type = 1 [(validate.rules).enum.defined_only = true]; + Major major = 2 [(validate.rules).enum.defined_only = true]; } message MACPayload { option (gogoproto.populate) = false; - FHDR f_hdr = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - uint32 f_port = 2 [(validator.field) = {int_lt: 256}]; + FHDR f_hdr = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; + uint32 f_port = 2 [(validate.rules).uint32.lte = 255]; bytes frm_payload = 3 [(gogoproto.customname) = "FRMPayload"]; google.protobuf.Struct decoded_payload = 4; } @@ -124,9 +126,9 @@ message FHDR { option (gogoproto.populate) = false; bytes dev_addr = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "go.thethings.network/lorawan-stack/pkg/types.DevAddr"]; - FCtrl f_ctrl = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - uint32 f_cnt = 3 [(validator.field) = {int_lt: 65536}]; - bytes f_opts = 4; + FCtrl f_ctrl = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; + uint32 f_cnt = 3 [(validate.rules).uint32.lte = 65535]; + bytes f_opts = 4 [(validate.rules).bytes.max_len = 15]; } message FCtrl { @@ -154,7 +156,7 @@ enum RejoinType { message RejoinRequestPayload { option (gogoproto.populate) = false; - RejoinType rejoin_type = 1; + RejoinType rejoin_type = 1 [(validate.rules).enum.defined_only = true]; bytes net_id = 2 [(gogoproto.nullable) = false, (gogoproto.customname) = "NetID", (gogoproto.customtype) = "go.thethings.network/lorawan-stack/pkg/types.NetID"]; bytes join_eui = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "JoinEUI", (gogoproto.customtype) = "go.thethings.network/lorawan-stack/pkg/types.EUI64"]; bytes dev_eui = 4 [(gogoproto.nullable) = false, (gogoproto.customname) = "DevEUI", (gogoproto.customtype) = "go.thethings.network/lorawan-stack/pkg/types.EUI64"]; @@ -168,16 +170,16 @@ message JoinAcceptPayload { bytes join_nonce = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "go.thethings.network/lorawan-stack/pkg/types.JoinNonce"]; bytes net_id = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "NetID", (gogoproto.customtype) = "go.thethings.network/lorawan-stack/pkg/types.NetID"]; bytes dev_addr = 4 [(gogoproto.nullable) = false, (gogoproto.customtype) = "go.thethings.network/lorawan-stack/pkg/types.DevAddr"]; - DLSettings dl_settings = 5 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - RxDelay rx_delay = 6; + DLSettings dl_settings = 5 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; + RxDelay rx_delay = 6 [(validate.rules).enum.defined_only = true]; CFList cf_list = 7 [(gogoproto.customname) = "CFList"]; } message DLSettings { option (gogoproto.populate) = false; - uint32 rx1_dr_offset = 1 [(gogoproto.customname) = "Rx1DROffset"]; - DataRateIndex rx2_dr = 2 [(gogoproto.customname) = "Rx2DR"]; + uint32 rx1_dr_offset = 1 [(gogoproto.customname) = "Rx1DROffset", (validate.rules).uint32.lte = 7]; + DataRateIndex rx2_dr = 2 [(gogoproto.customname) = "Rx2DR", (validate.rules).enum.defined_only = true]; // OptNeg is set if Network Server implements LoRaWAN 1.1 or greater. bool opt_neg = 3 [(gogoproto.customname) = "OptNeg"]; } @@ -190,7 +192,7 @@ enum CFListType { message CFList { option (gogoproto.populate) = false; - CFListType type = 1; + CFListType type = 1 [(validate.rules).enum.defined_only = true]; // Frequencies to be broadcasted, in hecto-Hz. // These values are broadcasted as 24 bits unsigned integers. // This field should not contain default values. @@ -231,6 +233,8 @@ message FSKDataRate { message DataRate { oneof modulation { + option (validate.required) = true; + LoRaDataRate lora = 1 [(gogoproto.customname) = "LoRa"]; FSKDataRate fsk = 2 [(gogoproto.customname) = "FSK"]; }; @@ -243,9 +247,9 @@ message TxSettings { option (gogoproto.populate) = false; // Data rate. - DataRate data_rate = 1 [(gogoproto.nullable) = false]; + DataRate data_rate = 1 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; // LoRaWAN data rate index. - DataRateIndex data_rate_index = 2; + DataRateIndex data_rate_index = 2 [(validate.rules).enum.defined_only = true]; // LoRa coding rate. string coding_rate = 3; // Frequency (Hz). @@ -256,10 +260,10 @@ message TxSettings { bool invert_polarization = 6; // Index of the gateway channel that received the message. // Set by Gateway Server. - uint32 gateway_channel_index = 7 [(validator.field) = {int_lt: 256}]; + uint32 gateway_channel_index = 7 [(validate.rules).uint32 = {lte: 255}]; // Index of the device channel that received the message. // Set by Network Server. - uint32 device_channel_index = 8 [(validator.field) = {int_lt: 256}]; + uint32 device_channel_index = 8 [(validate.rules).uint32 = {lte: 255}]; // Send a CRC in the packet; only on uplink; on downlink, CRC should not be enabled. bool enable_crc = 9 [(gogoproto.customname) = "EnableCRC"]; // Timestamp of the gateway concentrator when the uplink message was received, or when the downlink message should be transmitted (microseconds). @@ -271,12 +275,12 @@ message TxSettings { } message GatewayAntennaIdentifiers { - GatewayIdentifiers gateway_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + GatewayIdentifiers gateway_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; uint32 antenna_index = 2; } message UplinkToken { - GatewayAntennaIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + GatewayAntennaIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; uint32 timestamp = 2; } @@ -284,6 +288,8 @@ message DownlinkPath { // Set uplink token for class A, B or C downlink to the uplink token received from the corresponding RxMetadata. Uplink tokens are opaque to the Network Server. // Set fixed to force using the specified gateway antenna identifiers for downlink. This can only be used for class B or C downlinks. oneof path { + option (validate.required) = true; + bytes uplink_token = 1; GatewayAntennaIdentifiers fixed = 2; } @@ -303,19 +309,19 @@ message TxRequest { repeated DownlinkPath downlink_paths = 2; // Rx1 delay (Rx2 delay is Rx1 delay + 1 second). - RxDelay rx1_delay = 3; + RxDelay rx1_delay = 3 [(validate.rules).enum.defined_only = true]; // LoRaWAN data rate index for Rx1. - DataRateIndex rx1_data_rate_index = 4; + DataRateIndex rx1_data_rate_index = 4 [(validate.rules).enum.defined_only = true]; // Frequency (Hz) for Rx1. uint64 rx1_frequency = 5; // LoRaWAN data rate index for Rx2. - DataRateIndex rx2_data_rate_index = 6; + DataRateIndex rx2_data_rate_index = 6 [(validate.rules).enum.defined_only = true]; // Frequency (Hz) for Rx2. uint64 rx2_frequency = 7; // Priority for scheduling. // Requests with a higher priority are allocated more channel time than messages with a lower priority, in duty-cycle limited regions. // A priority of HIGH or higher sets the HiPriorityFlag in the DLMetadata Object. - TxSchedulePriority priority = 8; + TxSchedulePriority priority = 8 [(validate.rules).enum.defined_only = true]; // Time when the downlink message should be transmitted. // This value is only valid for class C downlink; class A downlink uses uplink tokens and class B downlink is scheduled on ping slots. @@ -356,7 +362,9 @@ enum MACCommandIdentifier { } message MACCommand { - MACCommandIdentifier cid = 1 [(gogoproto.customname) = "CID"]; + option (gogoproto.populate) = false; + + MACCommandIdentifier cid = 1 [(gogoproto.customname) = "CID", (validate.rules).enum = {defined_only: true, not_in:[0]}]; oneof payload { bytes raw_payload = 2; @@ -393,23 +401,31 @@ message MACCommand { } message ResetInd { - Minor minor_version = 1; + option (gogoproto.populate) = false; + + Minor minor_version = 1 [(validate.rules).enum = {defined_only: true, in:[1]}]; } message ResetConf { - Minor minor_version = 1; + option (gogoproto.populate) = false; + + Minor minor_version = 1 [(validate.rules).enum = {defined_only: true, in:[1]}]; } message LinkCheckAns { + option (gogoproto.populate) = false; + // Indicates the link margin in dB of the received LinkCheckReq, relative to the demodulation floor. - uint32 margin = 1; - uint32 gateway_count = 2; + uint32 margin = 1 [(validate.rules).uint32.lte = 254]; + uint32 gateway_count = 2 [(validate.rules).uint32.lte = 255]; } message LinkADRReq { - DataRateIndex data_rate_index = 1; - uint32 tx_power_index = 2; - repeated bool channel_mask = 3; + option (gogoproto.populate) = false; + + DataRateIndex data_rate_index = 1 [(validate.rules).enum.defined_only = true]; + uint32 tx_power_index = 2 [(validate.rules).uint32.lte = 15]; + repeated bool channel_mask = 3 [(validate.rules).repeated.max_items = 16]; reserved 4; // For RFU 7th bit of Redundancy. - uint32 channel_mask_control = 5; - uint32 nb_trans = 6; + uint32 channel_mask_control = 5 [(validate.rules).uint32.lte = 7]; + uint32 nb_trans = 6 [(validate.rules).uint32.lte = 15]; } message LinkADRAns { bool channel_mask_ack = 1; @@ -417,12 +433,14 @@ message MACCommand { bool tx_power_index_ack = 3; } message DutyCycleReq { - AggregatedDutyCycle max_duty_cycle = 1; + AggregatedDutyCycle max_duty_cycle = 1 [(validate.rules).enum.defined_only = true]; } message RxParamSetupReq { - DataRateIndex rx2_data_rate_index = 1; - uint32 rx1_data_rate_offset = 2; - uint64 rx2_frequency = 3; // Rx2 frequency (Hz). + option (gogoproto.populate) = false; + + DataRateIndex rx2_data_rate_index = 1 [(validate.rules).enum.defined_only = true]; + uint32 rx1_data_rate_offset = 2 [(validate.rules).uint32.lte = 7]; + uint64 rx2_frequency = 3 [(validate.rules).uint64.gte = 100000]; // Rx2 frequency (Hz). } message RxParamSetupAns { bool rx2_data_rate_index_ack = 1; @@ -430,99 +448,113 @@ message MACCommand { bool rx2_frequency_ack = 3; } message DevStatusAns { + option (gogoproto.populate) = false; + // Device battery status. // 0 indicates that the device is connected to an external power source. // 1..254 indicates a battery level. // 255 indicates that the device was not able to measure the battery level. - uint32 battery = 1; + uint32 battery = 1 [(validate.rules).uint32.lte = 255]; // SNR of the last downlink (dB; [-32, +31]). - int32 margin = 2; + int32 margin = 2 [(validate.rules).int32 = {gte: -32, lte: 31}]; } message NewChannelReq { - uint32 channel_index = 1; - uint64 frequency = 2; // Channel frequency (Hz). - DataRateIndex min_data_rate_index = 3; - DataRateIndex max_data_rate_index = 4; + option (gogoproto.populate) = false; + + uint32 channel_index = 1 [(validate.rules).uint32.lte = 255]; + uint64 frequency = 2 [(validate.rules).uint64.gte = 100000]; // Channel frequency (Hz). + DataRateIndex min_data_rate_index = 3 [(validate.rules).enum.defined_only = true]; + DataRateIndex max_data_rate_index = 4 [(validate.rules).enum.defined_only = true]; } message NewChannelAns { bool frequency_ack = 1; bool data_rate_ack = 2; } message DLChannelReq { - uint32 channel_index = 1; - uint64 frequency = 2; // Downlink channel frequency (Hz). + option (gogoproto.populate) = false; + + uint32 channel_index = 1 [(validate.rules).uint32.lte = 255]; + uint64 frequency = 2 [(validate.rules).uint64.gte = 100000]; // Downlink channel frequency (Hz). } message DLChannelAns { bool channel_index_ack = 1; bool frequency_ack = 2; } message RxTimingSetupReq { - RxDelay delay = 1; + RxDelay delay = 1 [(validate.rules).enum.defined_only = true]; } message TxParamSetupReq { // Indicates the maximum EIRP value in dBm, indexed by the following vector: // [ 8 10 12 13 14 16 18 20 21 24 26 27 29 30 33 36 ] - DeviceEIRP max_eirp_index = 1 [(gogoproto.customname) = "MaxEIRPIndex"]; + DeviceEIRP max_eirp_index = 1 [(gogoproto.customname) = "MaxEIRPIndex", (validate.rules).enum.defined_only = true]; bool uplink_dwell_time = 2; bool downlink_dwell_time = 3; } message RekeyInd { - Minor minor_version = 1; + Minor minor_version = 1 [(validate.rules).enum.defined_only = true]; } message RekeyConf { - Minor minor_version = 1; + Minor minor_version = 1 [(validate.rules).enum.defined_only = true]; } message ADRParamSetupReq { // Exponent e that configures the ADR_ACK_LIMIT = 2^e messages. - ADRAckLimitExponent adr_ack_limit_exponent = 1 [(gogoproto.customname) = "ADRAckLimitExponent"]; + ADRAckLimitExponent adr_ack_limit_exponent = 1 [(gogoproto.customname) = "ADRAckLimitExponent", (validate.rules).enum.defined_only = true]; // Exponent e that configures the ADR_ACK_DELAY = 2^e messages. - ADRAckDelayExponent adr_ack_delay_exponent = 2 [(gogoproto.customname) = "ADRAckDelayExponent"]; + ADRAckDelayExponent adr_ack_delay_exponent = 2 [(gogoproto.customname) = "ADRAckDelayExponent", (validate.rules).enum.defined_only = true]; } message DeviceTimeAns { - google.protobuf.Timestamp time = 7 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp time = 7 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true, (validate.rules).message.required = true]; } message ForceRejoinReq { - uint32 rejoin_type = 1; - DataRateIndex data_rate_index = 2; - uint32 max_retries = 3; + option (gogoproto.populate) = false; + + RejoinType rejoin_type = 1 [(validate.rules).enum.defined_only = true]; + DataRateIndex data_rate_index = 2 [(validate.rules).enum.defined_only = true]; + uint32 max_retries = 3 [(validate.rules).uint32.lte = 7]; // Exponent e that configures the rejoin period = 32 * 2^e + rand(0,32) seconds. - RejoinPeriodExponent period_exponent = 4; + RejoinPeriodExponent period_exponent = 4 [(validate.rules).enum.defined_only = true]; } message RejoinParamSetupReq { // Exponent e that configures the rejoin counter = 2^(e+4) messages. - RejoinCountExponent max_count_exponent = 1; + RejoinCountExponent max_count_exponent = 1 [(validate.rules).enum.defined_only = true]; // Exponent e that configures the rejoin timer = 2^(e+10) seconds. - RejoinTimeExponent max_time_exponent = 2; + RejoinTimeExponent max_time_exponent = 2 [(validate.rules).enum.defined_only = true]; } message RejoinParamSetupAns { bool max_time_exponent_ack = 1; } message PingSlotInfoReq { - PingSlotPeriod period = 1; + PingSlotPeriod period = 1 [(validate.rules).enum.defined_only = true]; } message PingSlotChannelReq { - uint64 frequency = 1; // Ping slot channel frequency (Hz). - DataRateIndex data_rate_index = 2; + option (gogoproto.populate) = false; + + uint64 frequency = 1 [(validate.rules).uint64.gte = 100000]; // Ping slot channel frequency (Hz). + DataRateIndex data_rate_index = 2 [(validate.rules).enum.defined_only = true]; } message PingSlotChannelAns { bool frequency_ack = 1; bool data_rate_index_ack = 2; } message BeaconTimingAns { - uint32 delay = 1; // (uint16) See LoRaWAN specification. - uint32 channel_index = 2; + option (gogoproto.populate) = false; + + uint32 delay = 1 [(validate.rules).uint32.lte = 65535]; // (uint16) See LoRaWAN specification. + uint32 channel_index = 2 [(validate.rules).uint32.lte = 255]; } message BeaconFreqReq { - uint64 frequency = 1; // Frequency of the Class B beacons (Hz). + option (gogoproto.populate) = false; + + uint64 frequency = 1 [(validate.rules).uint64.gte = 100000]; // Frequency of the Class B beacons (Hz). } message BeaconFreqAns { bool frequency_ack = 1; } message DeviceModeInd { - Class class = 1; + Class class = 1 [(validate.rules).enum.defined_only = true]; } message DeviceModeConf { - Class class = 1; + Class class = 1 [(validate.rules).enum.defined_only = true]; } } diff --git a/api/message_services.proto b/api/message_services.proto index 989c443578..20f57ae5a7 100644 --- a/api/message_services.proto +++ b/api/message_services.proto @@ -15,6 +15,7 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; import "lorawan-stack/api/end_device.proto"; import "lorawan-stack/api/identifiers.proto"; import "lorawan-stack/api/messages.proto"; @@ -24,16 +25,16 @@ package ttn.lorawan.v3; option go_package = "go.thethings.network/lorawan-stack/pkg/ttnpb"; message ProcessUplinkMessageRequest { - EndDeviceIdentifiers ids = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; - EndDeviceVersionIdentifiers end_device_version_ids = 2 [(gogoproto.nullable) = false, (gogoproto.customname) = "EndDeviceVersionIDs"]; - ApplicationUplink message = 3 [(gogoproto.nullable) = false]; + EndDeviceIdentifiers ids = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true, (validate.rules).message.required = true]; + EndDeviceVersionIdentifiers end_device_version_ids = 2 [(gogoproto.nullable) = false, (gogoproto.customname) = "EndDeviceVersionIDs", (validate.rules).message.required = true]; + ApplicationUplink message = 3 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; string parameter = 4; } message ProcessDownlinkMessageRequest { - EndDeviceIdentifiers ids = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; - EndDeviceVersionIdentifiers end_device_version_ids = 2 [(gogoproto.nullable) = false, (gogoproto.customname) = "EndDeviceVersionIDs"]; - ApplicationDownlink message = 3 [(gogoproto.nullable) = false]; + EndDeviceIdentifiers ids = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true, (validate.rules).message.required = true]; + EndDeviceVersionIdentifiers end_device_version_ids = 2 [(gogoproto.nullable) = false, (gogoproto.customname) = "EndDeviceVersionIDs", (validate.rules).message.required = true]; + ApplicationDownlink message = 3 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; string parameter = 4; } diff --git a/api/messages.proto b/api/messages.proto index 7386c1f761..1775d27327 100644 --- a/api/messages.proto +++ b/api/messages.proto @@ -15,7 +15,7 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; -import "github.com/mwitkow/go-proto-validators/validator.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; import "lorawan-stack/api/error.proto"; @@ -73,8 +73,8 @@ message UplinkMessage { bytes raw_payload = 1; Message payload = 2; - TxSettings settings = 4 [(gogoproto.nullable) = false]; - repeated RxMetadata rx_metadata = 5; + TxSettings settings = 4 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; + repeated RxMetadata rx_metadata = 5 [(validate.rules).repeated.min_items = 1]; // Server time when a component received the message. // The Gateway Server, Network Server and Application Server may set this value to their local server time of reception. google.protobuf.Timestamp received_at = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; @@ -128,6 +128,8 @@ message DownlinkMessage { Message payload = 2; EndDeviceIdentifiers end_device_ids = 3 [(gogoproto.customname) = "EndDeviceIDs"]; oneof settings { + option (validate.required) = true; + TxRequest request = 4; TxSettings scheduled = 5; } @@ -148,23 +150,23 @@ message TxAcknowledgment { TX_POWER = 7; GPS_UNLOCKED = 8; } - Result result = 2; + Result result = 2 [(validate.rules).enum.defined_only = true]; } message ApplicationUplink { // Join Server issued identifier for the session keys used by this uplink. bytes session_key_id = 1 [(gogoproto.customname) = "SessionKeyID"]; - uint32 f_port = 2; + uint32 f_port = 2 [(validate.rules).uint32.lte = 255]; uint32 f_cnt = 3; bytes frm_payload = 4 [(gogoproto.customname) = "FRMPayload"]; google.protobuf.Struct decoded_payload = 5; - repeated RxMetadata rx_metadata = 6; - TxSettings settings = 7 [(gogoproto.nullable) = false]; + repeated RxMetadata rx_metadata = 6 [(validate.rules).repeated.min_items = 1]; + TxSettings settings = 7 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; } message ApplicationLocation { string service = 1; - Location location = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + Location location = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; map attributes = 3; } @@ -185,7 +187,7 @@ message ApplicationDownlink { // Join Server issued identifier for the session keys used by this downlink. bytes session_key_id = 1 [(gogoproto.customname) = "SessionKeyID"]; - uint32 f_port = 2; + uint32 f_port = 2 [(validate.rules).uint32.lte = 255]; uint32 f_cnt = 3; bytes frm_payload = 4 [(gogoproto.customname) = "FRMPayload"]; google.protobuf.Struct decoded_payload = 5; @@ -208,7 +210,7 @@ message ApplicationDownlink { // If not set, this downlink message may be transmitted in class A, B and C. ClassBC class_b_c = 7; // Priority for scheduling the downlink message. - TxSchedulePriority priority = 8; + TxSchedulePriority priority = 8 [(validate.rules).enum.defined_only = true]; repeated string correlation_ids = 9 [(gogoproto.customname) = "CorrelationIDs"]; } @@ -218,20 +220,22 @@ message ApplicationDownlinks { } message ApplicationDownlinkFailed { - ApplicationDownlink downlink = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - ErrorDetails error = 2 [(gogoproto.nullable) = false]; + ApplicationDownlink downlink = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; + ErrorDetails error = 2 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; } message ApplicationInvalidatedDownlinks { - repeated ApplicationDownlink downlinks = 1; + repeated ApplicationDownlink downlinks = 1 [(validate.rules).repeated.min_items = 1]; uint32 last_f_cnt_down = 2; } message ApplicationUp { - EndDeviceIdentifiers end_device_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + EndDeviceIdentifiers end_device_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; repeated string correlation_ids = 2 [(gogoproto.customname) = "CorrelationIDs"]; oneof up { + option (validate.required) = true; + ApplicationUplink uplink_message = 3; ApplicationJoinAccept join_accept = 4; ApplicationDownlink downlink_ack = 5; @@ -260,11 +264,11 @@ enum PayloadFormatter { message MessagePayloadFormatters { // Payload formatter for uplink messages, must be set together with its parameter. - PayloadFormatter up_formatter = 1; + PayloadFormatter up_formatter = 1 [(validate.rules).enum.defined_only = true]; // Parameter for the up_formatter, must be set together. string up_formatter_parameter = 2; // Payload formatter for downlink messages, must be set together with its parameter. - PayloadFormatter down_formatter = 3; + PayloadFormatter down_formatter = 3 [(validate.rules).enum.defined_only = true]; // Parameter for the down_formatter, must be set together. string down_formatter_parameter = 4; } diff --git a/api/metadata.proto b/api/metadata.proto index a2f57d0a94..866b2a53fd 100644 --- a/api/metadata.proto +++ b/api/metadata.proto @@ -15,6 +15,7 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; import "lorawan-stack/api/enums.proto"; @@ -27,7 +28,7 @@ option go_package = "go.thethings.network/lorawan-stack/pkg/ttnpb"; // Contains metadata for a received message. Each antenna that receives // a message corresponds to one RxMetadata. message RxMetadata { - GatewayIdentifiers gateway_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + GatewayIdentifiers gateway_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; uint32 antenna_index = 2; google.protobuf.Timestamp time = 3 [(gogoproto.stdtime) = true]; // Gateway concentrator timestamp when the Rx finished (microseconds). @@ -50,7 +51,7 @@ message RxMetadata { // Antenna location; injected by the Gateway Server. Location location = 13; // Gateway downlink path constraint; injected by the Gateway Server. - DownlinkPathConstraint downlink_path_constraint = 14; + DownlinkPathConstraint downlink_path_constraint = 14 [(validate.rules).enum.defined_only = true]; // Uplink token to be included in the Tx request in class A downlink; injected by gateway, Gateway Server or fNS. bytes uplink_token = 15; // Advanced metadata fields @@ -61,15 +62,15 @@ message RxMetadata { message Location { // The North–South position (degrees; -90 to +90), where 0 is the equator, North pole is positive, South pole is negative. - double latitude = 1; + double latitude = 1 [(validate.rules).double = {gte: -90, lte: 90}]; // The East-West position (degrees; -180 to +180), where 0 is the Prime Meridian (Greenwich), East is positive , West is negative. - double longitude = 2; + double longitude = 2 [(validate.rules).double = {gte: -180, lte: 180}]; // The altitude (meters), where 0 is the mean sea level. int32 altitude = 3; // The accuracy of the location (meters). int32 accuracy = 4; // Source of the location information. - LocationSource source = 5; + LocationSource source = 5 [(validate.rules).enum.defined_only = true]; } enum LocationSource { diff --git a/api/oauth.proto b/api/oauth.proto index 75b7e29d14..31369ee88d 100644 --- a/api/oauth.proto +++ b/api/oauth.proto @@ -15,6 +15,7 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; import "google/protobuf/timestamp.proto"; import "lorawan-stack/api/identifiers.proto"; import "lorawan-stack/api/rights.proto"; @@ -24,13 +25,13 @@ package ttn.lorawan.v3; option go_package = "go.thethings.network/lorawan-stack/pkg/ttnpb"; message OAuthClientAuthorizationIdentifiers { - UserIdentifiers user_ids = 1 [(gogoproto.customname) = "UserIDs", (gogoproto.nullable) = false]; - ClientIdentifiers client_ids = 2 [(gogoproto.customname) = "ClientIDs", (gogoproto.nullable) = false]; + UserIdentifiers user_ids = 1 [(gogoproto.customname) = "UserIDs", (gogoproto.nullable) = false, (validate.rules).message.required = true]; + ClientIdentifiers client_ids = 2 [(gogoproto.customname) = "ClientIDs", (gogoproto.nullable) = false, (validate.rules).message.required = true]; } message OAuthClientAuthorization { - UserIdentifiers user_ids = 1 [(gogoproto.customname) = "UserIDs", (gogoproto.nullable) = false]; - ClientIdentifiers client_ids = 2 [(gogoproto.customname) = "ClientIDs", (gogoproto.nullable) = false]; + UserIdentifiers user_ids = 1 [(gogoproto.customname) = "UserIDs", (gogoproto.nullable) = false, (validate.rules).message.required = true]; + ClientIdentifiers client_ids = 2 [(gogoproto.customname) = "ClientIDs", (gogoproto.nullable) = false, (validate.rules).message.required = true]; repeated Right rights = 3; google.protobuf.Timestamp created_at = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; google.protobuf.Timestamp updated_at = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; @@ -41,7 +42,7 @@ message OAuthClientAuthorizations { } message ListOAuthClientAuthorizationsRequest { - UserIdentifiers user_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + UserIdentifiers user_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; // Order the results by this field path (must be present in the field mask). // Default ordering is by ID. Prepend with a minus (-) to reverse the order. string order = 2; @@ -52,8 +53,8 @@ message ListOAuthClientAuthorizationsRequest { } message OAuthAuthorizationCode { - UserIdentifiers user_ids = 1 [(gogoproto.customname) = "UserIDs", (gogoproto.nullable) = false]; - ClientIdentifiers client_ids = 2 [(gogoproto.customname) = "ClientIDs", (gogoproto.nullable) = false]; + UserIdentifiers user_ids = 1 [(gogoproto.customname) = "UserIDs", (gogoproto.nullable) = false, (validate.rules).message.required = true]; + ClientIdentifiers client_ids = 2 [(gogoproto.customname) = "ClientIDs", (gogoproto.nullable) = false, (validate.rules).message.required = true]; repeated Right rights = 3; string code = 4; string redirect_uri = 5 [(gogoproto.customname) = "RedirectURI"]; @@ -63,14 +64,14 @@ message OAuthAuthorizationCode { } message OAuthAccessTokenIdentifiers { - UserIdentifiers user_ids = 1 [(gogoproto.customname) = "UserIDs", (gogoproto.nullable) = false]; - ClientIdentifiers client_ids = 2 [(gogoproto.customname) = "ClientIDs", (gogoproto.nullable) = false]; + UserIdentifiers user_ids = 1 [(gogoproto.customname) = "UserIDs", (gogoproto.nullable) = false, (validate.rules).message.required = true]; + ClientIdentifiers client_ids = 2 [(gogoproto.customname) = "ClientIDs", (gogoproto.nullable) = false, (validate.rules).message.required = true]; string id = 3 [(gogoproto.customname) = "ID"]; } message OAuthAccessToken { - UserIdentifiers user_ids = 1 [(gogoproto.customname) = "UserIDs", (gogoproto.nullable) = false]; - ClientIdentifiers client_ids = 2 [(gogoproto.customname) = "ClientIDs", (gogoproto.nullable) = false]; + UserIdentifiers user_ids = 1 [(gogoproto.customname) = "UserIDs", (gogoproto.nullable) = false, (validate.rules).message.required = true]; + ClientIdentifiers client_ids = 2 [(gogoproto.customname) = "ClientIDs", (gogoproto.nullable) = false, (validate.rules).message.required = true]; string id = 3 [(gogoproto.customname) = "ID"]; string access_token = 4; string refresh_token = 5; @@ -84,8 +85,8 @@ message OAuthAccessTokens { } message ListOAuthAccessTokensRequest { - UserIdentifiers user_ids = 1 [(gogoproto.customname) = "UserIDs", (gogoproto.nullable) = false]; - ClientIdentifiers client_ids = 2 [(gogoproto.customname) = "ClientIDs", (gogoproto.nullable) = false]; + UserIdentifiers user_ids = 1 [(gogoproto.customname) = "UserIDs", (gogoproto.nullable) = false, (validate.rules).message.required = true]; + ClientIdentifiers client_ids = 2 [(gogoproto.customname) = "ClientIDs", (gogoproto.nullable) = false, (validate.rules).message.required = true]; // Order the results by this field path (must be present in the field mask). // Default ordering is by ID. Prepend with a minus (-) to reverse the order. string order = 3; diff --git a/api/organization.proto b/api/organization.proto index 7246f74023..c1078266db 100644 --- a/api/organization.proto +++ b/api/organization.proto @@ -15,6 +15,7 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "lorawan-stack/api/contact_info.proto"; @@ -26,7 +27,7 @@ package ttn.lorawan.v3; option go_package = "go.thethings.network/lorawan-stack/pkg/ttnpb"; message Organization { - OrganizationIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + OrganizationIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.Timestamp created_at = 2 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; @@ -41,7 +42,7 @@ message Organizations { } message GetOrganizationRequest { - OrganizationIdentifiers organization_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + OrganizationIdentifiers organization_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false]; } @@ -64,30 +65,30 @@ message ListOrganizationsRequest { } message CreateOrganizationRequest { - Organization organization = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + Organization organization = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; // Collaborator to grant all rights on the newly created application. // NOTE: It is currently not possible to have organizations collaborating on // other organizations. - OrganizationOrUserIdentifiers collaborator = 2 [(gogoproto.nullable) = false]; + OrganizationOrUserIdentifiers collaborator = 2 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; } message UpdateOrganizationRequest { - Organization organization = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + Organization organization = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false]; } message CreateOrganizationAPIKeyRequest { - OrganizationIdentifiers organization_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + OrganizationIdentifiers organization_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; string name = 2; repeated Right rights = 3; } message UpdateOrganizationAPIKeyRequest { - OrganizationIdentifiers organization_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - APIKey api_key = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + OrganizationIdentifiers organization_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; + APIKey api_key = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; } message SetOrganizationCollaboratorRequest { - OrganizationIdentifiers organization_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - Collaborator collaborator = 2 [(gogoproto.nullable) = false]; + OrganizationIdentifiers organization_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; + Collaborator collaborator = 2 [(gogoproto.nullable) = false, (validate.rules).message.required = true]; } diff --git a/api/regional.proto b/api/regional.proto index 331ebaf813..3b336dbf2d 100644 --- a/api/regional.proto +++ b/api/regional.proto @@ -15,6 +15,7 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; import "google/protobuf/duration.proto"; import "lorawan-stack/api/gateway.proto"; @@ -34,6 +35,7 @@ message ConcentratorConfig { // Frequency (Hz). uint64 frequency = 1; uint32 radio = 2; + // Bandwidth (Hz). uint32 bandwidth = 3; uint32 spreading_factor = 4; } diff --git a/api/rights.proto b/api/rights.proto index 69fc10848b..df2ba81a5a 100644 --- a/api/rights.proto +++ b/api/rights.proto @@ -17,6 +17,7 @@ syntax = "proto3"; package ttn.lorawan.v3; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; import "lorawan-stack/api/identifiers.proto"; option go_package = "go.thethings.network/lorawan-stack/pkg/ttnpb"; @@ -175,7 +176,7 @@ message APIKeys { } message Collaborator { - OrganizationOrUserIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + OrganizationOrUserIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; repeated Right rights = 2; } diff --git a/api/search_services.proto b/api/search_services.proto index 99b4fe6187..6038a87ee2 100644 --- a/api/search_services.proto +++ b/api/search_services.proto @@ -15,6 +15,7 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; import "google/api/annotations.proto"; import "google/protobuf/field_mask.proto"; import "lorawan-stack/api/application.proto"; @@ -81,7 +82,7 @@ service EntityRegistrySearch { } message SearchEndDevicesRequest { - ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; // Find end devices where the ID contains this substring. string id_contains = 2 [(gogoproto.customname) = "IDContains"]; diff --git a/api/user.proto b/api/user.proto index 7f1ac9ebf2..32578883ed 100644 --- a/api/user.proto +++ b/api/user.proto @@ -15,7 +15,7 @@ syntax = "proto3"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; -import "github.com/mwitkow/go-proto-validators/validator.proto"; +import "github.com/lyft/protoc-gen-validate/validate/validate.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; @@ -31,7 +31,7 @@ option go_package = "go.thethings.network/lorawan-stack/pkg/ttnpb"; // User is the message that defines an user on the network. message User { - UserIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + UserIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.Timestamp created_at = 2 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; @@ -42,7 +42,7 @@ message User { // Primary email address that can be used for logging in. // This address is not public, use contact_info for that. - string primary_email_address = 8; + string primary_email_address = 8 [(validate.rules).string.email = true]; google.protobuf.Timestamp primary_email_address_validated_at = 9 [(gogoproto.stdtime) = true]; // Only used on create; never returned on API calls. @@ -52,15 +52,15 @@ message User { // The reviewing state of the user. // This field can only be modified by admins. - State state = 13; + State state = 13 [(validate.rules).enum.defined_only = true]; // This user is an admin. // This field can only be modified by other admins. bool admin = 14; // The temporary password can only be used to update a user's password; never returned on API calls. string temporary_password = 15; - google.protobuf.Timestamp temporary_password_created_at = 16 [(gogoproto.nullable) = true, (gogoproto.stdtime) = true]; - google.protobuf.Timestamp temporary_password_expires_at = 17 [(gogoproto.nullable) = true, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp temporary_password_created_at = 16 [(gogoproto.stdtime) = true]; + google.protobuf.Timestamp temporary_password_expires_at = 17 [(gogoproto.stdtime) = true]; Picture profile_picture = 18; } @@ -87,43 +87,43 @@ message Users { } message GetUserRequest { - UserIdentifiers user_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + UserIdentifiers user_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false]; } message CreateUserRequest { - User user = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + User user = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; string invitation_token = 2; } message UpdateUserRequest { - User user = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + User user = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false]; } message CreateTemporaryPasswordRequest { - UserIdentifiers user_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + UserIdentifiers user_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; } message UpdateUserPasswordRequest { - UserIdentifiers user_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + UserIdentifiers user_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; string new = 2; string old = 3; } message CreateUserAPIKeyRequest { - UserIdentifiers user_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + UserIdentifiers user_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; string name = 2; repeated Right rights = 3; } message UpdateUserAPIKeyRequest { - UserIdentifiers user_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - APIKey api_key = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + UserIdentifiers user_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; + APIKey api_key = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; } message Invitation { - string email = 1; + string email = 1 [(validate.rules).string.email = true]; string token = 2; google.protobuf.Timestamp expires_at = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; @@ -139,20 +139,20 @@ message Invitations { } message SendInvitationRequest { - string email = 1 [(validator.field) = {string_not_empty: true}]; + string email = 1 [(validate.rules).string.email = true]; } message DeleteInvitationRequest { - string email = 1 [(validator.field) = {string_not_empty: true}]; + string email = 1 [(validate.rules).string.email = true]; } message UserSessionIdentifiers { - UserIdentifiers user_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + UserIdentifiers user_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; string session_id = 2 [(gogoproto.customname) = "SessionID"]; } message UserSession { - UserIdentifiers user_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + UserIdentifiers user_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; string session_id = 2 [(gogoproto.customname) = "SessionID"]; google.protobuf.Timestamp created_at = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; google.protobuf.Timestamp updated_at = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; @@ -164,7 +164,7 @@ message UserSessions { } message ListUserSessionsRequest { - UserIdentifiers user_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + UserIdentifiers user_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true]; // Order the results by this field path (must be present in the field mask). // Default ordering is by ID. Prepend with a minus (-) to reverse the order. string order = 2; diff --git a/config/messages.json b/config/messages.json index 9c277ee5de..08e0e704b3 100644 --- a/config/messages.json +++ b/config/messages.json @@ -4391,15 +4391,6 @@ "file": "errors.go" } }, - "error:pkg/ttnpb:expected_uplink_mtype": { - "translations": { - "en": "MType `{result}` is not an uplink MType" - }, - "description": { - "package": "pkg/ttnpb", - "file": "message_validators.go" - } - }, "error:pkg/ttnpb:field_bound": { "translations": { "en": "`{lorawan_field}` should be between `{min}` and `{max}`" @@ -4424,7 +4415,7 @@ }, "description": { "package": "pkg/ttnpb", - "file": "identifiers_validators.go" + "file": "identifiers.go" } }, "error:pkg/ttnpb:missing_field": { @@ -4472,15 +4463,6 @@ "file": "fieldmask_utils.go" } }, - "error:pkg/ttnpb:raw_payload": { - "translations": { - "en": "missing raw payload" - }, - "description": { - "package": "pkg/ttnpb", - "file": "message_validators.go" - } - }, "error:pkg/ttnpb:unknown_field": { "translations": { "en": "unknown `{lorawan_field}`" diff --git a/go.mod b/go.mod index 230ef62348..4dc791797f 100644 --- a/go.mod +++ b/go.mod @@ -65,6 +65,7 @@ require ( github.com/labstack/echo v3.3.10+incompatible github.com/labstack/gommon v0.2.8 github.com/lib/pq v1.0.0 + github.com/lyft/protoc-gen-validate v0.0.13 github.com/magefile/mage v1.8.0 github.com/mattn/go-colorable v0.1.0 // indirect github.com/mattn/go-isatty v0.0.4 @@ -76,7 +77,6 @@ require ( github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.1.2 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 - github.com/mwitkow/go-proto-validators v0.0.0-20190212092829-1f388280e944 github.com/nicksnyder/go-i18n v1.10.0 // indirect github.com/oklog/ulid v1.3.1 github.com/olekukonko/tablewriter v0.0.1 // indirect diff --git a/go.sum b/go.sum index 6d6a6f2e56..a6da19fc93 100644 --- a/go.sum +++ b/go.sum @@ -237,6 +237,8 @@ github.com/labstack/gommon v0.2.8 h1:JvRqmeZcfrHC5u6uVleB4NxxNbzx6gpbJiQknDbKQu0 github.com/labstack/gommon v0.2.8/go.mod h1:/tj9csK2iPSBvn+3NLM9e52usepMtrd5ilFYA+wQNJ4= github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lyft/protoc-gen-validate v0.0.13 h1:KNt/RhmQTOLr7Aj8PsJ7mTronaFyx80mRTT9qF261dA= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magefile/mage v1.8.0 h1:mzL+xIopvPURVBwHG9A50JcjBO+xV3b5iZ7khFRI+5E= github.com/magefile/mage v1.8.0/go.mod h1:IUDi13rsHje59lecXokTfGX0QIzO45uVPlXnJYsXepA= github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= @@ -271,8 +273,6 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-proto-validators v0.0.0-20190212092829-1f388280e944 h1:RY9I2vt95pyT12MKfJo1Ck3O+NPQqlukBahURwDtJBc= -github.com/mwitkow/go-proto-validators v0.0.0-20190212092829-1f388280e944/go.mod h1:m2XC9Qq0AlmmVksL6FktJCdTYyLk7V3fKyp0sl1yWQo= github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/nicksnyder/go-i18n v1.10.0 h1:5AzlPKvXBH4qBzmZ09Ua9Gipyruv6uApMcrNZdo96+Q= diff --git a/pkg/applicationserver/io/web/redis/registry.go b/pkg/applicationserver/io/web/redis/registry.go index 27d5f37038..3c09f6b7a1 100644 --- a/pkg/applicationserver/io/web/redis/registry.go +++ b/pkg/applicationserver/io/web/redis/registry.go @@ -31,10 +31,18 @@ var ( ) func applyWebhookFieldMask(dst, src *ttnpb.ApplicationWebhook, paths ...string) (*ttnpb.ApplicationWebhook, error) { + paths = append(paths, "ids") + if dst == nil { dst = &ttnpb.ApplicationWebhook{} } - return dst, dst.SetFields(src, append(paths, "ids")...) + if err := dst.SetFields(src, paths...); err != nil { + return nil, err + } + if err := dst.ValidateFields(paths...); err != nil { + return nil, err + } + return dst, nil } // WebhookRegistry is a Redis webhook registry. diff --git a/pkg/applicationserver/io/web/webhooks.go b/pkg/applicationserver/io/web/webhooks.go index 8ccf70b64d..30fe367412 100644 --- a/pkg/applicationserver/io/web/webhooks.go +++ b/pkg/applicationserver/io/web/webhooks.go @@ -225,7 +225,7 @@ func (w *webhooks) validateAndFillIDs() echo.MiddlewareFunc { ApplicationIdentifiers: appID, WebhookID: c.Param(webhookIDKey), } - if err := hookID.Validate(); err != nil { + if err := hookID.ValidateFields(); err != nil { return err } c.Set(webhookIDKey, hookID) diff --git a/pkg/applicationserver/redis/registry.go b/pkg/applicationserver/redis/registry.go index b4301fe156..66e5dbe904 100644 --- a/pkg/applicationserver/redis/registry.go +++ b/pkg/applicationserver/redis/registry.go @@ -32,13 +32,15 @@ var ( ) func applyDeviceFieldMask(dst, src *ttnpb.EndDevice, paths ...string) (*ttnpb.EndDevice, error) { + paths = append(paths, "ids") + if dst == nil { dst = &ttnpb.EndDevice{} } - if err := dst.SetFields(src, append(paths, "ids")...); err != nil { + if err := dst.SetFields(src, paths...); err != nil { return nil, err } - if err := dst.EndDeviceIdentifiers.Validate(); err != nil { + if err := dst.ValidateFields(paths...); err != nil { return nil, err } return dst, nil diff --git a/pkg/crypto/cryptoservices/grpc.go b/pkg/crypto/cryptoservices/grpc.go index e9f756c119..796a6eefed 100644 --- a/pkg/crypto/cryptoservices/grpc.go +++ b/pkg/crypto/cryptoservices/grpc.go @@ -63,7 +63,7 @@ func (s *networkRPCClient) JoinAcceptMIC(ctx context.Context, dev *ttnpb.EndDevi ProvisionerID: dev.ProvisionerID, ProvisioningData: dev.ProvisioningData, }, - JoinRequestType: uint32(joinReqType), + JoinRequestType: ttnpb.RejoinType(joinReqType), DevNonce: dn, }, s.callOpts...) if err != nil { diff --git a/pkg/encoding/lorawan/mac.go b/pkg/encoding/lorawan/mac.go index b4c414ca0f..b98cd477d0 100644 --- a/pkg/encoding/lorawan/mac.go +++ b/pkg/encoding/lorawan/mac.go @@ -648,8 +648,8 @@ var DefaultMACCommands = MACCommandSpec{ v |= byte(pld.MaxRetries) b = append(b, v) - if pld.RejoinType > 7 { - return nil, errExpectedLowerOrEqual("RejoinType", 7)(pld.RejoinType) + if pld.RejoinType > 2 { + return nil, errExpectedLowerOrEqual("RejoinType", 2)(pld.RejoinType) } // Second byte v = byte(pld.RejoinType) << 4 @@ -666,7 +666,7 @@ var DefaultMACCommands = MACCommandSpec{ ForceRejoinReq: &ttnpb.MACCommand_ForceRejoinReq{ PeriodExponent: ttnpb.RejoinPeriodExponent(uint32(b[0] >> 3)), MaxRetries: uint32(b[0] & 0x7), - RejoinType: uint32(b[1] >> 4), + RejoinType: ttnpb.RejoinType(b[1] >> 4), DataRateIndex: ttnpb.DataRateIndex(b[1] & 0xf), }, } @@ -784,10 +784,10 @@ var DefaultMACCommands = MACCommandSpec{ AppendDownlink: func(b []byte, cmd ttnpb.MACCommand) ([]byte, error) { pld := cmd.GetPingSlotChannelReq() - if pld.Frequency > maxUint24 { - return nil, errExpectedLowerOrEqual("Frequency", maxUint24)(pld.Frequency) + if pld.Frequency < 100000 || pld.Frequency > maxUint24*100 { + return nil, errExpectedBetween("Frequency", 100000, maxUint24*100)(pld.Frequency) } - b = appendUint64(b, pld.Frequency, 3) + b = appendUint64(b, pld.Frequency/100, 3) if pld.DataRateIndex > 15 { return nil, errExpectedLowerOrEqual("DataRateIndex", 15)(pld.DataRateIndex) @@ -798,7 +798,7 @@ var DefaultMACCommands = MACCommandSpec{ UnmarshalDownlink: newMACUnmarshaler(ttnpb.CID_PING_SLOT_CHANNEL, "PingSlotChannelReq", 4, func(b []byte, cmd *ttnpb.MACCommand) error { cmd.Payload = &ttnpb.MACCommand_PingSlotChannelReq_{ PingSlotChannelReq: &ttnpb.MACCommand_PingSlotChannelReq{ - Frequency: parseUint64(b[0:3]), + Frequency: parseUint64(b[0:3]) * 100, DataRateIndex: ttnpb.DataRateIndex(b[3] & 0xf), }, } @@ -867,16 +867,16 @@ var DefaultMACCommands = MACCommandSpec{ DownlinkLength: 3, AppendDownlink: func(b []byte, cmd ttnpb.MACCommand) ([]byte, error) { pld := cmd.GetBeaconFreqReq() - if pld.Frequency > maxUint24 { - return nil, errExpectedLowerOrEqual("Frequency", maxUint24)(pld.Frequency) + if pld.Frequency < 100000 || pld.Frequency > maxUint24*100 { + return nil, errExpectedBetween("Frequency", 100000, maxUint24*100)(pld.Frequency) } - b = appendUint64(b, pld.Frequency, 3) + b = appendUint64(b, pld.Frequency/100, 3) return b, nil }, UnmarshalDownlink: newMACUnmarshaler(ttnpb.CID_BEACON_FREQ, "BeaconFreqReq", 3, func(b []byte, cmd *ttnpb.MACCommand) error { cmd.Payload = &ttnpb.MACCommand_BeaconFreqReq_{ BeaconFreqReq: &ttnpb.MACCommand_BeaconFreqReq{ - Frequency: parseUint64(b[0:3]), + Frequency: parseUint64(b[0:3]) * 100, }, } return nil diff --git a/pkg/encoding/lorawan/mac_test.go b/pkg/encoding/lorawan/mac_test.go index 31c545342b..b51665c2c2 100644 --- a/pkg/encoding/lorawan/mac_test.go +++ b/pkg/encoding/lorawan/mac_test.go @@ -266,9 +266,9 @@ func TestLoRaWANEncodingMAC(t *testing.T) { MaxRetries: 0x7, PeriodExponent: 0x7, DataRateIndex: 0xd, - RejoinType: 0x7, + RejoinType: 0x2, }, - []byte{0x0E, 0x3f, 0x7d}, + []byte{0x0E, 0x3f, 0x2d}, false, }, { @@ -305,7 +305,7 @@ func TestLoRaWANEncodingMAC(t *testing.T) { { "PingSlotChannelReq", &ttnpb.MACCommand_PingSlotChannelReq{ - Frequency: 0x42ffff, + Frequency: 0x1a2bff9c, // 0x42ffff * 100 DataRateIndex: 0xf, }, []byte{0x11, 0xff, 0xff, 0x42, 0xf}, @@ -338,7 +338,7 @@ func TestLoRaWANEncodingMAC(t *testing.T) { { "BeaconFreqReq", &ttnpb.MACCommand_BeaconFreqReq{ - Frequency: 0x42ffff, + Frequency: 0x1a2bff9c, // 0x42ffff * 100 }, []byte{0x13, 0xff, 0xff, 0x42}, false, diff --git a/pkg/encoding/lorawan/messages.go b/pkg/encoding/lorawan/messages.go index f4f883ed46..e0531a21f1 100644 --- a/pkg/encoding/lorawan/messages.go +++ b/pkg/encoding/lorawan/messages.go @@ -585,14 +585,12 @@ func GetUplinkMessageIdentifiers(msg *ttnpb.UplinkMessage) (ttnpb.EndDeviceIdent if n == 0 { return ttnpb.EndDeviceIdentifiers{}, errMissing("PHYPayload") } - if msg.Payload == nil { - msg.Payload = &ttnpb.Message{} - } - if err := UnmarshalMHDR(msg.RawPayload[0:1], &msg.Payload.MHDR); err != nil { + var mhdr ttnpb.MHDR + if err := UnmarshalMHDR(msg.RawPayload[0:1], &mhdr); err != nil { return ttnpb.EndDeviceIdentifiers{}, errFailedDecoding("MHDR").WithCause(err) } var ids ttnpb.EndDeviceIdentifiers - switch msg.Payload.MHDR.MType { + switch mhdr.MType { case ttnpb.MType_CONFIRMED_UP, ttnpb.MType_UNCONFIRMED_UP: if n < 12 { return ttnpb.EndDeviceIdentifiers{}, errExpectedLengthHigherOrEqual("FHDR", 7)(n - 5) @@ -637,6 +635,6 @@ func GetUplinkMessageIdentifiers(msg *ttnpb.UplinkMessage) (ttnpb.EndDeviceIdent } return ids, nil default: - return ttnpb.EndDeviceIdentifiers{}, errUnknown("MType")(msg.Payload.MType.String()) + return ttnpb.EndDeviceIdentifiers{}, errUnknown("MType")(mhdr.MType.String()) } } diff --git a/pkg/joinserver/grpc_deviceregistry.go b/pkg/joinserver/grpc_deviceregistry.go index e50e671bad..f83d274022 100644 --- a/pkg/joinserver/grpc_deviceregistry.go +++ b/pkg/joinserver/grpc_deviceregistry.go @@ -34,12 +34,6 @@ type jsEndDeviceRegistryServer struct { // Get implements ttnpb.JsEndDeviceRegistryServer. func (srv jsEndDeviceRegistryServer) Get(ctx context.Context, req *ttnpb.GetEndDeviceRequest) (*ttnpb.EndDevice, error) { - if req.JoinEUI == nil || req.JoinEUI.IsZero() { - return nil, errNoJoinEUI - } - if req.DevEUI == nil || req.DevEUI.IsZero() { - return nil, errNoDevEUI - } if err := rights.RequireApplication(ctx, req.ApplicationIdentifiers, ttnpb.RIGHT_APPLICATION_DEVICES_READ); err != nil { return nil, err } @@ -50,8 +44,7 @@ func (srv jsEndDeviceRegistryServer) Get(ctx context.Context, req *ttnpb.GetEndD } paths = append(paths, "provisioner_id", "provisioning_data") } - // TODO: Validate field mask (https://github.com/TheThingsNetwork/lorawan-stack/issues/39) - dev, err := srv.JS.devices.GetByEUI(ctx, *req.EndDeviceIdentifiers.JoinEUI, *req.EndDeviceIdentifiers.DevEUI, paths) + dev, err := srv.JS.devices.GetByID(ctx, req.ApplicationIdentifiers, req.DeviceID, paths) if errors.IsNotFound(err) { return nil, errDeviceNotFound } @@ -129,11 +122,7 @@ func (srv jsEndDeviceRegistryServer) Set(ctx context.Context, req *ttnpb.SetEndD return nil, err } } - // TODO: Validate field mask (https://github.com/TheThingsNetwork/lorawan-stack/issues/39) - return srv.JS.devices.SetByEUI(ctx, *req.EndDevice.JoinEUI, *req.EndDevice.DevEUI, req.FieldMask.Paths, func(dev *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { - if dev != nil && !dev.ApplicationIdentifiers.Equal(req.EndDevice.ApplicationIdentifiers) { - return nil, nil, errInvalidIdentifiers - } + return srv.JS.devices.SetByID(ctx, req.EndDevice.ApplicationIdentifiers, req.EndDevice.DeviceID, req.FieldMask.Paths, func(dev *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { return &req.EndDevice, req.FieldMask.Paths, nil }) } @@ -260,16 +249,10 @@ func (srv jsEndDeviceRegistryServer) Provision(req *ttnpb.ProvisionEndDevicesReq // Delete implements ttnpb.JsEndDeviceRegistryServer. func (srv jsEndDeviceRegistryServer) Delete(ctx context.Context, ids *ttnpb.EndDeviceIdentifiers) (*pbtypes.Empty, error) { - if ids.JoinEUI == nil || ids.JoinEUI.IsZero() { - return nil, errNoJoinEUI - } - if ids.DevEUI == nil || ids.DevEUI.IsZero() { - return nil, errNoDevEUI - } if err := rights.RequireApplication(ctx, ids.ApplicationIdentifiers, ttnpb.RIGHT_APPLICATION_DEVICES_WRITE); err != nil { return nil, err } - _, err := srv.JS.devices.SetByEUI(ctx, *ids.JoinEUI, *ids.DevEUI, nil, func(dev *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { + _, err := srv.JS.devices.SetByID(ctx, ids.ApplicationIdentifiers, ids.DeviceID, nil, func(dev *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { if dev == nil || !dev.ApplicationIdentifiers.Equal(ids.ApplicationIdentifiers) { return nil, nil, errDeviceNotFound } diff --git a/pkg/joinserver/grpc_deviceregistry_test.go b/pkg/joinserver/grpc_deviceregistry_test.go index 9f6f2da386..b9e5845af2 100644 --- a/pkg/joinserver/grpc_deviceregistry_test.go +++ b/pkg/joinserver/grpc_deviceregistry_test.go @@ -33,8 +33,8 @@ import ( "go.thethings.network/lorawan-stack/pkg/util/test/assertions/should" ) -type getByEUIFuncKey struct{} -type setByEUIFuncKey struct{} +type getByIDFuncKey struct{} +type setByIDFuncKey struct{} var ( registeredJoinEUI = eui64Ptr(types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}) @@ -90,7 +90,7 @@ func TestDeviceRegistryGet(t *testing.T) { for _, tc := range []struct { Name string ContextFunc func(context.Context) context.Context - GetByEUIFunc func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string) (*ttnpb.EndDevice, error) + GetByIDFunc func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string) (*ttnpb.EndDevice, error) DeviceRequest *ttnpb.GetEndDeviceRequest ErrorAssertion func(*testing.T, error) bool ContextAssertion func(context.Context) bool @@ -105,9 +105,9 @@ func TestDeviceRegistryGet(t *testing.T) { }, }) }, - GetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string) (*ttnpb.EndDevice, error) { - test.MustTFromContext(ctx).Errorf("GetByEUIFunc must not be called") - return nil, errors.New("GetByEUIFunc must not be called") + GetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string) (*ttnpb.EndDevice, error) { + test.MustTFromContext(ctx).Errorf("GetByIDFunc must not be called") + return nil, errors.New("GetByIDFunc must not be called") }, DeviceRequest: &ttnpb.GetEndDeviceRequest{ EndDeviceIdentifiers: deepcopy.Copy(registeredDevice.EndDeviceIdentifiers).(ttnpb.EndDeviceIdentifiers), @@ -120,79 +120,7 @@ func TestDeviceRegistryGet(t *testing.T) { }, ContextAssertion: func(ctx context.Context) bool { a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, getByEUIFuncKey{}), should.Equal, 0) - }, - }, - { - Name: "No DevEUI", - ContextFunc: func(ctx context.Context) context.Context { - return rights.NewContext(ctx, rights.Rights{ - ApplicationRights: map[string]*ttnpb.Rights{ - unique.ID(ctx, deepcopy.Copy(registeredDevice.EndDeviceIdentifiers.ApplicationIdentifiers).(ttnpb.ApplicationIdentifiers)): ttnpb.RightsFrom( - ttnpb.RIGHT_APPLICATION_DEVICES_READ, - ), - }, - }) - }, - GetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string) (*ttnpb.EndDevice, error) { - test.MustTFromContext(ctx).Errorf("GetByEUIFunc must not be called") - return nil, errors.New("GetByEUIFunc must not be called") - }, - DeviceRequest: &ttnpb.GetEndDeviceRequest{ - EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ - ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ - ApplicationID: registeredApplicationID, - }, - DeviceID: registeredDeviceID, - JoinEUI: registeredJoinEUI, - }, - FieldMask: pbtypes.FieldMask{ - Paths: []string{"ids"}, - }, - }, - ErrorAssertion: func(t *testing.T, err error) bool { - a := assertions.New(t) - return a.So(errors.IsInvalidArgument(err), should.BeTrue) - }, - ContextAssertion: func(ctx context.Context) bool { - a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, getByEUIFuncKey{}), should.Equal, 0) - }, - }, - { - Name: "No JoinEUI", - ContextFunc: func(ctx context.Context) context.Context { - return rights.NewContext(ctx, rights.Rights{ - ApplicationRights: map[string]*ttnpb.Rights{ - unique.ID(ctx, deepcopy.Copy(registeredDevice.EndDeviceIdentifiers.ApplicationIdentifiers).(ttnpb.ApplicationIdentifiers)): ttnpb.RightsFrom( - ttnpb.RIGHT_APPLICATION_DEVICES_READ, - ), - }, - }) - }, - GetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string) (*ttnpb.EndDevice, error) { - test.MustTFromContext(ctx).Errorf("GetByEUIFunc must not be called") - return nil, errors.New("GetByEUIFunc must not be called") - }, - DeviceRequest: &ttnpb.GetEndDeviceRequest{ - EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ - ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ - ApplicationID: registeredApplicationID, - }, - DeviceID: registeredDeviceID, - DevEUI: registeredDevEUI, - }, - FieldMask: pbtypes.FieldMask{ - Paths: []string{"ids"}, - }, - }, - ErrorAssertion: func(t *testing.T, err error) bool { - a := assertions.New(t) - return a.So(errors.IsInvalidArgument(err), should.BeTrue) - }, - ContextAssertion: func(ctx context.Context) bool { - a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, getByEUIFuncKey{}), should.Equal, 0) + return a.So(test.MustCounterFromContext(ctx, getByIDFuncKey{}), should.Equal, 0) }, }, { @@ -200,17 +128,19 @@ func TestDeviceRegistryGet(t *testing.T) { ContextFunc: func(ctx context.Context) context.Context { return rights.NewContext(ctx, rights.Rights{ ApplicationRights: map[string]*ttnpb.Rights{ - unique.ID(ctx, deepcopy.Copy(registeredDevice.EndDeviceIdentifiers.ApplicationIdentifiers).(ttnpb.ApplicationIdentifiers)): ttnpb.RightsFrom( + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: registeredApplicationID}): ttnpb.RightsFrom( ttnpb.RIGHT_APPLICATION_DEVICES_READ, ), }, }) }, - GetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string) (*ttnpb.EndDevice, error) { - defer test.MustIncrementContextCounter(ctx, getByEUIFuncKey{}, 1) + GetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string) (*ttnpb.EndDevice, error) { + defer test.MustIncrementContextCounter(ctx, getByIDFuncKey{}, 1) a := assertions.New(test.MustTFromContext(ctx)) - a.So(joinEUI, should.Equal, *unregisteredJoinEUI) - a.So(devEUI, should.Equal, *unregisteredDevEUI) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ + ApplicationID: registeredApplicationID, + }) + a.So(devID, should.Equal, unregisteredDeviceID) a.So(paths, should.HaveSameElementsDeep, []string{"ids"}) return nil, errNotFound }, @@ -233,7 +163,7 @@ func TestDeviceRegistryGet(t *testing.T) { }, ContextAssertion: func(ctx context.Context) bool { a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, getByEUIFuncKey{}), should.Equal, 1) + return a.So(test.MustCounterFromContext(ctx, getByIDFuncKey{}), should.Equal, 1) }, }, { @@ -247,11 +177,13 @@ func TestDeviceRegistryGet(t *testing.T) { }, }) }, - GetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string) (*ttnpb.EndDevice, error) { - defer test.MustIncrementContextCounter(ctx, getByEUIFuncKey{}, 1) + GetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string) (*ttnpb.EndDevice, error) { + defer test.MustIncrementContextCounter(ctx, getByIDFuncKey{}, 1) a := assertions.New(test.MustTFromContext(ctx)) - a.So(joinEUI, should.Equal, *registeredJoinEUI) - a.So(devEUI, should.Equal, *registeredDevEUI) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ + ApplicationID: "other-app", + }) + a.So(devID, should.Equal, "other-device") a.So(paths, should.HaveSameElementsDeep, []string{"ids"}) return deepcopy.Copy(registeredDevice).(*ttnpb.EndDevice), nil }, @@ -274,7 +206,7 @@ func TestDeviceRegistryGet(t *testing.T) { }, ContextAssertion: func(ctx context.Context) bool { a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, getByEUIFuncKey{}), should.Equal, 1) + return a.So(test.MustCounterFromContext(ctx, getByIDFuncKey{}), should.Equal, 1) }, }, { @@ -282,17 +214,19 @@ func TestDeviceRegistryGet(t *testing.T) { ContextFunc: func(ctx context.Context) context.Context { return rights.NewContext(ctx, rights.Rights{ ApplicationRights: map[string]*ttnpb.Rights{ - unique.ID(ctx, deepcopy.Copy(registeredDevice.EndDeviceIdentifiers.ApplicationIdentifiers).(ttnpb.ApplicationIdentifiers)): ttnpb.RightsFrom( + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: registeredApplicationID}): ttnpb.RightsFrom( ttnpb.RIGHT_APPLICATION_DEVICES_READ, ), }, }) }, - GetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string) (*ttnpb.EndDevice, error) { - defer test.MustIncrementContextCounter(ctx, getByEUIFuncKey{}, 1) + GetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string) (*ttnpb.EndDevice, error) { + defer test.MustIncrementContextCounter(ctx, getByIDFuncKey{}, 1) a := assertions.New(test.MustTFromContext(ctx)) - a.So(joinEUI, should.Equal, *registeredJoinEUI) - a.So(devEUI, should.Equal, *registeredDevEUI) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ + ApplicationID: registeredApplicationID, + }) + a.So(devID, should.Equal, registeredDeviceID) a.So(paths, should.HaveSameElementsDeep, []string{"ids"}) return deepcopy.Copy(registeredDevice).(*ttnpb.EndDevice), nil }, @@ -304,7 +238,7 @@ func TestDeviceRegistryGet(t *testing.T) { }, ContextAssertion: func(ctx context.Context) bool { a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, getByEUIFuncKey{}), should.Equal, 1) + return a.So(test.MustCounterFromContext(ctx, getByIDFuncKey{}), should.Equal, 1) }, }, { @@ -312,15 +246,15 @@ func TestDeviceRegistryGet(t *testing.T) { ContextFunc: func(ctx context.Context) context.Context { return rights.NewContext(ctx, rights.Rights{ ApplicationRights: map[string]*ttnpb.Rights{ - unique.ID(ctx, deepcopy.Copy(registeredDevice.EndDeviceIdentifiers.ApplicationIdentifiers).(ttnpb.ApplicationIdentifiers)): ttnpb.RightsFrom( + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: registeredApplicationID}): ttnpb.RightsFrom( ttnpb.RIGHT_APPLICATION_DEVICES_READ, ), }, }) }, - GetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string) (*ttnpb.EndDevice, error) { - test.MustTFromContext(ctx).Errorf("GetByEUIFunc must not be called") - return nil, errors.New("GetByEUIFunc must not be called") + GetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string) (*ttnpb.EndDevice, error) { + test.MustTFromContext(ctx).Errorf("GetByIDFunc must not be called") + return nil, errors.New("GetByIDFunc must not be called") }, DeviceRequest: &ttnpb.GetEndDeviceRequest{ EndDeviceIdentifiers: deepcopy.Copy(registeredDevice.EndDeviceIdentifiers).(ttnpb.EndDeviceIdentifiers), @@ -334,7 +268,7 @@ func TestDeviceRegistryGet(t *testing.T) { }, ContextAssertion: func(ctx context.Context) bool { a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, getByEUIFuncKey{}), should.Equal, 0) + return a.So(test.MustCounterFromContext(ctx, getByIDFuncKey{}), should.Equal, 0) }, }, { @@ -342,18 +276,20 @@ func TestDeviceRegistryGet(t *testing.T) { ContextFunc: func(ctx context.Context) context.Context { return rights.NewContext(ctx, rights.Rights{ ApplicationRights: map[string]*ttnpb.Rights{ - unique.ID(ctx, deepcopy.Copy(registeredDevice.EndDeviceIdentifiers.ApplicationIdentifiers).(ttnpb.ApplicationIdentifiers)): ttnpb.RightsFrom( + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: registeredApplicationID}): ttnpb.RightsFrom( ttnpb.RIGHT_APPLICATION_DEVICES_READ, ttnpb.RIGHT_APPLICATION_DEVICES_READ_KEYS, ), }, }) }, - GetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string) (*ttnpb.EndDevice, error) { - defer test.MustIncrementContextCounter(ctx, getByEUIFuncKey{}, 1) + GetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string) (*ttnpb.EndDevice, error) { + defer test.MustIncrementContextCounter(ctx, getByIDFuncKey{}, 1) a := assertions.New(test.MustTFromContext(ctx)) - a.So(joinEUI, should.Equal, *registeredJoinEUI) - a.So(devEUI, should.Equal, *registeredDevEUI) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ + ApplicationID: registeredApplicationID, + }) + a.So(devID, should.Equal, registeredDeviceID) a.So(paths, should.HaveSameElementsDeep, []string{"ids", "root_keys", "provisioner_id", "provisioning_data"}) return deepcopy.Copy(registeredDevice).(*ttnpb.EndDevice), nil }, @@ -365,7 +301,7 @@ func TestDeviceRegistryGet(t *testing.T) { }, ContextAssertion: func(ctx context.Context) bool { a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, getByEUIFuncKey{}), should.Equal, 1) + return a.So(test.MustCounterFromContext(ctx, getByIDFuncKey{}), should.Equal, 1) }, DeviceAssertion: func(t *testing.T, dev *ttnpb.EndDevice) bool { a := assertions.New(t) @@ -385,9 +321,9 @@ func TestDeviceRegistryGet(t *testing.T) { } { t.Run(tc.Name, func(t *testing.T) { a := assertions.New(t) - ctx := test.ContextWithCounter(tc.ContextFunc(test.ContextWithT(test.Context(), t)), getByEUIFuncKey{}) + ctx := test.ContextWithCounter(tc.ContextFunc(test.ContextWithT(test.Context(), t)), getByIDFuncKey{}) reg := &MockDeviceRegistry{ - GetByEUIFunc: tc.GetByEUIFunc, + GetByIDFunc: tc.GetByIDFunc, } js := test.Must(New( component.MustNew(test.GetLogger(t), &component.Config{}), @@ -443,7 +379,7 @@ func TestDeviceRegistrySet(t *testing.T) { for _, tc := range []struct { Name string ContextFunc func(context.Context) context.Context - SetByEUIFunc func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) + SetByIDFunc func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) DeviceRequest *ttnpb.SetEndDeviceRequest ErrorAssertion func(*testing.T, error) bool ContextAssertion func(context.Context) bool @@ -454,7 +390,7 @@ func TestDeviceRegistrySet(t *testing.T) { ContextFunc: func(ctx context.Context) context.Context { return rights.NewContext(ctx, rights.Rights{ ApplicationRights: map[string]*ttnpb.Rights{ - unique.ID(ctx, deepcopy.Copy(registeredDevice.EndDeviceIdentifiers.ApplicationIdentifiers).(ttnpb.ApplicationIdentifiers)): nil, + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: registeredApplicationID}): nil, }, }) }, @@ -464,9 +400,9 @@ func TestDeviceRegistrySet(t *testing.T) { Paths: []string{"ids"}, }, }, - SetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { - test.MustTFromContext(ctx).Errorf("SetByEUIFunc must not be called") - return nil, errors.New("SetByEUIFunc must not be called") + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + test.MustTFromContext(ctx).Errorf("SetByIDFunc must not be called") + return nil, errors.New("SetByIDFunc must not be called") }, ErrorAssertion: func(t *testing.T, err error) bool { a := assertions.New(t) @@ -474,11 +410,11 @@ func TestDeviceRegistrySet(t *testing.T) { }, ContextAssertion: func(ctx context.Context) bool { a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByEUIFuncKey{}), should.Equal, 0) + return a.So(test.MustCounterFromContext(ctx, setByIDFuncKey{}), should.Equal, 0) }, }, { - Name: "No DevEUI", + Name: "No JoinEUI", ContextFunc: func(ctx context.Context) context.Context { return rights.NewContext(ctx, rights.Rights{ ApplicationRights: map[string]*ttnpb.Rights{ @@ -495,16 +431,16 @@ func TestDeviceRegistrySet(t *testing.T) { ApplicationID: registeredApplicationID, }, DeviceID: registeredDeviceID, - JoinEUI: registeredJoinEUI, + DevEUI: registeredDevEUI, }, }, FieldMask: pbtypes.FieldMask{ Paths: []string{"ids"}, }, }, - SetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { - test.MustTFromContext(ctx).Errorf("SetByEUIFunc must not be called") - return nil, errors.New("SetByEUIFunc must not be called") + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + test.MustTFromContext(ctx).Errorf("SetByIDFunc must not be called") + return nil, errors.New("SetByIDFunc must not be called") }, ErrorAssertion: func(t *testing.T, err error) bool { a := assertions.New(t) @@ -512,11 +448,11 @@ func TestDeviceRegistrySet(t *testing.T) { }, ContextAssertion: func(ctx context.Context) bool { a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByEUIFuncKey{}), should.Equal, 0) + return a.So(test.MustCounterFromContext(ctx, setByIDFuncKey{}), should.Equal, 0) }, }, { - Name: "No JoinEUI", + Name: "No DevEUI", ContextFunc: func(ctx context.Context) context.Context { return rights.NewContext(ctx, rights.Rights{ ApplicationRights: map[string]*ttnpb.Rights{ @@ -533,16 +469,16 @@ func TestDeviceRegistrySet(t *testing.T) { ApplicationID: registeredApplicationID, }, DeviceID: registeredDeviceID, - DevEUI: registeredDevEUI, + JoinEUI: registeredJoinEUI, }, }, FieldMask: pbtypes.FieldMask{ Paths: []string{"ids"}, }, }, - SetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { - test.MustTFromContext(ctx).Errorf("SetByEUIFunc must not be called") - return nil, errors.New("SetByEUIFunc must not be called") + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + test.MustTFromContext(ctx).Errorf("SetByIDFunc must not be called") + return nil, errors.New("SetByIDFunc must not be called") }, ErrorAssertion: func(t *testing.T, err error) bool { a := assertions.New(t) @@ -550,7 +486,7 @@ func TestDeviceRegistrySet(t *testing.T) { }, ContextAssertion: func(ctx context.Context) bool { a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByEUIFuncKey{}), should.Equal, 0) + return a.So(test.MustCounterFromContext(ctx, setByIDFuncKey{}), should.Equal, 0) }, }, { @@ -579,18 +515,20 @@ func TestDeviceRegistrySet(t *testing.T) { Paths: []string{"ids"}, }, }, - SetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { a := assertions.New(test.MustTFromContext(ctx)) - defer test.MustIncrementContextCounter(ctx, setByEUIFuncKey{}, 1) - a.So(joinEUI, should.Equal, *unregisteredJoinEUI) - a.So(devEUI, should.Equal, *unregisteredDevEUI) + defer test.MustIncrementContextCounter(ctx, setByIDFuncKey{}, 1) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ + ApplicationID: registeredApplicationID, + }) + a.So(devID, should.Equal, "new-device") a.So(paths, should.Contain, "ids") dev, _, err := cb(nil) return dev, err }, ContextAssertion: func(ctx context.Context) bool { a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByEUIFuncKey{}), should.Equal, 1) + return a.So(test.MustCounterFromContext(ctx, setByIDFuncKey{}), should.Equal, 1) }, DeviceAssertion: func(t *testing.T, dev *ttnpb.EndDevice) bool { a := assertions.New(t) @@ -606,56 +544,12 @@ func TestDeviceRegistrySet(t *testing.T) { }) }, }, - { - Name: "Create, but registered in other application", - ContextFunc: func(ctx context.Context) context.Context { - return rights.NewContext(ctx, rights.Rights{ - ApplicationRights: map[string]*ttnpb.Rights{ - unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: "other-app"}): ttnpb.RightsFrom( - ttnpb.RIGHT_APPLICATION_DEVICES_WRITE, - ), - }, - }) - }, - DeviceRequest: &ttnpb.SetEndDeviceRequest{ - EndDevice: ttnpb.EndDevice{ - EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ - ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ - ApplicationID: "other-app", - }, - DeviceID: "new-device", - JoinEUI: registeredJoinEUI, - DevEUI: registeredDevEUI, - }, - }, - FieldMask: pbtypes.FieldMask{ - Paths: []string{"ids"}, - }, - }, - SetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { - a := assertions.New(test.MustTFromContext(ctx)) - defer test.MustIncrementContextCounter(ctx, setByEUIFuncKey{}, 1) - a.So(joinEUI, should.Equal, *registeredJoinEUI) - a.So(devEUI, should.Equal, *registeredDevEUI) - a.So(paths, should.Contain, "ids") - dev, _, err := cb(deepcopy.Copy(registeredDevice).(*ttnpb.EndDevice)) - return dev, err - }, - ErrorAssertion: func(t *testing.T, err error) bool { - a := assertions.New(t) - return a.So(errors.IsInvalidArgument(err), should.BeTrue) - }, - ContextAssertion: func(ctx context.Context) bool { - a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByEUIFuncKey{}), should.Equal, 1) - }, - }, { Name: "Set without keys", ContextFunc: func(ctx context.Context) context.Context { return rights.NewContext(ctx, rights.Rights{ ApplicationRights: map[string]*ttnpb.Rights{ - unique.ID(ctx, deepcopy.Copy(registeredDevice.EndDeviceIdentifiers.ApplicationIdentifiers).(ttnpb.ApplicationIdentifiers)): ttnpb.RightsFrom( + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: registeredApplicationID}): ttnpb.RightsFrom( ttnpb.RIGHT_APPLICATION_DEVICES_WRITE, ), }, @@ -667,18 +561,20 @@ func TestDeviceRegistrySet(t *testing.T) { Paths: []string{"ids"}, }, }, - SetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { a := assertions.New(test.MustTFromContext(ctx)) - defer test.MustIncrementContextCounter(ctx, setByEUIFuncKey{}, 1) - a.So(joinEUI, should.Equal, *registeredJoinEUI) - a.So(devEUI, should.Equal, *registeredDevEUI) + defer test.MustIncrementContextCounter(ctx, setByIDFuncKey{}, 1) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ + ApplicationID: registeredApplicationID, + }) + a.So(devID, should.Equal, registeredDeviceID) a.So(paths, should.Contain, "ids") dev, _, err := cb(deepcopy.Copy(registeredDevice).(*ttnpb.EndDevice)) return dev, err }, ContextAssertion: func(ctx context.Context) bool { a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByEUIFuncKey{}), should.Equal, 1) + return a.So(test.MustCounterFromContext(ctx, setByIDFuncKey{}), should.Equal, 1) }, }, { @@ -686,7 +582,7 @@ func TestDeviceRegistrySet(t *testing.T) { ContextFunc: func(ctx context.Context) context.Context { return rights.NewContext(ctx, rights.Rights{ ApplicationRights: map[string]*ttnpb.Rights{ - unique.ID(ctx, deepcopy.Copy(registeredDevice.EndDeviceIdentifiers.ApplicationIdentifiers).(ttnpb.ApplicationIdentifiers)): ttnpb.RightsFrom( + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: registeredApplicationID}): ttnpb.RightsFrom( ttnpb.RIGHT_APPLICATION_DEVICES_WRITE, ), }, @@ -698,9 +594,9 @@ func TestDeviceRegistrySet(t *testing.T) { Paths: []string{"ids", "root_keys"}, }, }, - SetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { - test.MustTFromContext(ctx).Errorf("SetByEUIFunc must not be called") - return nil, errors.New("SetByEUIFunc must not be called") + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + test.MustTFromContext(ctx).Errorf("SetByIDFunc must not be called") + return nil, errors.New("SetByIDFunc must not be called") }, ErrorAssertion: func(t *testing.T, err error) bool { a := assertions.New(t) @@ -708,7 +604,7 @@ func TestDeviceRegistrySet(t *testing.T) { }, ContextAssertion: func(ctx context.Context) bool { a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByEUIFuncKey{}), should.Equal, 0) + return a.So(test.MustCounterFromContext(ctx, setByIDFuncKey{}), should.Equal, 0) }, }, { @@ -716,7 +612,7 @@ func TestDeviceRegistrySet(t *testing.T) { ContextFunc: func(ctx context.Context) context.Context { return rights.NewContext(ctx, rights.Rights{ ApplicationRights: map[string]*ttnpb.Rights{ - unique.ID(ctx, deepcopy.Copy(registeredDevice.EndDeviceIdentifiers.ApplicationIdentifiers).(ttnpb.ApplicationIdentifiers)): ttnpb.RightsFrom( + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: registeredApplicationID}): ttnpb.RightsFrom( ttnpb.RIGHT_APPLICATION_DEVICES_WRITE, ttnpb.RIGHT_APPLICATION_DEVICES_WRITE_KEYS, ), @@ -729,26 +625,28 @@ func TestDeviceRegistrySet(t *testing.T) { Paths: []string{"ids", "root_keys"}, }, }, - SetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { a := assertions.New(test.MustTFromContext(ctx)) - defer test.MustIncrementContextCounter(ctx, setByEUIFuncKey{}, 1) - a.So(joinEUI, should.Equal, *registeredJoinEUI) - a.So(devEUI, should.Equal, *registeredDevEUI) + defer test.MustIncrementContextCounter(ctx, setByIDFuncKey{}, 1) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ + ApplicationID: registeredApplicationID, + }) + a.So(devID, should.Equal, registeredDeviceID) a.So(paths, should.Contain, "ids") dev, _, err := cb(deepcopy.Copy(registeredDevice).(*ttnpb.EndDevice)) return dev, err }, ContextAssertion: func(ctx context.Context) bool { a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByEUIFuncKey{}), should.Equal, 1) + return a.So(test.MustCounterFromContext(ctx, setByIDFuncKey{}), should.Equal, 1) }, }, } { t.Run(tc.Name, func(t *testing.T) { a := assertions.New(t) - ctx := test.ContextWithCounter(tc.ContextFunc(test.ContextWithT(test.Context(), t)), setByEUIFuncKey{}) + ctx := test.ContextWithCounter(tc.ContextFunc(test.ContextWithT(test.Context(), t)), setByIDFuncKey{}) reg := &MockDeviceRegistry{ - SetByEUIFunc: tc.SetByEUIFunc, + SetByIDFunc: tc.SetByIDFunc, } js := test.Must(New( component.MustNew(test.GetLogger(t), &component.Config{}), @@ -804,7 +702,7 @@ func TestDeviceRegistryDelete(t *testing.T) { for _, tc := range []struct { Name string ContextFunc func(context.Context) context.Context - SetByEUIFunc func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) + SetByIDFunc func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) Device *ttnpb.EndDeviceIdentifiers ErrorAssertion func(*testing.T, error) bool ContextAssertion func(context.Context) bool @@ -821,9 +719,9 @@ func TestDeviceRegistryDelete(t *testing.T) { }) }, Device: deepcopy.Copy(®isteredDevice.EndDeviceIdentifiers).(*ttnpb.EndDeviceIdentifiers), - SetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { - test.MustTFromContext(ctx).Errorf("SetByEUIFunc must not be called") - return nil, errors.New("SetByEUIFunc must not be called") + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + test.MustTFromContext(ctx).Errorf("SetByIDFunc must not be called") + return nil, errors.New("SetByIDFunc must not be called") }, ErrorAssertion: func(t *testing.T, err error) bool { a := assertions.New(t) @@ -831,69 +729,7 @@ func TestDeviceRegistryDelete(t *testing.T) { }, ContextAssertion: func(ctx context.Context) bool { a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByEUIFuncKey{}), should.Equal, 0) - }, - }, - { - Name: "No DevEUI", - ContextFunc: func(ctx context.Context) context.Context { - return rights.NewContext(ctx, rights.Rights{ - ApplicationRights: map[string]*ttnpb.Rights{ - unique.ID(ctx, deepcopy.Copy(registeredDevice.EndDeviceIdentifiers.ApplicationIdentifiers).(ttnpb.ApplicationIdentifiers)): ttnpb.RightsFrom( - ttnpb.RIGHT_APPLICATION_DEVICES_WRITE, - ), - }, - }) - }, - Device: &ttnpb.EndDeviceIdentifiers{ - ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ - ApplicationID: registeredApplicationID, - }, - DeviceID: registeredDeviceID, - JoinEUI: registeredJoinEUI, - }, - SetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { - test.MustTFromContext(ctx).Errorf("SetByEUIFunc must not be called") - return nil, errors.New("SetByEUIFunc must not be called") - }, - ErrorAssertion: func(t *testing.T, err error) bool { - a := assertions.New(t) - return a.So(errors.IsInvalidArgument(err), should.BeTrue) - }, - ContextAssertion: func(ctx context.Context) bool { - a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByEUIFuncKey{}), should.Equal, 0) - }, - }, - { - Name: "No JoinEUI", - ContextFunc: func(ctx context.Context) context.Context { - return rights.NewContext(ctx, rights.Rights{ - ApplicationRights: map[string]*ttnpb.Rights{ - unique.ID(ctx, deepcopy.Copy(registeredDevice.EndDeviceIdentifiers.ApplicationIdentifiers).(ttnpb.ApplicationIdentifiers)): ttnpb.RightsFrom( - ttnpb.RIGHT_APPLICATION_DEVICES_WRITE, - ), - }, - }) - }, - Device: &ttnpb.EndDeviceIdentifiers{ - ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ - ApplicationID: registeredApplicationID, - }, - DeviceID: registeredDeviceID, - DevEUI: registeredDevEUI, - }, - SetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { - test.MustTFromContext(ctx).Errorf("SetByEUIFunc must not be called") - return nil, errors.New("SetByEUIFunc must not be called") - }, - ErrorAssertion: func(t *testing.T, err error) bool { - a := assertions.New(t) - return a.So(errors.IsInvalidArgument(err), should.BeTrue) - }, - ContextAssertion: func(ctx context.Context) bool { - a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByEUIFuncKey{}), should.Equal, 0) + return a.So(test.MustCounterFromContext(ctx, setByIDFuncKey{}), should.Equal, 0) }, }, { @@ -901,7 +737,7 @@ func TestDeviceRegistryDelete(t *testing.T) { ContextFunc: func(ctx context.Context) context.Context { return rights.NewContext(ctx, rights.Rights{ ApplicationRights: map[string]*ttnpb.Rights{ - unique.ID(ctx, deepcopy.Copy(registeredDevice.EndDeviceIdentifiers.ApplicationIdentifiers).(ttnpb.ApplicationIdentifiers)): ttnpb.RightsFrom( + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: registeredApplicationID}): ttnpb.RightsFrom( ttnpb.RIGHT_APPLICATION_DEVICES_WRITE, ), }, @@ -915,11 +751,13 @@ func TestDeviceRegistryDelete(t *testing.T) { JoinEUI: unregisteredJoinEUI, DevEUI: unregisteredDevEUI, }, - SetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { a := assertions.New(test.MustTFromContext(ctx)) - defer test.MustIncrementContextCounter(ctx, setByEUIFuncKey{}, 1) - a.So(joinEUI, should.Equal, *unregisteredJoinEUI) - a.So(devEUI, should.Equal, *unregisteredDevEUI) + defer test.MustIncrementContextCounter(ctx, setByIDFuncKey{}, 1) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ + ApplicationID: registeredApplicationID, + }) + a.So(devID, should.Equal, unregisteredDeviceID) a.So(paths, should.BeNil) return nil, errNotFound }, @@ -929,7 +767,7 @@ func TestDeviceRegistryDelete(t *testing.T) { }, ContextAssertion: func(ctx context.Context) bool { a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByEUIFuncKey{}), should.Equal, 1) + return a.So(test.MustCounterFromContext(ctx, setByIDFuncKey{}), should.Equal, 1) }, }, { @@ -951,11 +789,13 @@ func TestDeviceRegistryDelete(t *testing.T) { JoinEUI: registeredJoinEUI, DevEUI: registeredDevEUI, }, - SetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { a := assertions.New(test.MustTFromContext(ctx)) - defer test.MustIncrementContextCounter(ctx, setByEUIFuncKey{}, 1) - a.So(joinEUI, should.Equal, *registeredJoinEUI) - a.So(devEUI, should.Equal, *registeredDevEUI) + defer test.MustIncrementContextCounter(ctx, setByIDFuncKey{}, 1) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ + ApplicationID: "other-app", + }) + a.So(devID, should.Equal, "other-device") a.So(paths, should.BeNil) dev, _, err := cb(deepcopy.Copy(registeredDevice).(*ttnpb.EndDevice)) return dev, err @@ -966,7 +806,7 @@ func TestDeviceRegistryDelete(t *testing.T) { }, ContextAssertion: func(ctx context.Context) bool { a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByEUIFuncKey{}), should.Equal, 1) + return a.So(test.MustCounterFromContext(ctx, setByIDFuncKey{}), should.Equal, 1) }, }, { @@ -974,33 +814,35 @@ func TestDeviceRegistryDelete(t *testing.T) { ContextFunc: func(ctx context.Context) context.Context { return rights.NewContext(ctx, rights.Rights{ ApplicationRights: map[string]*ttnpb.Rights{ - unique.ID(ctx, deepcopy.Copy(registeredDevice.EndDeviceIdentifiers.ApplicationIdentifiers).(ttnpb.ApplicationIdentifiers)): ttnpb.RightsFrom( + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: registeredApplicationID}): ttnpb.RightsFrom( ttnpb.RIGHT_APPLICATION_DEVICES_WRITE, ), }, }) }, Device: deepcopy.Copy(®isteredDevice.EndDeviceIdentifiers).(*ttnpb.EndDeviceIdentifiers), - SetByEUIFunc: func(ctx context.Context, joinEUI, devEUI types.EUI64, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string, cb func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { a := assertions.New(test.MustTFromContext(ctx)) - defer test.MustIncrementContextCounter(ctx, setByEUIFuncKey{}, 1) - a.So(joinEUI, should.Equal, *registeredJoinEUI) - a.So(devEUI, should.Equal, *registeredDevEUI) + defer test.MustIncrementContextCounter(ctx, setByIDFuncKey{}, 1) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ + ApplicationID: registeredApplicationID, + }) + a.So(devID, should.Equal, registeredDeviceID) a.So(paths, should.BeNil) dev, _, err := cb(deepcopy.Copy(registeredDevice).(*ttnpb.EndDevice)) return dev, err }, ContextAssertion: func(ctx context.Context) bool { a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByEUIFuncKey{}), should.Equal, 1) + return a.So(test.MustCounterFromContext(ctx, setByIDFuncKey{}), should.Equal, 1) }, }, } { t.Run(tc.Name, func(t *testing.T) { a := assertions.New(t) - ctx := test.ContextWithCounter(tc.ContextFunc(test.ContextWithT(test.Context(), t)), setByEUIFuncKey{}) + ctx := test.ContextWithCounter(tc.ContextFunc(test.ContextWithT(test.Context(), t)), setByIDFuncKey{}) reg := &MockDeviceRegistry{ - SetByEUIFunc: tc.SetByEUIFunc, + SetByIDFunc: tc.SetByIDFunc, } js := test.Must(New( component.MustNew(test.GetLogger(t), &component.Config{}), diff --git a/pkg/joinserver/grpc_nsjs.go b/pkg/joinserver/grpc_nsjs.go index bcae0db0d4..e10fcfe1c0 100644 --- a/pkg/joinserver/grpc_nsjs.go +++ b/pkg/joinserver/grpc_nsjs.go @@ -72,12 +72,6 @@ func (srv nsJsServer) HandleJoin(ctx context.Context, req *ttnpb.JoinRequest) (r return nil, errUnsupportedLoRaWANVersion.WithAttributes("version", req.SelectedMACVersion) } - if req.RawPayload == nil { - return nil, errNoPayload - } - if n := len(req.RawPayload); n != 23 { - return nil, errPayloadLengthMismatch.WithAttributes("length", n) - } req.Payload = &ttnpb.Message{} if err = lorawan.UnmarshalMessage(req.RawPayload, req.Payload); err != nil { return nil, errDecodePayload.WithCause(err) @@ -292,7 +286,27 @@ func (srv nsJsServer) HandleJoin(ctx context.Context, req *ttnpb.JoinRequest) (r RawPayload: append(b[:1], enc...), SessionKeys: sessionKeys, } - _, err = CreateKeys(ctx, srv.JS.keys, *dev.EndDeviceIdentifiers.DevEUI, &res.SessionKeys) + _, err = srv.JS.keys.SetByID(ctx, *dev.DevEUI, res.SessionKeys.SessionKeyID, + []string{ + "session_key_id", + "f_nwk_s_int_key", + "s_nwk_s_int_key", + "nwk_s_enc_key", + "app_s_key", + }, + func(stored *ttnpb.SessionKeys) (*ttnpb.SessionKeys, []string, error) { + if stored != nil { + return nil, nil, errDuplicateIdentifiers + } + return &res.SessionKeys, []string{ + "session_key_id", + "f_nwk_s_int_key", + "s_nwk_s_int_key", + "nwk_s_enc_key", + "app_s_key", + }, nil + }, + ) if err != nil { return nil, nil, err } diff --git a/pkg/joinserver/grpc_nsjs_test.go b/pkg/joinserver/grpc_nsjs_test.go index c53cc24e5e..48d5ffaa65 100644 --- a/pkg/joinserver/grpc_nsjs_test.go +++ b/pkg/joinserver/grpc_nsjs_test.go @@ -137,8 +137,10 @@ func TestHandleJoin(t *testing.T) { Name: "1.1.0/new device", Device: &ttnpb.EndDevice{ EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ - DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app"}, + DeviceID: "test-dev", }, RootKeys: &ttnpb.RootKeys{ AppKey: &ttnpb.KeyEnvelope{ @@ -244,8 +246,10 @@ func TestHandleJoin(t *testing.T) { LastDevNonce: 0x2441, LastJoinNonce: 0x42fffd, EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ - DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app"}, + DeviceID: "test-dev", }, RootKeys: &ttnpb.RootKeys{ AppKey: &ttnpb.KeyEnvelope{ @@ -352,8 +356,10 @@ func TestHandleJoin(t *testing.T) { LastDevNonce: 0x2442, LastJoinNonce: 0x42fffd, EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ - DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app"}, + DeviceID: "test-dev", }, RootKeys: &ttnpb.RootKeys{ AppKey: &ttnpb.KeyEnvelope{ @@ -404,8 +410,10 @@ func TestHandleJoin(t *testing.T) { Name: "1.0.2/new device", Device: &ttnpb.EndDevice{ EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ - DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app"}, + DeviceID: "test-dev", }, RootKeys: &ttnpb.RootKeys{ AppKey: &ttnpb.KeyEnvelope{ @@ -490,8 +498,10 @@ func TestHandleJoin(t *testing.T) { Name: "1.0.1/new device", Device: &ttnpb.EndDevice{ EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ - DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app"}, + DeviceID: "test-dev", }, RootKeys: &ttnpb.RootKeys{ AppKey: &ttnpb.KeyEnvelope{ @@ -576,8 +586,10 @@ func TestHandleJoin(t *testing.T) { Name: "1.0.0/new device", Device: &ttnpb.EndDevice{ EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ - DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app"}, + DeviceID: "test-dev", }, RootKeys: &ttnpb.RootKeys{ AppKey: &ttnpb.KeyEnvelope{ @@ -664,8 +676,10 @@ func TestHandleJoin(t *testing.T) { UsedDevNonces: []uint32{23, 41, 42, 52, 0x2444}, LastJoinNonce: 0x42fffd, EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ - DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app"}, + DeviceID: "test-dev", }, RootKeys: &ttnpb.RootKeys{ AppKey: &ttnpb.KeyEnvelope{ @@ -752,8 +766,10 @@ func TestHandleJoin(t *testing.T) { UsedDevNonces: []uint32{23, 41, 42, 52, 0x2442}, LastJoinNonce: 0x42fffe, EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ - DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app"}, + DeviceID: "test-dev", }, RootKeys: &ttnpb.RootKeys{ AppKey: &ttnpb.KeyEnvelope{ @@ -801,8 +817,10 @@ func TestHandleJoin(t *testing.T) { UsedDevNonces: []uint32{23, 41, 42, 52, 0x2442}, LastJoinNonce: 0x42fffe, EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ - DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app"}, + DeviceID: "test-dev", }, RootKeys: &ttnpb.RootKeys{ AppKey: &ttnpb.KeyEnvelope{ @@ -835,8 +853,10 @@ func TestHandleJoin(t *testing.T) { UsedDevNonces: []uint32{23, 41, 42, 52, 0x2442}, LastJoinNonce: 0x42fffe, EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ - DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app"}, + DeviceID: "test-dev", }, RootKeys: &ttnpb.RootKeys{ AppKey: &ttnpb.KeyEnvelope{ @@ -875,8 +895,10 @@ func TestHandleJoin(t *testing.T) { UsedDevNonces: []uint32{23, 41, 42, 52, 0x2442}, LastJoinNonce: 0x42fffe, EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ - DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app"}, + DeviceID: "test-dev", }, RootKeys: &ttnpb.RootKeys{ AppKey: &ttnpb.KeyEnvelope{ @@ -916,8 +938,10 @@ func TestHandleJoin(t *testing.T) { UsedDevNonces: []uint32{23, 41, 42, 52, 0x2442}, LastJoinNonce: 0x42fffe, EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ - DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app"}, + DeviceID: "test-dev", }, RootKeys: &ttnpb.RootKeys{ AppKey: &ttnpb.KeyEnvelope{ @@ -961,8 +985,10 @@ func TestHandleJoin(t *testing.T) { UsedDevNonces: []uint32{23, 41, 42, 52, 0x2442}, LastJoinNonce: 0x42fffe, EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ - DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app"}, + DeviceID: "test-dev", }, RootKeys: &ttnpb.RootKeys{ AppKey: &ttnpb.KeyEnvelope{ @@ -998,8 +1024,10 @@ func TestHandleJoin(t *testing.T) { UsedDevNonces: []uint32{23, 41, 42, 52, 0x2442}, LastJoinNonce: 0x42fffe, EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ - DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app"}, + DeviceID: "test-dev", }, RootKeys: &ttnpb.RootKeys{ AppKey: &ttnpb.KeyEnvelope{ @@ -1062,14 +1090,47 @@ func TestHandleJoin(t *testing.T) { pb := deepcopy.Copy(tc.Device).(*ttnpb.EndDevice) - ret, err := CreateDevice(authorizedCtx, devReg, deepcopy.Copy(pb).(*ttnpb.EndDevice)) - a.So(err, should.BeNil) - a.So(ret.CreatedAt, should.Equal, ret.UpdatedAt) + start := time.Now() + + ret, err := devReg.SetByID(authorizedCtx, pb.ApplicationIdentifiers, pb.DeviceID, + []string{ + "created_at", + "last_dev_nonce", + "last_join_nonce", + "lorawan_version", + "network_server_address", + "provisioner_id", + "provisioning_data", + "root_keys", + "updated_at", + "used_dev_nonces", + }, + func(stored *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { + if !a.So(stored, should.BeNil) { + t.Fatal("Registry is not empty") + } + return CopyEndDevice(pb), []string{ + "last_dev_nonce", + "last_join_nonce", + "lorawan_version", + "network_server_address", + "provisioner_id", + "provisioning_data", + "root_keys", + "used_dev_nonces", + }, nil + }, + ) + if !a.So(err, should.BeNil) || !a.So(ret, should.NotBeNil) { + t.Fatalf("Failed to create device: %s", err) + } + a.So(ret.CreatedAt, should.HappenAfter, start) + a.So(ret.UpdatedAt, should.HappenAfter, start) + a.So(ret.UpdatedAt, should.Equal, ret.CreatedAt) pb.CreatedAt = ret.CreatedAt pb.UpdatedAt = ret.UpdatedAt - a.So(ret, should.Resemble, pb) + a.So(ret, should.HaveEmptyDiff, pb) - start := time.Now() res, err := js.HandleJoin(authorizedCtx, deepcopy.Copy(tc.JoinRequest).(*ttnpb.JoinRequest)) if tc.ValidError != nil { if !a.So(err, should.BeError) || !a.So(tc.ValidError(err), should.BeTrue) { diff --git a/pkg/joinserver/joinserver_internal_test.go b/pkg/joinserver/joinserver_internal_test.go index afd100343d..cce7e4f7c8 100644 --- a/pkg/joinserver/joinserver_internal_test.go +++ b/pkg/joinserver/joinserver_internal_test.go @@ -40,7 +40,9 @@ type JsDeviceServer = jsEndDeviceRegistryServer type MockDeviceRegistry struct { GetByEUIFunc func(context.Context, types.EUI64, types.EUI64, []string) (*ttnpb.EndDevice, error) + GetByIDFunc func(context.Context, ttnpb.ApplicationIdentifiers, string, []string) (*ttnpb.EndDevice, error) SetByEUIFunc func(context.Context, types.EUI64, types.EUI64, []string, func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) + SetByIDFunc func(context.Context, ttnpb.ApplicationIdentifiers, string, []string, func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) } func (r *MockDeviceRegistry) GetByEUI(ctx context.Context, joinEUI types.EUI64, devEUI types.EUI64, paths []string) (*ttnpb.EndDevice, error) { @@ -50,6 +52,13 @@ func (r *MockDeviceRegistry) GetByEUI(ctx context.Context, joinEUI types.EUI64, return r.GetByEUIFunc(ctx, joinEUI, devEUI, paths) } +func (r *MockDeviceRegistry) GetByID(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string) (*ttnpb.EndDevice, error) { + if r.GetByIDFunc == nil { + return nil, errors.New("Not implemented") + } + return r.GetByIDFunc(ctx, appID, devID, paths) +} + func (r *MockDeviceRegistry) SetByEUI(ctx context.Context, joinEUI types.EUI64, devEUI types.EUI64, paths []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { if r.SetByEUIFunc == nil { return nil, errors.New("Not implemented") @@ -57,6 +66,13 @@ func (r *MockDeviceRegistry) SetByEUI(ctx context.Context, joinEUI types.EUI64, return r.SetByEUIFunc(ctx, joinEUI, devEUI, paths, f) } +func (r *MockDeviceRegistry) SetByID(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + if r.SetByIDFunc == nil { + return nil, errors.New("Not implemented") + } + return r.SetByIDFunc(ctx, appID, devID, paths, f) +} + type MockKeyRegistry struct { GetByIDFunc func(context.Context, types.EUI64, []byte, []string) (*ttnpb.SessionKeys, error) SetByIDFunc func(context.Context, types.EUI64, []byte, []string, func(*ttnpb.SessionKeys) (*ttnpb.SessionKeys, []string, error)) (*ttnpb.SessionKeys, error) diff --git a/pkg/joinserver/redis/registry.go b/pkg/joinserver/redis/registry.go index 48f90ca7ed..7dc7ff81b0 100644 --- a/pkg/joinserver/redis/registry.go +++ b/pkg/joinserver/redis/registry.go @@ -37,13 +37,17 @@ var ( ) func applyDeviceFieldMask(dst, src *ttnpb.EndDevice, paths ...string) (*ttnpb.EndDevice, error) { + paths = append(paths, "ids") + if dst == nil { dst = &ttnpb.EndDevice{} } - if err := dst.SetFields(src, append(paths, "ids")...); err != nil { + if err := dst.SetFields(src, paths...); err != nil { + return nil, err + } + if err := dst.ValidateFields(paths...); err != nil { return nil, err } - // TODO: Validation after applying fieldmasks https://github.com/TheThingsNetwork/lorawan-stack/issues/51 return dst, nil } @@ -67,7 +71,7 @@ func (r *DeviceRegistry) uidKey(uid string) string { return r.Redis.Key("uid", uid) } -func (r *DeviceRegistry) euiKey(devEUI, joinEUI types.EUI64) string { +func (r *DeviceRegistry) euiKey(joinEUI, devEUI types.EUI64) string { return r.Redis.Key("eui", joinEUI.String(), devEUI.String()) } @@ -75,6 +79,23 @@ func (r *DeviceRegistry) provisionerKey(provisionerID, pid string) string { return r.Redis.Key("provisioner", provisionerID, pid) } +// GetByID gets device by appID, devID. +func (r *DeviceRegistry) GetByID(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string) (*ttnpb.EndDevice, error) { + ids := ttnpb.EndDeviceIdentifiers{ + ApplicationIdentifiers: appID, + DeviceID: devID, + } + if err := ids.ValidateContext(ctx); err != nil { + return nil, err + } + + pb := &ttnpb.EndDevice{} + if err := ttnredis.GetProto(r.Redis, r.uidKey(unique.ID(ctx, ids))).ScanProto(pb); err != nil { + return nil, err + } + return applyDeviceFieldMask(nil, pb, paths...) +} + // GetByEUI gets device by joinEUI, devEUI. func (r *DeviceRegistry) GetByEUI(ctx context.Context, joinEUI types.EUI64, devEUI types.EUI64, paths []string) (*ttnpb.EndDevice, error) { if joinEUI.IsZero() || devEUI.IsZero() { @@ -82,7 +103,7 @@ func (r *DeviceRegistry) GetByEUI(ctx context.Context, joinEUI types.EUI64, devE } pb := &ttnpb.EndDevice{} - if err := ttnredis.GetProto(r.Redis, r.euiKey(joinEUI, devEUI)).ScanProto(pb); err != nil { + if err := ttnredis.FindProto(r.Redis, r.euiKey(joinEUI, devEUI), r.uidKey).ScanProto(pb); err != nil { return nil, err } return applyDeviceFieldMask(&ttnpb.EndDevice{}, pb, paths...) @@ -95,158 +116,168 @@ func equalEUI(x, y *types.EUI64) bool { return x.Equal(*y) } -// SetByEUI sets device by joinEUI, devEUI. -func (r *DeviceRegistry) SetByEUI(ctx context.Context, joinEUI types.EUI64, devEUI types.EUI64, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { - if joinEUI.IsZero() || devEUI.IsZero() { - return nil, errInvalidIdentifiers +func (r *DeviceRegistry) set(tx *redis.Tx, uid string, gets []string, f func(pb *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + uk := r.uidKey(uid) + + cmd := ttnredis.GetProto(tx, uk) + stored := &ttnpb.EndDevice{} + if err := cmd.ScanProto(stored); errors.IsNotFound(err) { + stored = nil + } else if err != nil { + return nil, err } - ek := r.euiKey(joinEUI, devEUI) var pb *ttnpb.EndDevice - err := r.Redis.Watch(func(tx *redis.Tx) error { - cmd := ttnredis.GetProto(tx, ek) - stored := &ttnpb.EndDevice{} - if err := cmd.ScanProto(stored); errors.IsNotFound(err) { - stored = nil - } else if err != nil { - return err + var err error + if stored != nil { + pb = &ttnpb.EndDevice{} + if err := cmd.ScanProto(pb); err != nil { + return nil, err + } + pb, err = applyDeviceFieldMask(nil, pb, gets...) + if err != nil { + return nil, err } + } - var err error - if stored != nil { - pb = &ttnpb.EndDevice{} - if err := cmd.ScanProto(pb); err != nil { - return err + var sets []string + pb, sets, err = f(pb) + if err != nil { + return nil, err + } + if stored == nil && pb == nil { + return nil, nil + } + + var pipelined func(redis.Pipeliner) error + if pb == nil { + pipelined = func(p redis.Pipeliner) error { + p.Del(uk) + if stored.JoinEUI != nil && stored.DevEUI != nil { + p.Del(r.euiKey(*stored.JoinEUI, *stored.DevEUI)) } - pb, err = applyDeviceFieldMask(nil, pb, gets...) + pid, err := provisionerUniqueID(stored) if err != nil { return err } - } - - var sets []string - pb, sets, err = f(pb) - if err != nil { - return err - } - if stored == nil && pb == nil { + if pid != "" { + p.Del(r.provisionerKey(stored.ProvisionerID, pid)) + } return nil } + } else { + if pb.JoinEUI == nil || pb.DevEUI == nil { + return nil, errInvalidIdentifiers + } - var f func(redis.Pipeliner) error - if pb == nil { - f = func(p redis.Pipeliner) error { - p.Del(ek) - if !stored.ApplicationIdentifiers.IsZero() && stored.DeviceID != "" { - p.Del(r.uidKey(unique.ID(ctx, stored.EndDeviceIdentifiers))) - } - pid, err := provisionerUniqueID(stored) - if err != nil { - return err - } - if pid != "" { - p.Del(r.provisionerKey(stored.ProvisionerID, pid)) - } - return nil + pb.UpdatedAt = time.Now().UTC() + sets = append(sets, "updated_at") + + updated := &ttnpb.EndDevice{} + var updatedPID string + if stored == nil { + pb.CreatedAt = pb.UpdatedAt + sets = append(sets, "created_at") + + updated, err = applyDeviceFieldMask(updated, pb, sets...) + if err != nil { + return nil, err + } + updatedPID, err = provisionerUniqueID(updated) + if err != nil { + return nil, err } } else { - if pb.JoinEUI == nil || *pb.JoinEUI != joinEUI || - pb.DevEUI == nil || *pb.DevEUI != devEUI { - return errInvalidIdentifiers + if err := cmd.ScanProto(updated); err != nil { + return nil, err } + updated, err = applyDeviceFieldMask(updated, pb, sets...) + if err != nil { + return nil, err + } + storedPID, err := provisionerUniqueID(stored) + if err != nil { + return nil, err + } + updatedPID, err = provisionerUniqueID(updated) + if err != nil { + return nil, err + } + if !equalEUI(stored.JoinEUI, updated.JoinEUI) || !equalEUI(stored.DevEUI, updated.DevEUI) || + stored.ApplicationIdentifiers != updated.ApplicationIdentifiers || stored.DeviceID != updated.DeviceID || + storedPID != updatedPID { + return nil, errInvalidIdentifiers + } + } + pb, err = applyDeviceFieldMask(nil, updated, gets...) + if err != nil { + return nil, err + } - pb.UpdatedAt = time.Now().UTC() - sets = append(sets, "updated_at") - - updated := &ttnpb.EndDevice{} - var updatedPID string + pipelined = func(p redis.Pipeliner) error { if stored == nil { - pb.CreatedAt = pb.UpdatedAt - sets = append(sets, "created_at") - - updated, err = applyDeviceFieldMask(updated, pb, sets...) - if err != nil { + ek := r.euiKey(*pb.JoinEUI, *pb.DevEUI) + if err := tx.Watch(ek).Err(); err != nil { return err } - updatedPID, err = provisionerUniqueID(updated) + i, err := tx.Exists(ek).Result() if err != nil { - return err + return ttnredis.ConvertError(err) } - } else { - if err := cmd.ScanProto(updated); err != nil { - return err - } - updated, err = applyDeviceFieldMask(updated, pb, sets...) - if err != nil { - return err + if i != 0 { + return errDuplicateIdentifiers } + p.SetNX(ek, uid, 0) + } - storedPID, err := provisionerUniqueID(stored) - if err != nil { + if updatedPID != "" { + pk := r.provisionerKey(updated.ProvisionerID, updatedPID) + if err := tx.Watch(pk).Err(); err != nil { return err } - updatedPID, err = provisionerUniqueID(updated) + i, err := tx.Exists(pk).Result() if err != nil { - return err + return ttnredis.ConvertError(err) } - if !equalEUI(stored.JoinEUI, updated.JoinEUI) || !equalEUI(stored.DevEUI, updated.DevEUI) || - stored.ApplicationIdentifiers != updated.ApplicationIdentifiers || stored.DeviceID != updated.DeviceID || - storedPID != updatedPID { - return errInvalidIdentifiers + if i != 0 { + return errAlreadyProvisioned } + p.SetNX(pk, uid, 0) } - pb, err = applyDeviceFieldMask(nil, updated, gets...) + + _, err := ttnredis.SetProto(p, uk, updated, 0) if err != nil { return err } - f = func(p redis.Pipeliner) error { - eid := ttnredis.Key(joinEUI.String(), devEUI.String()) - - if stored == nil { - if !updated.ApplicationIdentifiers.IsZero() && updated.DeviceID != "" { - ik := r.uidKey(unique.ID(ctx, updated.EndDeviceIdentifiers)) - if err := tx.Watch(ik).Err(); err != nil { - return err - } - i, err := tx.Exists(ik).Result() - if err != nil { - return ttnredis.ConvertError(err) - } - if i != 0 { - return errDuplicateIdentifiers - } - p.SetNX(ik, r.euiKey(joinEUI, devEUI), 0) - } - - if updatedPID != "" { - pk := r.provisionerKey(updated.ProvisionerID, updatedPID) - if err := tx.Watch(pk).Err(); err != nil { - return err - } - i, err := tx.Exists(pk).Result() - if err != nil { - return ttnredis.ConvertError(err) - } - if i != 0 { - return errAlreadyProvisioned - } - p.SetNX(pk, eid, 0) - } - } - - _, err := ttnredis.SetProto(p, ek, updated, 0) - if err != nil { - return err - } - return nil - } + return nil } - _, err = tx.Pipelined(f) + } + _, err = tx.Pipelined(pipelined) + if err != nil { + return nil, err + } + return pb, nil +} + +// SetByEUI sets device by joinEUI, devEUI. +func (r *DeviceRegistry) SetByEUI(ctx context.Context, joinEUI types.EUI64, devEUI types.EUI64, gets []string, f func(pb *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + if joinEUI.IsZero() || devEUI.IsZero() { + return nil, errInvalidIdentifiers + } + ek := r.euiKey(joinEUI, devEUI) + + var pb *ttnpb.EndDevice + err := r.Redis.Watch(func(tx *redis.Tx) error { + uid, err := tx.Get(ek).Result() if err != nil { - return err + return ttnredis.ConvertError(err) } - return nil + if err := tx.Watch(r.uidKey(uid)).Err(); err != nil { + return ttnredis.ConvertError(err) + } + pb, err = r.set(tx, uid, gets, f) + return err }, ek) if err != nil { return nil, err @@ -254,11 +285,51 @@ func (r *DeviceRegistry) SetByEUI(ctx context.Context, joinEUI types.EUI64, devE return pb, nil } +// SetByID sets device by appID, devID. +func (r *DeviceRegistry) SetByID(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(pb *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + ids := ttnpb.EndDeviceIdentifiers{ + ApplicationIdentifiers: appID, + DeviceID: devID, + } + if err := ids.ValidateContext(ctx); err != nil { + return nil, err + } + uid := unique.ID(ctx, ids) + + var pb *ttnpb.EndDevice + err := r.Redis.Watch(func(tx *redis.Tx) error { + var err error + pb, err = r.set(tx, uid, gets, func(stored *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { + updated, sets, err := f(stored) + if err != nil { + return nil, nil, err + } + if updated != nil && (updated.ApplicationIdentifiers != appID || updated.DeviceID != devID) { + return nil, nil, errInvalidIdentifiers + } + return updated, sets, nil + }) + return err + }, r.uidKey(uid)) + if err != nil { + return nil, err + } + return pb, nil +} + func applyKeyFieldMask(dst, src *ttnpb.SessionKeys, paths ...string) (*ttnpb.SessionKeys, error) { + paths = append(paths, "session_key_id") + if dst == nil { dst = &ttnpb.SessionKeys{} } - return dst, dst.SetFields(src, append(paths, "session_key_id")...) + if err := dst.SetFields(src, paths...); err != nil { + return nil, err + } + if err := dst.ValidateFields(paths...); err != nil { + return nil, err + } + return dst, nil } // KeyRegistry is an implementation of joinserver.KeyRegistry. diff --git a/pkg/joinserver/registry.go b/pkg/joinserver/registry.go index 4cfd6b43ac..ee192bd01f 100644 --- a/pkg/joinserver/registry.go +++ b/pkg/joinserver/registry.go @@ -24,32 +24,17 @@ import ( // DeviceRegistry is a registry, containing devices. type DeviceRegistry interface { GetByEUI(ctx context.Context, joinEUI types.EUI64, devEUI types.EUI64, paths []string) (*ttnpb.EndDevice, error) + GetByID(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string) (*ttnpb.EndDevice, error) SetByEUI(ctx context.Context, joinEUI types.EUI64, devEUI types.EUI64, paths []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) + SetByID(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) } // DeleteDevice deletes device identified by joinEUI, devEUI from r. -func DeleteDevice(ctx context.Context, r DeviceRegistry, joinEUI types.EUI64, devEUI types.EUI64) error { - _, err := r.SetByEUI(ctx, joinEUI, devEUI, ttnpb.EndDeviceFieldPathsTopLevel, func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { return nil, nil, nil }) +func DeleteDevice(ctx context.Context, r DeviceRegistry, appID ttnpb.ApplicationIdentifiers, devID string) error { + _, err := r.SetByID(ctx, appID, devID, nil, func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { return nil, nil, nil }) return err } -// CreateDevice creates device dev identified by joinEUI, devEUI from dev.EndDeviceIdentifiers at r. -func CreateDevice(ctx context.Context, r DeviceRegistry, dev *ttnpb.EndDevice) (*ttnpb.EndDevice, error) { - if dev.EndDeviceIdentifiers.JoinEUI == nil || dev.EndDeviceIdentifiers.DevEUI == nil { - return nil, errInvalidIdentifiers - } - dev, err := r.SetByEUI(ctx, *dev.EndDeviceIdentifiers.JoinEUI, *dev.EndDeviceIdentifiers.DevEUI, ttnpb.EndDeviceFieldPathsTopLevel, func(stored *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { - if stored != nil { - return nil, nil, errDuplicateIdentifiers - } - return dev, ttnpb.EndDeviceFieldPathsTopLevel, nil - }) - if err != nil { - return nil, err - } - return dev, nil -} - // KeyRegistry is a registry, containing session keys. type KeyRegistry interface { GetByID(ctx context.Context, devEUI types.EUI64, id []byte, paths []string) (*ttnpb.SessionKeys, error) @@ -58,23 +43,6 @@ type KeyRegistry interface { // DeleteKeys deletes session keys identified by devEUI, id pair from r. func DeleteKeys(ctx context.Context, r KeyRegistry, devEUI types.EUI64, id []byte) error { - _, err := r.SetByID(ctx, devEUI, id, ttnpb.SessionKeysFieldPathsTopLevel, func(*ttnpb.SessionKeys) (*ttnpb.SessionKeys, []string, error) { return nil, nil, nil }) + _, err := r.SetByID(ctx, devEUI, id, nil, func(*ttnpb.SessionKeys) (*ttnpb.SessionKeys, []string, error) { return nil, nil, nil }) return err } - -// CreateKeys creates session keys ks identified by devEUI, ks.SessionKeyID at r. -func CreateKeys(ctx context.Context, r KeyRegistry, devEUI types.EUI64, ks *ttnpb.SessionKeys) (*ttnpb.SessionKeys, error) { - if devEUI.IsZero() || len(ks.SessionKeyID) == 0 { - return nil, errInvalidIdentifiers - } - ks, err := r.SetByID(ctx, devEUI, ks.SessionKeyID, ttnpb.SessionKeysFieldPathsTopLevel, func(stored *ttnpb.SessionKeys) (*ttnpb.SessionKeys, []string, error) { - if stored != nil { - return nil, nil, errDuplicateIdentifiers - } - return ks, ttnpb.SessionKeysFieldPathsTopLevel, nil - }) - if err != nil { - return nil, err - } - return ks, nil -} diff --git a/pkg/joinserver/registry_test.go b/pkg/joinserver/registry_test.go index 425252ab55..2fc74ab376 100644 --- a/pkg/joinserver/registry_test.go +++ b/pkg/joinserver/registry_test.go @@ -43,8 +43,10 @@ func handleDeviceRegistryTest(t *testing.T, reg DeviceRegistry) { pb := &ttnpb.EndDevice{ EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ - JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app"}, + DeviceID: "test-dev", }, ProvisionerID: "mock", ProvisioningData: &pbtypes.Struct{ @@ -66,9 +68,25 @@ func handleDeviceRegistryTest(t *testing.T, reg DeviceRegistry) { start := time.Now() - ret, err = CreateDevice(ctx, reg, pb) + ret, err = reg.SetByID(ctx, pb.ApplicationIdentifiers, pb.DeviceID, + []string{ + "created_at", + "provisioner_id", + "provisioning_data", + "updated_at", + }, + func(stored *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { + if !a.So(stored, should.BeNil) { + t.Fatal("Registry is not empty") + } + return CopyEndDevice(pb), []string{ + "provisioner_id", + "provisioning_data", + }, nil + }, + ) if !a.So(err, should.BeNil) || !a.So(ret, should.NotBeNil) { - t.FailNow() + t.Fatalf("Failed to create device: %s", err) } a.So(ret.CreatedAt, should.HappenAfter, start) a.So(ret.UpdatedAt, should.HappenAfter, start) @@ -78,11 +96,14 @@ func handleDeviceRegistryTest(t *testing.T, reg DeviceRegistry) { a.So(ret, should.HaveEmptyDiff, pb) ret, err = reg.GetByEUI(ctx, *pb.EndDeviceIdentifiers.JoinEUI, *pb.EndDeviceIdentifiers.DevEUI, ttnpb.EndDeviceFieldPathsTopLevel) - a.So(err, should.BeNil) + if !a.So(err, should.BeNil) { + t.Fatalf("Failed to get device: %s", err) + } a.So(ret, should.HaveEmptyDiff, pb) pbOther := CopyEndDevice(pb) - pbOther.EndDeviceIdentifiers.DevEUI = &types.EUI64{0x43, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} + pbOther.DeviceID = "other-device" + pbOther.DevEUI = &types.EUI64{0x43, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} ret, err = reg.GetByEUI(ctx, *pbOther.EndDeviceIdentifiers.JoinEUI, *pbOther.EndDeviceIdentifiers.DevEUI, ttnpb.EndDeviceFieldPathsTopLevel) if !a.So(err, should.NotBeNil) || !a.So(errors.IsNotFound(err), should.BeTrue) { @@ -90,12 +111,28 @@ func handleDeviceRegistryTest(t *testing.T, reg DeviceRegistry) { } a.So(ret, should.BeNil) - ret, err = CreateDevice(ctx, reg, pbOther) - if !a.So(errors.IsAlreadyExists(err), should.BeTrue) { // Conflicting provisioner unique ID. - t.FailNow() + ret, err = reg.SetByID(ctx, pbOther.ApplicationIdentifiers, pbOther.DeviceID, + []string{ + "created_at", + "provisioner_id", + "provisioning_data", + "updated_at", + }, + func(stored *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { + if !a.So(stored, should.BeNil) { + t.Fatal("Registry is not empty") + } + return CopyEndDevice(pbOther), []string{ + "provisioner_id", + "provisioning_data", + }, nil + }, + ) + if !a.So(errors.IsAlreadyExists(err), should.BeTrue) { + t.Fatal("Device with conflicting provisioner unique ID created") } - err = DeleteDevice(ctx, reg, *pb.EndDeviceIdentifiers.JoinEUI, *pb.EndDeviceIdentifiers.DevEUI) + err = DeleteDevice(ctx, reg, pb.ApplicationIdentifiers, pb.DeviceID) if !a.So(err, should.BeNil) { t.FailNow() } @@ -106,9 +143,25 @@ func handleDeviceRegistryTest(t *testing.T, reg DeviceRegistry) { } a.So(ret, should.BeNil) - ret, err = CreateDevice(ctx, reg, pbOther) + ret, err = reg.SetByID(ctx, pbOther.ApplicationIdentifiers, pbOther.DeviceID, + []string{ + "created_at", + "provisioner_id", + "provisioning_data", + "updated_at", + }, + func(stored *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { + if !a.So(stored, should.BeNil) { + t.Fatal("Registry is not empty") + } + return CopyEndDevice(pbOther), []string{ + "provisioner_id", + "provisioning_data", + }, nil + }, + ) if !a.So(err, should.BeNil) || !a.So(ret, should.NotBeNil) { // No more conflicts. - t.FailNow() + t.Fatalf("Failed to create device: %s", err) } a.So(ret.CreatedAt, should.HappenAfter, pb.CreatedAt) @@ -119,10 +172,12 @@ func handleDeviceRegistryTest(t *testing.T, reg DeviceRegistry) { a.So(ret, should.HaveEmptyDiff, pbOther) ret, err = reg.GetByEUI(ctx, *pbOther.EndDeviceIdentifiers.JoinEUI, *pbOther.EndDeviceIdentifiers.DevEUI, ttnpb.EndDeviceFieldPathsTopLevel) - a.So(err, should.BeNil) + if !a.So(err, should.BeNil) { + t.FailNow() + } a.So(ret, should.HaveEmptyDiff, pbOther) - err = DeleteDevice(ctx, reg, *pbOther.EndDeviceIdentifiers.JoinEUI, *pbOther.EndDeviceIdentifiers.DevEUI) + err = DeleteDevice(ctx, reg, pbOther.ApplicationIdentifiers, pbOther.DeviceID) if !a.So(err, should.BeNil) { t.FailNow() } @@ -200,11 +255,31 @@ func handleKeyRegistryTest(t *testing.T, reg KeyRegistry) { } a.So(ret, should.BeNil) - ret, err = CreateKeys(ctx, reg, devEUI, pb) + ret, err = reg.SetByID(ctx, devEUI, pb.SessionKeyID, + []string{ + "session_key_id", + "f_nwk_s_int_key", + "s_nwk_s_int_key", + "nwk_s_enc_key", + "app_s_key", + }, + func(stored *ttnpb.SessionKeys) (*ttnpb.SessionKeys, []string, error) { + if !a.So(stored, should.BeNil) { + t.Fatal("Registry is not empty") + } + return CopySessionKeys(pb), []string{ + "session_key_id", + "f_nwk_s_int_key", + "s_nwk_s_int_key", + "nwk_s_enc_key", + "app_s_key", + }, nil + }, + ) if !a.So(err, should.BeNil) || !a.So(ret, should.NotBeNil) { - t.FailNow() + t.Fatalf("Failed to create keys: %s", err) } - a.So(ret, should.HaveEmptyDiff, pb) + a.So(ret, should.Resemble, pb) ret, err = reg.GetByID(ctx, devEUI, pb.SessionKeyID, ttnpb.SessionKeysFieldPathsTopLevel) a.So(err, should.BeNil) @@ -219,11 +294,31 @@ func handleKeyRegistryTest(t *testing.T, reg KeyRegistry) { } a.So(ret, should.BeNil) - ret, err = CreateKeys(ctx, reg, devEUIOther, pbOther) + ret, err = reg.SetByID(ctx, devEUIOther, pbOther.SessionKeyID, + []string{ + "session_key_id", + "f_nwk_s_int_key", + "s_nwk_s_int_key", + "nwk_s_enc_key", + "app_s_key", + }, + func(stored *ttnpb.SessionKeys) (*ttnpb.SessionKeys, []string, error) { + if !a.So(stored, should.BeNil) { + t.Fatal("Registry is not empty") + } + return CopySessionKeys(pbOther), []string{ + "session_key_id", + "f_nwk_s_int_key", + "s_nwk_s_int_key", + "nwk_s_enc_key", + "app_s_key", + }, nil + }, + ) if !a.So(err, should.BeNil) || !a.So(ret, should.NotBeNil) { - t.FailNow() + t.Fatalf("Failed to create keys: %s", err) } - a.So(ret, should.HaveEmptyDiff, pbOther) + a.So(ret, should.Resemble, pbOther) ret, err = reg.GetByID(ctx, devEUIOther, pbOther.SessionKeyID, ttnpb.SessionKeysFieldPathsTopLevel) a.So(err, should.BeNil) diff --git a/pkg/networkserver/grpc_asns.go b/pkg/networkserver/grpc_asns.go index 59e7c59ac5..f26961e15c 100644 --- a/pkg/networkserver/grpc_asns.go +++ b/pkg/networkserver/grpc_asns.go @@ -117,13 +117,14 @@ func (ns *NetworkServer) DownlinkQueueReplace(ctx context.Context, req *ttnpb.Do return nil, err } - logger = logger.WithFields(log.Fields( - "device_class", dev.MACState.DeviceClass, - "queue_length", len(dev.QueuedApplicationDownlinks), - )) + logger = logger.WithField("queue_length", len(dev.QueuedApplicationDownlinks)) + if dev.MACState != nil { + logger = logger.WithField("device_class", dev.MACState.DeviceClass) + } + logger.Debug("Replaced application downlink queue") if dev.MACState != nil && dev.MACState.DeviceClass != ttnpb.CLASS_A && len(dev.QueuedApplicationDownlinks) > 0 { - logger.WithField("device_class", dev.MACState.DeviceClass).Debug("Adding downlink task...") + logger.Debug("Adding downlink task...") return ttnpb.Empty, ns.downlinkTasks.Add(ctx, req.EndDeviceIdentifiers, time.Now()) } return ttnpb.Empty, nil @@ -154,10 +155,11 @@ func (ns *NetworkServer) DownlinkQueuePush(ctx context.Context, req *ttnpb.Downl return nil, err } - logger = logger.WithFields(log.Fields( - "device_class", dev.MACState.DeviceClass, - "queue_length", len(dev.QueuedApplicationDownlinks), - )) + logger = logger.WithField("queue_length", len(dev.QueuedApplicationDownlinks)) + if dev.MACState != nil { + logger = logger.WithField("device_class", dev.MACState.DeviceClass) + } + logger.Debug("Pushed application downlink to queue") if dev.MACState != nil && dev.MACState.DeviceClass != ttnpb.CLASS_A { logger.Debug("Adding downlink task...") diff --git a/pkg/networkserver/grpc_asns_test.go b/pkg/networkserver/grpc_asns_test.go index 1e925656db..92b8a9039f 100644 --- a/pkg/networkserver/grpc_asns_test.go +++ b/pkg/networkserver/grpc_asns_test.go @@ -17,9 +17,11 @@ package networkserver_test import ( "context" "sync" + "sync/atomic" "testing" "time" + "github.com/mohae/deepcopy" "github.com/smartystreets/assertions" "go.thethings.network/lorawan-stack/pkg/auth/cluster" "go.thethings.network/lorawan-stack/pkg/auth/rights" @@ -114,523 +116,1154 @@ func TestLinkApplication(t *testing.T) { } func TestDownlinkQueueReplace(t *testing.T) { - ids := ttnpb.EndDeviceIdentifiers{ - ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ - ApplicationID: ApplicationID, - }, - DeviceID: DeviceID, - JoinEUI: &JoinEUI, - DevEUI: &DevEUI, - } - ctx := test.Context() - authorizedCtx := rights.NewContext(ctx, rights.Rights{ - ApplicationRights: map[string]*ttnpb.Rights{ - unique.ID(ctx, ids.ApplicationIdentifiers): ttnpb.RightsFrom(ttnpb.RIGHT_APPLICATION_LINK), - }, - }) - authorizedCtx = cluster.NewContext(authorizedCtx, errors.New("Cluster auth disabled")) + start := time.Now() for _, tc := range []struct { Name string - Context context.Context - Device *ttnpb.EndDevice + ContextFunc func(context.Context) context.Context + AddFunc func(context.Context, ttnpb.EndDeviceIdentifiers, time.Time) error + SetByIDFunc func(context.Context, ttnpb.ApplicationIdentifiers, string, []string, func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) Request *ttnpb.DownlinkQueueRequest ErrorAssertion func(*testing.T, error) bool + AddCalls uint64 + SetByIDCalls uint64 }{ { - Name: "wrong auth", - Context: authorizedCtx, - Request: ttnpb.NewPopulatedDownlinkQueueRequest(test.Randy, false), + Name: "No link rights", + ContextFunc: func(ctx context.Context) context.Context { + return rights.NewContext(ctx, rights.Rights{ + ApplicationRights: map[string]*ttnpb.Rights{ + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}): { + Rights: []ttnpb.Right{ + ttnpb.RIGHT_GATEWAY_SETTINGS_BASIC, + }, + }, + }, + }) + }, + AddFunc: func(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, at time.Time) error { + err := errors.New("AddFunc must not be called") + test.MustTFromContext(ctx).Error(err) + return err + }, + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + err := errors.New("SetByIDFunc must not be called") + test.MustTFromContext(ctx).Error(err) + return nil, err + }, + Request: &ttnpb.DownlinkQueueRequest{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + Downlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 0}, + }, + }, ErrorAssertion: func(t *testing.T, err error) bool { - a := assertions.New(t) - return a.So(err, should.BeError) && a.So(errors.IsPermissionDenied(err), should.BeTrue) + if !assertions.New(t).So(errors.IsPermissionDenied(err), should.BeTrue) { + t.Errorf("Received error: %s", err) + return false + } + return true }, }, + { - Name: "no device", - Context: authorizedCtx, + Name: "Non-existing device", + ContextFunc: func(ctx context.Context) context.Context { + return rights.NewContext(ctx, rights.Rights{ + ApplicationRights: map[string]*ttnpb.Rights{ + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}): { + Rights: []ttnpb.Right{ + ttnpb.RIGHT_APPLICATION_LINK, + }, + }, + }, + }) + }, + AddFunc: func(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, at time.Time) error { + err := errors.New("AddFunc must not be called") + test.MustTFromContext(ctx).Error(err) + return err + }, + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + t := test.MustTFromContext(ctx) + a := assertions.New(t) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}) + a.So(devID, should.Equal, "test-dev-id") + a.So(gets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + "mac_state.device_class", + }) + + dev, sets, err := f(nil) + if !a.So(err, should.BeError) { + t.Error("Error was expected") + return nil, errors.New("Error was expected") + } + a.So(sets, should.BeNil) + a.So(dev, should.BeNil) + return nil, err + }, Request: &ttnpb.DownlinkQueueRequest{ EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ - ApplicationIdentifiers: ids.ApplicationIdentifiers, - DeviceID: "non-existent", - JoinEUI: eui64Ptr(types.EUI64{0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}), - DevEUI: eui64Ptr(types.EUI64{0x42, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}), + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + Downlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 0}, }, - Downlinks: []*ttnpb.ApplicationDownlink{ttnpb.NewPopulatedApplicationDownlink(test.Randy, false)}, }, ErrorAssertion: func(t *testing.T, err error) bool { - a := assertions.New(t) - return a.So(err, should.BeError) && a.So(errors.IsNotFound(err), should.BeTrue) + if !assertions.New(t).So(errors.IsNotFound(err), should.BeTrue) { + t.Errorf("Received error: %s", err) + return false + } + return true }, + SetByIDCalls: 1, }, + { - Name: "empty queue/empty request", - Context: authorizedCtx, - Device: &ttnpb.EndDevice{ - EndDeviceIdentifiers: ids, - QueuedApplicationDownlinks: nil, + Name: "Valid request/replace/no MAC state", + ContextFunc: func(ctx context.Context) context.Context { + return rights.NewContext(ctx, rights.Rights{ + ApplicationRights: map[string]*ttnpb.Rights{ + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}): { + Rights: []ttnpb.Right{ + ttnpb.RIGHT_APPLICATION_LINK, + }, + }, + }, + }) + }, + AddFunc: func(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, at time.Time) error { + err := errors.New("AddFunc must not be called") + test.MustTFromContext(ctx).Error(err) + return err + }, + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + a := assertions.New(test.MustTFromContext(ctx)) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}) + a.So(devID, should.Equal, "test-dev-id") + a.So(gets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + "mac_state.device_class", + }) + + dev, sets, err := f(&ttnpb.EndDevice{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + QueuedApplicationDownlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 1}, + {FCnt: 2}, + {FCnt: 3}, + {FCnt: 5}, + }, + }) + if !a.So(err, should.BeNil) { + return nil, err + } + a.So(sets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + }) + a.So(dev, should.Resemble, &ttnpb.EndDevice{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + QueuedApplicationDownlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 0}, + {FCnt: 42}, + }, + }) + return dev, nil }, Request: &ttnpb.DownlinkQueueRequest{ - EndDeviceIdentifiers: ids, - Downlinks: nil, + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + Downlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 0}, + {FCnt: 42}, + }, }, + SetByIDCalls: 1, }, + { - Name: "empty queue/non-empty request", - Context: authorizedCtx, - Device: &ttnpb.EndDevice{ - EndDeviceIdentifiers: ids, - QueuedApplicationDownlinks: nil, + Name: "Valid request/replace/Class A", + ContextFunc: func(ctx context.Context) context.Context { + return rights.NewContext(ctx, rights.Rights{ + ApplicationRights: map[string]*ttnpb.Rights{ + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}): { + Rights: []ttnpb.Right{ + ttnpb.RIGHT_APPLICATION_LINK, + }, + }, + }, + }) + }, + AddFunc: func(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, at time.Time) error { + err := errors.New("AddFunc must not be called") + test.MustTFromContext(ctx).Error(err) + return err + }, + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + a := assertions.New(test.MustTFromContext(ctx)) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}) + a.So(devID, should.Equal, "test-dev-id") + a.So(gets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + "mac_state.device_class", + }) + + dev, sets, err := f(&ttnpb.EndDevice{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + MACState: &ttnpb.MACState{ + DeviceClass: ttnpb.CLASS_A, + }, + QueuedApplicationDownlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 1}, + {FCnt: 2}, + {FCnt: 3}, + {FCnt: 5}, + }, + }) + if !a.So(err, should.BeNil) { + return nil, err + } + a.So(sets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + }) + a.So(dev, should.Resemble, &ttnpb.EndDevice{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + MACState: &ttnpb.MACState{ + DeviceClass: ttnpb.CLASS_A, + }, + QueuedApplicationDownlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 0}, + {FCnt: 42}, + }, + }) + return dev, nil }, Request: &ttnpb.DownlinkQueueRequest{ - EndDeviceIdentifiers: ids, + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, Downlinks: []*ttnpb.ApplicationDownlink{ - Downlinks[0], - Downlinks[2], - Downlinks[1], + {FCnt: 0}, + {FCnt: 42}, }, }, + SetByIDCalls: 1, }, + { - Name: "non-empty queue/empty request", - Context: authorizedCtx, - Device: &ttnpb.EndDevice{ - EndDeviceIdentifiers: ids, - QueuedApplicationDownlinks: []*ttnpb.ApplicationDownlink{ - Downlinks[2], - Downlinks[1], - Downlinks[0], - Downlinks[4], + Name: "Valid request/replace/Class C", + ContextFunc: func(ctx context.Context) context.Context { + return rights.NewContext(ctx, rights.Rights{ + ApplicationRights: map[string]*ttnpb.Rights{ + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}): { + Rights: []ttnpb.Right{ + ttnpb.RIGHT_APPLICATION_LINK, + }, + }, + }, + }) + }, + AddFunc: func(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, at time.Time) error { + a := assertions.New(test.MustTFromContext(ctx)) + a.So(ids, should.Resemble, ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }) + a.So([]time.Time{start, at, time.Now()}, should.BeChronological) + return nil + }, + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + a := assertions.New(test.MustTFromContext(ctx)) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}) + a.So(devID, should.Equal, "test-dev-id") + a.So(gets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + "mac_state.device_class", + }) + + dev, sets, err := f(&ttnpb.EndDevice{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + MACState: &ttnpb.MACState{ + DeviceClass: ttnpb.CLASS_C, + }, + QueuedApplicationDownlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 1}, + {FCnt: 2}, + {FCnt: 3}, + {FCnt: 5}, + }, + }) + if !a.So(err, should.BeNil) { + return nil, err + } + a.So(sets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + }) + a.So(dev, should.Resemble, &ttnpb.EndDevice{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + MACState: &ttnpb.MACState{ + DeviceClass: ttnpb.CLASS_C, + }, + QueuedApplicationDownlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 0}, + {FCnt: 42}, + }, + }) + return dev, nil + }, + Request: &ttnpb.DownlinkQueueRequest{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, }, + Downlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 0}, + {FCnt: 42}, + }, + }, + AddCalls: 1, + SetByIDCalls: 1, + }, + + { + Name: "Valid request/delete/no MAC state", + ContextFunc: func(ctx context.Context) context.Context { + return rights.NewContext(ctx, rights.Rights{ + ApplicationRights: map[string]*ttnpb.Rights{ + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}): { + Rights: []ttnpb.Right{ + ttnpb.RIGHT_APPLICATION_LINK, + }, + }, + }, + }) + }, + AddFunc: func(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, at time.Time) error { + err := errors.New("AddFunc must not be called") + test.MustTFromContext(ctx).Error(err) + return err + }, + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + a := assertions.New(test.MustTFromContext(ctx)) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}) + a.So(devID, should.Equal, "test-dev-id") + a.So(gets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + "mac_state.device_class", + }) + + dev, sets, err := f(&ttnpb.EndDevice{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + QueuedApplicationDownlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 1}, + {FCnt: 2}, + {FCnt: 3}, + {FCnt: 5}, + }, + }) + if !a.So(err, should.BeNil) { + return nil, err + } + a.So(sets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + }) + a.So(dev, should.Resemble, &ttnpb.EndDevice{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + }) + return dev, nil }, Request: &ttnpb.DownlinkQueueRequest{ - EndDeviceIdentifiers: ids, + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, }, + SetByIDCalls: 1, }, + { - Name: "non-empty queue/non-empty request", - Context: authorizedCtx, - Device: &ttnpb.EndDevice{ - EndDeviceIdentifiers: ids, - QueuedApplicationDownlinks: []*ttnpb.ApplicationDownlink{ - Downlinks[2], - Downlinks[1], - Downlinks[0], - Downlinks[4], + Name: "Valid request/delete/Class A", + ContextFunc: func(ctx context.Context) context.Context { + return rights.NewContext(ctx, rights.Rights{ + ApplicationRights: map[string]*ttnpb.Rights{ + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}): { + Rights: []ttnpb.Right{ + ttnpb.RIGHT_APPLICATION_LINK, + }, + }, + }, + }) + }, + AddFunc: func(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, at time.Time) error { + err := errors.New("AddFunc must not be called") + test.MustTFromContext(ctx).Error(err) + return err + }, + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + a := assertions.New(test.MustTFromContext(ctx)) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}) + a.So(devID, should.Equal, "test-dev-id") + a.So(gets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + "mac_state.device_class", + }) + + dev, sets, err := f(&ttnpb.EndDevice{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + MACState: &ttnpb.MACState{ + DeviceClass: ttnpb.CLASS_A, + }, + QueuedApplicationDownlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 1}, + {FCnt: 2}, + {FCnt: 3}, + {FCnt: 5}, + }, + }) + if !a.So(err, should.BeNil) { + return nil, err + } + a.So(sets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + }) + a.So(dev, should.Resemble, &ttnpb.EndDevice{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + MACState: &ttnpb.MACState{ + DeviceClass: ttnpb.CLASS_A, + }, + }) + return dev, nil + }, + Request: &ttnpb.DownlinkQueueRequest{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, }, }, + SetByIDCalls: 1, + }, + + { + Name: "Valid request/delete/Class C", + ContextFunc: func(ctx context.Context) context.Context { + return rights.NewContext(ctx, rights.Rights{ + ApplicationRights: map[string]*ttnpb.Rights{ + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}): { + Rights: []ttnpb.Right{ + ttnpb.RIGHT_APPLICATION_LINK, + }, + }, + }, + }) + }, + AddFunc: func(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, at time.Time) error { + err := errors.New("AddFunc must not be called") + test.MustTFromContext(ctx).Error(err) + return err + }, + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + a := assertions.New(test.MustTFromContext(ctx)) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}) + a.So(devID, should.Equal, "test-dev-id") + a.So(gets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + "mac_state.device_class", + }) + + dev, sets, err := f(&ttnpb.EndDevice{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + MACState: &ttnpb.MACState{ + DeviceClass: ttnpb.CLASS_C, + }, + QueuedApplicationDownlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 1}, + {FCnt: 2}, + {FCnt: 3}, + {FCnt: 5}, + }, + }) + if !a.So(err, should.BeNil) { + return nil, err + } + a.So(sets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + }) + a.So(dev, should.Resemble, &ttnpb.EndDevice{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + MACState: &ttnpb.MACState{ + DeviceClass: ttnpb.CLASS_C, + }, + }) + return dev, nil + }, Request: &ttnpb.DownlinkQueueRequest{ - EndDeviceIdentifiers: ids, - Downlinks: []*ttnpb.ApplicationDownlink{ - Downlinks[0], - Downlinks[2], - Downlinks[1], + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, }, }, + SetByIDCalls: 1, }, } { t.Run(tc.Name, func(t *testing.T) { a := assertions.New(t) - redisClient, flush := test.NewRedis(t, "networkserver_test") - defer flush() - defer redisClient.Close() - devReg := &redis.DeviceRegistry{Redis: redisClient} - - type addReq struct { - ctx context.Context - devID ttnpb.EndDeviceIdentifiers - t time.Time - } - addReqCh := make(chan addReq, 1) + var addCalls, setByIDCalls uint64 ns := test.Must(New( component.MustNew(test.GetLogger(t), &component.Config{}), &Config{ - Devices: devReg, - DeduplicationWindow: 42, - CooldownWindow: 42, + Devices: &MockDeviceRegistry{ + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + atomic.AddUint64(&setByIDCalls, 1) + return tc.SetByIDFunc(ctx, appID, devID, gets, f) + }, + }, DownlinkTasks: &MockDownlinkTaskQueue{ - AddFunc: func(ctx context.Context, devID ttnpb.EndDeviceIdentifiers, t time.Time) error { - addReqCh <- addReq{ - ctx: ctx, - devID: devID, - t: t, - } - return nil + AddFunc: func(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, at time.Time) error { + atomic.AddUint64(&addCalls, 1) + return tc.AddFunc(ctx, ids, at) }, }, + DeduplicationWindow: 42, + CooldownWindow: 42, })).(*NetworkServer) + + ns.AddContextFiller(tc.ContextFunc) + ns.AddContextFiller(func(ctx context.Context) context.Context { + ctx, cancel := context.WithDeadline(ctx, time.Now().Add(Timeout)) + _ = cancel + return ctx + }) + ns.AddContextFiller(func(ctx context.Context) context.Context { + return test.ContextWithT(ctx, t) + }) test.Must(nil, ns.Start()) defer ns.Close() - start := time.Now() + req := deepcopy.Copy(tc.Request).(*ttnpb.DownlinkQueueRequest) - pb := CopyEndDevice(tc.Device) - if tc.Device != nil { - ret, err := CreateDevice(tc.Context, devReg, CopyEndDevice(tc.Device)) - if !a.So(err, should.BeNil) { - t.FailNow() - } - a.So(ret.CreatedAt, should.HappenAfter, start) - a.So(ret.UpdatedAt, should.HappenAfter, start) - a.So(ret.UpdatedAt, should.Equal, ret.CreatedAt) - pb.CreatedAt = ret.CreatedAt - pb.UpdatedAt = ret.UpdatedAt - a.So(ret, should.Resemble, pb) + res, err := ttnpb.NewAsNsClient(ns.LoopbackConn()).DownlinkQueueReplace(test.Context(), req) + if tc.ErrorAssertion != nil && a.So(tc.ErrorAssertion(t, err), should.BeTrue) { + a.So(res, should.BeNil) + } else if a.So(err, should.BeNil) { + a.So(res, should.Resemble, ttnpb.Empty) } - - _, err := ns.DownlinkQueueReplace(tc.Context, tc.Request) - if tc.ErrorAssertion != nil { - a.So(tc.ErrorAssertion(t, err), should.BeTrue) - return - } - a.So(err, should.BeNil) - - if pb.MACState != nil && pb.MACState.DeviceClass == ttnpb.CLASS_C { - select { - case req := <-addReqCh: - a.So(req.ctx, should.HaveParentContext, tc.Context) - a.So(req.devID, should.Resemble, ids) - a.So([]time.Time{start, req.t, time.Now()}, should.BeChronological) - - case <-time.After(Timeout): - t.Fatal("Timeout waiting for Add to be called") - } - } else { - a.So(addReqCh, should.BeEmpty) - } - - pb.QueuedApplicationDownlinks = tc.Request.Downlinks - - ret, err := devReg.GetByID(tc.Context, pb.EndDeviceIdentifiers.ApplicationIdentifiers, pb.EndDeviceIdentifiers.DeviceID, ttnpb.EndDeviceFieldPathsTopLevel) - if !a.So(err, should.BeNil) { - t.FailNow() - } - a.So(ret.UpdatedAt, should.HappenAfter, pb.UpdatedAt) - pb.UpdatedAt = ret.UpdatedAt - a.So(ret, should.HaveEmptyDiff, pb) + a.So(req, should.Resemble, tc.Request) + a.So(setByIDCalls, should.Equal, tc.SetByIDCalls) + a.So(addCalls, should.Equal, tc.AddCalls) }) } } func TestDownlinkQueuePush(t *testing.T) { - ids := ttnpb.EndDeviceIdentifiers{ - ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ - ApplicationID: ApplicationID, - }, - DeviceID: DeviceID, - JoinEUI: &JoinEUI, - DevEUI: &DevEUI, - } - ctx := test.Context() - authorizedCtx := rights.NewContext(ctx, rights.Rights{ - ApplicationRights: map[string]*ttnpb.Rights{ - unique.ID(ctx, ids.ApplicationIdentifiers): ttnpb.RightsFrom(ttnpb.RIGHT_APPLICATION_LINK), - }, - }) - authorizedCtx = cluster.NewContext(authorizedCtx, errors.New("Cluster auth disabled")) + start := time.Now() for _, tc := range []struct { Name string - Context context.Context - Device *ttnpb.EndDevice + ContextFunc func(context.Context) context.Context + AddFunc func(context.Context, ttnpb.EndDeviceIdentifiers, time.Time) error + SetByIDFunc func(context.Context, ttnpb.ApplicationIdentifiers, string, []string, func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) Request *ttnpb.DownlinkQueueRequest ErrorAssertion func(*testing.T, error) bool + AddCalls uint64 + SetByIDCalls uint64 }{ { - Name: "wrong auth", - Context: authorizedCtx, - Request: ttnpb.NewPopulatedDownlinkQueueRequest(test.Randy, false), - ErrorAssertion: func(t *testing.T, err error) bool { - a := assertions.New(t) - return a.So(err, should.BeError) && a.So(errors.IsPermissionDenied(err), should.BeTrue) + Name: "No link rights", + ContextFunc: func(ctx context.Context) context.Context { + return rights.NewContext(ctx, rights.Rights{ + ApplicationRights: map[string]*ttnpb.Rights{ + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}): { + Rights: []ttnpb.Right{ + ttnpb.RIGHT_GATEWAY_SETTINGS_BASIC, + }, + }, + }, + }) + }, + AddFunc: func(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, at time.Time) error { + err := errors.New("AddFunc must not be called") + test.MustTFromContext(ctx).Error(err) + return err + }, + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + err := errors.New("SetByIDFunc must not be called") + test.MustTFromContext(ctx).Error(err) + return nil, err }, - }, - { - Name: "no device", - Context: authorizedCtx, Request: &ttnpb.DownlinkQueueRequest{ EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ - ApplicationIdentifiers: ids.ApplicationIdentifiers, - DeviceID: "non-existent", - JoinEUI: eui64Ptr(types.EUI64{0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}), - DevEUI: eui64Ptr(types.EUI64{0x42, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}), + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + Downlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 0}, }, - Downlinks: []*ttnpb.ApplicationDownlink{ttnpb.NewPopulatedApplicationDownlink(test.Randy, false)}, }, ErrorAssertion: func(t *testing.T, err error) bool { - a := assertions.New(t) - return a.So(err, should.BeError) && a.So(errors.IsNotFound(err), should.BeTrue) + if !assertions.New(t).So(errors.IsPermissionDenied(err), should.BeTrue) { + t.Errorf("Received error: %s", err) + return false + } + return true }, }, + { - Name: "empty queue/empty request", - Context: authorizedCtx, - Device: &ttnpb.EndDevice{ - EndDeviceIdentifiers: ids, - QueuedApplicationDownlinks: nil, + Name: "Non-existing device", + ContextFunc: func(ctx context.Context) context.Context { + return rights.NewContext(ctx, rights.Rights{ + ApplicationRights: map[string]*ttnpb.Rights{ + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}): { + Rights: []ttnpb.Right{ + ttnpb.RIGHT_APPLICATION_LINK, + }, + }, + }, + }) + }, + AddFunc: func(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, at time.Time) error { + err := errors.New("AddFunc must not be called") + test.MustTFromContext(ctx).Error(err) + return err + }, + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + t := test.MustTFromContext(ctx) + a := assertions.New(t) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}) + a.So(devID, should.Equal, "test-dev-id") + a.So(gets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + "mac_state.device_class", + }) + + dev, sets, err := f(nil) + if !a.So(err, should.BeError) { + t.Error("Error was expected") + return nil, errors.New("Error was expected") + } + a.So(sets, should.BeNil) + a.So(dev, should.BeNil) + return nil, err }, Request: &ttnpb.DownlinkQueueRequest{ - EndDeviceIdentifiers: ids, - Downlinks: nil, + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + Downlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 0}, + }, }, + ErrorAssertion: func(t *testing.T, err error) bool { + if !assertions.New(t).So(errors.IsNotFound(err), should.BeTrue) { + t.Errorf("Received error: %s", err) + return false + } + return true + }, + SetByIDCalls: 1, }, + { - Name: "empty queue/non-empty request", - Context: authorizedCtx, - Device: &ttnpb.EndDevice{ - EndDeviceIdentifiers: ids, - QueuedApplicationDownlinks: nil, + Name: "Valid request/push/no MAC state", + ContextFunc: func(ctx context.Context) context.Context { + return rights.NewContext(ctx, rights.Rights{ + ApplicationRights: map[string]*ttnpb.Rights{ + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}): { + Rights: []ttnpb.Right{ + ttnpb.RIGHT_APPLICATION_LINK, + }, + }, + }, + }) + }, + AddFunc: func(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, at time.Time) error { + err := errors.New("AddFunc must not be called") + test.MustTFromContext(ctx).Error(err) + return err + }, + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + a := assertions.New(test.MustTFromContext(ctx)) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}) + a.So(devID, should.Equal, "test-dev-id") + a.So(gets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + "mac_state.device_class", + }) + + dev, sets, err := f(&ttnpb.EndDevice{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + QueuedApplicationDownlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 1}, + {FCnt: 2}, + {FCnt: 3}, + {FCnt: 5}, + }, + }) + if !a.So(err, should.BeNil) { + return nil, err + } + a.So(sets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + }) + a.So(dev, should.Resemble, &ttnpb.EndDevice{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + QueuedApplicationDownlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 1}, + {FCnt: 2}, + {FCnt: 3}, + {FCnt: 5}, + {FCnt: 0}, + {FCnt: 42}, + }, + }) + return dev, nil }, Request: &ttnpb.DownlinkQueueRequest{ - EndDeviceIdentifiers: ids, + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, Downlinks: []*ttnpb.ApplicationDownlink{ - Downlinks[0], - Downlinks[2], - Downlinks[1], + {FCnt: 0}, + {FCnt: 42}, }, }, + SetByIDCalls: 1, }, + { - Name: "non-empty queue/empty request", - Context: authorizedCtx, - Device: &ttnpb.EndDevice{ - EndDeviceIdentifiers: ids, - QueuedApplicationDownlinks: []*ttnpb.ApplicationDownlink{ - Downlinks[2], - Downlinks[1], - Downlinks[0], - Downlinks[4], - }, + Name: "Valid request/push/Class A", + ContextFunc: func(ctx context.Context) context.Context { + return rights.NewContext(ctx, rights.Rights{ + ApplicationRights: map[string]*ttnpb.Rights{ + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}): { + Rights: []ttnpb.Right{ + ttnpb.RIGHT_APPLICATION_LINK, + }, + }, + }, + }) + }, + AddFunc: func(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, at time.Time) error { + err := errors.New("AddFunc must not be called") + test.MustTFromContext(ctx).Error(err) + return err + }, + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + a := assertions.New(test.MustTFromContext(ctx)) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}) + a.So(devID, should.Equal, "test-dev-id") + a.So(gets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + "mac_state.device_class", + }) + + dev, sets, err := f(&ttnpb.EndDevice{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + MACState: &ttnpb.MACState{ + DeviceClass: ttnpb.CLASS_A, + }, + QueuedApplicationDownlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 1}, + {FCnt: 2}, + {FCnt: 3}, + {FCnt: 5}, + }, + }) + if !a.So(err, should.BeNil) { + return nil, err + } + a.So(sets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + }) + a.So(dev, should.Resemble, &ttnpb.EndDevice{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + MACState: &ttnpb.MACState{ + DeviceClass: ttnpb.CLASS_A, + }, + QueuedApplicationDownlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 1}, + {FCnt: 2}, + {FCnt: 3}, + {FCnt: 5}, + {FCnt: 0}, + {FCnt: 42}, + }, + }) + return dev, nil }, Request: &ttnpb.DownlinkQueueRequest{ - EndDeviceIdentifiers: ids, + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + Downlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 0}, + {FCnt: 42}, + }, }, + SetByIDCalls: 1, }, + { - Name: "non-empty queue/non-empty request", - Context: authorizedCtx, - Device: &ttnpb.EndDevice{ - EndDeviceIdentifiers: ids, - QueuedApplicationDownlinks: []*ttnpb.ApplicationDownlink{ - Downlinks[2], - Downlinks[1], - Downlinks[0], - Downlinks[4], - }, + Name: "Valid request/push/Class C", + ContextFunc: func(ctx context.Context) context.Context { + return rights.NewContext(ctx, rights.Rights{ + ApplicationRights: map[string]*ttnpb.Rights{ + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}): { + Rights: []ttnpb.Right{ + ttnpb.RIGHT_APPLICATION_LINK, + }, + }, + }, + }) + }, + AddFunc: func(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, at time.Time) error { + a := assertions.New(test.MustTFromContext(ctx)) + a.So(ids, should.Resemble, ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }) + a.So([]time.Time{start, at, time.Now()}, should.BeChronological) + return nil + }, + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + a := assertions.New(test.MustTFromContext(ctx)) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}) + a.So(devID, should.Equal, "test-dev-id") + a.So(gets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + "mac_state.device_class", + }) + + dev, sets, err := f(&ttnpb.EndDevice{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + MACState: &ttnpb.MACState{ + DeviceClass: ttnpb.CLASS_C, + }, + QueuedApplicationDownlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 1}, + {FCnt: 2}, + {FCnt: 3}, + {FCnt: 5}, + }, + }) + if !a.So(err, should.BeNil) { + return nil, err + } + a.So(sets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + }) + a.So(dev, should.Resemble, &ttnpb.EndDevice{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + MACState: &ttnpb.MACState{ + DeviceClass: ttnpb.CLASS_C, + }, + QueuedApplicationDownlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 1}, + {FCnt: 2}, + {FCnt: 3}, + {FCnt: 5}, + {FCnt: 0}, + {FCnt: 42}, + }, + }) + return dev, nil }, Request: &ttnpb.DownlinkQueueRequest{ - EndDeviceIdentifiers: ids, + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, Downlinks: []*ttnpb.ApplicationDownlink{ - Downlinks[0], - Downlinks[2], - Downlinks[1], + {FCnt: 0}, + {FCnt: 42}, }, }, + AddCalls: 1, + SetByIDCalls: 1, }, } { t.Run(tc.Name, func(t *testing.T) { a := assertions.New(t) - redisClient, flush := test.NewRedis(t, "networkserver_test") - defer flush() - defer redisClient.Close() - devReg := &redis.DeviceRegistry{Redis: redisClient} - - type addReq struct { - ctx context.Context - devID ttnpb.EndDeviceIdentifiers - t time.Time - } - addReqCh := make(chan addReq, 1) + var addCalls, setByIDCalls uint64 ns := test.Must(New( component.MustNew(test.GetLogger(t), &component.Config{}), &Config{ - Devices: devReg, - DeduplicationWindow: 42, - CooldownWindow: 42, + Devices: &MockDeviceRegistry{ + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + atomic.AddUint64(&setByIDCalls, 1) + return tc.SetByIDFunc(ctx, appID, devID, gets, f) + }, + }, DownlinkTasks: &MockDownlinkTaskQueue{ - AddFunc: func(ctx context.Context, devID ttnpb.EndDeviceIdentifiers, t time.Time) error { - addReqCh <- addReq{ - ctx: ctx, - devID: devID, - t: t, - } - return nil + AddFunc: func(ctx context.Context, ids ttnpb.EndDeviceIdentifiers, at time.Time) error { + atomic.AddUint64(&addCalls, 1) + return tc.AddFunc(ctx, ids, at) }, }, + DeduplicationWindow: 42, + CooldownWindow: 42, })).(*NetworkServer) + + ns.AddContextFiller(tc.ContextFunc) + ns.AddContextFiller(func(ctx context.Context) context.Context { + ctx, cancel := context.WithDeadline(ctx, time.Now().Add(Timeout)) + _ = cancel + return ctx + }) + ns.AddContextFiller(func(ctx context.Context) context.Context { + return test.ContextWithT(ctx, t) + }) test.Must(nil, ns.Start()) defer ns.Close() - start := time.Now() + req := deepcopy.Copy(tc.Request).(*ttnpb.DownlinkQueueRequest) - pb := CopyEndDevice(tc.Device) - if tc.Device != nil { - ret, err := CreateDevice(tc.Context, devReg, CopyEndDevice(tc.Device)) - if !a.So(err, should.BeNil) { - t.FailNow() - } - a.So(ret.CreatedAt, should.HappenAfter, start) - a.So(ret.UpdatedAt, should.HappenAfter, start) - a.So(ret.UpdatedAt, should.Equal, ret.CreatedAt) - pb.CreatedAt = ret.CreatedAt - pb.UpdatedAt = ret.UpdatedAt - a.So(ret, should.Resemble, pb) - } - - _, err := ns.DownlinkQueuePush(tc.Context, tc.Request) - if tc.ErrorAssertion != nil { - a.So(tc.ErrorAssertion(t, err), should.BeTrue) - return - } - a.So(err, should.BeNil) - - if pb.MACState != nil && pb.MACState.DeviceClass == ttnpb.CLASS_C { - select { - case req := <-addReqCh: - a.So(req.ctx, should.HaveParentContext, tc.Context) - a.So(req.devID, should.Resemble, ids) - a.So([]time.Time{start, req.t, time.Now()}, should.BeChronological) - - case <-time.After(Timeout): - t.Fatal("Timeout waiting for Add to be called") - } - } else { - a.So(addReqCh, should.BeEmpty) + res, err := ttnpb.NewAsNsClient(ns.LoopbackConn()).DownlinkQueuePush(test.Context(), req) + if tc.ErrorAssertion != nil && a.So(tc.ErrorAssertion(t, err), should.BeTrue) { + a.So(res, should.BeNil) + } else if a.So(err, should.BeNil) { + a.So(res, should.Resemble, ttnpb.Empty) } - - pb.QueuedApplicationDownlinks = append(pb.QueuedApplicationDownlinks, tc.Request.Downlinks...) - - ret, err := devReg.GetByID(tc.Context, pb.EndDeviceIdentifiers.ApplicationIdentifiers, pb.EndDeviceIdentifiers.DeviceID, ttnpb.EndDeviceFieldPathsTopLevel) - if !a.So(err, should.BeNil) { - t.FailNow() - } - a.So(ret.UpdatedAt, should.HappenAfter, pb.UpdatedAt) - pb.UpdatedAt = ret.UpdatedAt - a.So(ret, should.HaveEmptyDiff, pb) + a.So(req, should.Resemble, tc.Request) + a.So(setByIDCalls, should.Equal, tc.SetByIDCalls) + a.So(addCalls, should.Equal, tc.AddCalls) }) } } func TestDownlinkQueueList(t *testing.T) { - ids := ttnpb.EndDeviceIdentifiers{ - ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ - ApplicationID: ApplicationID, - }, - DeviceID: DeviceID, - JoinEUI: &JoinEUI, - DevEUI: &DevEUI, - } - ctx := test.Context() - authorizedCtx := rights.NewContext(ctx, rights.Rights{ - ApplicationRights: map[string]*ttnpb.Rights{ - unique.ID(ctx, ids.ApplicationIdentifiers): ttnpb.RightsFrom(ttnpb.RIGHT_APPLICATION_LINK), - }, - }) - authorizedCtx = cluster.NewContext(authorizedCtx, errors.New("Cluster auth disabled")) - for _, tc := range []struct { Name string - Context context.Context - Device *ttnpb.EndDevice + ContextFunc func(context.Context) context.Context + GetByIDFunc func(context.Context, ttnpb.ApplicationIdentifiers, string, []string) (*ttnpb.EndDevice, error) Request *ttnpb.EndDeviceIdentifiers + Downlinks *ttnpb.ApplicationDownlinks ErrorAssertion func(*testing.T, error) bool + GetByIDCalls uint64 }{ { - Name: "wrong auth", - Context: authorizedCtx, - Request: ttnpb.NewPopulatedEndDeviceIdentifiers(test.Randy, false), - ErrorAssertion: func(t *testing.T, err error) bool { - a := assertions.New(t) - return a.So(err, should.BeError) && a.So(errors.IsPermissionDenied(err), should.BeTrue) + Name: "No link rights", + ContextFunc: func(ctx context.Context) context.Context { + return rights.NewContext(ctx, rights.Rights{ + ApplicationRights: map[string]*ttnpb.Rights{ + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}): { + Rights: []ttnpb.Right{ + ttnpb.RIGHT_GATEWAY_SETTINGS_BASIC, + }, + }, + }, + }) + }, + GetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string) (*ttnpb.EndDevice, error) { + err := errors.New("GetByIDFunc must not be called") + test.MustTFromContext(ctx).Error(err) + return nil, err }, - }, - { - Name: "no device", - Context: authorizedCtx, Request: &ttnpb.EndDeviceIdentifiers{ - ApplicationIdentifiers: ids.ApplicationIdentifiers, - DeviceID: "non-existent", - JoinEUI: eui64Ptr(types.EUI64{0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}), - DevEUI: eui64Ptr(types.EUI64{0x42, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}), + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, }, ErrorAssertion: func(t *testing.T, err error) bool { - a := assertions.New(t) - return a.So(err, should.BeError) && a.So(errors.IsNotFound(err), should.BeTrue) + if !assertions.New(t).So(errors.IsPermissionDenied(err), should.BeTrue) { + t.Errorf("Received error: %s", err) + return false + } + return true }, }, + { - Name: "empty queue", - Context: authorizedCtx, - Device: &ttnpb.EndDevice{ - EndDeviceIdentifiers: ids, - QueuedApplicationDownlinks: nil, + Name: "Valid request/empty queue", + ContextFunc: func(ctx context.Context) context.Context { + return rights.NewContext(ctx, rights.Rights{ + ApplicationRights: map[string]*ttnpb.Rights{ + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}): { + Rights: []ttnpb.Right{ + ttnpb.RIGHT_APPLICATION_LINK, + }, + }, + }, + }) }, - Request: &ids, + GetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string) (*ttnpb.EndDevice, error) { + t := test.MustTFromContext(ctx) + a := assertions.New(t) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}) + a.So(devID, should.Equal, "test-dev-id") + a.So(gets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + }) + return &ttnpb.EndDevice{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + }, nil + }, + Request: &ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + Downlinks: &ttnpb.ApplicationDownlinks{}, + GetByIDCalls: 1, }, + { - Name: "non-empty queue", - Context: authorizedCtx, - Device: &ttnpb.EndDevice{ - EndDeviceIdentifiers: ids, - QueuedApplicationDownlinks: []*ttnpb.ApplicationDownlink{ - Downlinks[2], - Downlinks[1], - Downlinks[0], - Downlinks[4], + Name: "Valid request/non-empty queue", + ContextFunc: func(ctx context.Context) context.Context { + return rights.NewContext(ctx, rights.Rights{ + ApplicationRights: map[string]*ttnpb.Rights{ + unique.ID(ctx, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}): { + Rights: []ttnpb.Right{ + ttnpb.RIGHT_APPLICATION_LINK, + }, + }, + }, + }) + }, + GetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string) (*ttnpb.EndDevice, error) { + t := test.MustTFromContext(ctx) + a := assertions.New(t) + a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}) + a.So(devID, should.Equal, "test-dev-id") + a.So(gets, should.HaveSameElementsDeep, []string{ + "queued_application_downlinks", + }) + return &ttnpb.EndDevice{ + EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + QueuedApplicationDownlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 0}, + {FCnt: 42}, + }, + }, nil + }, + Request: &ttnpb.EndDeviceIdentifiers{ + DeviceID: "test-dev-id", + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, + }, + Downlinks: &ttnpb.ApplicationDownlinks{ + Downlinks: []*ttnpb.ApplicationDownlink{ + {FCnt: 0}, + {FCnt: 42}, }, }, - Request: &ids, + GetByIDCalls: 1, }, } { t.Run(tc.Name, func(t *testing.T) { a := assertions.New(t) - redisClient, flush := test.NewRedis(t, "networkserver_test") - defer flush() - defer redisClient.Close() - devReg := &redis.DeviceRegistry{Redis: redisClient} + var getByIDCalls uint64 ns := test.Must(New( component.MustNew(test.GetLogger(t), &component.Config{}), &Config{ - Devices: devReg, + Devices: &MockDeviceRegistry{ + GetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string) (*ttnpb.EndDevice, error) { + atomic.AddUint64(&getByIDCalls, 1) + return tc.GetByIDFunc(ctx, appID, devID, gets) + }, + }, + DownlinkTasks: &MockDownlinkTaskQueue{}, DeduplicationWindow: 42, CooldownWindow: 42, - DownlinkTasks: &MockDownlinkTaskQueue{}, })).(*NetworkServer) + + ns.AddContextFiller(tc.ContextFunc) + ns.AddContextFiller(func(ctx context.Context) context.Context { + ctx, cancel := context.WithDeadline(ctx, time.Now().Add(Timeout)) + _ = cancel + return ctx + }) + ns.AddContextFiller(func(ctx context.Context) context.Context { + return test.ContextWithT(ctx, t) + }) test.Must(nil, ns.Start()) defer ns.Close() - pb := CopyEndDevice(tc.Device) - if tc.Device != nil { - start := time.Now() - ret, err := CreateDevice(tc.Context, devReg, CopyEndDevice(tc.Device)) - if !a.So(err, should.BeNil) { - t.FailNow() - } - if !a.So(err, should.BeNil) { - t.FailNow() - } - a.So(ret.CreatedAt, should.HappenAfter, start) - a.So(ret.UpdatedAt, should.HappenAfter, start) - a.So(ret.UpdatedAt, should.Equal, ret.CreatedAt) - pb.CreatedAt = ret.CreatedAt - pb.UpdatedAt = ret.UpdatedAt - a.So(ret, should.Resemble, pb) - } + req := deepcopy.Copy(tc.Request).(*ttnpb.EndDeviceIdentifiers) - resp, err := ns.DownlinkQueueList(tc.Context, tc.Request) - if tc.ErrorAssertion != nil { - a.So(tc.ErrorAssertion(t, err), should.BeTrue) - a.So(resp, should.BeNil) - return + res, err := ttnpb.NewAsNsClient(ns.LoopbackConn()).DownlinkQueueList(test.Context(), req) + if tc.ErrorAssertion != nil && a.So(tc.ErrorAssertion(t, err), should.BeTrue) { + a.So(res, should.BeNil) + } else if a.So(err, should.BeNil) { + a.So(res, should.Resemble, tc.Downlinks) } - a.So(err, should.BeNil) - a.So(resp, should.HaveEmptyDiff, &ttnpb.ApplicationDownlinks{Downlinks: pb.QueuedApplicationDownlinks}) + a.So(req, should.Resemble, tc.Request) + a.So(getByIDCalls, should.Equal, tc.GetByIDCalls) }) } } diff --git a/pkg/networkserver/grpc_deviceregistry.go b/pkg/networkserver/grpc_deviceregistry.go index 1cf5250806..f4df1bf547 100644 --- a/pkg/networkserver/grpc_deviceregistry.go +++ b/pkg/networkserver/grpc_deviceregistry.go @@ -100,7 +100,7 @@ func (ns *NetworkServer) Set(ctx context.Context, req *ttnpb.SetEndDeviceRequest if ttnpb.HasAnyField(req.FieldMask.Paths, "mac_settings.ping_slot_date_rate_index") && req.EndDevice.GetMACSettings().GetPingSlotDataRateIndex() == nil { return nil, nil, errInvalidFieldValue.WithAttributes("field", "mac_settings.ping_slot_date_rate_index") } - if ttnpb.HasAnyField(req.FieldMask.Paths, "mac_settings.ping_slot_frequency") && req.EndDevice.GetMACSettings().GetPingSlotFrequency() == 0 { + if ttnpb.HasAnyField(req.FieldMask.Paths, "mac_settings.ping_slot_frequency") && req.EndDevice.GetMACSettings().GetPingSlotFrequency() == nil { return nil, nil, errInvalidFieldValue.WithAttributes("field", "mac_settings.ping_slot_frequency") } @@ -117,7 +117,7 @@ func (ns *NetworkServer) Set(ctx context.Context, req *ttnpb.SetEndDeviceRequest if ttnpb.HasAnyField(req.FieldMask.Paths, "mac_settings.rx2_data_rate_index") && req.EndDevice.GetMACSettings().GetRx2DataRateIndex() == nil { return nil, nil, errInvalidFieldValue.WithAttributes("field", "mac_settings.rx2_data_rate_index") } - if ttnpb.HasAnyField(req.FieldMask.Paths, "mac_settings.rx2_frequency") && req.EndDevice.GetMACSettings().GetRx2Frequency() == 0 { + if ttnpb.HasAnyField(req.FieldMask.Paths, "mac_settings.rx2_frequency") && req.EndDevice.GetMACSettings().GetRx2Frequency() == nil { return nil, nil, errInvalidFieldValue.WithAttributes("field", "mac_settings.rx2_frequency") } if ttnpb.HasAnyField(req.FieldMask.Paths, "mac_settings.factory_preset_frequencies") && len(req.EndDevice.GetMACSettings().GetFactoryPresetFrequencies()) == 0 { @@ -156,7 +156,7 @@ func (ns *NetworkServer) Set(ctx context.Context, req *ttnpb.SetEndDeviceRequest if ttnpb.HasAnyField(req.FieldMask.Paths, "mac_settings.desired_rx2_data_rate_index") && req.EndDevice.GetMACSettings().GetDesiredRx2DataRateIndex() == nil { return nil, nil, errInvalidFieldValue.WithAttributes("field", "mac_settings.desired_rx2_data_rate_index") } - if ttnpb.HasAnyField(req.FieldMask.Paths, "mac_settings.desired_rx2_frequency") && req.EndDevice.GetMACSettings().GetDesiredRx2Frequency() == 0 { + if ttnpb.HasAnyField(req.FieldMask.Paths, "mac_settings.desired_rx2_frequency") && req.EndDevice.GetMACSettings().GetDesiredRx2Frequency() == nil { return nil, nil, errInvalidFieldValue.WithAttributes("field", "mac_settings.desired_rx2_frequency") } diff --git a/pkg/networkserver/grpc_deviceregistry_test.go b/pkg/networkserver/grpc_deviceregistry_test.go index cc0cb3eea3..cc8024c16d 100644 --- a/pkg/networkserver/grpc_deviceregistry_test.go +++ b/pkg/networkserver/grpc_deviceregistry_test.go @@ -17,6 +17,7 @@ package networkserver_test import ( "context" "fmt" + "sync/atomic" "testing" "time" @@ -36,16 +37,14 @@ import ( ) func TestDeviceRegistryGet(t *testing.T) { - type getByIDCallKey struct{} - for _, tc := range []struct { - Name string - ContextFunc func(context.Context) context.Context - GetByIDFunc func(context.Context, ttnpb.ApplicationIdentifiers, string, []string) (*ttnpb.EndDevice, error) - Request *ttnpb.GetEndDeviceRequest - Device *ttnpb.EndDevice - ErrorAssertion func(*testing.T, error) bool - ContextAssertion func(context.Context) bool + Name string + ContextFunc func(context.Context) context.Context + GetByIDFunc func(context.Context, ttnpb.ApplicationIdentifiers, string, []string) (*ttnpb.EndDevice, error) + Request *ttnpb.GetEndDeviceRequest + Device *ttnpb.EndDevice + ErrorAssertion func(*testing.T, error) bool + GetByIDCalls uint64 }{ { Name: "No device read rights", @@ -60,7 +59,7 @@ func TestDeviceRegistryGet(t *testing.T) { }, }) }, - GetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string) (*ttnpb.EndDevice, error) { + GetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string) (*ttnpb.EndDevice, error) { err := errors.New("GetByIDFunc must not be called") test.MustTFromContext(ctx).Error(err) return nil, err @@ -83,10 +82,6 @@ func TestDeviceRegistryGet(t *testing.T) { } return true }, - ContextAssertion: func(ctx context.Context) bool { - a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, getByIDCallKey{}), should.Equal, 0) - }, }, { @@ -102,12 +97,11 @@ func TestDeviceRegistryGet(t *testing.T) { }, }) }, - GetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string) (*ttnpb.EndDevice, error) { - defer test.MustIncrementContextCounter(ctx, getByIDCallKey{}, 1) + GetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string) (*ttnpb.EndDevice, error) { a := assertions.New(test.MustTFromContext(ctx)) a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}) a.So(devID, should.Equal, "test-dev-id") - a.So(paths, should.HaveSameElementsDeep, []string{ + a.So(gets, should.HaveSameElementsDeep, []string{ "frequency_plan_id", }) return &ttnpb.EndDevice{ @@ -134,30 +128,29 @@ func TestDeviceRegistryGet(t *testing.T) { ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, }, }, - ContextAssertion: func(ctx context.Context) bool { - a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, getByIDCallKey{}), should.Equal, 1) - }, + GetByIDCalls: 1, }, } { t.Run(tc.Name, func(t *testing.T) { a := assertions.New(t) + var getByIDCalls uint64 + ns := test.Must(New( component.MustNew(test.GetLogger(t), &component.Config{}), &Config{ Devices: &MockDeviceRegistry{ - GetByIDFunc: tc.GetByIDFunc, + GetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string) (*ttnpb.EndDevice, error) { + atomic.AddUint64(&getByIDCalls, 1) + return tc.GetByIDFunc(ctx, appID, devID, gets) + }, }, + DownlinkTasks: &MockDownlinkTaskQueue{}, DeduplicationWindow: 42, CooldownWindow: 42, - DownlinkTasks: &MockDownlinkTaskQueue{}, })).(*NetworkServer) ns.AddContextFiller(tc.ContextFunc) - ns.AddContextFiller(func(ctx context.Context) context.Context { - return test.ContextWithCounter(ctx, getByIDCallKey{}) - }) ns.AddContextFiller(func(ctx context.Context) context.Context { ctx, cancel := context.WithDeadline(ctx, time.Now().Add(Timeout)) _ = cancel @@ -178,21 +171,20 @@ func TestDeviceRegistryGet(t *testing.T) { a.So(dev, should.Resemble, tc.Device) } a.So(req, should.Resemble, tc.Request) + a.So(getByIDCalls, should.Equal, tc.GetByIDCalls) }) } } func TestDeviceRegistrySet(t *testing.T) { - type setByIDCallKey struct{} - for _, tc := range []struct { - Name string - ContextFunc func(context.Context) context.Context - SetByIDFunc func(context.Context, ttnpb.ApplicationIdentifiers, string, []string, func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) - Request *ttnpb.SetEndDeviceRequest - Device *ttnpb.EndDevice - ErrorAssertion func(*testing.T, error) bool - ContextAssertion func(context.Context) bool + Name string + ContextFunc func(context.Context) context.Context + SetByIDFunc func(context.Context, ttnpb.ApplicationIdentifiers, string, []string, func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) + Request *ttnpb.SetEndDeviceRequest + Device *ttnpb.EndDevice + ErrorAssertion func(*testing.T, error) bool + SetByIDCalls uint64 }{ { Name: "No device write rights", @@ -241,10 +233,6 @@ func TestDeviceRegistrySet(t *testing.T) { } return true }, - ContextAssertion: func(ctx context.Context) bool { - a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByIDCallKey{}), should.Equal, 0) - }, }, { @@ -261,7 +249,6 @@ func TestDeviceRegistrySet(t *testing.T) { }) }, SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { - defer test.MustIncrementContextCounter(ctx, setByIDCallKey{}, 1) a := assertions.New(test.MustTFromContext(ctx)) a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}) a.So(devID, should.Equal, "test-dev-id") @@ -348,10 +335,7 @@ func TestDeviceRegistrySet(t *testing.T) { ADRMargin: &pbtypes.FloatValue{Value: 4}, }, }, - ContextAssertion: func(ctx context.Context) bool { - a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByIDCallKey{}), should.Equal, 1) - }, + SetByIDCalls: 1, }, { @@ -369,7 +353,6 @@ func TestDeviceRegistrySet(t *testing.T) { }) }, SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { - defer test.MustIncrementContextCounter(ctx, setByIDCallKey{}, 1) a := assertions.New(test.MustTFromContext(ctx)) a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}) a.So(devID, should.Equal, "test-dev-id") @@ -536,10 +519,7 @@ func TestDeviceRegistrySet(t *testing.T) { } return expected }(), - ContextAssertion: func(ctx context.Context) bool { - a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByIDCallKey{}), should.Equal, 1) - }, + SetByIDCalls: 1, }, { @@ -556,7 +536,6 @@ func TestDeviceRegistrySet(t *testing.T) { }) }, SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { - defer test.MustIncrementContextCounter(ctx, setByIDCallKey{}, 1) a := assertions.New(test.MustTFromContext(ctx)) a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}) a.So(devID, should.Equal, "test-dev-id") @@ -714,10 +693,7 @@ func TestDeviceRegistrySet(t *testing.T) { } return expected }(), - ContextAssertion: func(ctx context.Context) bool { - a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByIDCallKey{}), should.Equal, 1) - }, + SetByIDCalls: 1, }, { @@ -735,7 +711,6 @@ func TestDeviceRegistrySet(t *testing.T) { }) }, SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { - defer test.MustIncrementContextCounter(ctx, setByIDCallKey{}, 1) a := assertions.New(test.MustTFromContext(ctx)) a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}) a.So(devID, should.Equal, "test-dev-id") @@ -899,31 +874,30 @@ func TestDeviceRegistrySet(t *testing.T) { } return expected }(), - ContextAssertion: func(ctx context.Context) bool { - a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByIDCallKey{}), should.Equal, 1) - }, + SetByIDCalls: 1, }, } { t.Run(tc.Name, func(t *testing.T) { a := assertions.New(t) + var setByIDCalls uint64 + ns := test.Must(New( component.MustNew(test.GetLogger(t), &component.Config{}), &Config{ Devices: &MockDeviceRegistry{ - SetByIDFunc: tc.SetByIDFunc, + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + atomic.AddUint64(&setByIDCalls, 1) + return tc.SetByIDFunc(ctx, appID, devID, gets, f) + }, }, + DownlinkTasks: &MockDownlinkTaskQueue{}, DeduplicationWindow: 42, CooldownWindow: 42, - DownlinkTasks: &MockDownlinkTaskQueue{}, })).(*NetworkServer) ns.FrequencyPlans = frequencyplans.NewStore(test.FrequencyPlansFetcher) ns.AddContextFiller(tc.ContextFunc) - ns.AddContextFiller(func(ctx context.Context) context.Context { - return test.ContextWithCounter(ctx, setByIDCallKey{}) - }) ns.AddContextFiller(func(ctx context.Context) context.Context { ctx, cancel := context.WithDeadline(ctx, time.Now().Add(Timeout)) _ = cancel @@ -935,29 +909,29 @@ func TestDeviceRegistrySet(t *testing.T) { test.Must(nil, ns.Start()) defer ns.Close() + ctx := ns.FillContext(test.Context()) req := deepcopy.Copy(tc.Request).(*ttnpb.SetEndDeviceRequest) - dev, err := ttnpb.NewNsEndDeviceRegistryClient(ns.LoopbackConn()).Set(test.Context(), req) + dev, err := ttnpb.NewNsEndDeviceRegistryClient(ns.LoopbackConn()).Set(ctx, req) if tc.ErrorAssertion != nil && a.So(tc.ErrorAssertion(t, err), should.BeTrue) { a.So(dev, should.BeNil) } else if a.So(err, should.BeNil) { a.So(dev, should.Resemble, tc.Device) } a.So(req, should.Resemble, tc.Request) + a.So(setByIDCalls, should.Equal, tc.SetByIDCalls) }) } } func TestDeviceRegistryDelete(t *testing.T) { - type setByIDCallKey struct{} - for _, tc := range []struct { - Name string - ContextFunc func(context.Context) context.Context - SetByIDFunc func(context.Context, ttnpb.ApplicationIdentifiers, string, []string, func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) - Request *ttnpb.EndDeviceIdentifiers - ErrorAssertion func(*testing.T, error) bool - ContextAssertion func(context.Context) bool + Name string + ContextFunc func(context.Context) context.Context + SetByIDFunc func(context.Context, ttnpb.ApplicationIdentifiers, string, []string, func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) + Request *ttnpb.EndDeviceIdentifiers + ErrorAssertion func(*testing.T, error) bool + SetByIDCalls uint64 }{ { Name: "No device write rights", @@ -988,10 +962,6 @@ func TestDeviceRegistryDelete(t *testing.T) { } return true }, - ContextAssertion: func(ctx context.Context) bool { - a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByIDCallKey{}), should.Equal, 0) - }, }, { @@ -1008,7 +978,6 @@ func TestDeviceRegistryDelete(t *testing.T) { }) }, SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { - defer test.MustIncrementContextCounter(ctx, setByIDCallKey{}, 1) t := test.MustTFromContext(ctx) a := assertions.New(t) a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}) @@ -1027,10 +996,7 @@ func TestDeviceRegistryDelete(t *testing.T) { DeviceID: "test-dev-id", ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, }, - ContextAssertion: func(ctx context.Context) bool { - a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByIDCallKey{}), should.Equal, 1) - }, + SetByIDCalls: 1, }, { @@ -1046,12 +1012,11 @@ func TestDeviceRegistryDelete(t *testing.T) { }, }) }, - SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { - defer test.MustIncrementContextCounter(ctx, setByIDCallKey{}, 1) + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { a := assertions.New(test.MustTFromContext(ctx)) a.So(appID, should.Resemble, ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}) a.So(devID, should.Equal, "test-dev-id") - a.So(paths, should.BeNil) + a.So(gets, should.BeNil) dev, sets, err := f(&ttnpb.EndDevice{ EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ @@ -1070,30 +1035,29 @@ func TestDeviceRegistryDelete(t *testing.T) { DeviceID: "test-dev-id", ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app-id"}, }, - ContextAssertion: func(ctx context.Context) bool { - a := assertions.New(test.MustTFromContext(ctx)) - return a.So(test.MustCounterFromContext(ctx, setByIDCallKey{}), should.Equal, 1) - }, + SetByIDCalls: 1, }, } { t.Run(tc.Name, func(t *testing.T) { a := assertions.New(t) + var setByIDCalls uint64 + ns := test.Must(New( component.MustNew(test.GetLogger(t), &component.Config{}), &Config{ Devices: &MockDeviceRegistry{ - SetByIDFunc: tc.SetByIDFunc, + SetByIDFunc: func(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, gets []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) { + atomic.AddUint64(&setByIDCalls, 1) + return tc.SetByIDFunc(ctx, appID, devID, gets, f) + }, }, + DownlinkTasks: &MockDownlinkTaskQueue{}, DeduplicationWindow: 42, CooldownWindow: 42, - DownlinkTasks: &MockDownlinkTaskQueue{}, })).(*NetworkServer) ns.AddContextFiller(tc.ContextFunc) - ns.AddContextFiller(func(ctx context.Context) context.Context { - return test.ContextWithCounter(ctx, setByIDCallKey{}) - }) ns.AddContextFiller(func(ctx context.Context) context.Context { ctx, cancel := context.WithDeadline(ctx, time.Now().Add(Timeout)) _ = cancel @@ -1114,6 +1078,7 @@ func TestDeviceRegistryDelete(t *testing.T) { a.So(res, should.Resemble, ttnpb.Empty) } a.So(req, should.Resemble, tc.Request) + a.So(setByIDCalls, should.Equal, tc.SetByIDCalls) }) } } diff --git a/pkg/networkserver/grpc_gsns.go b/pkg/networkserver/grpc_gsns.go index 0a73e6cc2e..81812fbc2a 100644 --- a/pkg/networkserver/grpc_gsns.go +++ b/pkg/networkserver/grpc_gsns.go @@ -773,11 +773,11 @@ func (ns *NetworkServer) handleJoin(ctx context.Context, up *ttnpb.UplinkMessage return err } - defer func() { + defer func(dev *ttnpb.EndDevice) { if err != nil { registerDropJoinRequest(ctx, &dev.EndDeviceIdentifiers, up, err) } - }() + }(dev) logger = logger.WithField("device_uid", unique.ID(ctx, dev.EndDeviceIdentifiers)) ctx = log.NewContext(ctx, logger) @@ -855,10 +855,10 @@ func (ns *NetworkServer) handleJoin(ctx context.Context, up *ttnpb.UplinkMessage "supports_class_b", "supports_class_c", }, - func(dev *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { + func(stored *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { var paths []string - if err := resetMACState(dev, ns.Component.FrequencyPlans, ns.defaultMACSettings); err != nil { + if err := resetMACState(stored, ns.Component.FrequencyPlans, ns.defaultMACSettings); err != nil { resetErr = true return nil, nil, err } @@ -868,37 +868,37 @@ func (ns *NetworkServer) handleJoin(ctx context.Context, up *ttnpb.UplinkMessage keys.NwkSEncKey = keys.FNwkSIntKey keys.SNwkSIntKey = keys.FNwkSIntKey } - dev.MACState.QueuedJoinAccept = &ttnpb.MACState_JoinAccept{ + stored.MACState.QueuedJoinAccept = &ttnpb.MACState_JoinAccept{ Keys: keys, Payload: resp.RawPayload, Request: *req, } - dev.MACState.RxWindowsAvailable = true + stored.MACState.RxWindowsAvailable = true paths = append(paths, "mac_state") - upChIdx, err := searchUplinkChannel(up.Settings.Frequency, dev) + upChIdx, err := searchUplinkChannel(up.Settings.Frequency, stored) if err != nil { return nil, nil, err } up.Settings.DeviceChannelIndex = uint32(upChIdx) - upDRIdx, err := searchDataRate(up.Settings.DataRate, dev, ns.Component.FrequencyPlans) + upDRIdx, err := searchDataRate(up.Settings.DataRate, stored, ns.Component.FrequencyPlans) if err != nil { return nil, nil, err } up.Settings.DataRateIndex = upDRIdx - dev.RecentUplinks = append(dev.RecentUplinks, up) - if len(dev.RecentUplinks) > recentUplinkCount { - dev.RecentUplinks = append(dev.RecentUplinks[:0], dev.RecentUplinks[len(dev.RecentUplinks)-recentUplinkCount:]...) + stored.RecentUplinks = append(stored.RecentUplinks, up) + if len(stored.RecentUplinks) > recentUplinkCount { + stored.RecentUplinks = append(stored.RecentUplinks[:0], stored.RecentUplinks[len(stored.RecentUplinks)-recentUplinkCount:]...) } paths = append(paths, "recent_uplinks") - invalidatedQueue = dev.QueuedApplicationDownlinks - dev.QueuedApplicationDownlinks = nil + invalidatedQueue = stored.QueuedApplicationDownlinks + stored.QueuedApplicationDownlinks = nil paths = append(paths, "queued_application_downlinks") - return dev, paths, nil + return stored, paths, nil }) if err != nil && !resetErr { logger.WithError(err).Error("Failed to update device in registry") @@ -964,18 +964,17 @@ func (ns *NetworkServer) HandleUplink(ctx context.Context, up *ttnpb.UplinkMessa logger := log.FromContext(ctx) + up.Payload = &ttnpb.Message{} + if err := lorawan.UnmarshalMessage(up.RawPayload, up.Payload); err != nil { + return nil, errDecodePayload.WithCause(err) + } + if up.Payload.Major != ttnpb.Major_LORAWAN_R1 { return nil, errUnsupportedLoRaWANVersion.WithAttributes( "major", up.Payload.Major, ) } - if up.Payload.Payload == nil { - if err := lorawan.UnmarshalMessage(up.RawPayload, up.Payload); err != nil { - return nil, errDecodePayload.WithCause(err) - } - } - logger.Debug("Deduplicating uplink...") acc, stopDedup, ok := ns.deduplicateUplink(ctx, up) if ok { diff --git a/pkg/networkserver/grpc_gsns_test.go b/pkg/networkserver/grpc_gsns_test.go index 1d2e9226d9..4579eec3ef 100644 --- a/pkg/networkserver/grpc_gsns_test.go +++ b/pkg/networkserver/grpc_gsns_test.go @@ -153,6 +153,30 @@ func handleUplinkTest() func(t *testing.T) { return func(t *testing.T) { authorizedCtx := clusterauth.NewContext(test.Context(), nil) + t.Run("No device", func(t *testing.T) { + a := assertions.New(t) + + redisClient, flush := test.NewRedis(t, "networkserver_test") + defer flush() + defer redisClient.Close() + devReg := &redis.DeviceRegistry{Redis: redisClient} + + ns := test.Must(New( + component.MustNew(test.GetLogger(t), &component.Config{}), + &Config{ + Devices: devReg, + DeduplicationWindow: 42, + CooldownWindow: 42, + DownlinkTasks: &MockDownlinkTaskQueue{}, + })).(*NetworkServer) + ns.FrequencyPlans = frequencyplans.NewStore(test.FrequencyPlansFetcher) + test.Must(nil, ns.Start()) + defer ns.Close() + + _, err := ns.HandleUplink(authorizedCtx, ttnpb.NewPopulatedUplinkMessageUplink(test.Randy, types.AES128Key{}, types.AES128Key{}, false)) + a.So(err, should.NotBeNil) + }) + t.Run("No frequency match", func(t *testing.T) { a := assertions.New(t) @@ -197,11 +221,29 @@ func handleUplinkTest() func(t *testing.T) { FrequencyPlanID: test.EUFrequencyPlanID, } - ret, err := CreateDevice(authorizedCtx, devReg, pb) - if !a.So(err, should.BeNil) { - t.FailNow() + ret, err := devReg.SetByID(authorizedCtx, pb.ApplicationIdentifiers, pb.DeviceID, + []string{ + "created_at", + "frequency_plan_id", + "lorawan_phy_version", + "lorawan_version", + "session", + "updated_at", + }, + func(stored *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { + if !a.So(stored, should.BeNil) { + t.Fatal("Registry is not empty") + } + return CopyEndDevice(pb), []string{ + "frequency_plan_id", + "lorawan_phy_version", + "lorawan_version", + "session", + }, nil + }) + if !a.So(err, should.BeNil) || !a.So(ret, should.NotBeNil) { + t.Fatalf("Failed to create device, error: %s", err) } - pb.CreatedAt = ret.CreatedAt pb.UpdatedAt = ret.UpdatedAt a.So(ret, should.Resemble, pb) @@ -261,11 +303,29 @@ func handleUplinkTest() func(t *testing.T) { FrequencyPlanID: test.EUFrequencyPlanID, } - ret, err := CreateDevice(authorizedCtx, devReg, pb) - if !a.So(err, should.BeNil) { + ret, err := devReg.SetByID(authorizedCtx, pb.ApplicationIdentifiers, pb.DeviceID, + []string{ + "created_at", + "frequency_plan_id", + "lorawan_phy_version", + "lorawan_version", + "session", + "updated_at", + }, + func(stored *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { + if !a.So(stored, should.BeNil) { + t.Fatal("Registry is not empty") + } + return CopyEndDevice(pb), []string{ + "frequency_plan_id", + "lorawan_phy_version", + "lorawan_version", + "session", + }, nil + }) + if !a.So(err, should.BeNil) || !a.So(ret, should.NotBeNil) { t.FailNow() } - pb.CreatedAt = ret.CreatedAt pb.UpdatedAt = ret.UpdatedAt a.So(ret, should.Resemble, pb) @@ -301,22 +361,51 @@ func handleUplinkTest() func(t *testing.T) { MACState: &ttnpb.MACState{ LoRaWANVersion: ttnpb.MAC_V1_0, CurrentParameters: ttnpb.MACParameters{ + ADRAckLimit: 1, + ADRAckDelay: 1, + Rx2Frequency: 100000, Channels: []*ttnpb.MACParameters_Channel{ { - UplinkFrequency: 40, - DownlinkFrequency: 400, + UplinkFrequency: 100042, + DownlinkFrequency: 100043, MinDataRateIndex: 1, MaxDataRateIndex: 4, }, { UplinkFrequency: 868300000, - DownlinkFrequency: 42, + DownlinkFrequency: 868300001, MinDataRateIndex: 0, MaxDataRateIndex: 5, }, { - UplinkFrequency: 42, - DownlinkFrequency: 420, + UplinkFrequency: 100045, + DownlinkFrequency: 100046, + MinDataRateIndex: 3, + MaxDataRateIndex: 4, + }, + ttnpb.NewPopulatedMACParameters_Channel(test.Randy, false), + }, + }, + DesiredParameters: ttnpb.MACParameters{ + ADRAckLimit: 1, + ADRAckDelay: 1, + Rx2Frequency: 100000, + Channels: []*ttnpb.MACParameters_Channel{ + { + UplinkFrequency: 100042, + DownlinkFrequency: 100043, + MinDataRateIndex: 1, + MaxDataRateIndex: 4, + }, + { + UplinkFrequency: 868300000, + DownlinkFrequency: 868300001, + MinDataRateIndex: 0, + MaxDataRateIndex: 5, + }, + { + UplinkFrequency: 100045, + DownlinkFrequency: 100046, MinDataRateIndex: 3, MaxDataRateIndex: 4, }, @@ -354,7 +443,7 @@ func handleUplinkTest() func(t *testing.T) { msg := ttnpb.NewPopulatedUplinkMessageUplink(test.Randy, SNwkSIntKey, FNwkSIntKey, false) msg.Payload.GetMACPayload().FHDR.Ack = false msg.Payload.GetMACPayload().FHDR.ADR = false - msg.Settings.Frequency = 42 + msg.Settings.Frequency = 100045 msg.Settings.DataRate = band.All[band.EU_863_870].DataRates[3].Rate pld := msg.Payload.GetMACPayload() @@ -364,6 +453,7 @@ func handleUplinkTest() func(t *testing.T) { msg.Payload.MIC = nil mic := test.Must(crypto.ComputeLegacyUplinkMIC(FNwkSIntKey, DevAddr, 0x42, test.Must(lorawan.MarshalMessage(*msg.Payload)).([]byte))).([4]byte) msg.Payload.MIC = mic[:] + msg.RawPayload = test.Must(lorawan.MarshalMessage(*msg.Payload)).([]byte) return msg @@ -378,22 +468,51 @@ func handleUplinkTest() func(t *testing.T) { MACState: &ttnpb.MACState{ LoRaWANVersion: ttnpb.MAC_V1_0, CurrentParameters: ttnpb.MACParameters{ + ADRAckLimit: 1, + ADRAckDelay: 1, + Rx2Frequency: 100000, + Channels: []*ttnpb.MACParameters_Channel{ + { + UplinkFrequency: 100042, + DownlinkFrequency: 100043, + MinDataRateIndex: 1, + MaxDataRateIndex: 4, + }, + { + UplinkFrequency: 868300000, + DownlinkFrequency: 868300001, + MinDataRateIndex: 0, + MaxDataRateIndex: 5, + }, + { + UplinkFrequency: 100045, + DownlinkFrequency: 100046, + MinDataRateIndex: 3, + MaxDataRateIndex: 4, + }, + ttnpb.NewPopulatedMACParameters_Channel(test.Randy, false), + }, + }, + DesiredParameters: ttnpb.MACParameters{ + ADRAckLimit: 1, + ADRAckDelay: 1, + Rx2Frequency: 100000, Channels: []*ttnpb.MACParameters_Channel{ { - UplinkFrequency: 40, - DownlinkFrequency: 400, + UplinkFrequency: 100042, + DownlinkFrequency: 100043, MinDataRateIndex: 1, MaxDataRateIndex: 4, }, { UplinkFrequency: 868300000, - DownlinkFrequency: 42, + DownlinkFrequency: 868300001, MinDataRateIndex: 0, MaxDataRateIndex: 5, }, { - UplinkFrequency: 42, - DownlinkFrequency: 420, + UplinkFrequency: 100045, + DownlinkFrequency: 100046, MinDataRateIndex: 3, MaxDataRateIndex: 4, }, @@ -431,7 +550,7 @@ func handleUplinkTest() func(t *testing.T) { msg := ttnpb.NewPopulatedUplinkMessageUplink(test.Randy, SNwkSIntKey, FNwkSIntKey, false) msg.Payload.GetMACPayload().FHDR.Ack = false msg.Payload.GetMACPayload().FHDR.ADR = false - msg.Settings.Frequency = 42 + msg.Settings.Frequency = 100045 msg.Settings.DataRate = band.All[band.EU_863_870].DataRates[3].Rate pld := msg.Payload.GetMACPayload() @@ -441,6 +560,7 @@ func handleUplinkTest() func(t *testing.T) { msg.Payload.MIC = nil mic := test.Must(crypto.ComputeLegacyUplinkMIC(FNwkSIntKey, DevAddr, 0x42, test.Must(lorawan.MarshalMessage(*msg.Payload)).([]byte))).([4]byte) msg.Payload.MIC = mic[:] + msg.RawPayload = test.Must(lorawan.MarshalMessage(*msg.Payload)).([]byte) return msg @@ -453,22 +573,51 @@ func handleUplinkTest() func(t *testing.T) { LoRaWANVersion: ttnpb.MAC_V1_0, PendingApplicationDownlink: ttnpb.NewPopulatedApplicationDownlink(test.Randy, false), CurrentParameters: ttnpb.MACParameters{ + ADRAckLimit: 1, + ADRAckDelay: 1, + Rx2Frequency: 100000, + Channels: []*ttnpb.MACParameters_Channel{ + { + UplinkFrequency: 100042, + DownlinkFrequency: 100043, + MinDataRateIndex: 1, + MaxDataRateIndex: 4, + }, + { + UplinkFrequency: 868300000, + DownlinkFrequency: 868300001, + MinDataRateIndex: 0, + MaxDataRateIndex: 5, + }, + { + UplinkFrequency: 100045, + DownlinkFrequency: 100046, + MinDataRateIndex: 3, + MaxDataRateIndex: 4, + }, + ttnpb.NewPopulatedMACParameters_Channel(test.Randy, false), + }, + }, + DesiredParameters: ttnpb.MACParameters{ + ADRAckLimit: 1, + ADRAckDelay: 1, + Rx2Frequency: 100000, Channels: []*ttnpb.MACParameters_Channel{ { - UplinkFrequency: 40, - DownlinkFrequency: 400, + UplinkFrequency: 100042, + DownlinkFrequency: 100043, MinDataRateIndex: 1, MaxDataRateIndex: 4, }, { UplinkFrequency: 868300000, - DownlinkFrequency: 42, + DownlinkFrequency: 868300001, MinDataRateIndex: 0, MaxDataRateIndex: 5, }, { - UplinkFrequency: 42, - DownlinkFrequency: 420, + UplinkFrequency: 100045, + DownlinkFrequency: 100046, MinDataRateIndex: 3, MaxDataRateIndex: 4, }, @@ -511,7 +660,7 @@ func handleUplinkTest() func(t *testing.T) { msg := ttnpb.NewPopulatedUplinkMessageUplink(test.Randy, SNwkSIntKey, FNwkSIntKey, true) msg.Payload.GetMACPayload().FHDR.Ack = true msg.Payload.GetMACPayload().FHDR.ADR = false - msg.Settings.Frequency = 42 + msg.Settings.Frequency = 100045 msg.Settings.DataRate = band.All[band.EU_863_870].DataRates[3].Rate pld := msg.Payload.GetMACPayload() @@ -521,6 +670,7 @@ func handleUplinkTest() func(t *testing.T) { msg.Payload.MIC = nil mic := test.Must(crypto.ComputeLegacyUplinkMIC(FNwkSIntKey, DevAddr, 0x42, test.Must(lorawan.MarshalMessage(*msg.Payload)).([]byte))).([4]byte) msg.Payload.MIC = mic[:] + msg.RawPayload = test.Must(lorawan.MarshalMessage(*msg.Payload)).([]byte) return msg @@ -536,22 +686,51 @@ func handleUplinkTest() func(t *testing.T) { LoRaWANVersion: ttnpb.MAC_V1_0, PendingApplicationDownlink: ttnpb.NewPopulatedApplicationDownlink(test.Randy, false), CurrentParameters: ttnpb.MACParameters{ + ADRAckLimit: 1, + ADRAckDelay: 1, + Rx2Frequency: 100000, + Channels: []*ttnpb.MACParameters_Channel{ + { + UplinkFrequency: 100042, + DownlinkFrequency: 100043, + MinDataRateIndex: 1, + MaxDataRateIndex: 4, + }, + { + UplinkFrequency: 868300000, + DownlinkFrequency: 868300001, + MinDataRateIndex: 0, + MaxDataRateIndex: 5, + }, + { + UplinkFrequency: 100045, + DownlinkFrequency: 100046, + MinDataRateIndex: 3, + MaxDataRateIndex: 4, + }, + ttnpb.NewPopulatedMACParameters_Channel(test.Randy, false), + }, + }, + DesiredParameters: ttnpb.MACParameters{ + ADRAckLimit: 1, + ADRAckDelay: 1, + Rx2Frequency: 100000, Channels: []*ttnpb.MACParameters_Channel{ { - UplinkFrequency: 40, - DownlinkFrequency: 400, + UplinkFrequency: 100042, + DownlinkFrequency: 100043, MinDataRateIndex: 1, MaxDataRateIndex: 4, }, { UplinkFrequency: 868300000, - DownlinkFrequency: 42, + DownlinkFrequency: 868300001, MinDataRateIndex: 0, MaxDataRateIndex: 5, }, { - UplinkFrequency: 42, - DownlinkFrequency: 420, + UplinkFrequency: 100045, + DownlinkFrequency: 100046, MinDataRateIndex: 3, MaxDataRateIndex: 4, }, @@ -594,7 +773,7 @@ func handleUplinkTest() func(t *testing.T) { msg := ttnpb.NewPopulatedUplinkMessageUplink(test.Randy, SNwkSIntKey, FNwkSIntKey, true) msg.Payload.GetMACPayload().FHDR.Ack = true msg.Payload.GetMACPayload().FHDR.ADR = false - msg.Settings.Frequency = 42 + msg.Settings.Frequency = 100045 msg.Settings.DataRate = band.All[band.EU_863_870].DataRates[3].Rate pld := msg.Payload.GetMACPayload() @@ -604,6 +783,7 @@ func handleUplinkTest() func(t *testing.T) { msg.Payload.MIC = nil mic := test.Must(crypto.ComputeLegacyUplinkMIC(FNwkSIntKey, DevAddr, 0x42, test.Must(lorawan.MarshalMessage(*msg.Payload)).([]byte))).([4]byte) msg.Payload.MIC = mic[:] + msg.RawPayload = test.Must(lorawan.MarshalMessage(*msg.Payload)).([]byte) return msg @@ -615,22 +795,51 @@ func handleUplinkTest() func(t *testing.T) { MACState: &ttnpb.MACState{ LoRaWANVersion: ttnpb.MAC_V1_1, CurrentParameters: ttnpb.MACParameters{ + ADRAckLimit: 1, + ADRAckDelay: 1, + Rx2Frequency: 100000, + Channels: []*ttnpb.MACParameters_Channel{ + { + UplinkFrequency: 100042, + DownlinkFrequency: 100043, + MinDataRateIndex: 1, + MaxDataRateIndex: 4, + }, + { + UplinkFrequency: 868300000, + DownlinkFrequency: 868300001, + MinDataRateIndex: 0, + MaxDataRateIndex: 5, + }, + { + UplinkFrequency: 100045, + DownlinkFrequency: 100046, + MinDataRateIndex: 3, + MaxDataRateIndex: 4, + }, + ttnpb.NewPopulatedMACParameters_Channel(test.Randy, false), + }, + }, + DesiredParameters: ttnpb.MACParameters{ + ADRAckLimit: 1, + ADRAckDelay: 1, + Rx2Frequency: 100000, Channels: []*ttnpb.MACParameters_Channel{ { - UplinkFrequency: 40, - DownlinkFrequency: 400, + UplinkFrequency: 100042, + DownlinkFrequency: 100043, MinDataRateIndex: 1, MaxDataRateIndex: 4, }, { UplinkFrequency: 868300000, - DownlinkFrequency: 42, + DownlinkFrequency: 868300001, MinDataRateIndex: 0, MaxDataRateIndex: 5, }, { - UplinkFrequency: 42, - DownlinkFrequency: 420, + UplinkFrequency: 100045, + DownlinkFrequency: 100046, MinDataRateIndex: 3, MaxDataRateIndex: 4, }, @@ -671,7 +880,7 @@ func handleUplinkTest() func(t *testing.T) { msg := ttnpb.NewPopulatedUplinkMessageUplink(test.Randy, SNwkSIntKey, FNwkSIntKey, false) msg.Payload.GetMACPayload().FHDR.Ack = false msg.Payload.GetMACPayload().FHDR.ADR = false - msg.Settings.Frequency = 42 + msg.Settings.Frequency = 100045 msg.Settings.DataRate = band.All[band.EU_863_870].DataRates[3].Rate pld := msg.Payload.GetMACPayload() @@ -702,22 +911,51 @@ func handleUplinkTest() func(t *testing.T) { LoRaWANVersion: ttnpb.MAC_V1_1, PendingApplicationDownlink: ttnpb.NewPopulatedApplicationDownlink(test.Randy, false), CurrentParameters: ttnpb.MACParameters{ + ADRAckLimit: 1, + ADRAckDelay: 1, + Rx2Frequency: 100000, + Channels: []*ttnpb.MACParameters_Channel{ + { + UplinkFrequency: 100042, + DownlinkFrequency: 100043, + MinDataRateIndex: 1, + MaxDataRateIndex: 4, + }, + { + UplinkFrequency: 868300000, + DownlinkFrequency: 868300001, + MinDataRateIndex: 0, + MaxDataRateIndex: 5, + }, + { + UplinkFrequency: 100045, + DownlinkFrequency: 100046, + MinDataRateIndex: 3, + MaxDataRateIndex: 4, + }, + ttnpb.NewPopulatedMACParameters_Channel(test.Randy, false), + }, + }, + DesiredParameters: ttnpb.MACParameters{ + ADRAckLimit: 1, + ADRAckDelay: 1, + Rx2Frequency: 100000, Channels: []*ttnpb.MACParameters_Channel{ { - UplinkFrequency: 40, - DownlinkFrequency: 400, + UplinkFrequency: 100042, + DownlinkFrequency: 100043, MinDataRateIndex: 1, MaxDataRateIndex: 4, }, { UplinkFrequency: 868300000, - DownlinkFrequency: 42, + DownlinkFrequency: 868300001, MinDataRateIndex: 0, MaxDataRateIndex: 5, }, { - UplinkFrequency: 42, - DownlinkFrequency: 420, + UplinkFrequency: 100045, + DownlinkFrequency: 100046, MinDataRateIndex: 3, MaxDataRateIndex: 4, }, @@ -769,7 +1007,7 @@ func handleUplinkTest() func(t *testing.T) { msg := ttnpb.NewPopulatedUplinkMessageUplink(test.Randy, SNwkSIntKey, FNwkSIntKey, true) msg.Payload.GetMACPayload().FHDR.Ack = true msg.Payload.GetMACPayload().FHDR.ADR = false - msg.Settings.Frequency = 42 + msg.Settings.Frequency = 100045 msg.Settings.DataRate = band.All[band.EU_863_870].DataRates[3].Rate pld := msg.Payload.GetMACPayload() @@ -788,6 +1026,7 @@ func handleUplinkTest() func(t *testing.T) { test.Must(lorawan.MarshalMessage(*msg.Payload)).([]byte)), ).([4]byte) msg.Payload.MIC = mic[:] + msg.RawPayload = test.Must(lorawan.MarshalMessage(*msg.Payload)).([]byte) return msg @@ -802,22 +1041,51 @@ func handleUplinkTest() func(t *testing.T) { MACState: &ttnpb.MACState{ LoRaWANVersion: ttnpb.MAC_V1_1, CurrentParameters: ttnpb.MACParameters{ + ADRAckLimit: 1, + ADRAckDelay: 1, + Rx2Frequency: 100000, + Channels: []*ttnpb.MACParameters_Channel{ + { + UplinkFrequency: 100042, + DownlinkFrequency: 100043, + MinDataRateIndex: 1, + MaxDataRateIndex: 4, + }, + { + UplinkFrequency: 868300000, + DownlinkFrequency: 868300001, + MinDataRateIndex: 0, + MaxDataRateIndex: 5, + }, + { + UplinkFrequency: 100045, + DownlinkFrequency: 100046, + MinDataRateIndex: 3, + MaxDataRateIndex: 4, + }, + ttnpb.NewPopulatedMACParameters_Channel(test.Randy, false), + }, + }, + DesiredParameters: ttnpb.MACParameters{ + ADRAckLimit: 1, + ADRAckDelay: 1, + Rx2Frequency: 100000, Channels: []*ttnpb.MACParameters_Channel{ { - UplinkFrequency: 40, - DownlinkFrequency: 400, + UplinkFrequency: 100042, + DownlinkFrequency: 100043, MinDataRateIndex: 1, MaxDataRateIndex: 4, }, { UplinkFrequency: 868300000, - DownlinkFrequency: 42, + DownlinkFrequency: 868300001, MinDataRateIndex: 0, MaxDataRateIndex: 5, }, { - UplinkFrequency: 42, - DownlinkFrequency: 420, + UplinkFrequency: 100045, + DownlinkFrequency: 100046, MinDataRateIndex: 3, MaxDataRateIndex: 4, }, @@ -858,7 +1126,7 @@ func handleUplinkTest() func(t *testing.T) { msg := ttnpb.NewPopulatedUplinkMessageUplink(test.Randy, SNwkSIntKey, FNwkSIntKey, false) msg.Payload.GetMACPayload().FHDR.Ack = false msg.Payload.GetMACPayload().FHDR.ADR = false - msg.Settings.Frequency = 42 + msg.Settings.Frequency = 100045 msg.Settings.DataRate = band.All[band.EU_863_870].DataRates[3].Rate pld := msg.Payload.GetMACPayload() @@ -877,6 +1145,7 @@ func handleUplinkTest() func(t *testing.T) { test.Must(lorawan.MarshalMessage(*msg.Payload)).([]byte)), ).([4]byte) msg.Payload.MIC = mic[:] + msg.RawPayload = test.Must(lorawan.MarshalMessage(*msg.Payload)).([]byte) return msg @@ -892,22 +1161,51 @@ func handleUplinkTest() func(t *testing.T) { LoRaWANVersion: ttnpb.MAC_V1_1, PendingApplicationDownlink: ttnpb.NewPopulatedApplicationDownlink(test.Randy, false), CurrentParameters: ttnpb.MACParameters{ + ADRAckLimit: 1, + ADRAckDelay: 1, + Rx2Frequency: 100000, + Channels: []*ttnpb.MACParameters_Channel{ + { + UplinkFrequency: 100042, + DownlinkFrequency: 100043, + MinDataRateIndex: 1, + MaxDataRateIndex: 4, + }, + { + UplinkFrequency: 868300000, + DownlinkFrequency: 868300001, + MinDataRateIndex: 0, + MaxDataRateIndex: 5, + }, + { + UplinkFrequency: 100045, + DownlinkFrequency: 100046, + MinDataRateIndex: 3, + MaxDataRateIndex: 4, + }, + ttnpb.NewPopulatedMACParameters_Channel(test.Randy, false), + }, + }, + DesiredParameters: ttnpb.MACParameters{ + ADRAckLimit: 1, + ADRAckDelay: 1, + Rx2Frequency: 100000, Channels: []*ttnpb.MACParameters_Channel{ { - UplinkFrequency: 40, - DownlinkFrequency: 400, + UplinkFrequency: 100042, + DownlinkFrequency: 100043, MinDataRateIndex: 1, MaxDataRateIndex: 4, }, { UplinkFrequency: 868300000, - DownlinkFrequency: 42, + DownlinkFrequency: 868300001, MinDataRateIndex: 0, MaxDataRateIndex: 5, }, { - UplinkFrequency: 42, - DownlinkFrequency: 420, + UplinkFrequency: 100045, + DownlinkFrequency: 100046, MinDataRateIndex: 3, MaxDataRateIndex: 4, }, @@ -958,7 +1256,7 @@ func handleUplinkTest() func(t *testing.T) { msg := ttnpb.NewPopulatedUplinkMessageUplink(test.Randy, SNwkSIntKey, FNwkSIntKey, true) msg.Payload.GetMACPayload().FHDR.Ack = true msg.Payload.GetMACPayload().FHDR.ADR = false - msg.Settings.Frequency = 42 + msg.Settings.Frequency = 100045 msg.Settings.DataRate = band.All[band.EU_863_870].DataRates[3].Rate pld := msg.Payload.GetMACPayload() @@ -977,6 +1275,7 @@ func handleUplinkTest() func(t *testing.T) { test.Must(lorawan.MarshalMessage(*msg.Payload)).([]byte)), ).([4]byte) msg.Payload.MIC = mic[:] + msg.RawPayload = test.Must(lorawan.MarshalMessage(*msg.Payload)).([]byte) return msg @@ -986,6 +1285,8 @@ func handleUplinkTest() func(t *testing.T) { t.Run(tc.Name, func(t *testing.T) { a := assertions.New(t) + authorizedCtx := test.ContextWithT(authorizedCtx, t) + redisClient, flush := test.NewRedis(t, "networkserver_test") defer flush() defer redisClient.Close() @@ -1012,9 +1313,30 @@ func handleUplinkTest() func(t *testing.T) { // Fill DeviceRegistry with devices for i := 0; i < DeviceCount; i++ { - pb := ttnpb.NewPopulatedEndDevice(test.Randy, false) + pb := &ttnpb.EndDevice{} + if err := pb.SetFields(ttnpb.NewPopulatedEndDevice(test.Randy, false), []string{ + "frequency_plan_id", + "ids", + "lorawan_phy_version", + "lorawan_version", + "mac_state", + "pending_session", + "session", + }...); err != nil { + t.Fatalf("Failed to set fields: %s", err) + } for unique.ID(ctx, pb.EndDeviceIdentifiers) == unique.ID(ctx, tc.Device.EndDeviceIdentifiers) { - pb = ttnpb.NewPopulatedEndDevice(test.Randy, false) + if err := pb.SetFields(ttnpb.NewPopulatedEndDevice(test.Randy, false), []string{ + "frequency_plan_id", + "ids", + "lorawan_phy_version", + "lorawan_version", + "mac_state", + "pending_session", + "session", + }...); err != nil { + t.Fatalf("Failed to set fields: %s", err) + } } if s := pb.Session; s != nil { @@ -1035,9 +1357,32 @@ func handleUplinkTest() func(t *testing.T) { } } - ret, err := CreateDevice(ctx, devReg, pb) - if !a.So(err, should.BeNil) { - t.Fatalf("Failed to create device %+v", pb) + ret, err := devReg.SetByID(authorizedCtx, pb.ApplicationIdentifiers, pb.DeviceID, + []string{ + "created_at", + "frequency_plan_id", + "lorawan_phy_version", + "lorawan_version", + "mac_state", + "pending_session", + "session", + "updated_at", + }, + func(stored *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { + if !a.So(stored, should.BeNil) { + t.Fatal("Registry is not empty") + } + return CopyEndDevice(pb), []string{ + "frequency_plan_id", + "lorawan_phy_version", + "lorawan_version", + "mac_state", + "pending_session", + "session", + }, nil + }) + if !a.So(err, should.BeNil) || !a.So(ret, should.NotBeNil) { + t.Fatalf("Failed to create device, error: %s", err) } pb.CreatedAt = ret.CreatedAt pb.UpdatedAt = ret.UpdatedAt @@ -1104,9 +1449,36 @@ func handleUplinkTest() func(t *testing.T) { start := time.Now() - ret, err := CreateDevice(ctx, devReg, CopyEndDevice(tc.Device)) - if !a.So(err, should.BeNil) { - t.FailNow() + ret, err := devReg.SetByID(authorizedCtx, pb.ApplicationIdentifiers, pb.DeviceID, + []string{ + "created_at", + "frequency_plan_id", + "lorawan_phy_version", + "lorawan_version", + "mac_settings", + "mac_state", + "pending_session", + "recent_downlinks", + "session", + "updated_at", + }, + func(stored *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { + if !a.So(stored, should.BeNil) { + t.Fatal("Registry is not empty") + } + return CopyEndDevice(tc.Device), []string{ + "frequency_plan_id", + "lorawan_phy_version", + "lorawan_version", + "mac_settings", + "mac_state", + "pending_session", + "recent_downlinks", + "session", + }, nil + }) + if !a.So(err, should.BeNil) || !a.So(ret, should.NotBeNil) { + t.Fatalf("Failed to create device, error: %s", err) } pb.CreatedAt = ret.CreatedAt a.So(ret.UpdatedAt, should.HappenAfter, start) @@ -1377,46 +1749,31 @@ func (js *MockNsJsClient) GetNwkSKeys(ctx context.Context, req *ttnpb.SessionKey func handleJoinTest() func(t *testing.T) { return func(t *testing.T) { - a := assertions.New(t) - authorizedCtx := clusterauth.NewContext(test.Context(), nil) - redisClient, flush := test.NewRedis(t, "networkserver_test") - defer flush() - defer redisClient.Close() - devReg := &redis.DeviceRegistry{Redis: redisClient} - - ns := test.Must(New( - component.MustNew(test.GetLogger(t), &component.Config{}), - &Config{ - Devices: devReg, - DeduplicationWindow: 42, - CooldownWindow: 42, - DownlinkTasks: &MockDownlinkTaskQueue{}, - }, - )).(*NetworkServer) - ns.FrequencyPlans = frequencyplans.NewStore(test.FrequencyPlansFetcher) - test.Must(nil, ns.Start()) - defer ns.Close() - - _, err := ns.HandleUplink(authorizedCtx, ttnpb.NewPopulatedUplinkMessageJoinRequest(test.Randy)) - a.So(err, should.NotBeNil) - - req := ttnpb.NewPopulatedUplinkMessageJoinRequest(test.Randy) - pb := ttnpb.NewPopulatedEndDevice(test.Randy, false) + t.Run("No device", func(t *testing.T) { + a := assertions.New(t) - pb.EndDeviceIdentifiers.ApplicationID = ApplicationID - pb.EndDeviceIdentifiers.DeviceID = DeviceID - pb.EndDeviceIdentifiers.DevEUI = &req.Payload.GetJoinRequestPayload().DevEUI - pb.EndDeviceIdentifiers.JoinEUI = &req.Payload.GetJoinRequestPayload().JoinEUI + redisClient, flush := test.NewRedis(t, "networkserver_test") + defer flush() + defer redisClient.Close() + devReg := &redis.DeviceRegistry{Redis: redisClient} - _, err = CreateDevice(authorizedCtx, devReg, pb) - if !a.So(err, should.BeNil) { - t.Fatalf("Failed to create device %+v", pb) - } + ns := test.Must(New( + component.MustNew(test.GetLogger(t), &component.Config{}), + &Config{ + Devices: devReg, + DeduplicationWindow: 42, + CooldownWindow: 42, + DownlinkTasks: &MockDownlinkTaskQueue{}, + })).(*NetworkServer) + ns.FrequencyPlans = frequencyplans.NewStore(test.FrequencyPlansFetcher) + test.Must(nil, ns.Start()) + defer ns.Close() - _, err = ns.HandleUplink(authorizedCtx, req) - a.So(err, should.NotBeNil) + _, err := ns.HandleUplink(authorizedCtx, ttnpb.NewPopulatedUplinkMessageJoinRequest(test.Randy)) + a.So(err, should.NotBeNil) + }) for _, tc := range []struct { Name string @@ -1446,6 +1803,8 @@ func handleJoinTest() func(t *testing.T) { jr.DevEUI = DevEUI jr.JoinEUI = JoinEUI + msg.RawPayload = test.Must(lorawan.MarshalMessage(*msg.Payload)).([]byte) + return msg }(), }, @@ -1473,6 +1832,8 @@ func handleJoinTest() func(t *testing.T) { jr.DevEUI = DevEUI jr.JoinEUI = JoinEUI + msg.RawPayload = test.Must(lorawan.MarshalMessage(*msg.Payload)).([]byte) + return msg }(), }, @@ -1500,6 +1861,8 @@ func handleJoinTest() func(t *testing.T) { jr.DevEUI = DevEUI jr.JoinEUI = JoinEUI + msg.RawPayload = test.Must(lorawan.MarshalMessage(*msg.Payload)).([]byte) + return msg }(), }, @@ -1527,6 +1890,8 @@ func handleJoinTest() func(t *testing.T) { jr.DevEUI = DevEUI jr.JoinEUI = JoinEUI + msg.RawPayload = test.Must(lorawan.MarshalMessage(*msg.Payload)).([]byte) + return msg }(), }, @@ -1554,6 +1919,8 @@ func handleJoinTest() func(t *testing.T) { jr.DevEUI = DevEUI jr.JoinEUI = JoinEUI + msg.RawPayload = test.Must(lorawan.MarshalMessage(*msg.Payload)).([]byte) + return msg }(), }, @@ -1561,7 +1928,7 @@ func handleJoinTest() func(t *testing.T) { t.Run(tc.Name, func(t *testing.T) { a := assertions.New(t) - authorizedCtx = test.ContextWithT(authorizedCtx, t) + authorizedCtx := test.ContextWithT(authorizedCtx, t) redisClient, flush := test.NewRedis(t, "networkserver_test") defer flush() @@ -1570,15 +1937,49 @@ func handleJoinTest() func(t *testing.T) { // Fill DeviceRegistry with devices for i := 0; i < DeviceCount; i++ { - pb := ttnpb.NewPopulatedEndDevice(test.Randy, false) - for pb.Equal(tc.Device) { - pb = ttnpb.NewPopulatedEndDevice(test.Randy, false) + pb := &ttnpb.EndDevice{} + if err := pb.SetFields(ttnpb.NewPopulatedEndDevice(test.Randy, false), []string{ + "frequency_plan_id", + "ids", + "lorawan_phy_version", + "lorawan_version", + "mac_state", + "pending_session", + "session", + }...); err != nil { + t.Fatalf("Failed to set fields: %s", err) } - _, err = CreateDevice(authorizedCtx, devReg, pb) - if !a.So(err, should.BeNil) { - t.Fatalf("Failed to create device %+v", pb) + ret, err := devReg.SetByID(authorizedCtx, pb.ApplicationIdentifiers, pb.DeviceID, + []string{ + "created_at", + "frequency_plan_id", + "lorawan_phy_version", + "lorawan_version", + "mac_state", + "pending_session", + "session", + "updated_at", + }, + func(stored *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { + if !a.So(stored, should.BeNil) { + t.Fatal("Registry is not empty") + } + return CopyEndDevice(pb), []string{ + "frequency_plan_id", + "lorawan_phy_version", + "lorawan_version", + "mac_state", + "pending_session", + "session", + }, nil + }) + if !a.So(err, should.BeNil) || !a.So(ret, should.NotBeNil) { + t.Fatalf("Failed to create device, error: %s", err) } + pb.CreatedAt = ret.CreatedAt + pb.UpdatedAt = ret.UpdatedAt + a.So(ret, should.Resemble, pb) } type handleJoinRequest struct { @@ -1659,12 +2060,43 @@ func handleJoinTest() func(t *testing.T) { pb := CopyEndDevice(tc.Device) - ret, err := CreateDevice(authorizedCtx, devReg, CopyEndDevice(pb)) - a.So(err, should.BeNil) - a.So(ret.CreatedAt, should.Equal, ret.UpdatedAt) + start := time.Now() + + ret, err := devReg.SetByID(authorizedCtx, pb.ApplicationIdentifiers, pb.DeviceID, + []string{ + "created_at", + "frequency_plan_id", + "lorawan_phy_version", + "lorawan_version", + "mac_settings", + "mac_state", + "pending_session", + "recent_downlinks", + "session", + "updated_at", + }, + func(stored *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { + if !a.So(stored, should.BeNil) { + t.Fatal("Registry is not empty") + } + return CopyEndDevice(tc.Device), []string{ + "frequency_plan_id", + "lorawan_phy_version", + "lorawan_version", + "mac_settings", + "mac_state", + "pending_session", + "recent_downlinks", + "session", + }, nil + }) + if !a.So(err, should.BeNil) || !a.So(ret, should.NotBeNil) { + t.Fatalf("Failed to create device, error: %s", err) + } pb.CreatedAt = ret.CreatedAt + a.So(ret.UpdatedAt, should.HappenAfter, start) pb.UpdatedAt = ret.UpdatedAt - a.So(ret, should.Resemble, pb) + a.So(ret, should.HaveEmptyDiff, pb) err = ResetMACState(ret, ns.FrequencyPlans, ttnpb.MACSettings{}) if !a.So(err, should.BeNil) { @@ -1689,10 +2121,10 @@ func handleJoinTest() func(t *testing.T) { ctx := context.WithValue(authorizedCtx, struct{}{}, 42) ctx = log.NewContext(ctx, test.GetLogger(t)) - start := time.Now() - - resp := ttnpb.NewPopulatedJoinResponse(test.Randy, false) - resp.SessionKeys = *keys + resp := &ttnpb.JoinResponse{ + RawPayload: bytes.Repeat([]byte{42}, 17), + SessionKeys: *keys, + } errch := make(chan error, 1) go func() { @@ -1844,8 +2276,10 @@ func handleJoinTest() func(t *testing.T) { expectedRequest.CorrelationIDs = req.req.CorrelationIDs a.So(req.req, should.Resemble, expectedRequest) - resp := ttnpb.NewPopulatedJoinResponse(test.Randy, false) - resp.SessionKeys = *keys + resp := &ttnpb.JoinResponse{ + RawPayload: bytes.Repeat([]byte{42}, 17), + SessionKeys: *keys, + } req.ch <- resp req.errch <- nil diff --git a/pkg/networkserver/mac_dev_status.go b/pkg/networkserver/mac_dev_status.go index 7e3cc15a80..d16bfb38bb 100644 --- a/pkg/networkserver/mac_dev_status.go +++ b/pkg/networkserver/mac_dev_status.go @@ -18,6 +18,7 @@ import ( "context" "time" + pbtypes "github.com/gogo/protobuf/types" "go.thethings.network/lorawan-stack/pkg/events" "go.thethings.network/lorawan-stack/pkg/ttnpb" ) @@ -89,13 +90,13 @@ func handleDevStatusAns(ctx context.Context, dev *ttnpb.EndDevice, pld *ttnpb.MA switch pld.Battery { case 0: dev.PowerState = ttnpb.PowerState_POWER_EXTERNAL - dev.BatteryPercentage = -1 + dev.BatteryPercentage = nil case 255: dev.PowerState = ttnpb.PowerState_POWER_UNKNOWN - dev.BatteryPercentage = -1 + dev.BatteryPercentage = nil default: dev.PowerState = ttnpb.PowerState_POWER_BATTERY - dev.BatteryPercentage = float32(pld.Battery-1) / 253 + dev.BatteryPercentage = &pbtypes.FloatValue{Value: float32(pld.Battery-1) / 253} } dev.DownlinkMargin = pld.Margin dev.LastDevStatusReceivedAt = &recvAt diff --git a/pkg/networkserver/mac_dev_status_test.go b/pkg/networkserver/mac_dev_status_test.go index 2219dc9f88..c57e1580e0 100644 --- a/pkg/networkserver/mac_dev_status_test.go +++ b/pkg/networkserver/mac_dev_status_test.go @@ -18,6 +18,7 @@ import ( "testing" "time" + pbtypes "github.com/gogo/protobuf/types" "github.com/mohae/deepcopy" "github.com/smartystreets/assertions" "go.thethings.network/lorawan-stack/pkg/events" @@ -75,7 +76,7 @@ func TestHandleDevStatusAns(t *testing.T) { Error: errMACRequestNotFound, }, { - Name: "battery 42/margin 4", + Name: "battery 42%/margin 4", Device: &ttnpb.EndDevice{ MACState: &ttnpb.MACState{ LastDevStatusFCntUp: 2, @@ -83,7 +84,7 @@ func TestHandleDevStatusAns(t *testing.T) { ttnpb.CID_DEV_STATUS.MACCommand(), }, }, - BatteryPercentage: 44, + BatteryPercentage: &pbtypes.FloatValue{Value: 0.44}, PowerState: ttnpb.PowerState_POWER_EXTERNAL, }, Expected: &ttnpb.EndDevice{ @@ -92,7 +93,7 @@ func TestHandleDevStatusAns(t *testing.T) { LastDevStatusFCntUp: 43, PendingRequests: []*ttnpb.MACCommand{}, }, - BatteryPercentage: float32(42-1) / float32(253), + BatteryPercentage: &pbtypes.FloatValue{Value: float32(42-1) / float32(253)}, DownlinkMargin: 4, PowerState: ttnpb.PowerState_POWER_BATTERY, }, @@ -121,7 +122,7 @@ func TestHandleDevStatusAns(t *testing.T) { ttnpb.CID_DEV_STATUS.MACCommand(), }, }, - BatteryPercentage: 44, + BatteryPercentage: &pbtypes.FloatValue{Value: 0.44}, PowerState: ttnpb.PowerState_POWER_BATTERY, }, Expected: &ttnpb.EndDevice{ @@ -130,9 +131,8 @@ func TestHandleDevStatusAns(t *testing.T) { LastDevStatusFCntUp: 43, PendingRequests: []*ttnpb.MACCommand{}, }, - BatteryPercentage: -1, - DownlinkMargin: 20, - PowerState: ttnpb.PowerState_POWER_EXTERNAL, + DownlinkMargin: 20, + PowerState: ttnpb.PowerState_POWER_EXTERNAL, }, Payload: &ttnpb.MACCommand_DevStatusAns{ Battery: 0, @@ -159,7 +159,7 @@ func TestHandleDevStatusAns(t *testing.T) { ttnpb.CID_DEV_STATUS.MACCommand(), }, }, - BatteryPercentage: 44, + BatteryPercentage: &pbtypes.FloatValue{Value: 0.44}, PowerState: ttnpb.PowerState_POWER_BATTERY, }, Expected: &ttnpb.EndDevice{ @@ -168,9 +168,8 @@ func TestHandleDevStatusAns(t *testing.T) { LastDevStatusFCntUp: 43, PendingRequests: []*ttnpb.MACCommand{}, }, - BatteryPercentage: -1, - DownlinkMargin: -5, - PowerState: ttnpb.PowerState_POWER_UNKNOWN, + DownlinkMargin: -5, + PowerState: ttnpb.PowerState_POWER_UNKNOWN, }, Payload: &ttnpb.MACCommand_DevStatusAns{ Battery: 255, diff --git a/pkg/networkserver/redis/registry.go b/pkg/networkserver/redis/registry.go index 34a7cde9e3..3b09c08a65 100644 --- a/pkg/networkserver/redis/registry.go +++ b/pkg/networkserver/redis/registry.go @@ -33,13 +33,15 @@ var ( ) func applyDeviceFieldMask(dst, src *ttnpb.EndDevice, paths ...string) (*ttnpb.EndDevice, error) { + paths = append(paths, "ids") + if dst == nil { dst = &ttnpb.EndDevice{} } - if err := dst.SetFields(src, append(paths, "ids")...); err != nil { + if err := dst.SetFields(src, paths...); err != nil { return nil, err } - if err := dst.EndDeviceIdentifiers.Validate(); err != nil { + if err := dst.ValidateFields(paths...); err != nil { return nil, err } return dst, nil @@ -58,7 +60,7 @@ func (r *DeviceRegistry) addrKey(addr types.DevAddr) string { return r.Redis.Key("addr", addr.String()) } -func (r *DeviceRegistry) euiKey(devEUI, joinEUI types.EUI64) string { +func (r *DeviceRegistry) euiKey(joinEUI, devEUI types.EUI64) string { return r.Redis.Key("eui", joinEUI.String(), devEUI.String()) } diff --git a/pkg/networkserver/registry.go b/pkg/networkserver/registry.go index baac9c8de4..48284f6ec1 100644 --- a/pkg/networkserver/registry.go +++ b/pkg/networkserver/registry.go @@ -31,20 +31,6 @@ type DeviceRegistry interface { // DeleteDevice deletes device identified by appID, devID from r. func DeleteDevice(ctx context.Context, r DeviceRegistry, appID ttnpb.ApplicationIdentifiers, devID string) error { - _, err := r.SetByID(ctx, appID, devID, ttnpb.EndDeviceFieldPathsTopLevel, func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { return nil, nil, nil }) + _, err := r.SetByID(ctx, appID, devID, nil, func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { return nil, nil, nil }) return err } - -// CreateDevice creates device dev identified by appID, devID from dev.EndDeviceIdentifiers at r. -func CreateDevice(ctx context.Context, r DeviceRegistry, dev *ttnpb.EndDevice) (*ttnpb.EndDevice, error) { - dev, err := r.SetByID(ctx, dev.EndDeviceIdentifiers.ApplicationIdentifiers, dev.EndDeviceIdentifiers.DeviceID, ttnpb.EndDeviceFieldPathsTopLevel, func(stored *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { - if stored != nil { - return nil, nil, errDuplicateIdentifiers - } - return dev, ttnpb.EndDeviceFieldPathsTopLevel, nil - }) - if err != nil { - return nil, err - } - return dev, nil -} diff --git a/pkg/networkserver/registry_test.go b/pkg/networkserver/registry_test.go index 96bf60883f..2903ba8611 100644 --- a/pkg/networkserver/registry_test.go +++ b/pkg/networkserver/registry_test.go @@ -37,12 +37,10 @@ func handleRegistryTest(t *testing.T, reg DeviceRegistry) { pb := &ttnpb.EndDevice{ EndDeviceIdentifiers: ttnpb.EndDeviceIdentifiers{ - JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ - ApplicationID: "test-app", - }, - DeviceID: "test-dev", + JoinEUI: &types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + DevEUI: &types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "test-app"}, + DeviceID: "test-dev", }, Session: &ttnpb.Session{ DevAddr: types.DevAddr{0x42, 0xff, 0xff, 0xff}, @@ -83,9 +81,25 @@ func handleRegistryTest(t *testing.T, reg DeviceRegistry) { start := time.Now() - ret, err = CreateDevice(ctx, reg, pb) + ret, err = reg.SetByID(ctx, pb.ApplicationIdentifiers, pb.DeviceID, + []string{ + "created_at", + "pending_session", + "session", + "updated_at", + }, + func(stored *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { + if !a.So(stored, should.BeNil) { + t.Fatal("Registry is not empty") + } + return pb, []string{ + "session", + "pending_session", + }, nil + }, + ) if !a.So(err, should.BeNil) || !a.So(ret, should.NotBeNil) { - t.FailNow() + t.Fatalf("Failed to create device: %s", err) } a.So(ret.CreatedAt, should.HappenAfter, start) a.So(ret.UpdatedAt, should.HappenAfter, start) @@ -133,9 +147,25 @@ func handleRegistryTest(t *testing.T, reg DeviceRegistry) { } a.So(ret, should.BeNil) - ret, err = CreateDevice(ctx, reg, pbOther) + ret, err = reg.SetByID(ctx, pbOther.ApplicationIdentifiers, pbOther.DeviceID, + []string{ + "created_at", + "pending_session", + "session", + "updated_at", + }, + func(stored *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error) { + if !a.So(stored, should.BeNil) { + t.Fatal("Registry is not empty") + } + return pbOther, []string{ + "session", + "pending_session", + }, nil + }, + ) if !a.So(err, should.BeNil) || !a.So(ret, should.NotBeNil) { - t.FailNow() + t.Fatalf("Failed to create device: %s", err) } a.So(ret.CreatedAt, should.HappenAfter, pb.CreatedAt) a.So(ret.UpdatedAt, should.HappenAfter, pb.UpdatedAt) diff --git a/pkg/networkserver/utils.go b/pkg/networkserver/utils.go index 3b4e15ce75..b6f489d621 100644 --- a/pkg/networkserver/utils.go +++ b/pkg/networkserver/utils.go @@ -144,18 +144,18 @@ func resetMACState(dev *ttnpb.EndDevice, fps *frequencyplans.Store, defaults ttn } dev.MACState.CurrentParameters.Rx2Frequency = band.DefaultRx2Parameters.Frequency - if dev.GetMACSettings().GetRx2Frequency() != 0 { - dev.MACState.CurrentParameters.Rx2Frequency = dev.MACSettings.Rx2Frequency - } else if defaults.Rx2Frequency != 0 { - dev.MACState.CurrentParameters.Rx2Frequency = defaults.Rx2Frequency + if dev.GetMACSettings().GetRx2Frequency() != nil && dev.MACSettings.Rx2Frequency.Value != 0 { + dev.MACState.CurrentParameters.Rx2Frequency = dev.MACSettings.Rx2Frequency.Value + } else if defaults.Rx2Frequency != nil && dev.MACSettings.Rx2Frequency.Value != 0 { + dev.MACState.CurrentParameters.Rx2Frequency = defaults.Rx2Frequency.Value } dev.MACState.DesiredParameters.Rx2Frequency = dev.MACState.CurrentParameters.Rx2Frequency - if dev.MACSettings != nil && dev.GetMACSettings().GetDesiredRx2Frequency() != 0 { - dev.MACState.DesiredParameters.Rx2Frequency = dev.MACSettings.DesiredRx2Frequency + if dev.GetMACSettings().GetDesiredRx2Frequency() != nil && dev.MACSettings.Rx2Frequency.Value != 0 { + dev.MACState.DesiredParameters.Rx2Frequency = dev.MACSettings.DesiredRx2Frequency.Value } else if fp.Rx2Channel != nil { dev.MACState.DesiredParameters.Rx2Frequency = fp.Rx2Channel.Frequency - } else if defaults.DesiredRx2Frequency != 0 { - dev.MACState.DesiredParameters.Rx2Frequency = defaults.DesiredRx2Frequency + } else if defaults.DesiredRx2Frequency != nil && defaults.DesiredRx2Frequency.Value != 0 { + dev.MACState.DesiredParameters.Rx2Frequency = defaults.DesiredRx2Frequency.Value } dev.MACState.CurrentParameters.MaxDutyCycle = ttnpb.DUTY_CYCLE_1 @@ -171,10 +171,10 @@ func resetMACState(dev *ttnpb.EndDevice, fps *frequencyplans.Store, defaults ttn dev.MACState.DesiredParameters.RejoinCountPeriodicity = dev.MACState.CurrentParameters.RejoinCountPeriodicity dev.MACState.CurrentParameters.PingSlotFrequency = 0 - if dev.GetMACSettings().GetPingSlotFrequency() != 0 { - dev.MACState.CurrentParameters.PingSlotFrequency = dev.MACSettings.PingSlotFrequency - } else if defaults.PingSlotFrequency != 0 { - dev.MACState.CurrentParameters.PingSlotFrequency = defaults.PingSlotFrequency + if dev.GetMACSettings().GetPingSlotFrequency() != nil && dev.MACSettings.PingSlotFrequency.Value != 0 { + dev.MACState.CurrentParameters.PingSlotFrequency = dev.MACSettings.PingSlotFrequency.Value + } else if defaults.PingSlotFrequency != nil && defaults.PingSlotFrequency.Value != 0 { + dev.MACState.CurrentParameters.PingSlotFrequency = defaults.PingSlotFrequency.Value } dev.MACState.DesiredParameters.PingSlotFrequency = dev.MACState.CurrentParameters.PingSlotFrequency if fp.PingSlot != nil && fp.PingSlot.Frequency != 0 { diff --git a/pkg/rpcmiddleware/validator/validator.go b/pkg/rpcmiddleware/validator/validator.go index 2c7b53c4aa..58e48a26e9 100644 --- a/pkg/rpcmiddleware/validator/validator.go +++ b/pkg/rpcmiddleware/validator/validator.go @@ -39,14 +39,6 @@ func RegisterAllowedFieldMaskPaths(rpcFullMethod string, allowedPaths ...string) } } -func getAllowedFieldMaskPaths(rpcFullMethod string) map[string]struct{} { - return allowedFieldMaskPaths[rpcFullMethod] -} - -type fieldMaskGetter interface { - GetFieldMask() types.FieldMask -} - var errForbiddenFieldMaskPaths = errors.DefineInvalidArgument("field_mask_paths", "forbidden path(s) in field mask", "forbidden_paths") func forbiddenPaths(requestedPaths []string, allowedPaths map[string]struct{}) (invalidPaths []string) { @@ -60,14 +52,6 @@ nextRequestedPath: return } -type validatorWithContext interface { - ValidateContext(ctx context.Context) error -} - -type validator interface { - Validate() error -} - func convertError(err error) error { if ttnErr, ok := errors.From(err); ok { return ttnErr @@ -75,10 +59,46 @@ func convertError(err error) error { return grpc.Errorf(codes.InvalidArgument, err.Error()) } +func validateMessage(ctx context.Context, fullMethod string, msg interface{}) error { + if v, ok := msg.(interface { + GetFieldMask() types.FieldMask + }); ok { + if forbiddenPaths := forbiddenPaths(v.GetFieldMask().Paths, allowedFieldMaskPaths[fullMethod]); len(forbiddenPaths) > 0 { + return errForbiddenFieldMaskPaths.WithAttributes("forbidden_paths", forbiddenPaths) + } + } + + switch v := msg.(type) { + case interface { + ValidateContext(context.Context) error + }: + if err := v.ValidateContext(ctx); err != nil { + return convertError(err) + } + + case interface { + Validate() error + }: + if err := v.Validate(); err != nil { + return convertError(err) + } + + case interface { + ValidateFields(...string) error + }: + if err := v.ValidateFields(); err != nil { + return convertError(err) + } + + } + return nil +} + // UnaryServerInterceptor returns a new unary server interceptor that validates // incoming messages if those incoming messages implement: // (A) ValidateContext(ctx context.Context) error // (B) Validate() error +// (C) ValidateFields(...string) error // If a message implements both, then (A) should call (B). // // Invalid messages will be rejected with the error returned from the validator, @@ -89,28 +109,33 @@ func convertError(err error) error { // then the field mask paths are validated according to the registered list. func UnaryServerInterceptor() grpc.UnaryServerInterceptor { return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { - if v, ok := req.(fieldMaskGetter); ok { - if forbiddenPaths := forbiddenPaths(v.GetFieldMask().Paths, getAllowedFieldMaskPaths(info.FullMethod)); len(forbiddenPaths) > 0 { - return nil, errForbiddenFieldMaskPaths.WithAttributes("forbidden_paths", forbiddenPaths) - } - } - if v, ok := req.(validatorWithContext); ok { - if err := v.ValidateContext(ctx); err != nil { - return nil, convertError(err) - } - } else if v, ok := req.(validator); ok { - if err := v.Validate(); err != nil { - return nil, convertError(err) - } + if err := validateMessage(ctx, info.FullMethod, req); err != nil { + return nil, err } return handler(ctx, req) } } +type recvWrapper struct { + grpc.ServerStream + fullMethod string +} + +func (s *recvWrapper) RecvMsg(msg interface{}) error { + if err := s.ServerStream.RecvMsg(msg); err != nil { + return err + } + if err := validateMessage(s.Context(), s.fullMethod, msg); err != nil { + return err + } + return nil +} + // StreamServerInterceptor returns a new streaming server interceptor that validates // incoming messages if those incoming messages implement: // (A) ValidateContext(ctx context.Context) error // (B) Validate() error +// (C) ValidateFields(...string) error // If a message implements both, then (A) should call (B). // // Invalid messages will be rejected with the error returned from the validator, @@ -126,34 +151,9 @@ func UnaryServerInterceptor() grpc.UnaryServerInterceptor { // then the field mask paths are validated according to the registered list. func StreamServerInterceptor() grpc.StreamServerInterceptor { return func(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { - wrapper := &recvWrapper{ServerStream: stream, allowedFieldMaskPaths: getAllowedFieldMaskPaths(info.FullMethod)} - return handler(srv, wrapper) - } -} - -type recvWrapper struct { - grpc.ServerStream - allowedFieldMaskPaths map[string]struct{} -} - -func (s *recvWrapper) RecvMsg(m interface{}) error { - if err := s.ServerStream.RecvMsg(m); err != nil { - return err - } - if v, ok := m.(fieldMaskGetter); ok { - requested := v.GetFieldMask().Paths - if forbiddenPaths := forbiddenPaths(requested, s.allowedFieldMaskPaths); len(forbiddenPaths) > 0 { - return errForbiddenFieldMaskPaths.WithAttributes("forbidden_paths", forbiddenPaths) - } + return handler(srv, &recvWrapper{ + ServerStream: stream, + fullMethod: info.FullMethod, + }) } - if v, ok := m.(validatorWithContext); ok { - if err := v.ValidateContext(s.Context()); err != nil { - return convertError(err) - } - } else if v, ok := m.(validator); ok { - if err := v.Validate(); err != nil { - return convertError(err) - } - } - return nil } diff --git a/pkg/ttnpb/_api.pb.validate.go b/pkg/ttnpb/_api.pb.validate.go new file mode 100644 index 0000000000..fb43d9d432 --- /dev/null +++ b/pkg/ttnpb/_api.pb.validate.go @@ -0,0 +1,33 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) diff --git a/pkg/ttnpb/_api.validator.pb.go b/pkg/ttnpb/_api.validator.pb.go deleted file mode 100644 index cb300a21b9..0000000000 --- a/pkg/ttnpb/_api.validator.pb.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/_api.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -/* -The Things Network v3 API -*/ - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf diff --git a/pkg/ttnpb/application.go b/pkg/ttnpb/application.go new file mode 100644 index 0000000000..67e8020d13 --- /dev/null +++ b/pkg/ttnpb/application.go @@ -0,0 +1,29 @@ +// Copyright © 2019 The Things Network Foundation, The Things Industries B.V. +// +// 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. + +package ttnpb + +import ( + "context" +) + +// ValidateContext wraps the generated validator with (optionally context-based) custom checks. +func (m *UpdateApplicationRequest) ValidateContext(context.Context) error { + if len(m.FieldMask.Paths) == 0 { + return m.ValidateFields() + } + return m.ValidateFields(append(fieldsWithPrefix("application", m.FieldMask.Paths...), + "application.ids", + )...) +} diff --git a/pkg/ttnpb/application.pb.go b/pkg/ttnpb/application.pb.go index 7c007628c6..ec75c02074 100644 --- a/pkg/ttnpb/application.pb.go +++ b/pkg/ttnpb/application.pb.go @@ -9,6 +9,7 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" import _ "google.golang.org/genproto/googleapis/api/annotations" import time "time" @@ -50,7 +51,7 @@ type Application struct { func (m *Application) Reset() { *m = Application{} } func (*Application) ProtoMessage() {} func (*Application) Descriptor() ([]byte, []int) { - return fileDescriptor_application_87323d8f274374f4, []int{0} + return fileDescriptor_application_6c273b78dbccb28e, []int{0} } func (m *Application) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -130,7 +131,7 @@ type Applications struct { func (m *Applications) Reset() { *m = Applications{} } func (*Applications) ProtoMessage() {} func (*Applications) Descriptor() ([]byte, []int) { - return fileDescriptor_application_87323d8f274374f4, []int{1} + return fileDescriptor_application_6c273b78dbccb28e, []int{1} } func (m *Applications) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -176,7 +177,7 @@ type GetApplicationRequest struct { func (m *GetApplicationRequest) Reset() { *m = GetApplicationRequest{} } func (*GetApplicationRequest) ProtoMessage() {} func (*GetApplicationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_application_87323d8f274374f4, []int{2} + return fileDescriptor_application_6c273b78dbccb28e, []int{2} } func (m *GetApplicationRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -229,7 +230,7 @@ type ListApplicationsRequest struct { func (m *ListApplicationsRequest) Reset() { *m = ListApplicationsRequest{} } func (*ListApplicationsRequest) ProtoMessage() {} func (*ListApplicationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_application_87323d8f274374f4, []int{3} + return fileDescriptor_application_6c273b78dbccb28e, []int{3} } func (m *ListApplicationsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -304,7 +305,7 @@ type CreateApplicationRequest struct { func (m *CreateApplicationRequest) Reset() { *m = CreateApplicationRequest{} } func (*CreateApplicationRequest) ProtoMessage() {} func (*CreateApplicationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_application_87323d8f274374f4, []int{4} + return fileDescriptor_application_6c273b78dbccb28e, []int{4} } func (m *CreateApplicationRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -350,7 +351,7 @@ type UpdateApplicationRequest struct { func (m *UpdateApplicationRequest) Reset() { *m = UpdateApplicationRequest{} } func (*UpdateApplicationRequest) ProtoMessage() {} func (*UpdateApplicationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_application_87323d8f274374f4, []int{5} + return fileDescriptor_application_6c273b78dbccb28e, []int{5} } func (m *UpdateApplicationRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -397,7 +398,7 @@ type CreateApplicationAPIKeyRequest struct { func (m *CreateApplicationAPIKeyRequest) Reset() { *m = CreateApplicationAPIKeyRequest{} } func (*CreateApplicationAPIKeyRequest) ProtoMessage() {} func (*CreateApplicationAPIKeyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_application_87323d8f274374f4, []int{6} + return fileDescriptor_application_6c273b78dbccb28e, []int{6} } func (m *CreateApplicationAPIKeyRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -450,7 +451,7 @@ type UpdateApplicationAPIKeyRequest struct { func (m *UpdateApplicationAPIKeyRequest) Reset() { *m = UpdateApplicationAPIKeyRequest{} } func (*UpdateApplicationAPIKeyRequest) ProtoMessage() {} func (*UpdateApplicationAPIKeyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_application_87323d8f274374f4, []int{7} + return fileDescriptor_application_6c273b78dbccb28e, []int{7} } func (m *UpdateApplicationAPIKeyRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -489,7 +490,7 @@ type SetApplicationCollaboratorRequest struct { func (m *SetApplicationCollaboratorRequest) Reset() { *m = SetApplicationCollaboratorRequest{} } func (*SetApplicationCollaboratorRequest) ProtoMessage() {} func (*SetApplicationCollaboratorRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_application_87323d8f274374f4, []int{8} + return fileDescriptor_application_6c273b78dbccb28e, []int{8} } func (m *SetApplicationCollaboratorRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3168,67 +3169,70 @@ var ( ) func init() { - proto.RegisterFile("lorawan-stack/api/application.proto", fileDescriptor_application_87323d8f274374f4) + proto.RegisterFile("lorawan-stack/api/application.proto", fileDescriptor_application_6c273b78dbccb28e) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/application.proto", fileDescriptor_application_87323d8f274374f4) -} - -var fileDescriptor_application_87323d8f274374f4 = []byte{ - // 874 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x3d, 0x6c, 0x1c, 0x45, - 0x14, 0x9e, 0xf1, 0x39, 0x0e, 0x37, 0xe7, 0x38, 0x68, 0x45, 0x60, 0x65, 0xa2, 0xe7, 0xe3, 0x40, - 0xc8, 0x12, 0x78, 0x4f, 0x72, 0x1a, 0x40, 0x02, 0x74, 0xb6, 0x48, 0x64, 0x19, 0x64, 0x58, 0x88, - 0x10, 0x34, 0xa7, 0xb9, 0xbd, 0xb9, 0x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, 0x01, - 0xfc, 0x30, 0x01, 0xf4, 0x38, 0x01, 0xfc, 0x24, 0x01, 0xf4, 0x34, 0x01, 0xfc, 0x2c, 0x01, 0x74, - 0x2b, 0x05, 0x74, 0x3b, 0x05, 0x7c, 0x27, 0x05, 0xf4, 0x43, 0x0a, 0xf8, 0xc7, 0x14, 0xd0, 0xdd, - 0x14, 0xd0, 0xbd, 0x14, 0xf0, 0xfd, 0x14, 0xf0, 0x83, 0x14, 0xf0, 0xb7, 0xef, 0xfa, 0xc2, 0x51, - 0x87, 0x4c, 0x1d, 0xf2, 0xd0, 0x8f, 0x9d, 0x90, 0xa9, 0x9b, 0x42, 0xf6, 0x9b, 0xd3, 0xff, 0x0a, - 0x51, 0xdf, 0x6f, 0x2a, 0x15, 0x46, 0x9d, 0xce, 0x8a, 0x1e, 0x86, 0x2b, 0xff, 0x04, 0x00, 0x00, - 0xff, 0xff, 0xcc, 0xd3, 0x2a, 0x54, 0x5d, 0x09, 0x00, 0x00, + golang_proto.RegisterFile("lorawan-stack/api/application.proto", fileDescriptor_application_6c273b78dbccb28e) +} + +var fileDescriptor_application_6c273b78dbccb28e = []byte{ + // 915 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x3d, 0x8c, 0x1b, 0x45, + 0x14, 0xde, 0xb1, 0xef, 0x2e, 0x78, 0x7c, 0xb9, 0x44, 0x2b, 0x02, 0xab, 0x23, 0x9a, 0x33, 0x06, + 0xa1, 0x93, 0xc0, 0x6b, 0xe9, 0xd2, 0x20, 0x10, 0x20, 0xdb, 0x02, 0x74, 0xba, 0xa0, 0x4b, 0x16, + 0xd2, 0xd0, 0x58, 0xe3, 0xf5, 0x78, 0x6f, 0xe4, 0xf5, 0xce, 0xb2, 0xfb, 0x7c, 0x91, 0xa9, 0x52, + 0x46, 0x54, 0x29, 0x29, 0x11, 0x55, 0x2a, 0x94, 0x32, 0x42, 0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 0x74, 0x37, 0x21, 0xc6, 0xfd, 0x84, 0xa0, 0x07, 0x09, 0x31, 0x1e, 0x26, 0xc4, 0x38, 0x4a, + 0x88, 0x71, 0x9c, 0x10, 0x74, 0x92, 0x10, 0xf4, 0x28, 0x21, 0xc6, 0x93, 0x84, 0xa0, 0xa7, 0x09, + 0x31, 0x9e, 0x25, 0x04, 0x3d, 0x4f, 0x88, 0x71, 0x27, 0x25, 0xc6, 0xdd, 0x94, 0xa0, 0x7b, 0x29, + 0x31, 0xbe, 0x4f, 0x09, 0xfa, 0x21, 0x25, 0xc6, 0xfd, 0x94, 0x18, 0x0f, 0x52, 0x82, 0x1e, 0xa6, + 0x04, 0x1d, 0xa5, 0x04, 0x7d, 0xfd, 0x9e, 0x27, 0x6c, 0x38, 0x60, 0x70, 0xc0, 0x03, 0x2f, 0xb6, + 0x03, 0x06, 0xb7, 0x45, 0xd4, 0xaf, 0xcf, 0xfe, 0x8f, 0x84, 0x7d, 0xaf, 0x0e, 0x10, 0x84, 0x9d, + 0xce, 0x9a, 0x1a, 0x9f, 0x6b, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x84, 0x3e, 0x53, 0x60, 0xfe, + 0x09, 0x00, 0x00, } diff --git a/pkg/ttnpb/application.pb.paths.fm.go b/pkg/ttnpb/application.pb.paths.fm.go new file mode 100644 index 0000000000..db2520ceea --- /dev/null +++ b/pkg/ttnpb/application.pb.paths.fm.go @@ -0,0 +1,146 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var ApplicationFieldPathsNested = []string{ + "attributes", + "contact_info", + "created_at", + "description", + "ids", + "ids.application_id", + "name", + "updated_at", +} + +var ApplicationFieldPathsTopLevel = []string{ + "attributes", + "contact_info", + "created_at", + "description", + "ids", + "name", + "updated_at", +} +var ApplicationsFieldPathsNested = []string{ + "applications", +} + +var ApplicationsFieldPathsTopLevel = []string{ + "applications", +} +var GetApplicationRequestFieldPathsNested = []string{ + "application_ids", + "application_ids.application_id", + "field_mask", +} + +var GetApplicationRequestFieldPathsTopLevel = []string{ + "application_ids", + "field_mask", +} +var ListApplicationsRequestFieldPathsNested = []string{ + "collaborator", + "collaborator.ids", + "collaborator.ids.organization_ids", + "collaborator.ids.organization_ids.organization_id", + "collaborator.ids.user_ids", + "collaborator.ids.user_ids.email", + "collaborator.ids.user_ids.user_id", + "field_mask", + "limit", + "order", + "page", +} + +var ListApplicationsRequestFieldPathsTopLevel = []string{ + "collaborator", + "field_mask", + "limit", + "order", + "page", +} +var CreateApplicationRequestFieldPathsNested = []string{ + "application", + "application.attributes", + "application.contact_info", + "application.created_at", + "application.description", + "application.ids", + "application.ids.application_id", + "application.name", + "application.updated_at", + "collaborator", + "collaborator.ids", + "collaborator.ids.organization_ids", + "collaborator.ids.organization_ids.organization_id", + "collaborator.ids.user_ids", + "collaborator.ids.user_ids.email", + "collaborator.ids.user_ids.user_id", +} + +var CreateApplicationRequestFieldPathsTopLevel = []string{ + "application", + "collaborator", +} +var UpdateApplicationRequestFieldPathsNested = []string{ + "application", + "application.attributes", + "application.contact_info", + "application.created_at", + "application.description", + "application.ids", + "application.ids.application_id", + "application.name", + "application.updated_at", + "field_mask", +} + +var UpdateApplicationRequestFieldPathsTopLevel = []string{ + "application", + "field_mask", +} +var CreateApplicationAPIKeyRequestFieldPathsNested = []string{ + "application_ids", + "application_ids.application_id", + "name", + "rights", +} + +var CreateApplicationAPIKeyRequestFieldPathsTopLevel = []string{ + "application_ids", + "name", + "rights", +} +var UpdateApplicationAPIKeyRequestFieldPathsNested = []string{ + "api_key", + "api_key.id", + "api_key.key", + "api_key.name", + "api_key.rights", + "application_ids", + "application_ids.application_id", +} + +var UpdateApplicationAPIKeyRequestFieldPathsTopLevel = []string{ + "api_key", + "application_ids", +} +var SetApplicationCollaboratorRequestFieldPathsNested = []string{ + "application_ids", + "application_ids.application_id", + "collaborator", + "collaborator.ids", + "collaborator.ids.ids", + "collaborator.ids.ids.organization_ids", + "collaborator.ids.ids.organization_ids.organization_id", + "collaborator.ids.ids.user_ids", + "collaborator.ids.ids.user_ids.email", + "collaborator.ids.ids.user_ids.user_id", + "collaborator.rights", +} + +var SetApplicationCollaboratorRequestFieldPathsTopLevel = []string{ + "application_ids", + "collaborator", +} diff --git a/pkg/ttnpb/application.pb.fm.go b/pkg/ttnpb/application.pb.setters.fm.go similarity index 75% rename from pkg/ttnpb/application.pb.fm.go rename to pkg/ttnpb/application.pb.setters.fm.go index cb976955da..ff7cb0feee 100644 --- a/pkg/ttnpb/application.pb.fm.go +++ b/pkg/ttnpb/application.pb.setters.fm.go @@ -6,30 +6,9 @@ import ( fmt "fmt" time "time" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + types "github.com/gogo/protobuf/types" ) -var ApplicationFieldPathsNested = []string{ - "attributes", - "contact_info", - "created_at", - "description", - "ids", - "ids.application_id", - "name", - "updated_at", -} - -var ApplicationFieldPathsTopLevel = []string{ - "attributes", - "contact_info", - "created_at", - "description", - "ids", - "name", - "updated_at", -} - func (dst *Application) SetFields(src *Application, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -117,14 +96,6 @@ func (dst *Application) SetFields(src *Application, paths ...string) error { return nil } -var ApplicationsFieldPathsNested = []string{ - "applications", -} - -var ApplicationsFieldPathsTopLevel = []string{ - "applications", -} - func (dst *Applications) SetFields(src *Applications, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -145,17 +116,6 @@ func (dst *Applications) SetFields(src *Applications, paths ...string) error { return nil } -var GetApplicationRequestFieldPathsNested = []string{ - "application_ids", - "application_ids.application_id", - "field_mask", -} - -var GetApplicationRequestFieldPathsTopLevel = []string{ - "application_ids", - "field_mask", -} - func (dst *GetApplicationRequest) SetFields(src *GetApplicationRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -184,7 +144,7 @@ func (dst *GetApplicationRequest) SetFields(src *GetApplicationRequest, paths .. if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } @@ -195,28 +155,6 @@ func (dst *GetApplicationRequest) SetFields(src *GetApplicationRequest, paths .. return nil } -var ListApplicationsRequestFieldPathsNested = []string{ - "collaborator", - "collaborator.ids", - "collaborator.ids.organization_ids", - "collaborator.ids.organization_ids.organization_id", - "collaborator.ids.user_ids", - "collaborator.ids.user_ids.email", - "collaborator.ids.user_ids.user_id", - "field_mask", - "limit", - "order", - "page", -} - -var ListApplicationsRequestFieldPathsTopLevel = []string{ - "collaborator", - "field_mask", - "limit", - "order", - "page", -} - func (dst *ListApplicationsRequest) SetFields(src *ListApplicationsRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -248,7 +186,7 @@ func (dst *ListApplicationsRequest) SetFields(src *ListApplicationsRequest, path if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } case "order": @@ -289,30 +227,6 @@ func (dst *ListApplicationsRequest) SetFields(src *ListApplicationsRequest, path return nil } -var CreateApplicationRequestFieldPathsNested = []string{ - "application", - "application.attributes", - "application.contact_info", - "application.created_at", - "application.description", - "application.ids", - "application.ids.application_id", - "application.name", - "application.updated_at", - "collaborator", - "collaborator.ids", - "collaborator.ids.organization_ids", - "collaborator.ids.organization_ids.organization_id", - "collaborator.ids.user_ids", - "collaborator.ids.user_ids.email", - "collaborator.ids.user_ids.user_id", -} - -var CreateApplicationRequestFieldPathsTopLevel = []string{ - "application", - "collaborator", -} - func (dst *CreateApplicationRequest) SetFields(src *CreateApplicationRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -360,24 +274,6 @@ func (dst *CreateApplicationRequest) SetFields(src *CreateApplicationRequest, pa return nil } -var UpdateApplicationRequestFieldPathsNested = []string{ - "application", - "application.attributes", - "application.contact_info", - "application.created_at", - "application.description", - "application.ids", - "application.ids.application_id", - "application.name", - "application.updated_at", - "field_mask", -} - -var UpdateApplicationRequestFieldPathsTopLevel = []string{ - "application", - "field_mask", -} - func (dst *UpdateApplicationRequest) SetFields(src *UpdateApplicationRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -406,7 +302,7 @@ func (dst *UpdateApplicationRequest) SetFields(src *UpdateApplicationRequest, pa if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } @@ -417,19 +313,6 @@ func (dst *UpdateApplicationRequest) SetFields(src *UpdateApplicationRequest, pa return nil } -var CreateApplicationAPIKeyRequestFieldPathsNested = []string{ - "application_ids", - "application_ids.application_id", - "name", - "rights", -} - -var CreateApplicationAPIKeyRequestFieldPathsTopLevel = []string{ - "application_ids", - "name", - "rights", -} - func (dst *CreateApplicationAPIKeyRequest) SetFields(src *CreateApplicationAPIKeyRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -478,21 +361,6 @@ func (dst *CreateApplicationAPIKeyRequest) SetFields(src *CreateApplicationAPIKe return nil } -var UpdateApplicationAPIKeyRequestFieldPathsNested = []string{ - "api_key", - "api_key.id", - "api_key.key", - "api_key.name", - "api_key.rights", - "application_ids", - "application_ids.application_id", -} - -var UpdateApplicationAPIKeyRequestFieldPathsTopLevel = []string{ - "api_key", - "application_ids", -} - func (dst *UpdateApplicationAPIKeyRequest) SetFields(src *UpdateApplicationAPIKeyRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -540,25 +408,6 @@ func (dst *UpdateApplicationAPIKeyRequest) SetFields(src *UpdateApplicationAPIKe return nil } -var SetApplicationCollaboratorRequestFieldPathsNested = []string{ - "application_ids", - "application_ids.application_id", - "collaborator", - "collaborator.ids", - "collaborator.ids.ids", - "collaborator.ids.ids.organization_ids", - "collaborator.ids.ids.organization_ids.organization_id", - "collaborator.ids.ids.user_ids", - "collaborator.ids.ids.user_ids.email", - "collaborator.ids.ids.user_ids.user_id", - "collaborator.rights", -} - -var SetApplicationCollaboratorRequestFieldPathsTopLevel = []string{ - "application_ids", - "collaborator", -} - func (dst *SetApplicationCollaboratorRequest) SetFields(src *SetApplicationCollaboratorRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { diff --git a/pkg/ttnpb/application.pb.validate.go b/pkg/ttnpb/application.pb.validate.go new file mode 100644 index 0000000000..f33cdec6db --- /dev/null +++ b/pkg/ttnpb/application.pb.validate.go @@ -0,0 +1,1005 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on Application with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *Application) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ApplicationFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "ids": + + if v, ok := interface{}(&m.ApplicationIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationValidationError{ + field: "ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "created_at": + + if v, ok := interface{}(&m.CreatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationValidationError{ + field: "created_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "updated_at": + + if v, ok := interface{}(&m.UpdatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationValidationError{ + field: "updated_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "name": + // no validation rules for Name + case "description": + // no validation rules for Description + case "attributes": + // no validation rules for Attributes + case "contact_info": + + for idx, item := range m.GetContactInfo() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationValidationError{ + field: fmt.Sprintf("contact_info[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + default: + return ApplicationValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ApplicationValidationError is the validation error returned by +// Application.ValidateFields if the designated constraints aren't met. +type ApplicationValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ApplicationValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ApplicationValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ApplicationValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ApplicationValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ApplicationValidationError) ErrorName() string { return "ApplicationValidationError" } + +// Error satisfies the builtin error interface +func (e ApplicationValidationError) 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 %sApplication.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ApplicationValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ApplicationValidationError{} + +// ValidateFields checks the field values on Applications with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *Applications) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ApplicationsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "applications": + + for idx, item := range m.GetApplications() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationsValidationError{ + field: fmt.Sprintf("applications[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + default: + return ApplicationsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ApplicationsValidationError is the validation error returned by +// Applications.ValidateFields if the designated constraints aren't met. +type ApplicationsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ApplicationsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ApplicationsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ApplicationsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ApplicationsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ApplicationsValidationError) ErrorName() string { return "ApplicationsValidationError" } + +// Error satisfies the builtin error interface +func (e ApplicationsValidationError) 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 %sApplications.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ApplicationsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ApplicationsValidationError{} + +// ValidateFields checks the field values on GetApplicationRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GetApplicationRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GetApplicationRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "application_ids": + + if v, ok := interface{}(&m.ApplicationIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GetApplicationRequestValidationError{ + field: "application_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GetApplicationRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return GetApplicationRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GetApplicationRequestValidationError is the validation error returned by +// GetApplicationRequest.ValidateFields if the designated constraints aren't met. +type GetApplicationRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetApplicationRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetApplicationRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetApplicationRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetApplicationRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetApplicationRequestValidationError) ErrorName() string { + return "GetApplicationRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetApplicationRequestValidationError) 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 %sGetApplicationRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetApplicationRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetApplicationRequestValidationError{} + +// ValidateFields checks the field values on ListApplicationsRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ListApplicationsRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ListApplicationsRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "collaborator": + + if v, ok := interface{}(m.GetCollaborator()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ListApplicationsRequestValidationError{ + field: "collaborator", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ListApplicationsRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "order": + // no validation rules for Order + case "limit": + // no validation rules for Limit + case "page": + // no validation rules for Page + default: + return ListApplicationsRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ListApplicationsRequestValidationError is the validation error returned by +// ListApplicationsRequest.ValidateFields if the designated constraints aren't met. +type ListApplicationsRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListApplicationsRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListApplicationsRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListApplicationsRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListApplicationsRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListApplicationsRequestValidationError) ErrorName() string { + return "ListApplicationsRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e ListApplicationsRequestValidationError) 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 %sListApplicationsRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListApplicationsRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListApplicationsRequestValidationError{} + +// ValidateFields checks the field values on CreateApplicationRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *CreateApplicationRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = CreateApplicationRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "application": + + if v, ok := interface{}(&m.Application).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return CreateApplicationRequestValidationError{ + field: "application", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "collaborator": + + if v, ok := interface{}(&m.Collaborator).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return CreateApplicationRequestValidationError{ + field: "collaborator", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return CreateApplicationRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// CreateApplicationRequestValidationError is the validation error returned by +// CreateApplicationRequest.ValidateFields if the designated constraints +// aren't met. +type CreateApplicationRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CreateApplicationRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CreateApplicationRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CreateApplicationRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CreateApplicationRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CreateApplicationRequestValidationError) ErrorName() string { + return "CreateApplicationRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e CreateApplicationRequestValidationError) 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 %sCreateApplicationRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CreateApplicationRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CreateApplicationRequestValidationError{} + +// ValidateFields checks the field values on UpdateApplicationRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *UpdateApplicationRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = UpdateApplicationRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "application": + + if v, ok := interface{}(&m.Application).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UpdateApplicationRequestValidationError{ + field: "application", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UpdateApplicationRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return UpdateApplicationRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// UpdateApplicationRequestValidationError is the validation error returned by +// UpdateApplicationRequest.ValidateFields if the designated constraints +// aren't met. +type UpdateApplicationRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UpdateApplicationRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UpdateApplicationRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UpdateApplicationRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UpdateApplicationRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UpdateApplicationRequestValidationError) ErrorName() string { + return "UpdateApplicationRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e UpdateApplicationRequestValidationError) 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 %sUpdateApplicationRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UpdateApplicationRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UpdateApplicationRequestValidationError{} + +// ValidateFields checks the field values on CreateApplicationAPIKeyRequest +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *CreateApplicationAPIKeyRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = CreateApplicationAPIKeyRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "application_ids": + + if v, ok := interface{}(&m.ApplicationIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return CreateApplicationAPIKeyRequestValidationError{ + field: "application_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "name": + // no validation rules for Name + case "rights": + + default: + return CreateApplicationAPIKeyRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// CreateApplicationAPIKeyRequestValidationError is the validation error +// returned by CreateApplicationAPIKeyRequest.ValidateFields if the designated +// constraints aren't met. +type CreateApplicationAPIKeyRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CreateApplicationAPIKeyRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CreateApplicationAPIKeyRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CreateApplicationAPIKeyRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CreateApplicationAPIKeyRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CreateApplicationAPIKeyRequestValidationError) ErrorName() string { + return "CreateApplicationAPIKeyRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e CreateApplicationAPIKeyRequestValidationError) 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 %sCreateApplicationAPIKeyRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CreateApplicationAPIKeyRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CreateApplicationAPIKeyRequestValidationError{} + +// ValidateFields checks the field values on UpdateApplicationAPIKeyRequest +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *UpdateApplicationAPIKeyRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = UpdateApplicationAPIKeyRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "application_ids": + + if v, ok := interface{}(&m.ApplicationIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UpdateApplicationAPIKeyRequestValidationError{ + field: "application_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "api_key": + + if v, ok := interface{}(&m.APIKey).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UpdateApplicationAPIKeyRequestValidationError{ + field: "api_key", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return UpdateApplicationAPIKeyRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// UpdateApplicationAPIKeyRequestValidationError is the validation error +// returned by UpdateApplicationAPIKeyRequest.ValidateFields if the designated +// constraints aren't met. +type UpdateApplicationAPIKeyRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UpdateApplicationAPIKeyRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UpdateApplicationAPIKeyRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UpdateApplicationAPIKeyRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UpdateApplicationAPIKeyRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UpdateApplicationAPIKeyRequestValidationError) ErrorName() string { + return "UpdateApplicationAPIKeyRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e UpdateApplicationAPIKeyRequestValidationError) 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 %sUpdateApplicationAPIKeyRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UpdateApplicationAPIKeyRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UpdateApplicationAPIKeyRequestValidationError{} + +// ValidateFields checks the field values on SetApplicationCollaboratorRequest +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *SetApplicationCollaboratorRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = SetApplicationCollaboratorRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "application_ids": + + if v, ok := interface{}(&m.ApplicationIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SetApplicationCollaboratorRequestValidationError{ + field: "application_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "collaborator": + + if v, ok := interface{}(&m.Collaborator).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SetApplicationCollaboratorRequestValidationError{ + field: "collaborator", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return SetApplicationCollaboratorRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// SetApplicationCollaboratorRequestValidationError is the validation error +// returned by SetApplicationCollaboratorRequest.ValidateFields if the +// designated constraints aren't met. +type SetApplicationCollaboratorRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SetApplicationCollaboratorRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SetApplicationCollaboratorRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SetApplicationCollaboratorRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SetApplicationCollaboratorRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SetApplicationCollaboratorRequestValidationError) ErrorName() string { + return "SetApplicationCollaboratorRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e SetApplicationCollaboratorRequestValidationError) 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 %sSetApplicationCollaboratorRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SetApplicationCollaboratorRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SetApplicationCollaboratorRequestValidationError{} diff --git a/pkg/ttnpb/application.validator.pb.go b/pkg/ttnpb/application.validator.pb.go deleted file mode 100644 index 86ffec27a2..0000000000 --- a/pkg/ttnpb/application.validator.pb.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/application.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/timestamp" -import _ "google.golang.org/genproto/googleapis/api/annotations" -import _ "google.golang.org/genproto/protobuf/field_mask" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *Application) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ApplicationIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.CreatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("CreatedAt", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UpdatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UpdatedAt", err) - } - // Validation of proto3 map<> fields is unsupported. - for _, item := range this.ContactInfo { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ContactInfo", err) - } - } - } - return nil -} -func (this *Applications) Validate() error { - for _, item := range this.Applications { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Applications", err) - } - } - } - return nil -} -func (this *GetApplicationRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ApplicationIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *ListApplicationsRequest) Validate() error { - if this.Collaborator != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Collaborator); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Collaborator", err) - } - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *CreateApplicationRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Application)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Application", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Collaborator)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Collaborator", err) - } - return nil -} -func (this *UpdateApplicationRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Application)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Application", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *CreateApplicationAPIKeyRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ApplicationIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationIdentifiers", err) - } - return nil -} -func (this *UpdateApplicationAPIKeyRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ApplicationIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.APIKey)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("APIKey", err) - } - return nil -} -func (this *SetApplicationCollaboratorRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ApplicationIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Collaborator)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Collaborator", err) - } - return nil -} diff --git a/pkg/ttnpb/application_services.pb.gw.go b/pkg/ttnpb/application_services.pb.gw.go index b3514531ee..fa11ae3794 100644 --- a/pkg/ttnpb/application_services.pb.gw.go +++ b/pkg/ttnpb/application_services.pb.gw.go @@ -9,11 +9,10 @@ It translates gRPC into RESTful JSON APIs. package ttnpb import ( + "context" "io" "net/http" - "context" - "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" diff --git a/pkg/ttnpb/application_services.pb.validate.go b/pkg/ttnpb/application_services.pb.validate.go new file mode 100644 index 0000000000..fb43d9d432 --- /dev/null +++ b/pkg/ttnpb/application_services.pb.validate.go @@ -0,0 +1,33 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) diff --git a/pkg/ttnpb/application_services.validator.pb.go b/pkg/ttnpb/application_services.validator.pb.go deleted file mode 100644 index 8d86751d34..0000000000 --- a/pkg/ttnpb/application_services.validator.pb.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/application_services.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/empty" -import _ "google.golang.org/genproto/googleapis/api/annotations" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen diff --git a/pkg/ttnpb/applicationserver.go b/pkg/ttnpb/applicationserver.go new file mode 100644 index 0000000000..0a3ce53f33 --- /dev/null +++ b/pkg/ttnpb/applicationserver.go @@ -0,0 +1,29 @@ +// Copyright © 2019 The Things Network Foundation, The Things Industries B.V. +// +// 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. + +package ttnpb + +import ( + "context" +) + +// ValidateContext wraps the generated validator with (optionally context-based) custom checks. +func (m *SetApplicationLinkRequest) ValidateContext(context.Context) error { + if len(m.FieldMask.Paths) == 0 { + return m.ValidateFields() + } + return m.ValidateFields(append(fieldsWithPrefix("link", m.FieldMask.Paths...), + "application_ids", + )...) +} diff --git a/pkg/ttnpb/applicationserver.pb.go b/pkg/ttnpb/applicationserver.pb.go index e1c39b3939..5c70de9886 100644 --- a/pkg/ttnpb/applicationserver.pb.go +++ b/pkg/ttnpb/applicationserver.pb.go @@ -9,7 +9,7 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import types "github.com/gogo/protobuf/types" -import _ "github.com/mwitkow/go-proto-validators" +import _ "github.com/lyft/protoc-gen-validate/validate" import _ "google.golang.org/genproto/googleapis/api/annotations" import time "time" @@ -55,7 +55,7 @@ type ApplicationLink struct { func (m *ApplicationLink) Reset() { *m = ApplicationLink{} } func (*ApplicationLink) ProtoMessage() {} func (*ApplicationLink) Descriptor() ([]byte, []int) { - return fileDescriptor_applicationserver_fd6744fee21f219e, []int{0} + return fileDescriptor_applicationserver_3632194468baadab, []int{0} } func (m *ApplicationLink) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -115,7 +115,7 @@ type GetApplicationLinkRequest struct { func (m *GetApplicationLinkRequest) Reset() { *m = GetApplicationLinkRequest{} } func (*GetApplicationLinkRequest) ProtoMessage() {} func (*GetApplicationLinkRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_applicationserver_fd6744fee21f219e, []int{1} + return fileDescriptor_applicationserver_3632194468baadab, []int{1} } func (m *GetApplicationLinkRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -162,7 +162,7 @@ type SetApplicationLinkRequest struct { func (m *SetApplicationLinkRequest) Reset() { *m = SetApplicationLinkRequest{} } func (*SetApplicationLinkRequest) ProtoMessage() {} func (*SetApplicationLinkRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_applicationserver_fd6744fee21f219e, []int{2} + return fileDescriptor_applicationserver_3632194468baadab, []int{2} } func (m *SetApplicationLinkRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -218,7 +218,7 @@ type ApplicationLinkStats struct { func (m *ApplicationLinkStats) Reset() { *m = ApplicationLinkStats{} } func (*ApplicationLinkStats) ProtoMessage() {} func (*ApplicationLinkStats) Descriptor() ([]byte, []int) { - return fileDescriptor_applicationserver_fd6744fee21f219e, []int{3} + return fileDescriptor_applicationserver_3632194468baadab, []int{3} } func (m *ApplicationLinkStats) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2132,91 +2132,91 @@ var ( ) func init() { - proto.RegisterFile("lorawan-stack/api/applicationserver.proto", fileDescriptor_applicationserver_fd6744fee21f219e) + proto.RegisterFile("lorawan-stack/api/applicationserver.proto", fileDescriptor_applicationserver_3632194468baadab) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/applicationserver.proto", fileDescriptor_applicationserver_fd6744fee21f219e) -} - -var fileDescriptor_applicationserver_fd6744fee21f219e = []byte{ - // 1257 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x97, 0x4f, 0x8c, 0x13, 0x55, - 0x1c, 0xc7, 0xe7, 0x75, 0xcb, 0x2e, 0xfb, 0x50, 0xfe, 0x0c, 0x04, 0x77, 0xab, 0xbe, 0x6e, 0x06, - 0x24, 0x6d, 0x43, 0x67, 0xb0, 0x20, 0xd1, 0x1a, 0xdd, 0xcc, 0x0a, 0xac, 0x08, 0x1b, 0xb1, 0x85, - 0xa8, 0xcb, 0x9f, 0xe6, 0xb5, 0xf3, 0xda, 0x9d, 0xb4, 0x9d, 0x19, 0xe7, 0xbd, 0xd9, 0x5a, 0xfe, - 0x24, 0xc4, 0x18, 0xe5, 0xe0, 0x81, 0x68, 0x48, 0x38, 0x1a, 0x4f, 0x1c, 0x89, 0xc6, 0xc0, 0xc9, - 0x90, 0x78, 0x21, 0x7a, 0xc1, 0x78, 0x21, 0x31, 0x01, 0x3a, 0xf5, 0x40, 0xe2, 0x85, 0x93, 0xe1, - 0x62, 0x62, 0xe6, 0xcd, 0xf4, 0x3f, 0x85, 0xee, 0x4a, 0xf0, 0xf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xd2, 0x44, 0xc2, 0xd5, 0x26, 0x02, 0xd7, 0x9b, 0x08, 0xdc, 0x68, 0x22, 0xb0, 0xb8, 0xb3, 0x64, - 0xca, 0x6c, 0x89, 0xb0, 0x25, 0xdd, 0x28, 0x51, 0x39, 0xf8, 0xfc, 0x51, 0x7a, 0xff, 0xb1, 0x58, - 0xe5, 0x92, 0xc2, 0x98, 0x61, 0xe5, 0xf3, 0xe3, 0xbc, 0x07, 0xbb, 0xff, 0x0d, 0x00, 0x00, 0xff, - 0xff, 0x3e, 0x78, 0xd5, 0x93, 0x3c, 0x0e, 0x00, 0x00, + golang_proto.RegisterFile("lorawan-stack/api/applicationserver.proto", fileDescriptor_applicationserver_3632194468baadab) +} + +var fileDescriptor_applicationserver_3632194468baadab = []byte{ + // 1263 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x97, 0x4b, 0x6c, 0x1b, 0x45, + 0x18, 0xc7, 0x77, 0x1c, 0x27, 0x69, 0xa6, 0xd0, 0xc7, 0xb4, 0x2a, 0x89, 0x81, 0x49, 0xb4, 0x2d, + 0x95, 0x13, 0xc5, 0xbb, 0xc5, 0x05, 0x04, 0xa9, 0x20, 0xda, 0xd0, 0x36, 0x94, 0x36, 0xa2, 0xd8, + 0xad, 0x90, 0xd2, 0x87, 0x35, 0xf1, 0x8e, 0x9d, 0x95, 0xd7, 0xbb, 0xcb, 0xce, 0x6c, 0x82, 0xfb, + 0x90, 0x2a, 0x84, 0xa0, 0xea, 0xa9, 0x80, 0x2a, 0xf5, 0x88, 0x38, 0xf5, 0x58, 0x81, 0x10, 0x15, + 0x07, 0x54, 0x4e, 0x54, 0x70, 0x29, 0xe2, 0xd2, 0x53, 0xa9, 0xd7, 0x1c, 0x8a, 0xb8, 0xf4, 0xd8, + 0x23, 0xda, 0xd9, 0xf5, 0x3b, 0x49, 0xdd, 0x50, 0x15, 0x71, 0x9b, 0xdd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xe0, 0xab, 0x1a, 0x96, 0xae, 0xd5, 0xb0, 0x74, 0xbd, 0x86, 0xc1, 0x8d, 0x1a, 0x06, 0x37, + 0x6b, 0x18, 0xcc, 0x4f, 0x16, 0x6d, 0x85, 0x2f, 0x52, 0xbe, 0x68, 0x58, 0x45, 0xa6, 0x44, 0x9f, + 0x3f, 0x6a, 0xfb, 0x5f, 0x2d, 0xa7, 0x54, 0x54, 0x39, 0xb7, 0x9c, 0x85, 0x85, 0x01, 0x91, 0x83, + 0xbd, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0xa6, 0x90, 0x3e, 0x72, 0xfa, 0x0e, 0x00, 0x00, } diff --git a/pkg/ttnpb/applicationserver.pb.gw.go b/pkg/ttnpb/applicationserver.pb.gw.go index 3689bf027e..2e6f88cd82 100644 --- a/pkg/ttnpb/applicationserver.pb.gw.go +++ b/pkg/ttnpb/applicationserver.pb.gw.go @@ -9,11 +9,10 @@ It translates gRPC into RESTful JSON APIs. package ttnpb import ( + "context" "io" "net/http" - "context" - "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" diff --git a/pkg/ttnpb/applicationserver.pb.paths.fm.go b/pkg/ttnpb/applicationserver.pb.paths.fm.go new file mode 100644 index 0000000000..11c743528a --- /dev/null +++ b/pkg/ttnpb/applicationserver.pb.paths.fm.go @@ -0,0 +1,65 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var ApplicationLinkFieldPathsNested = []string{ + "api_key", + "default_formatters", + "default_formatters.down_formatter", + "default_formatters.down_formatter_parameter", + "default_formatters.up_formatter", + "default_formatters.up_formatter_parameter", + "network_server_address", +} + +var ApplicationLinkFieldPathsTopLevel = []string{ + "api_key", + "default_formatters", + "network_server_address", +} +var GetApplicationLinkRequestFieldPathsNested = []string{ + "application_ids", + "application_ids.application_id", + "field_mask", +} + +var GetApplicationLinkRequestFieldPathsTopLevel = []string{ + "application_ids", + "field_mask", +} +var SetApplicationLinkRequestFieldPathsNested = []string{ + "application_ids", + "application_ids.application_id", + "field_mask", + "link", + "link.api_key", + "link.default_formatters", + "link.default_formatters.down_formatter", + "link.default_formatters.down_formatter_parameter", + "link.default_formatters.up_formatter", + "link.default_formatters.up_formatter_parameter", + "link.network_server_address", +} + +var SetApplicationLinkRequestFieldPathsTopLevel = []string{ + "application_ids", + "field_mask", + "link", +} +var ApplicationLinkStatsFieldPathsNested = []string{ + "downlink_count", + "last_downlink_forwarded_at", + "last_up_received_at", + "linked_at", + "network_server_address", + "up_count", +} + +var ApplicationLinkStatsFieldPathsTopLevel = []string{ + "downlink_count", + "last_downlink_forwarded_at", + "last_up_received_at", + "linked_at", + "network_server_address", + "up_count", +} diff --git a/pkg/ttnpb/applicationserver.pb.fm.go b/pkg/ttnpb/applicationserver.pb.setters.fm.go similarity index 77% rename from pkg/ttnpb/applicationserver.pb.fm.go rename to pkg/ttnpb/applicationserver.pb.setters.fm.go index 559072dbc6..2177d7246c 100644 --- a/pkg/ttnpb/applicationserver.pb.fm.go +++ b/pkg/ttnpb/applicationserver.pb.setters.fm.go @@ -5,25 +5,9 @@ package ttnpb import ( fmt "fmt" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + types "github.com/gogo/protobuf/types" ) -var ApplicationLinkFieldPathsNested = []string{ - "api_key", - "default_formatters", - "default_formatters.down_formatter", - "default_formatters.down_formatter_parameter", - "default_formatters.up_formatter", - "default_formatters.up_formatter_parameter", - "network_server_address", -} - -var ApplicationLinkFieldPathsTopLevel = []string{ - "api_key", - "default_formatters", - "network_server_address", -} - func (dst *ApplicationLink) SetFields(src *ApplicationLink, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -76,17 +60,6 @@ func (dst *ApplicationLink) SetFields(src *ApplicationLink, paths ...string) err return nil } -var GetApplicationLinkRequestFieldPathsNested = []string{ - "application_ids", - "application_ids.application_id", - "field_mask", -} - -var GetApplicationLinkRequestFieldPathsTopLevel = []string{ - "application_ids", - "field_mask", -} - func (dst *GetApplicationLinkRequest) SetFields(src *GetApplicationLinkRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -115,7 +88,7 @@ func (dst *GetApplicationLinkRequest) SetFields(src *GetApplicationLinkRequest, if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } @@ -126,26 +99,6 @@ func (dst *GetApplicationLinkRequest) SetFields(src *GetApplicationLinkRequest, return nil } -var SetApplicationLinkRequestFieldPathsNested = []string{ - "application_ids", - "application_ids.application_id", - "field_mask", - "link", - "link.api_key", - "link.default_formatters", - "link.default_formatters.down_formatter", - "link.default_formatters.down_formatter_parameter", - "link.default_formatters.up_formatter", - "link.default_formatters.up_formatter_parameter", - "link.network_server_address", -} - -var SetApplicationLinkRequestFieldPathsTopLevel = []string{ - "application_ids", - "field_mask", - "link", -} - func (dst *SetApplicationLinkRequest) SetFields(src *SetApplicationLinkRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -192,7 +145,7 @@ func (dst *SetApplicationLinkRequest) SetFields(src *SetApplicationLinkRequest, if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } @@ -203,24 +156,6 @@ func (dst *SetApplicationLinkRequest) SetFields(src *SetApplicationLinkRequest, return nil } -var ApplicationLinkStatsFieldPathsNested = []string{ - "downlink_count", - "last_downlink_forwarded_at", - "last_up_received_at", - "linked_at", - "network_server_address", - "up_count", -} - -var ApplicationLinkStatsFieldPathsTopLevel = []string{ - "downlink_count", - "last_downlink_forwarded_at", - "last_up_received_at", - "linked_at", - "network_server_address", - "up_count", -} - func (dst *ApplicationLinkStats) SetFields(src *ApplicationLinkStats, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { diff --git a/pkg/ttnpb/applicationserver.pb.validate.go b/pkg/ttnpb/applicationserver.pb.validate.go new file mode 100644 index 0000000000..53d24453e9 --- /dev/null +++ b/pkg/ttnpb/applicationserver.pb.validate.go @@ -0,0 +1,500 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on ApplicationLink with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ApplicationLink) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ApplicationLinkFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "network_server_address": + + if !_ApplicationLink_NetworkServerAddress_Pattern.MatchString(m.GetNetworkServerAddress()) { + return ApplicationLinkValidationError{ + field: "network_server_address", + reason: "value does not match regex pattern \"^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$\"", + } + } + + case "api_key": + + if utf8.RuneCountInString(m.GetAPIKey()) < 1 { + return ApplicationLinkValidationError{ + field: "api_key", + reason: "value length must be at least 1 runes", + } + } + + case "default_formatters": + + if v, ok := interface{}(m.GetDefaultFormatters()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationLinkValidationError{ + field: "default_formatters", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return ApplicationLinkValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ApplicationLinkValidationError is the validation error returned by +// ApplicationLink.ValidateFields if the designated constraints aren't met. +type ApplicationLinkValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ApplicationLinkValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ApplicationLinkValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ApplicationLinkValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ApplicationLinkValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ApplicationLinkValidationError) ErrorName() string { return "ApplicationLinkValidationError" } + +// Error satisfies the builtin error interface +func (e ApplicationLinkValidationError) 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 %sApplicationLink.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ApplicationLinkValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ApplicationLinkValidationError{} + +var _ApplicationLink_NetworkServerAddress_Pattern = regexp.MustCompile("^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$") + +// ValidateFields checks the field values on GetApplicationLinkRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GetApplicationLinkRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GetApplicationLinkRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "application_ids": + + if v, ok := interface{}(&m.ApplicationIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GetApplicationLinkRequestValidationError{ + field: "application_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GetApplicationLinkRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return GetApplicationLinkRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GetApplicationLinkRequestValidationError is the validation error returned by +// GetApplicationLinkRequest.ValidateFields if the designated constraints +// aren't met. +type GetApplicationLinkRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetApplicationLinkRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetApplicationLinkRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetApplicationLinkRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetApplicationLinkRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetApplicationLinkRequestValidationError) ErrorName() string { + return "GetApplicationLinkRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetApplicationLinkRequestValidationError) 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 %sGetApplicationLinkRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetApplicationLinkRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetApplicationLinkRequestValidationError{} + +// ValidateFields checks the field values on SetApplicationLinkRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *SetApplicationLinkRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = SetApplicationLinkRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "application_ids": + + if v, ok := interface{}(&m.ApplicationIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SetApplicationLinkRequestValidationError{ + field: "application_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "link": + + if v, ok := interface{}(&m.ApplicationLink).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SetApplicationLinkRequestValidationError{ + field: "link", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SetApplicationLinkRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return SetApplicationLinkRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// SetApplicationLinkRequestValidationError is the validation error returned by +// SetApplicationLinkRequest.ValidateFields if the designated constraints +// aren't met. +type SetApplicationLinkRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SetApplicationLinkRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SetApplicationLinkRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SetApplicationLinkRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SetApplicationLinkRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SetApplicationLinkRequestValidationError) ErrorName() string { + return "SetApplicationLinkRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e SetApplicationLinkRequestValidationError) 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 %sSetApplicationLinkRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SetApplicationLinkRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SetApplicationLinkRequestValidationError{} + +// ValidateFields checks the field values on ApplicationLinkStats with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ApplicationLinkStats) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ApplicationLinkStatsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "linked_at": + + if v, ok := interface{}(m.GetLinkedAt()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationLinkStatsValidationError{ + field: "linked_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "network_server_address": + + if !_ApplicationLinkStats_NetworkServerAddress_Pattern.MatchString(m.GetNetworkServerAddress()) { + return ApplicationLinkStatsValidationError{ + field: "network_server_address", + reason: "value does not match regex pattern \"^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$\"", + } + } + + case "last_up_received_at": + + if v, ok := interface{}(m.GetLastUpReceivedAt()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationLinkStatsValidationError{ + field: "last_up_received_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "up_count": + // no validation rules for UpCount + case "last_downlink_forwarded_at": + + if v, ok := interface{}(m.GetLastDownlinkForwardedAt()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationLinkStatsValidationError{ + field: "last_downlink_forwarded_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "downlink_count": + // no validation rules for DownlinkCount + default: + return ApplicationLinkStatsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ApplicationLinkStatsValidationError is the validation error returned by +// ApplicationLinkStats.ValidateFields if the designated constraints aren't met. +type ApplicationLinkStatsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ApplicationLinkStatsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ApplicationLinkStatsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ApplicationLinkStatsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ApplicationLinkStatsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ApplicationLinkStatsValidationError) ErrorName() string { + return "ApplicationLinkStatsValidationError" +} + +// Error satisfies the builtin error interface +func (e ApplicationLinkStatsValidationError) 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 %sApplicationLinkStats.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ApplicationLinkStatsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ApplicationLinkStatsValidationError{} + +var _ApplicationLinkStats_NetworkServerAddress_Pattern = regexp.MustCompile("^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$") diff --git a/pkg/ttnpb/applicationserver.validator.pb.go b/pkg/ttnpb/applicationserver.validator.pb.go deleted file mode 100644 index 2fb89fc62e..0000000000 --- a/pkg/ttnpb/applicationserver.validator.pb.go +++ /dev/null @@ -1,80 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/applicationserver.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import regexp "regexp" -import fmt "fmt" -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/empty" -import _ "github.com/golang/protobuf/ptypes/timestamp" -import _ "github.com/mwitkow/go-proto-validators" -import _ "google.golang.org/genproto/googleapis/api/annotations" -import _ "google.golang.org/genproto/protobuf/field_mask" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -var _regex_ApplicationLink_NetworkServerAddress = regexp.MustCompile(`^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$`) - -func (this *ApplicationLink) Validate() error { - if !_regex_ApplicationLink_NetworkServerAddress.MatchString(this.NetworkServerAddress) { - return github_com_mwitkow_go_proto_validators.FieldError("NetworkServerAddress", fmt.Errorf(`value '%v' must be a string conforming to regex "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"`, this.NetworkServerAddress)) - } - if this.APIKey == "" { - return github_com_mwitkow_go_proto_validators.FieldError("APIKey", fmt.Errorf(`value '%v' must not be an empty string`, this.APIKey)) - } - if this.DefaultFormatters != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.DefaultFormatters); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DefaultFormatters", err) - } - } - return nil -} -func (this *GetApplicationLinkRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ApplicationIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *SetApplicationLinkRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ApplicationIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ApplicationLink)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationLink", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *ApplicationLinkStats) Validate() error { - if this.LinkedAt != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.LinkedAt); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("LinkedAt", err) - } - } - if this.LastUpReceivedAt != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.LastUpReceivedAt); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("LastUpReceivedAt", err) - } - } - if this.LastDownlinkForwardedAt != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.LastDownlinkForwardedAt); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("LastDownlinkForwardedAt", err) - } - } - return nil -} diff --git a/pkg/ttnpb/applicationserver_web.go b/pkg/ttnpb/applicationserver_web.go index bd98bd2535..6a147183e3 100644 --- a/pkg/ttnpb/applicationserver_web.go +++ b/pkg/ttnpb/applicationserver_web.go @@ -14,8 +14,20 @@ package ttnpb +import "context" + // IsZero reports whether ids represent zero identifiers. func (ids ApplicationWebhookIdentifiers) IsZero() bool { return ids.GetWebhookID() == "" && ids.GetApplicationID() == "" } + +// ValidateContext wraps the generated validator with (optionally context-based) custom checks. +func (m *SetApplicationWebhookRequest) ValidateContext(context.Context) error { + if len(m.FieldMask.Paths) == 0 { + return m.ValidateFields() + } + return m.ValidateFields(append(fieldsWithPrefix("webhook", m.FieldMask.Paths...), + "webhook.ids", + )...) +} diff --git a/pkg/ttnpb/applicationserver_web.pb.go b/pkg/ttnpb/applicationserver_web.pb.go index 680462e965..52daeafe15 100644 --- a/pkg/ttnpb/applicationserver_web.pb.go +++ b/pkg/ttnpb/applicationserver_web.pb.go @@ -9,7 +9,7 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import types "github.com/gogo/protobuf/types" -import _ "github.com/mwitkow/go-proto-validators" +import _ "github.com/lyft/protoc-gen-validate/validate" import _ "google.golang.org/genproto/googleapis/api/annotations" import time "time" @@ -51,7 +51,7 @@ type ApplicationWebhookIdentifiers struct { func (m *ApplicationWebhookIdentifiers) Reset() { *m = ApplicationWebhookIdentifiers{} } func (*ApplicationWebhookIdentifiers) ProtoMessage() {} func (*ApplicationWebhookIdentifiers) Descriptor() ([]byte, []int) { - return fileDescriptor_applicationserver_web_cae7911b27bddc2a, []int{0} + return fileDescriptor_applicationserver_web_5a28f309cc954373, []int{0} } func (m *ApplicationWebhookIdentifiers) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -113,7 +113,7 @@ type ApplicationWebhook struct { func (m *ApplicationWebhook) Reset() { *m = ApplicationWebhook{} } func (*ApplicationWebhook) ProtoMessage() {} func (*ApplicationWebhook) Descriptor() ([]byte, []int) { - return fileDescriptor_applicationserver_web_cae7911b27bddc2a, []int{1} + return fileDescriptor_applicationserver_web_5a28f309cc954373, []int{1} } func (m *ApplicationWebhook) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -243,7 +243,7 @@ type ApplicationWebhook_Message struct { func (m *ApplicationWebhook_Message) Reset() { *m = ApplicationWebhook_Message{} } func (*ApplicationWebhook_Message) ProtoMessage() {} func (*ApplicationWebhook_Message) Descriptor() ([]byte, []int) { - return fileDescriptor_applicationserver_web_cae7911b27bddc2a, []int{1, 1} + return fileDescriptor_applicationserver_web_5a28f309cc954373, []int{1, 1} } func (m *ApplicationWebhook_Message) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -288,7 +288,7 @@ type ApplicationWebhooks struct { func (m *ApplicationWebhooks) Reset() { *m = ApplicationWebhooks{} } func (*ApplicationWebhooks) ProtoMessage() {} func (*ApplicationWebhooks) Descriptor() ([]byte, []int) { - return fileDescriptor_applicationserver_web_cae7911b27bddc2a, []int{2} + return fileDescriptor_applicationserver_web_5a28f309cc954373, []int{2} } func (m *ApplicationWebhooks) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -334,7 +334,7 @@ type ApplicationWebhookFormats struct { func (m *ApplicationWebhookFormats) Reset() { *m = ApplicationWebhookFormats{} } func (*ApplicationWebhookFormats) ProtoMessage() {} func (*ApplicationWebhookFormats) Descriptor() ([]byte, []int) { - return fileDescriptor_applicationserver_web_cae7911b27bddc2a, []int{3} + return fileDescriptor_applicationserver_web_5a28f309cc954373, []int{3} } func (m *ApplicationWebhookFormats) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -380,7 +380,7 @@ type GetApplicationWebhookRequest struct { func (m *GetApplicationWebhookRequest) Reset() { *m = GetApplicationWebhookRequest{} } func (*GetApplicationWebhookRequest) ProtoMessage() {} func (*GetApplicationWebhookRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_applicationserver_web_cae7911b27bddc2a, []int{4} + return fileDescriptor_applicationserver_web_5a28f309cc954373, []int{4} } func (m *GetApplicationWebhookRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -426,7 +426,7 @@ type ListApplicationWebhooksRequest struct { func (m *ListApplicationWebhooksRequest) Reset() { *m = ListApplicationWebhooksRequest{} } func (*ListApplicationWebhooksRequest) ProtoMessage() {} func (*ListApplicationWebhooksRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_applicationserver_web_cae7911b27bddc2a, []int{5} + return fileDescriptor_applicationserver_web_5a28f309cc954373, []int{5} } func (m *ListApplicationWebhooksRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -472,7 +472,7 @@ type SetApplicationWebhookRequest struct { func (m *SetApplicationWebhookRequest) Reset() { *m = SetApplicationWebhookRequest{} } func (*SetApplicationWebhookRequest) ProtoMessage() {} func (*SetApplicationWebhookRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_applicationserver_web_cae7911b27bddc2a, []int{6} + return fileDescriptor_applicationserver_web_5a28f309cc954373, []int{6} } func (m *SetApplicationWebhookRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3326,86 +3326,87 @@ var ( ) func init() { - proto.RegisterFile("lorawan-stack/api/applicationserver_web.proto", fileDescriptor_applicationserver_web_cae7911b27bddc2a) + proto.RegisterFile("lorawan-stack/api/applicationserver_web.proto", fileDescriptor_applicationserver_web_5a28f309cc954373) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/applicationserver_web.proto", fileDescriptor_applicationserver_web_cae7911b27bddc2a) -} - -var fileDescriptor_applicationserver_web_cae7911b27bddc2a = []byte{ - // 1179 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x97, 0x41, 0x6c, 0xd3, 0x56, - 0x1c, 0xc6, 0xfd, 0x48, 0x69, 0x9a, 0x17, 0x28, 0xd3, 0x63, 0x43, 0x5e, 0x80, 0x97, 0xca, 0x6c, - 0xa8, 0x20, 0x62, 0x4f, 0x45, 0x42, 0x5b, 0x35, 0x0d, 0x35, 0x83, 0x76, 0xd5, 0x60, 0x0c, 0x67, - 0x08, 0x6d, 0x88, 0x45, 0x2f, 0xf1, 0x4b, 0x62, 0xe2, 0xd8, 0xc6, 0xef, 0xa5, 0x19, 0x43, 0x48, - 0x68, 0x27, 0x8e, 0x48, 0xbb, 0xec, 0x36, 0xb4, 0xcb, 0xd8, 0x4e, 0x1c, 0x39, 0xec, 0x80, 0xb4, - 0x4b, 0x4f, 0x53, 0xa5, 0x5d, 0x38, 0xb5, 0xc4, 0xd9, 0x81, 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x00, 0x00, + golang_proto.RegisterFile("lorawan-stack/api/applicationserver_web.proto", fileDescriptor_applicationserver_web_5a28f309cc954373) +} + +var fileDescriptor_applicationserver_web_5a28f309cc954373 = []byte{ + // 1193 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x97, 0x41, 0x6c, 0xd3, 0x56, + 0x18, 0xc7, 0xfd, 0x9a, 0xd2, 0x34, 0x2f, 0x50, 0xd0, 0x63, 0x43, 0x5e, 0x80, 0x97, 0xca, 0x20, + 0x54, 0x10, 0x71, 0xa6, 0x20, 0xa1, 0xad, 0x9b, 0x86, 0x9a, 0x01, 0x1d, 0x1a, 0x0c, 0x70, 0x56, + 0x21, 0x0d, 0xb1, 0xe8, 0x25, 0x7e, 0x49, 0x4c, 0x1c, 0xdb, 0xf8, 0xbd, 0x34, 0xea, 0x10, 0x12, + 0xda, 0x09, 0xed, 0x84, 0xb4, 0xcb, 0x6e, 0x43, 0x3b, 0xb1, 0x5b, 0x27, 0xed, 0x80, 0x76, 0xaa, + 0x34, 0x69, 0xea, 0xb1, 0xd2, 0x2e, 0x48, 0x93, 0x3a, 0xe2, 0xec, 0x00, 0x37, 0x8e, 0x1c, 0x27, + 0xdb, 0xcf, 0x69, 0x9a, 0x84, 0xb6, 0x69, 0xb5, 0x9d, 0xea, 0x97, 0xf7, 0x7d, 0xbf, 0xf7, 0xff, + 0xfe, 0xfe, 0xfc, 0xd9, 0x85, 0x19, 0xd3, 0x76, 0x49, 0x8b, 0x58, 0x19, 0xc6, 0x49, 0xb9, 0x9e, + 0x25, 0x8e, 0x91, 0x25, 0x8e, 0x63, 0x1a, 0x65, 0xc2, 0x0d, 0xdb, 0x62, 0xd4, 0x5d, 0xa4, 0x6e, + 0xb1, 0x45, 0x4b, 0xaa, 0xe3, 0xda, 0xdc, 0x46, 0x53, 0x9c, 0x5b, 0xaa, 0x48, 0x51, 0x17, 0xcf, + 0x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69, 0x63, 0xf0, 0xd0, 0xc3, 0xe0, 0x91, 0x87, 0xa5, 0xa7, 0x1e, 0x06, 0xcb, 0x1e, 0x96, 0x9e, + 0x79, 0x58, 0x5a, 0xf1, 0xb0, 0xb4, 0xea, 0x61, 0xb0, 0xe6, 0x61, 0xf0, 0xdc, 0xc3, 0xd2, 0x0b, + 0x0f, 0x83, 0x97, 0x1e, 0x96, 0x5e, 0x7b, 0x18, 0xbc, 0xf1, 0xb0, 0xf4, 0xb0, 0x83, 0xa5, 0x47, + 0x1d, 0x0c, 0x1e, 0x77, 0xb0, 0xf4, 0x43, 0x07, 0x83, 0x27, 0x1d, 0x2c, 0x3d, 0xed, 0x60, 0x69, + 0xb9, 0x83, 0xc1, 0xb3, 0x0e, 0x06, 0x2b, 0x1d, 0x0c, 0xbe, 0x3a, 0x5b, 0xb5, 0x55, 0x5e, 0xa3, + 0xbc, 0x66, 0x58, 0x55, 0xa6, 0x5a, 0x94, 0xb7, 0x6c, 0xb7, 0x9e, 0xdd, 0xfc, 0xcf, 0x87, 0x53, + 0xaf, 0x66, 0x39, 0xb7, 0x9c, 0x52, 0x69, 0x22, 0x70, 0xe1, 0xdc, 0xbf, 0x01, 0x00, 0x00, 0xff, + 0xff, 0x0c, 0xd1, 0xa7, 0x65, 0xc7, 0x0d, 0x00, 0x00, } diff --git a/pkg/ttnpb/applicationserver_web.pb.gw.go b/pkg/ttnpb/applicationserver_web.pb.gw.go index e9d8da05ee..12605c01ff 100644 --- a/pkg/ttnpb/applicationserver_web.pb.gw.go +++ b/pkg/ttnpb/applicationserver_web.pb.gw.go @@ -9,11 +9,10 @@ It translates gRPC into RESTful JSON APIs. package ttnpb import ( + "context" "io" "net/http" - "context" - "github.com/gogo/protobuf/types" "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" diff --git a/pkg/ttnpb/applicationserver_web.pb.paths.fm.go b/pkg/ttnpb/applicationserver_web.pb.paths.fm.go new file mode 100644 index 0000000000..f64f6001fa --- /dev/null +++ b/pkg/ttnpb/applicationserver_web.pb.paths.fm.go @@ -0,0 +1,135 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var ApplicationWebhookIdentifiersFieldPathsNested = []string{ + "application_ids", + "application_ids.application_id", + "webhook_id", +} + +var ApplicationWebhookIdentifiersFieldPathsTopLevel = []string{ + "application_ids", + "webhook_id", +} +var ApplicationWebhookFieldPathsNested = []string{ + "base_url", + "created_at", + "downlink_ack", + "downlink_ack.path", + "downlink_failed", + "downlink_failed.path", + "downlink_nack", + "downlink_nack.path", + "downlink_queued", + "downlink_queued.path", + "downlink_sent", + "downlink_sent.path", + "format", + "headers", + "ids", + "ids.application_ids", + "ids.application_ids.application_id", + "ids.webhook_id", + "join_accept", + "join_accept.path", + "location_solved", + "location_solved.path", + "updated_at", + "uplink_message", + "uplink_message.path", +} + +var ApplicationWebhookFieldPathsTopLevel = []string{ + "base_url", + "created_at", + "downlink_ack", + "downlink_failed", + "downlink_nack", + "downlink_queued", + "downlink_sent", + "format", + "headers", + "ids", + "join_accept", + "location_solved", + "updated_at", + "uplink_message", +} +var ApplicationWebhooksFieldPathsNested = []string{ + "webhooks", +} + +var ApplicationWebhooksFieldPathsTopLevel = []string{ + "webhooks", +} +var ApplicationWebhookFormatsFieldPathsNested = []string{ + "formats", +} + +var ApplicationWebhookFormatsFieldPathsTopLevel = []string{ + "formats", +} +var GetApplicationWebhookRequestFieldPathsNested = []string{ + "field_mask", + "ids", + "ids.application_ids", + "ids.application_ids.application_id", + "ids.webhook_id", +} + +var GetApplicationWebhookRequestFieldPathsTopLevel = []string{ + "field_mask", + "ids", +} +var ListApplicationWebhooksRequestFieldPathsNested = []string{ + "application_ids", + "application_ids.application_id", + "field_mask", +} + +var ListApplicationWebhooksRequestFieldPathsTopLevel = []string{ + "application_ids", + "field_mask", +} +var SetApplicationWebhookRequestFieldPathsNested = []string{ + "field_mask", + "webhook", + "webhook.base_url", + "webhook.created_at", + "webhook.downlink_ack", + "webhook.downlink_ack.path", + "webhook.downlink_failed", + "webhook.downlink_failed.path", + "webhook.downlink_nack", + "webhook.downlink_nack.path", + "webhook.downlink_queued", + "webhook.downlink_queued.path", + "webhook.downlink_sent", + "webhook.downlink_sent.path", + "webhook.format", + "webhook.headers", + "webhook.ids", + "webhook.ids.application_ids", + "webhook.ids.application_ids.application_id", + "webhook.ids.webhook_id", + "webhook.join_accept", + "webhook.join_accept.path", + "webhook.location_solved", + "webhook.location_solved.path", + "webhook.updated_at", + "webhook.uplink_message", + "webhook.uplink_message.path", +} + +var SetApplicationWebhookRequestFieldPathsTopLevel = []string{ + "field_mask", + "webhook", +} +var ApplicationWebhook_MessageFieldPathsNested = []string{ + "path", +} + +var ApplicationWebhook_MessageFieldPathsTopLevel = []string{ + "path", +} diff --git a/pkg/ttnpb/applicationserver_web.pb.fm.go b/pkg/ttnpb/applicationserver_web.pb.setters.fm.go similarity index 78% rename from pkg/ttnpb/applicationserver_web.pb.fm.go rename to pkg/ttnpb/applicationserver_web.pb.setters.fm.go index af371dad77..9a80d1b34b 100644 --- a/pkg/ttnpb/applicationserver_web.pb.fm.go +++ b/pkg/ttnpb/applicationserver_web.pb.setters.fm.go @@ -6,20 +6,9 @@ import ( fmt "fmt" time "time" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + types "github.com/gogo/protobuf/types" ) -var ApplicationWebhookIdentifiersFieldPathsNested = []string{ - "application_ids", - "application_ids.application_id", - "webhook_id", -} - -var ApplicationWebhookIdentifiersFieldPathsTopLevel = []string{ - "application_ids", - "webhook_id", -} - func (dst *ApplicationWebhookIdentifiers) SetFields(src *ApplicationWebhookIdentifiers, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -59,51 +48,6 @@ func (dst *ApplicationWebhookIdentifiers) SetFields(src *ApplicationWebhookIdent return nil } -var ApplicationWebhookFieldPathsNested = []string{ - "base_url", - "created_at", - "downlink_ack", - "downlink_ack.path", - "downlink_failed", - "downlink_failed.path", - "downlink_nack", - "downlink_nack.path", - "downlink_queued", - "downlink_queued.path", - "downlink_sent", - "downlink_sent.path", - "format", - "headers", - "ids", - "ids.application_ids", - "ids.application_ids.application_id", - "ids.webhook_id", - "join_accept", - "join_accept.path", - "location_solved", - "location_solved.path", - "updated_at", - "uplink_message", - "uplink_message.path", -} - -var ApplicationWebhookFieldPathsTopLevel = []string{ - "base_url", - "created_at", - "downlink_ack", - "downlink_failed", - "downlink_nack", - "downlink_queued", - "downlink_sent", - "format", - "headers", - "ids", - "join_accept", - "location_solved", - "updated_at", - "uplink_message", -} - func (dst *ApplicationWebhook) SetFields(src *ApplicationWebhook, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -350,43 +294,6 @@ func (dst *ApplicationWebhook) SetFields(src *ApplicationWebhook, paths ...strin return nil } -var ApplicationWebhook_MessageFieldPathsNested = []string{ - "path", -} - -var ApplicationWebhook_MessageFieldPathsTopLevel = []string{ - "path", -} - -func (dst *ApplicationWebhook_Message) SetFields(src *ApplicationWebhook_Message, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "path": - if len(subs) > 0 { - return fmt.Errorf("'path' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Path = src.Path - } else { - var zero string - dst.Path = zero - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - -var ApplicationWebhooksFieldPathsNested = []string{ - "webhooks", -} - -var ApplicationWebhooksFieldPathsTopLevel = []string{ - "webhooks", -} - func (dst *ApplicationWebhooks) SetFields(src *ApplicationWebhooks, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -407,14 +314,6 @@ func (dst *ApplicationWebhooks) SetFields(src *ApplicationWebhooks, paths ...str return nil } -var ApplicationWebhookFormatsFieldPathsNested = []string{ - "formats", -} - -var ApplicationWebhookFormatsFieldPathsTopLevel = []string{ - "formats", -} - func (dst *ApplicationWebhookFormats) SetFields(src *ApplicationWebhookFormats, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -435,19 +334,6 @@ func (dst *ApplicationWebhookFormats) SetFields(src *ApplicationWebhookFormats, return nil } -var GetApplicationWebhookRequestFieldPathsNested = []string{ - "field_mask", - "ids", - "ids.application_ids", - "ids.application_ids.application_id", - "ids.webhook_id", -} - -var GetApplicationWebhookRequestFieldPathsTopLevel = []string{ - "field_mask", - "ids", -} - func (dst *GetApplicationWebhookRequest) SetFields(src *GetApplicationWebhookRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -476,7 +362,7 @@ func (dst *GetApplicationWebhookRequest) SetFields(src *GetApplicationWebhookReq if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } @@ -487,17 +373,6 @@ func (dst *GetApplicationWebhookRequest) SetFields(src *GetApplicationWebhookReq return nil } -var ListApplicationWebhooksRequestFieldPathsNested = []string{ - "application_ids", - "application_ids.application_id", - "field_mask", -} - -var ListApplicationWebhooksRequestFieldPathsTopLevel = []string{ - "application_ids", - "field_mask", -} - func (dst *ListApplicationWebhooksRequest) SetFields(src *ListApplicationWebhooksRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -526,7 +401,7 @@ func (dst *ListApplicationWebhooksRequest) SetFields(src *ListApplicationWebhook if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } @@ -537,41 +412,6 @@ func (dst *ListApplicationWebhooksRequest) SetFields(src *ListApplicationWebhook return nil } -var SetApplicationWebhookRequestFieldPathsNested = []string{ - "field_mask", - "webhook", - "webhook.base_url", - "webhook.created_at", - "webhook.downlink_ack", - "webhook.downlink_ack.path", - "webhook.downlink_failed", - "webhook.downlink_failed.path", - "webhook.downlink_nack", - "webhook.downlink_nack.path", - "webhook.downlink_queued", - "webhook.downlink_queued.path", - "webhook.downlink_sent", - "webhook.downlink_sent.path", - "webhook.format", - "webhook.headers", - "webhook.ids", - "webhook.ids.application_ids", - "webhook.ids.application_ids.application_id", - "webhook.ids.webhook_id", - "webhook.join_accept", - "webhook.join_accept.path", - "webhook.location_solved", - "webhook.location_solved.path", - "webhook.updated_at", - "webhook.uplink_message", - "webhook.uplink_message.path", -} - -var SetApplicationWebhookRequestFieldPathsTopLevel = []string{ - "field_mask", - "webhook", -} - func (dst *SetApplicationWebhookRequest) SetFields(src *SetApplicationWebhookRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -600,7 +440,7 @@ func (dst *SetApplicationWebhookRequest) SetFields(src *SetApplicationWebhookReq if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } @@ -610,3 +450,24 @@ func (dst *SetApplicationWebhookRequest) SetFields(src *SetApplicationWebhookReq } return nil } + +func (dst *ApplicationWebhook_Message) SetFields(src *ApplicationWebhook_Message, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "path": + if len(subs) > 0 { + return fmt.Errorf("'path' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Path = src.Path + } else { + var zero string + dst.Path = zero + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} diff --git a/pkg/ttnpb/applicationserver_web.pb.validate.go b/pkg/ttnpb/applicationserver_web.pb.validate.go new file mode 100644 index 0000000000..667ec72989 --- /dev/null +++ b/pkg/ttnpb/applicationserver_web.pb.validate.go @@ -0,0 +1,948 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on ApplicationWebhookIdentifiers with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *ApplicationWebhookIdentifiers) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ApplicationWebhookIdentifiersFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "application_ids": + + if v, ok := interface{}(&m.ApplicationIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationWebhookIdentifiersValidationError{ + field: "application_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "webhook_id": + + if utf8.RuneCountInString(m.GetWebhookID()) > 36 { + return ApplicationWebhookIdentifiersValidationError{ + field: "webhook_id", + reason: "value length must be at most 36 runes", + } + } + + if !_ApplicationWebhookIdentifiers_WebhookID_Pattern.MatchString(m.GetWebhookID()) { + return ApplicationWebhookIdentifiersValidationError{ + field: "webhook_id", + reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$\"", + } + } + + default: + return ApplicationWebhookIdentifiersValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ApplicationWebhookIdentifiersValidationError is the validation error +// returned by ApplicationWebhookIdentifiers.ValidateFields if the designated +// constraints aren't met. +type ApplicationWebhookIdentifiersValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ApplicationWebhookIdentifiersValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ApplicationWebhookIdentifiersValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ApplicationWebhookIdentifiersValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ApplicationWebhookIdentifiersValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ApplicationWebhookIdentifiersValidationError) ErrorName() string { + return "ApplicationWebhookIdentifiersValidationError" +} + +// Error satisfies the builtin error interface +func (e ApplicationWebhookIdentifiersValidationError) 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 %sApplicationWebhookIdentifiers.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ApplicationWebhookIdentifiersValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ApplicationWebhookIdentifiersValidationError{} + +var _ApplicationWebhookIdentifiers_WebhookID_Pattern = regexp.MustCompile("^[a-z0-9](?:[-]?[a-z0-9]){2,}$") + +// ValidateFields checks the field values on ApplicationWebhook with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ApplicationWebhook) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ApplicationWebhookFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "ids": + + if v, ok := interface{}(&m.ApplicationWebhookIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationWebhookValidationError{ + field: "ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "created_at": + + if v, ok := interface{}(&m.CreatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationWebhookValidationError{ + field: "created_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "updated_at": + + if v, ok := interface{}(&m.UpdatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationWebhookValidationError{ + field: "updated_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "base_url": + // no validation rules for BaseURL + case "headers": + // no validation rules for Headers + case "format": + // no validation rules for Format + case "uplink_message": + + if v, ok := interface{}(m.GetUplinkMessage()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationWebhookValidationError{ + field: "uplink_message", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "join_accept": + + if v, ok := interface{}(m.GetJoinAccept()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationWebhookValidationError{ + field: "join_accept", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "downlink_ack": + + if v, ok := interface{}(m.GetDownlinkAck()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationWebhookValidationError{ + field: "downlink_ack", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "downlink_nack": + + if v, ok := interface{}(m.GetDownlinkNack()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationWebhookValidationError{ + field: "downlink_nack", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "downlink_sent": + + if v, ok := interface{}(m.GetDownlinkSent()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationWebhookValidationError{ + field: "downlink_sent", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "downlink_failed": + + if v, ok := interface{}(m.GetDownlinkFailed()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationWebhookValidationError{ + field: "downlink_failed", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "downlink_queued": + + if v, ok := interface{}(m.GetDownlinkQueued()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationWebhookValidationError{ + field: "downlink_queued", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "location_solved": + + if v, ok := interface{}(m.GetLocationSolved()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationWebhookValidationError{ + field: "location_solved", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return ApplicationWebhookValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ApplicationWebhookValidationError is the validation error returned by +// ApplicationWebhook.ValidateFields if the designated constraints aren't met. +type ApplicationWebhookValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ApplicationWebhookValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ApplicationWebhookValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ApplicationWebhookValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ApplicationWebhookValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ApplicationWebhookValidationError) ErrorName() string { + return "ApplicationWebhookValidationError" +} + +// Error satisfies the builtin error interface +func (e ApplicationWebhookValidationError) 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 %sApplicationWebhook.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ApplicationWebhookValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ApplicationWebhookValidationError{} + +// ValidateFields checks the field values on ApplicationWebhooks with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ApplicationWebhooks) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ApplicationWebhooksFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "webhooks": + + for idx, item := range m.GetWebhooks() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationWebhooksValidationError{ + field: fmt.Sprintf("webhooks[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + default: + return ApplicationWebhooksValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ApplicationWebhooksValidationError is the validation error returned by +// ApplicationWebhooks.ValidateFields if the designated constraints aren't met. +type ApplicationWebhooksValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ApplicationWebhooksValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ApplicationWebhooksValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ApplicationWebhooksValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ApplicationWebhooksValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ApplicationWebhooksValidationError) ErrorName() string { + return "ApplicationWebhooksValidationError" +} + +// Error satisfies the builtin error interface +func (e ApplicationWebhooksValidationError) 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 %sApplicationWebhooks.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ApplicationWebhooksValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ApplicationWebhooksValidationError{} + +// ValidateFields checks the field values on ApplicationWebhookFormats with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ApplicationWebhookFormats) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ApplicationWebhookFormatsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "formats": + // no validation rules for Formats + default: + return ApplicationWebhookFormatsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ApplicationWebhookFormatsValidationError is the validation error returned by +// ApplicationWebhookFormats.ValidateFields if the designated constraints +// aren't met. +type ApplicationWebhookFormatsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ApplicationWebhookFormatsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ApplicationWebhookFormatsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ApplicationWebhookFormatsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ApplicationWebhookFormatsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ApplicationWebhookFormatsValidationError) ErrorName() string { + return "ApplicationWebhookFormatsValidationError" +} + +// Error satisfies the builtin error interface +func (e ApplicationWebhookFormatsValidationError) 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 %sApplicationWebhookFormats.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ApplicationWebhookFormatsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ApplicationWebhookFormatsValidationError{} + +// ValidateFields checks the field values on GetApplicationWebhookRequest with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *GetApplicationWebhookRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GetApplicationWebhookRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "ids": + + if v, ok := interface{}(&m.ApplicationWebhookIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GetApplicationWebhookRequestValidationError{ + field: "ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GetApplicationWebhookRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return GetApplicationWebhookRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GetApplicationWebhookRequestValidationError is the validation error returned +// by GetApplicationWebhookRequest.ValidateFields if the designated +// constraints aren't met. +type GetApplicationWebhookRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetApplicationWebhookRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetApplicationWebhookRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetApplicationWebhookRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetApplicationWebhookRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetApplicationWebhookRequestValidationError) ErrorName() string { + return "GetApplicationWebhookRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetApplicationWebhookRequestValidationError) 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 %sGetApplicationWebhookRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetApplicationWebhookRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetApplicationWebhookRequestValidationError{} + +// ValidateFields checks the field values on ListApplicationWebhooksRequest +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *ListApplicationWebhooksRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ListApplicationWebhooksRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "application_ids": + + if v, ok := interface{}(&m.ApplicationIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ListApplicationWebhooksRequestValidationError{ + field: "application_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ListApplicationWebhooksRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return ListApplicationWebhooksRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ListApplicationWebhooksRequestValidationError is the validation error +// returned by ListApplicationWebhooksRequest.ValidateFields if the designated +// constraints aren't met. +type ListApplicationWebhooksRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListApplicationWebhooksRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListApplicationWebhooksRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListApplicationWebhooksRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListApplicationWebhooksRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListApplicationWebhooksRequestValidationError) ErrorName() string { + return "ListApplicationWebhooksRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e ListApplicationWebhooksRequestValidationError) 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 %sListApplicationWebhooksRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListApplicationWebhooksRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListApplicationWebhooksRequestValidationError{} + +// ValidateFields checks the field values on SetApplicationWebhookRequest with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *SetApplicationWebhookRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = SetApplicationWebhookRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "webhook": + + if v, ok := interface{}(&m.ApplicationWebhook).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SetApplicationWebhookRequestValidationError{ + field: "webhook", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SetApplicationWebhookRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return SetApplicationWebhookRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// SetApplicationWebhookRequestValidationError is the validation error returned +// by SetApplicationWebhookRequest.ValidateFields if the designated +// constraints aren't met. +type SetApplicationWebhookRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SetApplicationWebhookRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SetApplicationWebhookRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SetApplicationWebhookRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SetApplicationWebhookRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SetApplicationWebhookRequestValidationError) ErrorName() string { + return "SetApplicationWebhookRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e SetApplicationWebhookRequestValidationError) 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 %sSetApplicationWebhookRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SetApplicationWebhookRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SetApplicationWebhookRequestValidationError{} + +// ValidateFields checks the field values on ApplicationWebhook_Message with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *ApplicationWebhook_Message) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ApplicationWebhook_MessageFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "path": + // no validation rules for Path + default: + return ApplicationWebhook_MessageValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ApplicationWebhook_MessageValidationError is the validation error returned +// by ApplicationWebhook_Message.ValidateFields if the designated constraints +// aren't met. +type ApplicationWebhook_MessageValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ApplicationWebhook_MessageValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ApplicationWebhook_MessageValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ApplicationWebhook_MessageValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ApplicationWebhook_MessageValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ApplicationWebhook_MessageValidationError) ErrorName() string { + return "ApplicationWebhook_MessageValidationError" +} + +// Error satisfies the builtin error interface +func (e ApplicationWebhook_MessageValidationError) 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 %sApplicationWebhook_Message.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ApplicationWebhook_MessageValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ApplicationWebhook_MessageValidationError{} diff --git a/pkg/ttnpb/applicationserver_web.validator.pb.go b/pkg/ttnpb/applicationserver_web.validator.pb.go deleted file mode 100644 index 7a1b931265..0000000000 --- a/pkg/ttnpb/applicationserver_web.validator.pb.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/applicationserver_web.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import regexp "regexp" -import fmt "fmt" -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/empty" -import _ "github.com/golang/protobuf/ptypes/timestamp" -import _ "github.com/mwitkow/go-proto-validators" -import _ "google.golang.org/genproto/googleapis/api/annotations" -import _ "google.golang.org/genproto/protobuf/field_mask" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -var _regex_ApplicationWebhookIdentifiers_WebhookID = regexp.MustCompile(`^[a-z0-9](?:[-]?[a-z0-9]){2,}$`) - -func (this *ApplicationWebhookIdentifiers) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ApplicationIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationIdentifiers", err) - } - if !_regex_ApplicationWebhookIdentifiers_WebhookID.MatchString(this.WebhookID) { - return github_com_mwitkow_go_proto_validators.FieldError("WebhookID", fmt.Errorf(`value '%v' must be a string conforming to regex "^[a-z0-9](?:[-]?[a-z0-9]){2,}$"`, this.WebhookID)) - } - if !(len(this.WebhookID) < 37) { - return github_com_mwitkow_go_proto_validators.FieldError("WebhookID", fmt.Errorf(`value '%v' must length be less than '37'`, this.WebhookID)) - } - return nil -} -func (this *ApplicationWebhook) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ApplicationWebhookIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationWebhookIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.CreatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("CreatedAt", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UpdatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UpdatedAt", err) - } - // Validation of proto3 map<> fields is unsupported. - if this.UplinkMessage != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.UplinkMessage); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UplinkMessage", err) - } - } - if this.JoinAccept != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.JoinAccept); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("JoinAccept", err) - } - } - if this.DownlinkAck != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.DownlinkAck); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DownlinkAck", err) - } - } - if this.DownlinkNack != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.DownlinkNack); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DownlinkNack", err) - } - } - if this.DownlinkSent != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.DownlinkSent); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DownlinkSent", err) - } - } - if this.DownlinkFailed != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.DownlinkFailed); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DownlinkFailed", err) - } - } - if this.DownlinkQueued != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.DownlinkQueued); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DownlinkQueued", err) - } - } - if this.LocationSolved != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.LocationSolved); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("LocationSolved", err) - } - } - return nil -} -func (this *ApplicationWebhook_Message) Validate() error { - return nil -} -func (this *ApplicationWebhooks) Validate() error { - for _, item := range this.Webhooks { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Webhooks", err) - } - } - } - return nil -} -func (this *ApplicationWebhookFormats) Validate() error { - // Validation of proto3 map<> fields is unsupported. - return nil -} -func (this *GetApplicationWebhookRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ApplicationWebhookIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationWebhookIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *ListApplicationWebhooksRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ApplicationIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *SetApplicationWebhookRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ApplicationWebhook)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationWebhook", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} diff --git a/pkg/ttnpb/client.go b/pkg/ttnpb/client.go new file mode 100644 index 0000000000..6648f6a5bc --- /dev/null +++ b/pkg/ttnpb/client.go @@ -0,0 +1,29 @@ +// Copyright © 2019 The Things Network Foundation, The Things Industries B.V. +// +// 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. + +package ttnpb + +import ( + "context" +) + +// ValidateContext wraps the generated validator with (optionally context-based) custom checks. +func (m *UpdateClientRequest) ValidateContext(context.Context) error { + if len(m.FieldMask.Paths) == 0 { + return m.ValidateFields() + } + return m.ValidateFields(append(fieldsWithPrefix("client", m.FieldMask.Paths...), + "client.ids", + )...) +} diff --git a/pkg/ttnpb/client.pb.go b/pkg/ttnpb/client.pb.go index 4f4b683a02..0d45572c7d 100644 --- a/pkg/ttnpb/client.pb.go +++ b/pkg/ttnpb/client.pb.go @@ -9,6 +9,7 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" import time "time" @@ -59,7 +60,7 @@ var GrantType_value = map[string]int32{ } func (GrantType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_client_02751df5c6a7bb69, []int{0} + return fileDescriptor_client_e1e973862478c1e0, []int{0} } // An OAuth client on the network. @@ -100,7 +101,7 @@ type Client struct { func (m *Client) Reset() { *m = Client{} } func (*Client) ProtoMessage() {} func (*Client) Descriptor() ([]byte, []int) { - return fileDescriptor_client_02751df5c6a7bb69, []int{0} + return fileDescriptor_client_e1e973862478c1e0, []int{0} } func (m *Client) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -229,7 +230,7 @@ type Clients struct { func (m *Clients) Reset() { *m = Clients{} } func (*Clients) ProtoMessage() {} func (*Clients) Descriptor() ([]byte, []int) { - return fileDescriptor_client_02751df5c6a7bb69, []int{1} + return fileDescriptor_client_e1e973862478c1e0, []int{1} } func (m *Clients) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -275,7 +276,7 @@ type GetClientRequest struct { func (m *GetClientRequest) Reset() { *m = GetClientRequest{} } func (*GetClientRequest) ProtoMessage() {} func (*GetClientRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_client_02751df5c6a7bb69, []int{2} + return fileDescriptor_client_e1e973862478c1e0, []int{2} } func (m *GetClientRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -328,7 +329,7 @@ type ListClientsRequest struct { func (m *ListClientsRequest) Reset() { *m = ListClientsRequest{} } func (*ListClientsRequest) ProtoMessage() {} func (*ListClientsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_client_02751df5c6a7bb69, []int{3} + return fileDescriptor_client_e1e973862478c1e0, []int{3} } func (m *ListClientsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -403,7 +404,7 @@ type CreateClientRequest struct { func (m *CreateClientRequest) Reset() { *m = CreateClientRequest{} } func (*CreateClientRequest) ProtoMessage() {} func (*CreateClientRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_client_02751df5c6a7bb69, []int{4} + return fileDescriptor_client_e1e973862478c1e0, []int{4} } func (m *CreateClientRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -449,7 +450,7 @@ type UpdateClientRequest struct { func (m *UpdateClientRequest) Reset() { *m = UpdateClientRequest{} } func (*UpdateClientRequest) ProtoMessage() {} func (*UpdateClientRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_client_02751df5c6a7bb69, []int{5} + return fileDescriptor_client_e1e973862478c1e0, []int{5} } func (m *UpdateClientRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -495,7 +496,7 @@ type SetClientCollaboratorRequest struct { func (m *SetClientCollaboratorRequest) Reset() { *m = SetClientCollaboratorRequest{} } func (*SetClientCollaboratorRequest) ProtoMessage() {} func (*SetClientCollaboratorRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_client_02751df5c6a7bb69, []int{6} + return fileDescriptor_client_e1e973862478c1e0, []int{6} } func (m *SetClientCollaboratorRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3089,76 +3090,79 @@ var ( ) func init() { - proto.RegisterFile("lorawan-stack/api/client.proto", fileDescriptor_client_02751df5c6a7bb69) + proto.RegisterFile("lorawan-stack/api/client.proto", fileDescriptor_client_e1e973862478c1e0) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/client.proto", fileDescriptor_client_02751df5c6a7bb69) -} - -var fileDescriptor_client_02751df5c6a7bb69 = []byte{ - // 1018 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x4f, 0x6c, 0x1b, 0xc5, - 0x17, 0xde, 0x89, 0x13, 0x27,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x4c, 0x3e, 0xf4, 0xf6, 0x28, - 0x8b, 0xb9, 0xdd, 0x8e, 0x8c, 0xe1, 0x77, 0x47, 0x61, 0x6e, 0x33, 0x57, 0xf1, 0x26, 0x67, 0x22, - 0x21, 0x8d, 0xf1, 0x42, 0x70, 0x67, 0x5f, 0xc5, 0x78, 0xe1, 0xaf, 0x29, 0x98, 0x5e, 0xd7, 0xe6, - 0xa0, 0x9b, 0x30, 0xc5, 0x6d, 0x69, 0x82, 0x3c, 0x28, 0xce, 0xae, 0xbe, 0x63, 0x5d, 0x35, 0xc9, - 0x8a, 0x48, 0xdb, 0x97, 0x1f, 0x58, 0x9b, 0x39, 0x39, 0x5b, 0x36, 0x4e, 0xcf, 0x96, 0x01, 0x09, - 0xf3, 0xd0, 0x3a, 0x84, 0x0d, 0xc1, 0xa8, 0x62, 0x76, 0x8d, 0x2a, 0x73, 0x42, 0x57, 0xc9, 0x59, - 0x91, 0x13, 0x56, 0xe2, 0x84, 0x55, 0x4d, 0x9c, 0x88, 0xd2, 0x8f, 0xfe, 0x5c, 0x06, 0x24, 0x13, - 0xe7, 0x95, 0x55, 0x58, 0xa4, 0xeb, 0xdb, 0x49, 0x91, 0xd4, 0x3f, 0x29, 0x12, 0xe7, 0x95, 0x15, - 0x42, 0x70, 0xd2, 0xa5, 0x1d, 0x66, 0x4e, 0xe6, 0x41, 0x31, 0x43, 0xf4, 0x19, 0xe5, 0xe1, 0xac, - 0xcd, 0x64, 0x43, 0x70, 0x5f, 0x71, 0xcf, 0x35, 0xa7, 0x34, 0x34, 0x78, 0x85, 0x36, 0x21, 0xa4, - 0x4a, 0x09, 0x5e, 0xef, 0x2a, 0x26, 0xcd, 0x74, 0x3e, 0x55, 0x9c, 0x5d, 0x7d, 0x7f, 0xbc, 0x0b, - 0x56, 0xf9, 0x82, 0xb8, 0xe1, 0x2a, 0x71, 0x40, 0x06, 0x32, 0xd1, 0x17, 0x70, 0x6e, 0xb0, 0x97, - 0xe6, 0xb4, 0xae, 0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0x60, 0xe3, 0x59, 0x80, 0xc1, 0xf3, 0x00, 0x1b, 0x0f, 0xfa, 0xd8, - 0x38, 0xec, 0x63, 0x70, 0xd4, 0xc7, 0xc6, 0xcf, 0x7d, 0x0c, 0x7e, 0xed, 0x63, 0xe3, 0xb8, 0x8f, - 0x8d, 0x87, 0x7d, 0x0c, 0x1e, 0xf5, 0x31, 0x78, 0xdc, 0xc7, 0xe0, 0xee, 0x47, 0x8e, 0x67, 0xa9, - 0x7d, 0xa6, 0xf6, 0xb9, 0xeb, 0x48, 0xcb, 0x65, 0xea, 0xbe, 0x27, 0x5a, 0xa5, 0xab, 0x7f, 0xe0, - 0x7e, 0xcb, 0x29, 0x29, 0xe5, 0xfa, 0xf5, 0x7a, 0x5a, 0x37, 0xf7, 0xfa, 0xdf, 0x01, 0x00, 0x00, - 0xff, 0xff, 0x18, 0xbe, 0x65, 0x85, 0xee, 0x08, 0x00, 0x00, + golang_proto.RegisterFile("lorawan-stack/api/client.proto", fileDescriptor_client_e1e973862478c1e0) +} + +var fileDescriptor_client_e1e973862478c1e0 = []byte{ + // 1067 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x41, 0x6c, 0x1b, 0x45, + 0x17, 0xde, 0x89, 0x13, 0x37, 0x9e, 0x24, 0xfe, 0xfd, 0x4f, 0xa0, 0x2c, 0x26, 0x4c, 0x8c, 0x41, + 0xc8, 0x42, 0x78, 0x0d, 0xa9, 0x10, 0x88, 0x0a, 0x90, 0x9d, 0x26, 0x69, 0x04, 0xc4, 0x65, 0xe2, + 0x08, 0xa9, 0x42, 0xb2, 0xc6, 0xde, 0xf1, 0x66, 0x64, 0x7b, 0xd7, 0xcc, 0x8c, 0x53, 0x85, 0x53, + 0xc5, 0x29, 0x42, 0x42, 0xea, 0x11, 0x71, 0x42, 0x70, 0x29, 0xb7, 0x1e, 0x2b, 0xc4, 0x21, 0x27, + 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 0x9f, 0xfd, 0x36, 0x0e, 0xe3, 0xab, 0x5a, 0x59, 0xb4, 0x01, 0x63, 0xdc, + 0x96, 0x26, 0xc8, 0x80, 0xdc, 0xdc, 0xca, 0x2b, 0xd6, 0x45, 0x85, 0xad, 0x10, 0xb4, 0x79, 0xfe, + 0x81, 0x12, 0x3a, 0x3a, 0x59, 0x36, 0x8e, 0x4f, 0x96, 0xc1, 0x2f, 0x7f, 0x1c, 0xc6, 0x66, 0xbe, + 0x01, 0x53, 0x29, 0x40, 0x82, 0x0e, 0x68, 0x15, 0xc2, 0xba, 0x60, 0x54, 0x31, 0xbb, 0x4a, 0x95, + 0x39, 0xa5, 0xfb, 0xa5, 0xad, 0x50, 0x13, 0x6b, 0xa0, 0x89, 0x55, 0x19, 0x68, 0x52, 0x9a, 0x0d, + 0x1a, 0xdd, 0xfb, 0x7d, 0x19, 0x90, 0x44, 0x54, 0x57, 0x54, 0x41, 0x93, 0x6e, 0xc7, 0x1e, 0x34, + 0x89, 0xfd, 0x9d, 0x26, 0x51, 0x5d, 0x51, 0x21, 0x04, 0xa7, 0x5d, 0xda, 0x66, 0xe6, 0x74, 0x06, + 0xe4, 0x12, 0x44, 0x9f, 0x51, 0x06, 0xce, 0xd9, 0x4c, 0xd6, 0x05, 0xef, 0x28, 0xee, 0xb9, 0xe6, + 0x8c, 0x4e, 0x0d, 0x5f, 0xa1, 0x75, 0x08, 0xa9, 0x52, 0x82, 0xd7, 0xba, 0x8a, 0x49, 0x33, 0x9e, + 0x89, 0xe5, 0xe6, 0x56, 0x5e, 0x9f, 0xac, 0x87, 0x55, 0x3c, 0x03, 0xae, 0xb9, 0x4a, 0xec, 0x93, + 0xa1, 0x4a, 0xf4, 0x21, 0x9c, 0x1f, 0x76, 0xd5, 0xbc, 0xa2, 0x3b, 0xbd, 0x34, 0xd6, 0x29, 0xc4, + 0x6c, 0xba, 0x0d, 0x8f, 0xcc, 0xd5, 0xcf, 0x03, 0x74, 0x15, 0xc6, 0x25, 0xab, 0x0b, 0xa6, 0xcc, + 0x59, 0x4d, 0x32, 0x8a, 0xd0, 0x3b, 0x70, 0x41, 0x30, 0x9b, 0x0b, 0x56, 0x57, 0xd5, 0xae, 0xe0, + 0xd2, 0x4c, 0x64, 0x62, 0xb9, 0x44, 0x29, 0xe5, 0x9f, 0x2c, 0xcf, 0x93, 0x28, 0xb1, 0x43, 0x36, + 0x25, 0x99, 0x1f, 0xc0, 0x76, 0x04, 0x97, 0xe8, 0x5d, 0x38, 0x23, 0x15, 0x55, 0xcc, 0x84, 0x19, + 0x90, 0x4b, 0xae, 0x3c, 0x3f, 0xca, 0x63, 0x3b, 0x48, 0x96, 0xa0, 0x76, 0xf3, 0x6b, 0xed, 0x66, + 0x88, 0x47, 0x79, 0x88, 0x64, 0x93, 0x77, 0xaa, 0xb4, 0xab, 0x76, 0x3d, 0xc1, 0xbf, 0xa2, 0x5a, + 0xb8, 0xb9, 0x0c, 0xc8, 0xcd, 0x92, 0xff, 0x07, 0x99, 0xe2, 0x70, 0x02, 0xa5, 0xe1, 0x2c, 0x73, + 0x6d, 0x4f, 0x48, 0x66, 0x9b, 0xf3, 0x1a, 0x74, 0x16, 0xa3, 0xb7, 0x61, 0xdc, 0x11, 0xd4, 0x55, + 0xd2, 0x5c, 0xc8, 0xc4, 0x72, 0xc9, 0x95, 0x17, 0x47, 0x49, 0x6c, 0x04, 0xd9, 0xca, 0x7e, 0x87, + 0x91, 0x08, 0x88, 0xf2, 0x30, 0x1e, 0x4e, 0xac, 0x99, 0xd4, 0x25, 0x63, 0xbc, 0x49, 0x90, 0x25, + 0x11, 0x28, 0xfd, 0x01, 0xfc, 0xdf, 0x88, 0x27, 0x28, 0x05, 0x63, 0x4d, 0xb6, 0xaf, 0x07, 0x3b, + 0x41, 0x82, 0x23, 0x7a, 0x0e, 0xce, 0xec, 0xd1, 0x56, 0x97, 0xe9, 0xe1, 0x4c, 0x90, 0x30, 0x78, + 0x7f, 0xea, 0x3d, 0x90, 0xbd, 0x0e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 0x63, 0xe3, 0xa0, 0x8f, 0xc1, 0xbd, 0x3e, 0x36, 0xbe, 0xeb, 0x63, 0xf0, 0x43, 0x1f, 0x1b, 0xf7, + 0xfb, 0xd8, 0x78, 0xd0, 0xc7, 0xe0, 0x61, 0x1f, 0x83, 0xc3, 0x3e, 0x06, 0xb7, 0xdf, 0x74, 0x3c, + 0x4b, 0xed, 0x32, 0xb5, 0xcb, 0x5d, 0x47, 0x5a, 0x2e, 0x53, 0x77, 0x3c, 0xd1, 0x2c, 0x5c, 0xfc, + 0x4b, 0xd0, 0x69, 0x3a, 0x05, 0xa5, 0xdc, 0x4e, 0xad, 0x16, 0xd7, 0x86, 0x5f, 0xfb, 0x33, 0x00, + 0x00, 0xff, 0xff, 0xa4, 0x72, 0x1e, 0x55, 0x7d, 0x09, 0x00, 0x00, } diff --git a/pkg/ttnpb/client.pb.paths.fm.go b/pkg/ttnpb/client.pb.paths.fm.go new file mode 100644 index 0000000000..f376009ccb --- /dev/null +++ b/pkg/ttnpb/client.pb.paths.fm.go @@ -0,0 +1,148 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var ClientFieldPathsNested = []string{ + "attributes", + "contact_info", + "created_at", + "description", + "endorsed", + "grants", + "ids", + "ids.client_id", + "name", + "redirect_uris", + "rights", + "secret", + "skip_authorization", + "state", + "updated_at", +} + +var ClientFieldPathsTopLevel = []string{ + "attributes", + "contact_info", + "created_at", + "description", + "endorsed", + "grants", + "ids", + "name", + "redirect_uris", + "rights", + "secret", + "skip_authorization", + "state", + "updated_at", +} +var ClientsFieldPathsNested = []string{ + "clients", +} + +var ClientsFieldPathsTopLevel = []string{ + "clients", +} +var GetClientRequestFieldPathsNested = []string{ + "client_ids", + "client_ids.client_id", + "field_mask", +} + +var GetClientRequestFieldPathsTopLevel = []string{ + "client_ids", + "field_mask", +} +var ListClientsRequestFieldPathsNested = []string{ + "collaborator", + "collaborator.ids", + "collaborator.ids.organization_ids", + "collaborator.ids.organization_ids.organization_id", + "collaborator.ids.user_ids", + "collaborator.ids.user_ids.email", + "collaborator.ids.user_ids.user_id", + "field_mask", + "limit", + "order", + "page", +} + +var ListClientsRequestFieldPathsTopLevel = []string{ + "collaborator", + "field_mask", + "limit", + "order", + "page", +} +var CreateClientRequestFieldPathsNested = []string{ + "client", + "client.attributes", + "client.contact_info", + "client.created_at", + "client.description", + "client.endorsed", + "client.grants", + "client.ids", + "client.ids.client_id", + "client.name", + "client.redirect_uris", + "client.rights", + "client.secret", + "client.skip_authorization", + "client.state", + "client.updated_at", + "collaborator", + "collaborator.ids", + "collaborator.ids.organization_ids", + "collaborator.ids.organization_ids.organization_id", + "collaborator.ids.user_ids", + "collaborator.ids.user_ids.email", + "collaborator.ids.user_ids.user_id", +} + +var CreateClientRequestFieldPathsTopLevel = []string{ + "client", + "collaborator", +} +var UpdateClientRequestFieldPathsNested = []string{ + "client", + "client.attributes", + "client.contact_info", + "client.created_at", + "client.description", + "client.endorsed", + "client.grants", + "client.ids", + "client.ids.client_id", + "client.name", + "client.redirect_uris", + "client.rights", + "client.secret", + "client.skip_authorization", + "client.state", + "client.updated_at", + "field_mask", +} + +var UpdateClientRequestFieldPathsTopLevel = []string{ + "client", + "field_mask", +} +var SetClientCollaboratorRequestFieldPathsNested = []string{ + "client_ids", + "client_ids.client_id", + "collaborator", + "collaborator.ids", + "collaborator.ids.ids", + "collaborator.ids.ids.organization_ids", + "collaborator.ids.ids.organization_ids.organization_id", + "collaborator.ids.ids.user_ids", + "collaborator.ids.ids.user_ids.email", + "collaborator.ids.ids.user_ids.user_id", + "collaborator.rights", +} + +var SetClientCollaboratorRequestFieldPathsTopLevel = []string{ + "client_ids", + "collaborator", +} diff --git a/pkg/ttnpb/client.pb.fm.go b/pkg/ttnpb/client.pb.setters.fm.go similarity index 75% rename from pkg/ttnpb/client.pb.fm.go rename to pkg/ttnpb/client.pb.setters.fm.go index 182b7aa5d6..19f7b878c2 100644 --- a/pkg/ttnpb/client.pb.fm.go +++ b/pkg/ttnpb/client.pb.setters.fm.go @@ -6,44 +6,9 @@ import ( fmt "fmt" time "time" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + types "github.com/gogo/protobuf/types" ) -var ClientFieldPathsNested = []string{ - "attributes", - "contact_info", - "created_at", - "description", - "endorsed", - "grants", - "ids", - "ids.client_id", - "name", - "redirect_uris", - "rights", - "secret", - "skip_authorization", - "state", - "updated_at", -} - -var ClientFieldPathsTopLevel = []string{ - "attributes", - "contact_info", - "created_at", - "description", - "endorsed", - "grants", - "ids", - "name", - "redirect_uris", - "rights", - "secret", - "skip_authorization", - "state", - "updated_at", -} - func (dst *Client) SetFields(src *Client, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -198,14 +163,6 @@ func (dst *Client) SetFields(src *Client, paths ...string) error { return nil } -var ClientsFieldPathsNested = []string{ - "clients", -} - -var ClientsFieldPathsTopLevel = []string{ - "clients", -} - func (dst *Clients) SetFields(src *Clients, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -226,17 +183,6 @@ func (dst *Clients) SetFields(src *Clients, paths ...string) error { return nil } -var GetClientRequestFieldPathsNested = []string{ - "client_ids", - "client_ids.client_id", - "field_mask", -} - -var GetClientRequestFieldPathsTopLevel = []string{ - "client_ids", - "field_mask", -} - func (dst *GetClientRequest) SetFields(src *GetClientRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -265,7 +211,7 @@ func (dst *GetClientRequest) SetFields(src *GetClientRequest, paths ...string) e if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } @@ -276,28 +222,6 @@ func (dst *GetClientRequest) SetFields(src *GetClientRequest, paths ...string) e return nil } -var ListClientsRequestFieldPathsNested = []string{ - "collaborator", - "collaborator.ids", - "collaborator.ids.organization_ids", - "collaborator.ids.organization_ids.organization_id", - "collaborator.ids.user_ids", - "collaborator.ids.user_ids.email", - "collaborator.ids.user_ids.user_id", - "field_mask", - "limit", - "order", - "page", -} - -var ListClientsRequestFieldPathsTopLevel = []string{ - "collaborator", - "field_mask", - "limit", - "order", - "page", -} - func (dst *ListClientsRequest) SetFields(src *ListClientsRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -329,7 +253,7 @@ func (dst *ListClientsRequest) SetFields(src *ListClientsRequest, paths ...strin if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } case "order": @@ -370,37 +294,6 @@ func (dst *ListClientsRequest) SetFields(src *ListClientsRequest, paths ...strin return nil } -var CreateClientRequestFieldPathsNested = []string{ - "client", - "client.attributes", - "client.contact_info", - "client.created_at", - "client.description", - "client.endorsed", - "client.grants", - "client.ids", - "client.ids.client_id", - "client.name", - "client.redirect_uris", - "client.rights", - "client.secret", - "client.skip_authorization", - "client.state", - "client.updated_at", - "collaborator", - "collaborator.ids", - "collaborator.ids.organization_ids", - "collaborator.ids.organization_ids.organization_id", - "collaborator.ids.user_ids", - "collaborator.ids.user_ids.email", - "collaborator.ids.user_ids.user_id", -} - -var CreateClientRequestFieldPathsTopLevel = []string{ - "client", - "collaborator", -} - func (dst *CreateClientRequest) SetFields(src *CreateClientRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -448,31 +341,6 @@ func (dst *CreateClientRequest) SetFields(src *CreateClientRequest, paths ...str return nil } -var UpdateClientRequestFieldPathsNested = []string{ - "client", - "client.attributes", - "client.contact_info", - "client.created_at", - "client.description", - "client.endorsed", - "client.grants", - "client.ids", - "client.ids.client_id", - "client.name", - "client.redirect_uris", - "client.rights", - "client.secret", - "client.skip_authorization", - "client.state", - "client.updated_at", - "field_mask", -} - -var UpdateClientRequestFieldPathsTopLevel = []string{ - "client", - "field_mask", -} - func (dst *UpdateClientRequest) SetFields(src *UpdateClientRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -501,7 +369,7 @@ func (dst *UpdateClientRequest) SetFields(src *UpdateClientRequest, paths ...str if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } @@ -512,25 +380,6 @@ func (dst *UpdateClientRequest) SetFields(src *UpdateClientRequest, paths ...str return nil } -var SetClientCollaboratorRequestFieldPathsNested = []string{ - "client_ids", - "client_ids.client_id", - "collaborator", - "collaborator.ids", - "collaborator.ids.ids", - "collaborator.ids.ids.organization_ids", - "collaborator.ids.ids.organization_ids.organization_id", - "collaborator.ids.ids.user_ids", - "collaborator.ids.ids.user_ids.email", - "collaborator.ids.ids.user_ids.user_id", - "collaborator.rights", -} - -var SetClientCollaboratorRequestFieldPathsTopLevel = []string{ - "client_ids", - "collaborator", -} - func (dst *SetClientCollaboratorRequest) SetFields(src *SetClientCollaboratorRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { diff --git a/pkg/ttnpb/client.pb.validate.go b/pkg/ttnpb/client.pb.validate.go new file mode 100644 index 0000000000..9ba2eb468d --- /dev/null +++ b/pkg/ttnpb/client.pb.validate.go @@ -0,0 +1,818 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on Client with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *Client) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ClientFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "ids": + + if v, ok := interface{}(&m.ClientIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ClientValidationError{ + field: "ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "created_at": + + if v, ok := interface{}(&m.CreatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ClientValidationError{ + field: "created_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "updated_at": + + if v, ok := interface{}(&m.UpdatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ClientValidationError{ + field: "updated_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "name": + // no validation rules for Name + case "description": + // no validation rules for Description + case "attributes": + // no validation rules for Attributes + case "contact_info": + + for idx, item := range m.GetContactInfo() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ClientValidationError{ + field: fmt.Sprintf("contact_info[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "secret": + // no validation rules for Secret + case "redirect_uris": + + case "state": + + if _, ok := State_name[int32(m.GetState())]; !ok { + return ClientValidationError{ + field: "state", + reason: "value must be one of the defined enum values", + } + } + + case "skip_authorization": + // no validation rules for SkipAuthorization + case "endorsed": + // no validation rules for Endorsed + case "grants": + + case "rights": + + default: + return ClientValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ClientValidationError is the validation error returned by +// Client.ValidateFields if the designated constraints aren't met. +type ClientValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ClientValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ClientValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ClientValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ClientValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ClientValidationError) ErrorName() string { return "ClientValidationError" } + +// Error satisfies the builtin error interface +func (e ClientValidationError) 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 %sClient.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ClientValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ClientValidationError{} + +// ValidateFields checks the field values on Clients with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *Clients) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ClientsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "clients": + + for idx, item := range m.GetClients() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ClientsValidationError{ + field: fmt.Sprintf("clients[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + default: + return ClientsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ClientsValidationError is the validation error returned by +// Clients.ValidateFields if the designated constraints aren't met. +type ClientsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ClientsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ClientsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ClientsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ClientsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ClientsValidationError) ErrorName() string { return "ClientsValidationError" } + +// Error satisfies the builtin error interface +func (e ClientsValidationError) 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 %sClients.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ClientsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ClientsValidationError{} + +// ValidateFields checks the field values on GetClientRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GetClientRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GetClientRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "client_ids": + + if v, ok := interface{}(&m.ClientIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GetClientRequestValidationError{ + field: "client_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GetClientRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return GetClientRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GetClientRequestValidationError is the validation error returned by +// GetClientRequest.ValidateFields if the designated constraints aren't met. +type GetClientRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetClientRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetClientRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetClientRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetClientRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetClientRequestValidationError) ErrorName() string { return "GetClientRequestValidationError" } + +// Error satisfies the builtin error interface +func (e GetClientRequestValidationError) 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 %sGetClientRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetClientRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetClientRequestValidationError{} + +// ValidateFields checks the field values on ListClientsRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ListClientsRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ListClientsRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "collaborator": + + if v, ok := interface{}(m.GetCollaborator()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ListClientsRequestValidationError{ + field: "collaborator", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ListClientsRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "order": + // no validation rules for Order + case "limit": + // no validation rules for Limit + case "page": + // no validation rules for Page + default: + return ListClientsRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ListClientsRequestValidationError is the validation error returned by +// ListClientsRequest.ValidateFields if the designated constraints aren't met. +type ListClientsRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListClientsRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListClientsRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListClientsRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListClientsRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListClientsRequestValidationError) ErrorName() string { + return "ListClientsRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e ListClientsRequestValidationError) 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 %sListClientsRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListClientsRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListClientsRequestValidationError{} + +// ValidateFields checks the field values on CreateClientRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *CreateClientRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = CreateClientRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "client": + + if v, ok := interface{}(&m.Client).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return CreateClientRequestValidationError{ + field: "client", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "collaborator": + + if v, ok := interface{}(&m.Collaborator).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return CreateClientRequestValidationError{ + field: "collaborator", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return CreateClientRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// CreateClientRequestValidationError is the validation error returned by +// CreateClientRequest.ValidateFields if the designated constraints aren't met. +type CreateClientRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CreateClientRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CreateClientRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CreateClientRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CreateClientRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CreateClientRequestValidationError) ErrorName() string { + return "CreateClientRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e CreateClientRequestValidationError) 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 %sCreateClientRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CreateClientRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CreateClientRequestValidationError{} + +// ValidateFields checks the field values on UpdateClientRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *UpdateClientRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = UpdateClientRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "client": + + if v, ok := interface{}(&m.Client).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UpdateClientRequestValidationError{ + field: "client", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UpdateClientRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return UpdateClientRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// UpdateClientRequestValidationError is the validation error returned by +// UpdateClientRequest.ValidateFields if the designated constraints aren't met. +type UpdateClientRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UpdateClientRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UpdateClientRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UpdateClientRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UpdateClientRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UpdateClientRequestValidationError) ErrorName() string { + return "UpdateClientRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e UpdateClientRequestValidationError) 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 %sUpdateClientRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UpdateClientRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UpdateClientRequestValidationError{} + +// ValidateFields checks the field values on SetClientCollaboratorRequest with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *SetClientCollaboratorRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = SetClientCollaboratorRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "client_ids": + + if v, ok := interface{}(&m.ClientIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SetClientCollaboratorRequestValidationError{ + field: "client_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "collaborator": + + if v, ok := interface{}(&m.Collaborator).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SetClientCollaboratorRequestValidationError{ + field: "collaborator", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return SetClientCollaboratorRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// SetClientCollaboratorRequestValidationError is the validation error returned +// by SetClientCollaboratorRequest.ValidateFields if the designated +// constraints aren't met. +type SetClientCollaboratorRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SetClientCollaboratorRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SetClientCollaboratorRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SetClientCollaboratorRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SetClientCollaboratorRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SetClientCollaboratorRequestValidationError) ErrorName() string { + return "SetClientCollaboratorRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e SetClientCollaboratorRequestValidationError) 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 %sSetClientCollaboratorRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SetClientCollaboratorRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SetClientCollaboratorRequestValidationError{} diff --git a/pkg/ttnpb/client.validator.pb.go b/pkg/ttnpb/client.validator.pb.go deleted file mode 100644 index cababb4b48..0000000000 --- a/pkg/ttnpb/client.validator.pb.go +++ /dev/null @@ -1,98 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/client.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/timestamp" -import _ "google.golang.org/genproto/protobuf/field_mask" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *Client) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ClientIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ClientIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.CreatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("CreatedAt", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UpdatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UpdatedAt", err) - } - // Validation of proto3 map<> fields is unsupported. - for _, item := range this.ContactInfo { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ContactInfo", err) - } - } - } - return nil -} -func (this *Clients) Validate() error { - for _, item := range this.Clients { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Clients", err) - } - } - } - return nil -} -func (this *GetClientRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ClientIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ClientIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *ListClientsRequest) Validate() error { - if this.Collaborator != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Collaborator); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Collaborator", err) - } - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *CreateClientRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Client)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Client", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Collaborator)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Collaborator", err) - } - return nil -} -func (this *UpdateClientRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Client)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Client", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *SetClientCollaboratorRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ClientIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ClientIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Collaborator)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Collaborator", err) - } - return nil -} diff --git a/pkg/ttnpb/client_services.pb.gw.go b/pkg/ttnpb/client_services.pb.gw.go index 3fc9844125..4adf3c9c4f 100644 --- a/pkg/ttnpb/client_services.pb.gw.go +++ b/pkg/ttnpb/client_services.pb.gw.go @@ -9,11 +9,10 @@ It translates gRPC into RESTful JSON APIs. package ttnpb import ( + "context" "io" "net/http" - "context" - "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" diff --git a/pkg/ttnpb/client_services.pb.validate.go b/pkg/ttnpb/client_services.pb.validate.go new file mode 100644 index 0000000000..fb43d9d432 --- /dev/null +++ b/pkg/ttnpb/client_services.pb.validate.go @@ -0,0 +1,33 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) diff --git a/pkg/ttnpb/client_services.validator.pb.go b/pkg/ttnpb/client_services.validator.pb.go deleted file mode 100644 index b5ce42cefc..0000000000 --- a/pkg/ttnpb/client_services.validator.pb.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/client_services.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/empty" -import _ "google.golang.org/genproto/googleapis/api/annotations" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen diff --git a/pkg/ttnpb/cluster.pb.go b/pkg/ttnpb/cluster.pb.go index a236dc7a26..7df0cf9add 100644 --- a/pkg/ttnpb/cluster.pb.go +++ b/pkg/ttnpb/cluster.pb.go @@ -8,6 +8,7 @@ import golang_proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" +import _ "github.com/lyft/protoc-gen-validate/validate" import strconv "strconv" @@ -64,7 +65,7 @@ var PeerInfo_Role_value = map[string]int32{ } func (PeerInfo_Role) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_cluster_2e545a3f337d7e13, []int{0, 0} + return fileDescriptor_cluster_aceacf85c99722e6, []int{0, 0} } // PeerInfo @@ -73,7 +74,7 @@ type PeerInfo struct { GRPCPort uint32 `protobuf:"varint,1,opt,name=grpc_port,json=grpcPort,proto3" json:"grpc_port,omitempty"` // Indicates whether the gRPC server uses TLS. TLS bool `protobuf:"varint,2,opt,name=tls,proto3" json:"tls,omitempty"` - // Roles of the peer () + // Roles of the peer. Roles []PeerInfo_Role `protobuf:"varint,3,rep,packed,name=roles,proto3,enum=ttn.lorawan.v3.PeerInfo_Role" json:"roles,omitempty"` // Tags of the peer Tags map[string]string `protobuf:"bytes,4,rep,name=tags,proto3" json:"tags,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` @@ -84,7 +85,7 @@ type PeerInfo struct { func (m *PeerInfo) Reset() { *m = PeerInfo{} } func (*PeerInfo) ProtoMessage() {} func (*PeerInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_cluster_2e545a3f337d7e13, []int{0} + return fileDescriptor_cluster_aceacf85c99722e6, []int{0} } func (m *PeerInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -821,46 +822,47 @@ var ( ) func init() { - proto.RegisterFile("lorawan-stack/api/cluster.proto", fileDescriptor_cluster_2e545a3f337d7e13) + proto.RegisterFile("lorawan-stack/api/cluster.proto", fileDescriptor_cluster_aceacf85c99722e6) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/cluster.proto", fileDescriptor_cluster_2e545a3f337d7e13) + golang_proto.RegisterFile("lorawan-stack/api/cluster.proto", fileDescriptor_cluster_aceacf85c99722e6) } -var fileDescriptor_cluster_2e545a3f337d7e13 = []byte{ - // 529 bytes of a gzipped FileDescriptorProto +var fileDescriptor_cluster_aceacf85c99722e6 = []byte{ + // 556 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x31, 0x4c, 0xdb, 0x4c, - 0x1c, 0xc5, 0xef, 0x70, 0x80, 0xe4, 0xf8, 0x80, 0x7c, 0xd7, 0xaa, 0x4a, 0x91, 0xfa, 0x4f, 0x94, - 0x29, 0x95, 0x8a, 0x2d, 0x11, 0xa9, 0xad, 0xba, 0x25, 0x91, 0x15, 0xb9, 0x45, 0x89, 0x75, 0xb1, - 0x8a, 0xd2, 0x25, 0x72, 0x22, 0xe3, 0x44, 0x71, 0x7d, 0x96, 0x7d, 0x01, 0xb1, 0x31, 0x32, 0x55, - 0x5d, 0x2a, 0x75, 0xac, 0x3a, 0x31, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x21, 0x7c, 0x5e, 0x18, - 0x19, 0x19, 0x2b, 0x3b, 0x0d, 0x12, 0x43, 0xb7, 0xf7, 0x7e, 0xf7, 0xfe, 0xba, 0x37, 0x3c, 0x52, - 0xf6, 0x78, 0x68, 0x1f, 0xda, 0xfe, 0x76, 0x24, 0xec, 0xd1, 0x54, 0xb3, 0x83, 0x89, 0x36, 0xf2, - 0x66, 0x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04, 0xf0, 0x79, 0x02, 0xf8, - 0x22, 0x01, 0xfc, 0xe5, 0x8d, 0xcb, 0x55, 0x31, 0x76, 0xc4, 0x78, 0xe2, 0xbb, 0x91, 0xea, 0x3b, - 0xe2, 0x90, 0x87, 0x53, 0xed, 0xe9, 0xf8, 0x82, 0xa9, 0xab, 0x09, 0xe1, 0x07, 0xc3, 0xe1, 0x4a, - 0x36, 0x9e, 0xfa, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2a, 0x0f, 0xcf, 0xb8, 0x9e, 0x02, 0x00, - 0x00, + 0x14, 0xc7, 0xef, 0x70, 0x80, 0xe4, 0xf8, 0x80, 0x7c, 0xd7, 0xaa, 0x4a, 0x91, 0xfa, 0x88, 0x98, + 0x52, 0xa9, 0xb1, 0x25, 0x90, 0xda, 0xaa, 0x9d, 0x42, 0x64, 0x21, 0xb7, 0x28, 0xb1, 0x2e, 0x56, + 0x51, 0xba, 0x20, 0x27, 0x75, 0x9c, 0x28, 0xae, 0xcf, 0xb2, 0x2f, 0x41, 0xd9, 0x18, 0x99, 0xaa, + 0x2e, 0x95, 0x3a, 0x56, 0x9d, 0x18, 0x19, 0x19, 0x19, 0x19, 0x19, 0x99, 0x10, 0x3e, 0x2f, 0x8c, + 0x8c, 0x8c, 0x95, 0x9d, 0x06, 0x15, 0x55, 0xdd, 0xfe, 0xef, 0xe7, 0xdf, 0x93, 0xff, 0x27, 0x3d, + 0xb2, 0xee, 0xf1, 0xd0, 0x3e, 0xb0, 0xfd, 0x6a, 0x24, 0xec, 0xee, 0x50, 0xb3, 0x83, 0x81, 0xd6, + 0xf5, 0x46, 0x91, 0x70, 0x42, 0x35, 0x08, 0xb9, 0xe0, 0x74, 0x45, 0x08, 0x5f, 0xfd, 0x2d, 0xa9, + 0xe3, 0xad, 0xb5, 0xaa, 0x3b, 0x10, 0xfd, 0x51, 0x47, 0xed, 0xf2, 0xcf, 0x9a, 0xcb, 0x5d, 0xae, + 0x65, 0x5a, 0x67, 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 0xc7, 0x17, + 0x2e, 0x57, 0x45, 0xdf, 0x11, 0xfd, 0x81, 0xef, 0x46, 0xaa, 0xef, 0x88, 0x03, 0x1e, 0x0e, 0xb5, + 0x87, 0x97, 0x1b, 0x0c, 0x5d, 0x4d, 0x08, 0x3f, 0xe8, 0x74, 0x16, 0xb2, 0xe3, 0xd9, 0xfa, 0x15, + 0x00, 0x00, 0xff, 0xff, 0x81, 0x7d, 0x44, 0x14, 0xdb, 0x02, 0x00, 0x00, } diff --git a/pkg/ttnpb/cluster.pb.paths.fm.go b/pkg/ttnpb/cluster.pb.paths.fm.go new file mode 100644 index 0000000000..c88ab92ff8 --- /dev/null +++ b/pkg/ttnpb/cluster.pb.paths.fm.go @@ -0,0 +1,17 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var PeerInfoFieldPathsNested = []string{ + "grpc_port", + "roles", + "tags", + "tls", +} + +var PeerInfoFieldPathsTopLevel = []string{ + "grpc_port", + "roles", + "tags", + "tls", +} diff --git a/pkg/ttnpb/cluster.pb.fm.go b/pkg/ttnpb/cluster.pb.setters.fm.go similarity index 87% rename from pkg/ttnpb/cluster.pb.fm.go rename to pkg/ttnpb/cluster.pb.setters.fm.go index 83eb83b62b..46acf5e737 100644 --- a/pkg/ttnpb/cluster.pb.fm.go +++ b/pkg/ttnpb/cluster.pb.setters.fm.go @@ -4,20 +4,6 @@ package ttnpb import fmt "fmt" -var PeerInfoFieldPathsNested = []string{ - "grpc_port", - "roles", - "tags", - "tls", -} - -var PeerInfoFieldPathsTopLevel = []string{ - "grpc_port", - "roles", - "tags", - "tls", -} - func (dst *PeerInfo) SetFields(src *PeerInfo, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { diff --git a/pkg/ttnpb/cluster.pb.validate.go b/pkg/ttnpb/cluster.pb.validate.go new file mode 100644 index 0000000000..0007eaa68b --- /dev/null +++ b/pkg/ttnpb/cluster.pb.validate.go @@ -0,0 +1,120 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on PeerInfo with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *PeerInfo) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = PeerInfoFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "grpc_port": + // no validation rules for GRPCPort + case "tls": + // no validation rules for TLS + case "roles": + + case "tags": + // no validation rules for Tags + default: + return PeerInfoValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// PeerInfoValidationError is the validation error returned by +// PeerInfo.ValidateFields if the designated constraints aren't met. +type PeerInfoValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e PeerInfoValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e PeerInfoValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e PeerInfoValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e PeerInfoValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e PeerInfoValidationError) ErrorName() string { return "PeerInfoValidationError" } + +// Error satisfies the builtin error interface +func (e PeerInfoValidationError) 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 %sPeerInfo.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = PeerInfoValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = PeerInfoValidationError{} diff --git a/pkg/ttnpb/cluster.validator.pb.go b/pkg/ttnpb/cluster.validator.pb.go deleted file mode 100644 index 6060f8a5c3..0000000000 --- a/pkg/ttnpb/cluster.validator.pb.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/cluster.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *PeerInfo) Validate() error { - // Validation of proto3 map<> fields is unsupported. - return nil -} diff --git a/pkg/ttnpb/contact_info.pb.gw.go b/pkg/ttnpb/contact_info.pb.gw.go index a1b1a84127..548941dc90 100644 --- a/pkg/ttnpb/contact_info.pb.gw.go +++ b/pkg/ttnpb/contact_info.pb.gw.go @@ -9,11 +9,10 @@ It translates gRPC into RESTful JSON APIs. package ttnpb import ( + "context" "io" "net/http" - "context" - "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" diff --git a/pkg/ttnpb/contact_info.pb.paths.fm.go b/pkg/ttnpb/contact_info.pb.paths.fm.go new file mode 100644 index 0000000000..44e8916ed0 --- /dev/null +++ b/pkg/ttnpb/contact_info.pb.paths.fm.go @@ -0,0 +1,56 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var ContactInfoFieldPathsNested = []string{ + "contact_method", + "contact_type", + "public", + "validated_at", + "value", +} + +var ContactInfoFieldPathsTopLevel = []string{ + "contact_method", + "contact_type", + "public", + "validated_at", + "value", +} +var ContactInfoValidationFieldPathsNested = []string{ + "contact_info", + "created_at", + "entity", + "entity.ids", + "entity.ids.application_ids", + "entity.ids.application_ids.application_id", + "entity.ids.client_ids", + "entity.ids.client_ids.client_id", + "entity.ids.device_ids", + "entity.ids.device_ids.application_ids", + "entity.ids.device_ids.application_ids.application_id", + "entity.ids.device_ids.dev_addr", + "entity.ids.device_ids.dev_eui", + "entity.ids.device_ids.device_id", + "entity.ids.device_ids.join_eui", + "entity.ids.gateway_ids", + "entity.ids.gateway_ids.eui", + "entity.ids.gateway_ids.gateway_id", + "entity.ids.organization_ids", + "entity.ids.organization_ids.organization_id", + "entity.ids.user_ids", + "entity.ids.user_ids.email", + "entity.ids.user_ids.user_id", + "expires_at", + "id", + "token", +} + +var ContactInfoValidationFieldPathsTopLevel = []string{ + "contact_info", + "created_at", + "entity", + "expires_at", + "id", + "token", +} diff --git a/pkg/ttnpb/contact_info.pb.fm.go b/pkg/ttnpb/contact_info.pb.setters.fm.go similarity index 73% rename from pkg/ttnpb/contact_info.pb.fm.go rename to pkg/ttnpb/contact_info.pb.setters.fm.go index a80919b77f..4bc245ffcd 100644 --- a/pkg/ttnpb/contact_info.pb.fm.go +++ b/pkg/ttnpb/contact_info.pb.setters.fm.go @@ -4,22 +4,6 @@ package ttnpb import fmt "fmt" -var ContactInfoFieldPathsNested = []string{ - "contact_method", - "contact_type", - "public", - "validated_at", - "value", -} - -var ContactInfoFieldPathsTopLevel = []string{ - "contact_method", - "contact_type", - "public", - "validated_at", - "value", -} - func (dst *ContactInfo) SetFields(src *ContactInfo, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -80,44 +64,6 @@ func (dst *ContactInfo) SetFields(src *ContactInfo, paths ...string) error { return nil } -var ContactInfoValidationFieldPathsNested = []string{ - "contact_info", - "created_at", - "entity", - "entity.ids", - "entity.ids.application_ids", - "entity.ids.application_ids.application_id", - "entity.ids.client_ids", - "entity.ids.client_ids.client_id", - "entity.ids.device_ids", - "entity.ids.device_ids.application_ids", - "entity.ids.device_ids.application_ids.application_id", - "entity.ids.device_ids.dev_addr", - "entity.ids.device_ids.dev_eui", - "entity.ids.device_ids.device_id", - "entity.ids.device_ids.join_eui", - "entity.ids.gateway_ids", - "entity.ids.gateway_ids.eui", - "entity.ids.gateway_ids.gateway_id", - "entity.ids.organization_ids", - "entity.ids.organization_ids.organization_id", - "entity.ids.user_ids", - "entity.ids.user_ids.email", - "entity.ids.user_ids.user_id", - "expires_at", - "id", - "token", -} - -var ContactInfoValidationFieldPathsTopLevel = []string{ - "contact_info", - "created_at", - "entity", - "expires_at", - "id", - "token", -} - func (dst *ContactInfoValidation) SetFields(src *ContactInfoValidation, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { diff --git a/pkg/ttnpb/contact_info.pb.validate.go b/pkg/ttnpb/contact_info.pb.validate.go new file mode 100644 index 0000000000..2e3a859020 --- /dev/null +++ b/pkg/ttnpb/contact_info.pb.validate.go @@ -0,0 +1,270 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on ContactInfo with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *ContactInfo) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ContactInfoFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "contact_type": + // no validation rules for ContactType + case "contact_method": + // no validation rules for ContactMethod + case "value": + // no validation rules for Value + case "public": + // no validation rules for Public + case "validated_at": + + if v, ok := interface{}(m.GetValidatedAt()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ContactInfoValidationError{ + field: "validated_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return ContactInfoValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ContactInfoValidationError is the validation error returned by +// ContactInfo.ValidateFields if the designated constraints aren't met. +type ContactInfoValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ContactInfoValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ContactInfoValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ContactInfoValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ContactInfoValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ContactInfoValidationError) ErrorName() string { return "ContactInfoValidationError" } + +// Error satisfies the builtin error interface +func (e ContactInfoValidationError) 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 %sContactInfo.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ContactInfoValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ContactInfoValidationError{} + +// ValidateFields checks the field values on ContactInfoValidation with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ContactInfoValidation) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ContactInfoValidationFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "id": + // no validation rules for ID + case "token": + // no validation rules for Token + case "entity": + + if v, ok := interface{}(m.GetEntity()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ContactInfoValidationValidationError{ + field: "entity", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "contact_info": + + for idx, item := range m.GetContactInfo() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ContactInfoValidationValidationError{ + field: fmt.Sprintf("contact_info[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "created_at": + + if v, ok := interface{}(m.GetCreatedAt()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ContactInfoValidationValidationError{ + field: "created_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "expires_at": + + if v, ok := interface{}(m.GetExpiresAt()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ContactInfoValidationValidationError{ + field: "expires_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return ContactInfoValidationValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ContactInfoValidationValidationError is the validation error returned by +// ContactInfoValidation.ValidateFields if the designated constraints aren't met. +type ContactInfoValidationValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ContactInfoValidationValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ContactInfoValidationValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ContactInfoValidationValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ContactInfoValidationValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ContactInfoValidationValidationError) ErrorName() string { + return "ContactInfoValidationValidationError" +} + +// Error satisfies the builtin error interface +func (e ContactInfoValidationValidationError) 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 %sContactInfoValidation.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ContactInfoValidationValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ContactInfoValidationValidationError{} diff --git a/pkg/ttnpb/contact_info.validator.pb.go b/pkg/ttnpb/contact_info.validator.pb.go deleted file mode 100644 index daf5466394..0000000000 --- a/pkg/ttnpb/contact_info.validator.pb.go +++ /dev/null @@ -1,55 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/contact_info.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/empty" -import _ "github.com/golang/protobuf/ptypes/timestamp" -import _ "google.golang.org/genproto/googleapis/api/annotations" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *ContactInfo) Validate() error { - if this.ValidatedAt != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ValidatedAt); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ValidatedAt", err) - } - } - return nil -} -func (this *ContactInfoValidation) Validate() error { - if this.Entity != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Entity); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Entity", err) - } - } - for _, item := range this.ContactInfo { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ContactInfo", err) - } - } - } - if this.CreatedAt != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.CreatedAt); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("CreatedAt", err) - } - } - if this.ExpiresAt != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ExpiresAt); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ExpiresAt", err) - } - } - return nil -} diff --git a/pkg/ttnpb/end_device.go b/pkg/ttnpb/end_device.go new file mode 100644 index 0000000000..811a01a6f8 --- /dev/null +++ b/pkg/ttnpb/end_device.go @@ -0,0 +1,39 @@ +// Copyright © 2019 The Things Network Foundation, The Things Industries B.V. +// +// 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. + +package ttnpb + +import "context" + +// ValidateContext wraps the generated validator with (optionally context-based) custom checks. +func (m *UpdateEndDeviceRequest) ValidateContext(context.Context) error { + if len(m.FieldMask.Paths) == 0 { + return m.ValidateFields() + } + return m.ValidateFields(append(fieldsWithPrefix("end_device", m.FieldMask.Paths...), + "end_device.ids.application_ids", + "end_device.ids.device_id", + )...) +} + +// ValidateContext wraps the generated validator with (optionally context-based) custom checks. +func (m *SetEndDeviceRequest) ValidateContext(context.Context) error { + if len(m.FieldMask.Paths) == 0 { + return m.ValidateFields() + } + return m.ValidateFields(append(fieldsWithPrefix("end_device", m.FieldMask.Paths...), + "end_device.ids.application_ids", + "end_device.ids.device_id", + )...) +} diff --git a/pkg/ttnpb/end_device.pb.go b/pkg/ttnpb/end_device.pb.go index a4e03a5897..32c1b980a7 100644 --- a/pkg/ttnpb/end_device.pb.go +++ b/pkg/ttnpb/end_device.pb.go @@ -9,7 +9,7 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import types "github.com/gogo/protobuf/types" -import _ "github.com/mwitkow/go-proto-validators" +import _ "github.com/lyft/protoc-gen-validate/validate" import _ "google.golang.org/genproto/googleapis/api/annotations" import go_thethings_network_lorawan_stack_pkg_types "go.thethings.network/lorawan-stack/pkg/types" @@ -62,7 +62,7 @@ var PowerState_value = map[string]int32{ } func (PowerState) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{0} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{0} } type Session struct { @@ -87,7 +87,7 @@ type Session struct { func (m *Session) Reset() { *m = Session{} } func (*Session) ProtoMessage() {} func (*Session) Descriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{0} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{0} } func (m *Session) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -199,7 +199,7 @@ type MACParameters struct { func (m *MACParameters) Reset() { *m = MACParameters{} } func (*MACParameters) ProtoMessage() {} func (*MACParameters) Descriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{1} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{1} } func (m *MACParameters) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -379,7 +379,7 @@ type MACParameters_Channel struct { func (m *MACParameters_Channel) Reset() { *m = MACParameters_Channel{} } func (*MACParameters_Channel) ProtoMessage() {} func (*MACParameters_Channel) Descriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{1, 0} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{1, 0} } func (m *MACParameters_Channel) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -456,7 +456,7 @@ type EndDeviceBrand struct { func (m *EndDeviceBrand) Reset() { *m = EndDeviceBrand{} } func (*EndDeviceBrand) ProtoMessage() {} func (*EndDeviceBrand) Descriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{2} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{2} } func (m *EndDeviceBrand) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -524,7 +524,7 @@ type EndDeviceModel struct { func (m *EndDeviceModel) Reset() { *m = EndDeviceModel{} } func (*EndDeviceModel) ProtoMessage() {} func (*EndDeviceModel) Descriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{3} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{3} } func (m *EndDeviceModel) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -587,7 +587,7 @@ type EndDeviceVersionIdentifiers struct { func (m *EndDeviceVersionIdentifiers) Reset() { *m = EndDeviceVersionIdentifiers{} } func (*EndDeviceVersionIdentifiers) ProtoMessage() {} func (*EndDeviceVersionIdentifiers) Descriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{4} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{4} } func (m *EndDeviceVersionIdentifiers) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -679,7 +679,7 @@ type EndDeviceVersion struct { func (m *EndDeviceVersion) Reset() { *m = EndDeviceVersion{} } func (*EndDeviceVersion) ProtoMessage() {} func (*EndDeviceVersion) Descriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{5} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{5} } func (m *EndDeviceVersion) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -804,7 +804,7 @@ type MACSettings struct { PingSlotDataRateIndex *MACSettings_DataRateIndexValue `protobuf:"bytes,3,opt,name=ping_slot_data_rate_index,json=pingSlotDataRateIndex,proto3" json:"ping_slot_data_rate_index,omitempty"` // Frequency of the class B ping slot (Hz). // If unset, the default value from Network Server configuration will be used. - PingSlotFrequency uint64 `protobuf:"varint,4,opt,name=ping_slot_frequency,json=pingSlotFrequency,proto3" json:"ping_slot_frequency,omitempty"` + PingSlotFrequency *types.UInt64Value `protobuf:"bytes,4,opt,name=ping_slot_frequency,json=pingSlotFrequency,proto3" json:"ping_slot_frequency,omitempty"` // Maximum delay for the device to answer a MAC request or a confirmed downlink frame. // If unset, the default value from Network Server configuration will be used. ClassCTimeout *time.Duration `protobuf:"bytes,5,opt,name=class_c_timeout,json=classCTimeout,proto3,stdduration" json:"class_c_timeout,omitempty"` @@ -819,7 +819,7 @@ type MACSettings struct { Rx2DataRateIndex *MACSettings_DataRateIndexValue `protobuf:"bytes,8,opt,name=rx2_data_rate_index,json=rx2DataRateIndex,proto3" json:"rx2_data_rate_index,omitempty"` // Frequency for Rx2 (Hz). // If unset, the default value from Network Server configuration or regional parameters specification will be used. - Rx2Frequency uint64 `protobuf:"varint,9,opt,name=rx2_frequency,json=rx2Frequency,proto3" json:"rx2_frequency,omitempty"` + Rx2Frequency *types.UInt64Value `protobuf:"bytes,9,opt,name=rx2_frequency,json=rx2Frequency,proto3" json:"rx2_frequency,omitempty"` // List of factory-preset frequencies. // If unset, the default value from Network Server configuration or regional parameters specification will be used. FactoryPresetFrequencies []uint64 `protobuf:"varint,10,rep,packed,name=factory_preset_frequencies,json=factoryPresetFrequencies,proto3" json:"factory_preset_frequencies,omitempty"` @@ -855,15 +855,15 @@ type MACSettings struct { DesiredRx2DataRateIndex *MACSettings_DataRateIndexValue `protobuf:"bytes,20,opt,name=desired_rx2_data_rate_index,json=desiredRx2DataRateIndex,proto3" json:"desired_rx2_data_rate_index,omitempty"` // The Rx2 frequency index Network Server should configure device to use via MAC commands. // If unset, the default value from frequency plan, Network Server configuration or regional parameters specification will be used. - DesiredRx2Frequency uint64 `protobuf:"varint,21,opt,name=desired_rx2_frequency,json=desiredRx2Frequency,proto3" json:"desired_rx2_frequency,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_sizecache int32 `json:"-"` + DesiredRx2Frequency *types.UInt64Value `protobuf:"bytes,21,opt,name=desired_rx2_frequency,json=desiredRx2Frequency,proto3" json:"desired_rx2_frequency,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *MACSettings) Reset() { *m = MACSettings{} } func (*MACSettings) ProtoMessage() {} func (*MACSettings) Descriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{6} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{6} } func (m *MACSettings) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -913,11 +913,11 @@ func (m *MACSettings) GetPingSlotDataRateIndex() *MACSettings_DataRateIndexValue return nil } -func (m *MACSettings) GetPingSlotFrequency() uint64 { +func (m *MACSettings) GetPingSlotFrequency() *types.UInt64Value { if m != nil { return m.PingSlotFrequency } - return 0 + return nil } func (m *MACSettings) GetClassCTimeout() *time.Duration { @@ -948,11 +948,11 @@ func (m *MACSettings) GetRx2DataRateIndex() *MACSettings_DataRateIndexValue { return nil } -func (m *MACSettings) GetRx2Frequency() uint64 { +func (m *MACSettings) GetRx2Frequency() *types.UInt64Value { if m != nil { return m.Rx2Frequency } - return 0 + return nil } func (m *MACSettings) GetFactoryPresetFrequencies() []uint64 { @@ -1032,11 +1032,11 @@ func (m *MACSettings) GetDesiredRx2DataRateIndex() *MACSettings_DataRateIndexVal return nil } -func (m *MACSettings) GetDesiredRx2Frequency() uint64 { +func (m *MACSettings) GetDesiredRx2Frequency() *types.UInt64Value { if m != nil { return m.DesiredRx2Frequency } - return 0 + return nil } type MACSettings_DataRateIndexValue struct { @@ -1048,7 +1048,7 @@ type MACSettings_DataRateIndexValue struct { func (m *MACSettings_DataRateIndexValue) Reset() { *m = MACSettings_DataRateIndexValue{} } func (*MACSettings_DataRateIndexValue) ProtoMessage() {} func (*MACSettings_DataRateIndexValue) Descriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{6, 0} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{6, 0} } func (m *MACSettings_DataRateIndexValue) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1093,7 +1093,7 @@ type MACSettings_PingSlotPeriodValue struct { func (m *MACSettings_PingSlotPeriodValue) Reset() { *m = MACSettings_PingSlotPeriodValue{} } func (*MACSettings_PingSlotPeriodValue) ProtoMessage() {} func (*MACSettings_PingSlotPeriodValue) Descriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{6, 1} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{6, 1} } func (m *MACSettings_PingSlotPeriodValue) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1138,7 +1138,7 @@ type MACSettings_AggregatedDutyCycleValue struct { func (m *MACSettings_AggregatedDutyCycleValue) Reset() { *m = MACSettings_AggregatedDutyCycleValue{} } func (*MACSettings_AggregatedDutyCycleValue) ProtoMessage() {} func (*MACSettings_AggregatedDutyCycleValue) Descriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{6, 2} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{6, 2} } func (m *MACSettings_AggregatedDutyCycleValue) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1183,7 +1183,7 @@ type MACSettings_RxDelayValue struct { func (m *MACSettings_RxDelayValue) Reset() { *m = MACSettings_RxDelayValue{} } func (*MACSettings_RxDelayValue) ProtoMessage() {} func (*MACSettings_RxDelayValue) Descriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{6, 3} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{6, 3} } func (m *MACSettings_RxDelayValue) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1265,7 +1265,7 @@ type MACState struct { func (m *MACState) Reset() { *m = MACState{} } func (*MACState) ProtoMessage() {} func (*MACState) Descriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{7} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{7} } func (m *MACState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1399,7 +1399,7 @@ type MACState_JoinAccept struct { func (m *MACState_JoinAccept) Reset() { *m = MACState_JoinAccept{} } func (*MACState_JoinAccept) ProtoMessage() {} func (*MACState_JoinAccept) Descriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{7, 0} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{7, 0} } func (m *MACState_JoinAccept) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1555,7 +1555,7 @@ type EndDevice struct { // Latest-known battery percentage of the device. // Received via the DevStatus MAC command at last_dev_status_received_at or earlier. // Stored in Network Server. - BatteryPercentage float32 `protobuf:"fixed32,35,opt,name=battery_percentage,json=batteryPercentage,proto3" json:"battery_percentage,omitempty"` + BatteryPercentage *types.FloatValue `protobuf:"bytes,35,opt,name=battery_percentage,json=batteryPercentage,proto3" json:"battery_percentage,omitempty"` // Demodulation signal-to-noise ratio (dB). // Received via the DevStatus MAC command at last_dev_status_received_at. // Stored in Network Server. @@ -1587,7 +1587,7 @@ type EndDevice struct { func (m *EndDevice) Reset() { *m = EndDevice{} } func (*EndDevice) ProtoMessage() {} func (*EndDevice) Descriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{8} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{8} } func (m *EndDevice) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1840,11 +1840,11 @@ func (m *EndDevice) GetPowerState() PowerState { return PowerState_POWER_UNKNOWN } -func (m *EndDevice) GetBatteryPercentage() float32 { +func (m *EndDevice) GetBatteryPercentage() *types.FloatValue { if m != nil { return m.BatteryPercentage } - return 0 + return nil } func (m *EndDevice) GetDownlinkMargin() int32 { @@ -1912,7 +1912,7 @@ type EndDevices struct { func (m *EndDevices) Reset() { *m = EndDevices{} } func (*EndDevices) ProtoMessage() {} func (*EndDevices) Descriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{9} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{9} } func (m *EndDevices) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1957,7 +1957,7 @@ type CreateEndDeviceRequest struct { func (m *CreateEndDeviceRequest) Reset() { *m = CreateEndDeviceRequest{} } func (*CreateEndDeviceRequest) ProtoMessage() {} func (*CreateEndDeviceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{10} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{10} } func (m *CreateEndDeviceRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1996,7 +1996,7 @@ type UpdateEndDeviceRequest struct { func (m *UpdateEndDeviceRequest) Reset() { *m = UpdateEndDeviceRequest{} } func (*UpdateEndDeviceRequest) ProtoMessage() {} func (*UpdateEndDeviceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{11} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{11} } func (m *UpdateEndDeviceRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2042,7 +2042,7 @@ type GetEndDeviceRequest struct { func (m *GetEndDeviceRequest) Reset() { *m = GetEndDeviceRequest{} } func (*GetEndDeviceRequest) ProtoMessage() {} func (*GetEndDeviceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{12} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{12} } func (m *GetEndDeviceRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2095,7 +2095,7 @@ type ListEndDevicesRequest struct { func (m *ListEndDevicesRequest) Reset() { *m = ListEndDevicesRequest{} } func (*ListEndDevicesRequest) ProtoMessage() {} func (*ListEndDevicesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{13} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{13} } func (m *ListEndDevicesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2162,7 +2162,7 @@ type SetEndDeviceRequest struct { func (m *SetEndDeviceRequest) Reset() { *m = SetEndDeviceRequest{} } func (*SetEndDeviceRequest) ProtoMessage() {} func (*SetEndDeviceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_end_device_080420e51ae629f6, []int{14} + return fileDescriptor_end_device_6bafadec442a1d5e, []int{14} } func (m *SetEndDeviceRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2623,7 +2623,7 @@ func (this *MACSettings) Equal(that interface{}) bool { if !this.PingSlotDataRateIndex.Equal(that1.PingSlotDataRateIndex) { return false } - if this.PingSlotFrequency != that1.PingSlotFrequency { + if !this.PingSlotFrequency.Equal(that1.PingSlotFrequency) { return false } if this.ClassCTimeout != nil && that1.ClassCTimeout != nil { @@ -2644,7 +2644,7 @@ func (this *MACSettings) Equal(that interface{}) bool { if !this.Rx2DataRateIndex.Equal(that1.Rx2DataRateIndex) { return false } - if this.Rx2Frequency != that1.Rx2Frequency { + if !this.Rx2Frequency.Equal(that1.Rx2Frequency) { return false } if len(this.FactoryPresetFrequencies) != len(that1.FactoryPresetFrequencies) { @@ -2691,7 +2691,7 @@ func (this *MACSettings) Equal(that interface{}) bool { if !this.DesiredRx2DataRateIndex.Equal(that1.DesiredRx2DataRateIndex) { return false } - if this.DesiredRx2Frequency != that1.DesiredRx2Frequency { + if !this.DesiredRx2Frequency.Equal(that1.DesiredRx2Frequency) { return false } return true @@ -3040,7 +3040,7 @@ func (this *EndDevice) Equal(that interface{}) bool { if this.PowerState != that1.PowerState { return false } - if this.BatteryPercentage != that1.BatteryPercentage { + if !this.BatteryPercentage.Equal(that1.BatteryPercentage) { return false } if this.DownlinkMargin != that1.DownlinkMargin { @@ -3807,122 +3807,132 @@ func (m *MACSettings) MarshalTo(dAtA []byte) (int, error) { } i += n9 } - if m.PingSlotFrequency != 0 { - dAtA[i] = 0x20 + if m.PingSlotFrequency != nil { + dAtA[i] = 0x22 i++ - i = encodeVarintEndDevice(dAtA, i, m.PingSlotFrequency) + i = encodeVarintEndDevice(dAtA, i, uint64(m.PingSlotFrequency.Size())) + n10, err := m.PingSlotFrequency.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n10 } if m.ClassCTimeout != nil { dAtA[i] = 0x2a i++ i = encodeVarintEndDevice(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(*m.ClassCTimeout))) - n10, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.ClassCTimeout, dAtA[i:]) + n11, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.ClassCTimeout, dAtA[i:]) if err != nil { return 0, err } - i += n10 + i += n11 } if m.Rx1Delay != nil { dAtA[i] = 0x32 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.Rx1Delay.Size())) - n11, err := m.Rx1Delay.MarshalTo(dAtA[i:]) + n12, err := m.Rx1Delay.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n11 + i += n12 } if m.Rx1DataRateOffset != nil { dAtA[i] = 0x3a i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.Rx1DataRateOffset.Size())) - n12, err := m.Rx1DataRateOffset.MarshalTo(dAtA[i:]) + n13, err := m.Rx1DataRateOffset.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n12 + i += n13 } if m.Rx2DataRateIndex != nil { dAtA[i] = 0x42 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.Rx2DataRateIndex.Size())) - n13, err := m.Rx2DataRateIndex.MarshalTo(dAtA[i:]) + n14, err := m.Rx2DataRateIndex.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n13 + i += n14 } - if m.Rx2Frequency != 0 { - dAtA[i] = 0x48 + if m.Rx2Frequency != nil { + dAtA[i] = 0x4a i++ - i = encodeVarintEndDevice(dAtA, i, m.Rx2Frequency) + i = encodeVarintEndDevice(dAtA, i, uint64(m.Rx2Frequency.Size())) + n15, err := m.Rx2Frequency.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n15 } if len(m.FactoryPresetFrequencies) > 0 { - dAtA15 := make([]byte, len(m.FactoryPresetFrequencies)*10) - var j14 int + dAtA17 := make([]byte, len(m.FactoryPresetFrequencies)*10) + var j16 int for _, num := range m.FactoryPresetFrequencies { for num >= 1<<7 { - dAtA15[j14] = uint8(num&0x7f | 0x80) + dAtA17[j16] = uint8(num&0x7f | 0x80) num >>= 7 - j14++ + j16++ } - dAtA15[j14] = uint8(num) - j14++ + dAtA17[j16] = uint8(num) + j16++ } dAtA[i] = 0x52 i++ - i = encodeVarintEndDevice(dAtA, i, uint64(j14)) - i += copy(dAtA[i:], dAtA15[:j14]) + i = encodeVarintEndDevice(dAtA, i, uint64(j16)) + i += copy(dAtA[i:], dAtA17[:j16]) } if m.MaxDutyCycle != nil { dAtA[i] = 0x5a i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.MaxDutyCycle.Size())) - n16, err := m.MaxDutyCycle.MarshalTo(dAtA[i:]) + n18, err := m.MaxDutyCycle.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n16 + i += n18 } if m.Supports32BitFCnt != nil { dAtA[i] = 0x62 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.Supports32BitFCnt.Size())) - n17, err := m.Supports32BitFCnt.MarshalTo(dAtA[i:]) + n19, err := m.Supports32BitFCnt.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n17 + i += n19 } if m.UseADR != nil { dAtA[i] = 0x6a i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.UseADR.Size())) - n18, err := m.UseADR.MarshalTo(dAtA[i:]) + n20, err := m.UseADR.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n18 + i += n20 } if m.ADRMargin != nil { dAtA[i] = 0x72 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.ADRMargin.Size())) - n19, err := m.ADRMargin.MarshalTo(dAtA[i:]) + n21, err := m.ADRMargin.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n19 + i += n21 } if m.ResetsFCnt != nil { dAtA[i] = 0x7a i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.ResetsFCnt.Size())) - n20, err := m.ResetsFCnt.MarshalTo(dAtA[i:]) + n22, err := m.ResetsFCnt.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n20 + i += n22 } if m.StatusTimePeriodicity != nil { dAtA[i] = 0x82 @@ -3930,11 +3940,11 @@ func (m *MACSettings) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1 i++ i = encodeVarintEndDevice(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(*m.StatusTimePeriodicity))) - n21, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.StatusTimePeriodicity, dAtA[i:]) + n23, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.StatusTimePeriodicity, dAtA[i:]) if err != nil { return 0, err } - i += n21 + i += n23 } if m.StatusCountPeriodicity != nil { dAtA[i] = 0x8a @@ -3942,11 +3952,11 @@ func (m *MACSettings) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.StatusCountPeriodicity.Size())) - n22, err := m.StatusCountPeriodicity.MarshalTo(dAtA[i:]) + n24, err := m.StatusCountPeriodicity.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n22 + i += n24 } if m.DesiredRx1Delay != nil { dAtA[i] = 0x92 @@ -3954,11 +3964,11 @@ func (m *MACSettings) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.DesiredRx1Delay.Size())) - n23, err := m.DesiredRx1Delay.MarshalTo(dAtA[i:]) + n25, err := m.DesiredRx1Delay.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n23 + i += n25 } if m.DesiredRx1DataRateOffset != nil { dAtA[i] = 0x9a @@ -3966,11 +3976,11 @@ func (m *MACSettings) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.DesiredRx1DataRateOffset.Size())) - n24, err := m.DesiredRx1DataRateOffset.MarshalTo(dAtA[i:]) + n26, err := m.DesiredRx1DataRateOffset.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n24 + i += n26 } if m.DesiredRx2DataRateIndex != nil { dAtA[i] = 0xa2 @@ -3978,18 +3988,23 @@ func (m *MACSettings) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.DesiredRx2DataRateIndex.Size())) - n25, err := m.DesiredRx2DataRateIndex.MarshalTo(dAtA[i:]) + n27, err := m.DesiredRx2DataRateIndex.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n25 + i += n27 } - if m.DesiredRx2Frequency != 0 { - dAtA[i] = 0xa8 + if m.DesiredRx2Frequency != nil { + dAtA[i] = 0xaa i++ dAtA[i] = 0x1 i++ - i = encodeVarintEndDevice(dAtA, i, m.DesiredRx2Frequency) + i = encodeVarintEndDevice(dAtA, i, uint64(m.DesiredRx2Frequency.Size())) + n28, err := m.DesiredRx2Frequency.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n28 } return i, nil } @@ -4104,19 +4119,19 @@ func (m *MACState) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.CurrentParameters.Size())) - n26, err := m.CurrentParameters.MarshalTo(dAtA[i:]) + n29, err := m.CurrentParameters.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n26 + i += n29 dAtA[i] = 0x12 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.DesiredParameters.Size())) - n27, err := m.DesiredParameters.MarshalTo(dAtA[i:]) + n30, err := m.DesiredParameters.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n27 + i += n30 if m.DeviceClass != 0 { dAtA[i] = 0x18 i++ @@ -4131,11 +4146,11 @@ func (m *MACState) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x2a i++ i = encodeVarintEndDevice(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(*m.LastConfirmedDownlinkAt))) - n28, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.LastConfirmedDownlinkAt, dAtA[i:]) + n31, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.LastConfirmedDownlinkAt, dAtA[i:]) if err != nil { return 0, err } - i += n28 + i += n31 } if m.LastDevStatusFCntUp != 0 { dAtA[i] = 0x30 @@ -4151,11 +4166,11 @@ func (m *MACState) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x42 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.PendingApplicationDownlink.Size())) - n29, err := m.PendingApplicationDownlink.MarshalTo(dAtA[i:]) + n32, err := m.PendingApplicationDownlink.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n29 + i += n32 } if len(m.QueuedResponses) > 0 { for _, msg := range m.QueuedResponses { @@ -4185,21 +4200,21 @@ func (m *MACState) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x5a i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.QueuedJoinAccept.Size())) - n30, err := m.QueuedJoinAccept.MarshalTo(dAtA[i:]) + n33, err := m.QueuedJoinAccept.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n30 + i += n33 } if m.PendingJoinRequest != nil { dAtA[i] = 0x62 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.PendingJoinRequest.Size())) - n31, err := m.PendingJoinRequest.MarshalTo(dAtA[i:]) + n34, err := m.PendingJoinRequest.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n31 + i += n34 } if m.RxWindowsAvailable { dAtA[i] = 0x68 @@ -4238,19 +4253,19 @@ func (m *MACState_JoinAccept) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x12 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.Request.Size())) - n32, err := m.Request.MarshalTo(dAtA[i:]) + n35, err := m.Request.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n32 + i += n35 dAtA[i] = 0x1a i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.Keys.Size())) - n33, err := m.Keys.MarshalTo(dAtA[i:]) + n36, err := m.Keys.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n33 + i += n36 return i, nil } @@ -4272,27 +4287,27 @@ func (m *EndDevice) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.EndDeviceIdentifiers.Size())) - n34, err := m.EndDeviceIdentifiers.MarshalTo(dAtA[i:]) + n37, err := m.EndDeviceIdentifiers.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n34 + i += n37 dAtA[i] = 0x12 i++ i = encodeVarintEndDevice(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt))) - n35, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i:]) + n38, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i:]) if err != nil { return 0, err } - i += n35 + i += n38 dAtA[i] = 0x1a i++ i = encodeVarintEndDevice(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdatedAt))) - n36, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UpdatedAt, dAtA[i:]) + n39, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UpdatedAt, dAtA[i:]) if err != nil { return 0, err } - i += n36 + i += n39 if len(m.Name) > 0 { dAtA[i] = 0x22 i++ @@ -4326,11 +4341,11 @@ func (m *EndDevice) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x3a i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.VersionIDs.Size())) - n37, err := m.VersionIDs.MarshalTo(dAtA[i:]) + n40, err := m.VersionIDs.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n37 + i += n40 } if len(m.ServiceProfileID) > 0 { dAtA[i] = 0x42 @@ -4376,11 +4391,11 @@ func (m *EndDevice) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x12 i++ i = encodeVarintEndDevice(dAtA, i, uint64(v.Size())) - n38, err := v.MarshalTo(dAtA[i:]) + n41, err := v.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n38 + i += n41 } } } @@ -4468,11 +4483,11 @@ func (m *EndDevice) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.RootKeys.Size())) - n39, err := m.RootKeys.MarshalTo(dAtA[i:]) + n42, err := m.RootKeys.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n39 + i += n42 } if m.NetID != nil { dAtA[i] = 0xba @@ -4480,11 +4495,11 @@ func (m *EndDevice) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.NetID.Size())) - n40, err := m.NetID.MarshalTo(dAtA[i:]) + n43, err := m.NetID.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n40 + i += n43 } if m.MACSettings != nil { dAtA[i] = 0xc2 @@ -4492,11 +4507,11 @@ func (m *EndDevice) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.MACSettings.Size())) - n41, err := m.MACSettings.MarshalTo(dAtA[i:]) + n44, err := m.MACSettings.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n41 + i += n44 } if m.MACState != nil { dAtA[i] = 0xca @@ -4504,11 +4519,11 @@ func (m *EndDevice) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.MACState.Size())) - n42, err := m.MACState.MarshalTo(dAtA[i:]) + n45, err := m.MACState.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n42 + i += n45 } if m.Session != nil { dAtA[i] = 0xd2 @@ -4516,11 +4531,11 @@ func (m *EndDevice) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.Session.Size())) - n43, err := m.Session.MarshalTo(dAtA[i:]) + n46, err := m.Session.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n43 + i += n46 } if m.PendingSession != nil { dAtA[i] = 0xda @@ -4528,11 +4543,11 @@ func (m *EndDevice) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.PendingSession.Size())) - n44, err := m.PendingSession.MarshalTo(dAtA[i:]) + n47, err := m.PendingSession.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n44 + i += n47 } if m.LastDevNonce != 0 { dAtA[i] = 0xe0 @@ -4542,23 +4557,23 @@ func (m *EndDevice) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintEndDevice(dAtA, i, uint64(m.LastDevNonce)) } if len(m.UsedDevNonces) > 0 { - dAtA46 := make([]byte, len(m.UsedDevNonces)*10) - var j45 int + dAtA49 := make([]byte, len(m.UsedDevNonces)*10) + var j48 int for _, num := range m.UsedDevNonces { for num >= 1<<7 { - dAtA46[j45] = uint8(uint64(num)&0x7f | 0x80) + dAtA49[j48] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j45++ + j48++ } - dAtA46[j45] = uint8(num) - j45++ + dAtA49[j48] = uint8(num) + j48++ } dAtA[i] = 0xea i++ dAtA[i] = 0x1 i++ - i = encodeVarintEndDevice(dAtA, i, uint64(j45)) - i += copy(dAtA[i:], dAtA46[:j45]) + i = encodeVarintEndDevice(dAtA, i, uint64(j48)) + i += copy(dAtA[i:], dAtA49[:j48]) } if m.LastJoinNonce != 0 { dAtA[i] = 0xf0 @@ -4587,11 +4602,11 @@ func (m *EndDevice) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x2 i++ i = encodeVarintEndDevice(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(*m.LastDevStatusReceivedAt))) - n47, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.LastDevStatusReceivedAt, dAtA[i:]) + n50, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.LastDevStatusReceivedAt, dAtA[i:]) if err != nil { return 0, err } - i += n47 + i += n50 } if m.PowerState != 0 { dAtA[i] = 0x90 @@ -4600,13 +4615,17 @@ func (m *EndDevice) MarshalTo(dAtA []byte) (int, error) { i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.PowerState)) } - if m.BatteryPercentage != 0 { - dAtA[i] = 0x9d + if m.BatteryPercentage != nil { + dAtA[i] = 0x9a i++ dAtA[i] = 0x2 i++ - encoding_binary.LittleEndian.PutUint32(dAtA[i:], math.Float32bits(float32(m.BatteryPercentage))) - i += 4 + i = encodeVarintEndDevice(dAtA, i, uint64(m.BatteryPercentage.Size())) + n51, err := m.BatteryPercentage.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n51 } if m.DownlinkMargin != 0 { dAtA[i] = 0xa0 @@ -4677,11 +4696,11 @@ func (m *EndDevice) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x2 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.Formatters.Size())) - n48, err := m.Formatters.MarshalTo(dAtA[i:]) + n52, err := m.Formatters.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n48 + i += n52 } if len(m.ProvisionerID) > 0 { dAtA[i] = 0xd2 @@ -4697,11 +4716,11 @@ func (m *EndDevice) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x2 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.ProvisioningData.Size())) - n49, err := m.ProvisioningData.MarshalTo(dAtA[i:]) + n53, err := m.ProvisioningData.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n49 + i += n53 } return i, nil } @@ -4754,11 +4773,11 @@ func (m *CreateEndDeviceRequest) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.EndDevice.Size())) - n50, err := m.EndDevice.MarshalTo(dAtA[i:]) + n54, err := m.EndDevice.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n50 + i += n54 return i, nil } @@ -4780,19 +4799,19 @@ func (m *UpdateEndDeviceRequest) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.EndDevice.Size())) - n51, err := m.EndDevice.MarshalTo(dAtA[i:]) + n55, err := m.EndDevice.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n51 + i += n55 dAtA[i] = 0x12 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.FieldMask.Size())) - n52, err := m.FieldMask.MarshalTo(dAtA[i:]) + n56, err := m.FieldMask.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n52 + i += n56 return i, nil } @@ -4814,19 +4833,19 @@ func (m *GetEndDeviceRequest) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.EndDeviceIdentifiers.Size())) - n53, err := m.EndDeviceIdentifiers.MarshalTo(dAtA[i:]) + n57, err := m.EndDeviceIdentifiers.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n53 + i += n57 dAtA[i] = 0x12 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.FieldMask.Size())) - n54, err := m.FieldMask.MarshalTo(dAtA[i:]) + n58, err := m.FieldMask.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n54 + i += n58 return i, nil } @@ -4848,19 +4867,19 @@ func (m *ListEndDevicesRequest) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.ApplicationIdentifiers.Size())) - n55, err := m.ApplicationIdentifiers.MarshalTo(dAtA[i:]) + n59, err := m.ApplicationIdentifiers.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n55 + i += n59 dAtA[i] = 0x12 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.FieldMask.Size())) - n56, err := m.FieldMask.MarshalTo(dAtA[i:]) + n60, err := m.FieldMask.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n56 + i += n60 if len(m.Order) > 0 { dAtA[i] = 0x1a i++ @@ -4898,19 +4917,19 @@ func (m *SetEndDeviceRequest) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.EndDevice.Size())) - n57, err := m.EndDevice.MarshalTo(dAtA[i:]) + n61, err := m.EndDevice.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n57 + i += n61 dAtA[i] = 0x12 i++ i = encodeVarintEndDevice(dAtA, i, uint64(m.FieldMask.Size())) - n58, err := m.FieldMask.MarshalTo(dAtA[i:]) + n62, err := m.FieldMask.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n58 + i += n62 return i, nil } @@ -4987,7 +5006,9 @@ func NewPopulatedMACSettings(r randyEndDevice, easy bool) *MACSettings { if r.Intn(10) != 0 { this.PingSlotDataRateIndex = NewPopulatedMACSettings_DataRateIndexValue(r, easy) } - this.PingSlotFrequency = uint64(r.Uint32()) + if r.Intn(10) != 0 { + this.PingSlotFrequency = types.NewPopulatedUInt64Value(r, easy) + } if r.Intn(10) != 0 { this.ClassCTimeout = github_com_gogo_protobuf_types.NewPopulatedStdDuration(r, easy) } @@ -5000,7 +5021,9 @@ func NewPopulatedMACSettings(r randyEndDevice, easy bool) *MACSettings { if r.Intn(10) != 0 { this.Rx2DataRateIndex = NewPopulatedMACSettings_DataRateIndexValue(r, easy) } - this.Rx2Frequency = uint64(r.Uint32()) + if r.Intn(10) != 0 { + this.Rx2Frequency = types.NewPopulatedUInt64Value(r, easy) + } v5 := r.Intn(10) this.FactoryPresetFrequencies = make([]uint64, v5) for i := 0; i < v5; i++ { @@ -5036,7 +5059,9 @@ func NewPopulatedMACSettings(r randyEndDevice, easy bool) *MACSettings { if r.Intn(10) != 0 { this.DesiredRx2DataRateIndex = NewPopulatedMACSettings_DataRateIndexValue(r, easy) } - this.DesiredRx2Frequency = uint64(r.Uint32()) + if r.Intn(10) != 0 { + this.DesiredRx2Frequency = types.NewPopulatedUInt64Value(r, easy) + } if !easy && r.Intn(10) != 0 { } return this @@ -5494,8 +5519,9 @@ func (m *MACSettings) Size() (n int) { l = m.PingSlotDataRateIndex.Size() n += 1 + l + sovEndDevice(uint64(l)) } - if m.PingSlotFrequency != 0 { - n += 1 + sovEndDevice(m.PingSlotFrequency) + if m.PingSlotFrequency != nil { + l = m.PingSlotFrequency.Size() + n += 1 + l + sovEndDevice(uint64(l)) } if m.ClassCTimeout != nil { l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.ClassCTimeout) @@ -5513,8 +5539,9 @@ func (m *MACSettings) Size() (n int) { l = m.Rx2DataRateIndex.Size() n += 1 + l + sovEndDevice(uint64(l)) } - if m.Rx2Frequency != 0 { - n += 1 + sovEndDevice(m.Rx2Frequency) + if m.Rx2Frequency != nil { + l = m.Rx2Frequency.Size() + n += 1 + l + sovEndDevice(uint64(l)) } if len(m.FactoryPresetFrequencies) > 0 { l = 0 @@ -5563,8 +5590,9 @@ func (m *MACSettings) Size() (n int) { l = m.DesiredRx2DataRateIndex.Size() n += 2 + l + sovEndDevice(uint64(l)) } - if m.DesiredRx2Frequency != 0 { - n += 2 + sovEndDevice(m.DesiredRx2Frequency) + if m.DesiredRx2Frequency != nil { + l = m.DesiredRx2Frequency.Size() + n += 2 + l + sovEndDevice(uint64(l)) } return n } @@ -5829,8 +5857,9 @@ func (m *EndDevice) Size() (n int) { if m.PowerState != 0 { n += 2 + sovEndDevice(uint64(m.PowerState)) } - if m.BatteryPercentage != 0 { - n += 6 + if m.BatteryPercentage != nil { + l = m.BatteryPercentage.Size() + n += 2 + l + sovEndDevice(uint64(l)) } if m.DownlinkMargin != 0 { n += 2 + sovEndDevice(uint64(m.DownlinkMargin)) @@ -6101,12 +6130,12 @@ func (this *MACSettings) String() string { `ClassBTimeout:` + strings.Replace(fmt.Sprintf("%v", this.ClassBTimeout), "Duration", "types.Duration", 1) + `,`, `PingSlotPeriodicity:` + strings.Replace(fmt.Sprintf("%v", this.PingSlotPeriodicity), "MACSettings_PingSlotPeriodValue", "MACSettings_PingSlotPeriodValue", 1) + `,`, `PingSlotDataRateIndex:` + strings.Replace(fmt.Sprintf("%v", this.PingSlotDataRateIndex), "MACSettings_DataRateIndexValue", "MACSettings_DataRateIndexValue", 1) + `,`, - `PingSlotFrequency:` + fmt.Sprintf("%v", this.PingSlotFrequency) + `,`, + `PingSlotFrequency:` + strings.Replace(fmt.Sprintf("%v", this.PingSlotFrequency), "UInt64Value", "types.UInt64Value", 1) + `,`, `ClassCTimeout:` + strings.Replace(fmt.Sprintf("%v", this.ClassCTimeout), "Duration", "types.Duration", 1) + `,`, `Rx1Delay:` + strings.Replace(fmt.Sprintf("%v", this.Rx1Delay), "MACSettings_RxDelayValue", "MACSettings_RxDelayValue", 1) + `,`, `Rx1DataRateOffset:` + strings.Replace(fmt.Sprintf("%v", this.Rx1DataRateOffset), "UInt32Value", "types.UInt32Value", 1) + `,`, `Rx2DataRateIndex:` + strings.Replace(fmt.Sprintf("%v", this.Rx2DataRateIndex), "MACSettings_DataRateIndexValue", "MACSettings_DataRateIndexValue", 1) + `,`, - `Rx2Frequency:` + fmt.Sprintf("%v", this.Rx2Frequency) + `,`, + `Rx2Frequency:` + strings.Replace(fmt.Sprintf("%v", this.Rx2Frequency), "UInt64Value", "types.UInt64Value", 1) + `,`, `FactoryPresetFrequencies:` + fmt.Sprintf("%v", this.FactoryPresetFrequencies) + `,`, `MaxDutyCycle:` + strings.Replace(fmt.Sprintf("%v", this.MaxDutyCycle), "MACSettings_AggregatedDutyCycleValue", "MACSettings_AggregatedDutyCycleValue", 1) + `,`, `Supports32BitFCnt:` + strings.Replace(fmt.Sprintf("%v", this.Supports32BitFCnt), "BoolValue", "types.BoolValue", 1) + `,`, @@ -6118,7 +6147,7 @@ func (this *MACSettings) String() string { `DesiredRx1Delay:` + strings.Replace(fmt.Sprintf("%v", this.DesiredRx1Delay), "MACSettings_RxDelayValue", "MACSettings_RxDelayValue", 1) + `,`, `DesiredRx1DataRateOffset:` + strings.Replace(fmt.Sprintf("%v", this.DesiredRx1DataRateOffset), "UInt32Value", "types.UInt32Value", 1) + `,`, `DesiredRx2DataRateIndex:` + strings.Replace(fmt.Sprintf("%v", this.DesiredRx2DataRateIndex), "MACSettings_DataRateIndexValue", "MACSettings_DataRateIndexValue", 1) + `,`, - `DesiredRx2Frequency:` + fmt.Sprintf("%v", this.DesiredRx2Frequency) + `,`, + `DesiredRx2Frequency:` + strings.Replace(fmt.Sprintf("%v", this.DesiredRx2Frequency), "UInt64Value", "types.UInt64Value", 1) + `,`, `}`, }, "") return s @@ -6256,7 +6285,7 @@ func (this *EndDevice) String() string { `LastRJCount1:` + fmt.Sprintf("%v", this.LastRJCount1) + `,`, `LastDevStatusReceivedAt:` + strings.Replace(fmt.Sprintf("%v", this.LastDevStatusReceivedAt), "Timestamp", "types.Timestamp", 1) + `,`, `PowerState:` + fmt.Sprintf("%v", this.PowerState) + `,`, - `BatteryPercentage:` + fmt.Sprintf("%v", this.BatteryPercentage) + `,`, + `BatteryPercentage:` + strings.Replace(fmt.Sprintf("%v", this.BatteryPercentage), "FloatValue", "types.FloatValue", 1) + `,`, `DownlinkMargin:` + fmt.Sprintf("%v", this.DownlinkMargin) + `,`, `RecentADRUplinks:` + strings.Replace(fmt.Sprintf("%v", this.RecentADRUplinks), "UplinkMessage", "UplinkMessage", 1) + `,`, `RecentUplinks:` + strings.Replace(fmt.Sprintf("%v", this.RecentUplinks), "UplinkMessage", "UplinkMessage", 1) + `,`, @@ -8078,10 +8107,10 @@ func (m *MACSettings) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 4: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PingSlotFrequency", wireType) } - m.PingSlotFrequency = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEndDevice @@ -8091,11 +8120,25 @@ func (m *MACSettings) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.PingSlotFrequency |= (uint64(b) & 0x7F) << shift + msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthEndDevice + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PingSlotFrequency == nil { + m.PingSlotFrequency = &types.UInt64Value{} + } + if err := m.PingSlotFrequency.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ClassCTimeout", wireType) @@ -8229,10 +8272,10 @@ func (m *MACSettings) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 9: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Rx2Frequency", wireType) } - m.Rx2Frequency = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEndDevice @@ -8242,11 +8285,25 @@ func (m *MACSettings) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Rx2Frequency |= (uint64(b) & 0x7F) << shift + msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthEndDevice + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Rx2Frequency == nil { + m.Rx2Frequency = &types.UInt64Value{} + } + if err := m.Rx2Frequency.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 10: if wireType == 0 { var v uint64 @@ -8651,10 +8708,10 @@ func (m *MACSettings) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 21: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DesiredRx2Frequency", wireType) } - m.DesiredRx2Frequency = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEndDevice @@ -8664,11 +8721,25 @@ func (m *MACSettings) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.DesiredRx2Frequency |= (uint64(b) & 0x7F) << shift + msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthEndDevice + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DesiredRx2Frequency == nil { + m.DesiredRx2Frequency = &types.UInt64Value{} + } + if err := m.DesiredRx2Frequency.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEndDevice(dAtA[iNdEx:]) @@ -10658,16 +10729,38 @@ func (m *EndDevice) Unmarshal(dAtA []byte) error { } } case 35: - if wireType != 5 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BatteryPercentage", wireType) } - var v uint32 - if (iNdEx + 4) > l { + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndDevice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEndDevice + } + postIndex := iNdEx + msglen + if postIndex > l { return io.ErrUnexpectedEOF } - v = encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:]) - iNdEx += 4 - m.BatteryPercentage = float32(math.Float32frombits(v)) + if m.BatteryPercentage == nil { + m.BatteryPercentage = &types.FloatValue{} + } + if err := m.BatteryPercentage.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 36: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field DownlinkMargin", wireType) @@ -11701,251 +11794,260 @@ var ( ) func init() { - proto.RegisterFile("lorawan-stack/api/end_device.proto", fileDescriptor_end_device_080420e51ae629f6) + proto.RegisterFile("lorawan-stack/api/end_device.proto", fileDescriptor_end_device_6bafadec442a1d5e) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/end_device.proto", fileDescriptor_end_device_080420e51ae629f6) -} - -var fileDescriptor_end_device_080420e51ae629f6 = []byte{ - // 3822 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0x4d, 0x6c, 0x5c, 0xd7, - 0x75, 0x9e, 0x37, 0xa4, 0xc8, 0x99, 0x3b, 0xe4, 0xfc, 0x5c, 0x8a, 0xd2, 0x13, 0x25, 0xcf, 0xd0, - 0x94, 0xec, 0x8c, 0x14, 0x73, 0x28, 0x51, 0x72, 0x1b, 0x2b, 0x4e, 0xe9, 0x19, 0x0e, 0x65, 0xd3, - 0xa6, 0x28, 0xf6, 0x92, 0x92, 0x6a, 0x59, 0xd2, 0xc3, 0xe5, 0xbc, 0x4b, 0xf2, 0x99, 0x33, 0xef, - 0xbd, 0xdc, 0x77, 0x87, 0x1c, 0x26, 0x0e, 0x90, 0x45, 0x81, 0x66, 0x51, 0xa0, 0xd9, 0xb4, 0xc8, - 0xa6, 0x40, 0x50, 0xb4, 0x40, 0x50, 0xb4, 0x40, 0x56, 0x85, 0x37, 0x05, 0x02, 0x74, 0x63, 0xa0, - 0x1b, 0x2f, 0x83, 0x2c, 0x46, 0xd1, 0x70, 0xd1, 0x2c, 0x03, 0x74, 0x93, 0x65, 0x70, 0x7f, 0xde, - 0xcf, 0xfc, 0x51, 0xa4, 0x13, 0x03, 0xde, 0x0c, 0xde, 0x3b, 0xe7, 0x3b, 0xdf, 0x3d, 0xf7, 0xff, - 0x9c, 0xf3, 0x06, 0xcc, 0xd5, 0x1d, 0x8a, 0x0f, 0xb1, 0x3d, 0xef, 0x31, 0x5c, 0xdb, 0x5f, 0xc0, - 0xae, 0xb5, 0x40, 0x6c, 0xd3, 0x30, 0xc9, 0x81, 0x55, 0x23, 0x25, 0x97, 0x3a, 0xcc, 0x81, 0x69, - 0xc6, 0xec, 0x92, 0xc2, 0x95, 0x0e, 0x6e, 0xcf, 0xcc, 0xef, 0x5a, 0x6c, 0xaf, 0xb9, 0x5d, 0xaa, - 0x39, 0x8d, 0x85, 0x5d, 0x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 0x83, 0xf3, 0x27, 0x04, 0xc7, 0xe5, - 0x60, 0xf9, 0x9a, 0x10, 0xbe, 0x06, 0xa6, 0x1a, 0x96, 0xdd, 0x37, 0x4c, 0x23, 0xa7, 0x5a, 0xd5, - 0x0d, 0xcb, 0xee, 0x1e, 0x21, 0xce, 0xc6, 0x17, 0xec, 0x57, 0x38, 0xcc, 0x50, 0x96, 0xaf, 0xd7, - 0xde, 0x3d, 0x42, 0x6c, 0xbc, 0x5d, 0x27, 0x86, 0xec, 0xa4, 0x38, 0xb1, 0x12, 0x68, 0x42, 0x0a, - 0x1f, 0x0a, 0xd9, 0xdd, 0xd1, 0xcf, 0x7f, 0x5e, 0x88, 0xc9, 0xdf, 0xb9, 0x06, 0x48, 0xaf, 0xd8, - 0x66, 0x55, 0x84, 0x60, 0x15, 0x8a, 0x6d, 0x13, 0x5e, 0x00, 0x71, 0xcb, 0x14, 0x43, 0x95, 0xac, - 0x8c, 0x75, 0xda, 0x85, 0xf8, 0x6a, 0x15, 0xc5, 0x2d, 0x13, 0x42, 0x30, 0x6a, 0x63, 0x75, 0x88, - 0x27, 0x91, 0x78, 0x86, 0x97, 0xc0, 0x48, 0x93, 0xd6, 0x45, 0xd7, 0x93, 0x95, 0xf1, 0x4e, 0xbb, - 0x30, 0xf2, 0x10, 0xad, 0x21, 0x2e, 0x83, 0xe7, 0xc1, 0xb9, 0xba, 0xb3, 0xeb, 0x78, 0xfa, 0xe8, - 0xec, 0x48, 0x31, 0x89, 0xe4, 0xcb, 0x9c, 0x19, 0x69, 0xee, 0xbe, 0x63, 0x92, 0x3a, 0xbf, 0x50, - 0xb6, 0x79, 0xbb, 0x46, 0xd0, 0xa8, 0xb8, 0x50, 0x84, 0x2f, 0xab, 0x55, 0x34, 0x2e, 0x94, 0xab, - 0xbe, 0x5b, 0xf1, 0xa1, 0x6e, 0x8d, 0x84, 0x6e, 0xcd, 0xfd, 0x63, 0x1c, 0x5c, 0x0e, 0x9a, 0x79, - 0x44, 0x28, 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0x78, 0x7a, 0x52, 0x14, 0x3b, 0x06, 0x4d, 0xd5, 0xb2, - 0xd3, 0x68, 0x60, 0xdb, 0x44, 0x19, 0x69, 0x83, 0x7c, 0x13, 0x4e, 0xe3, 0x7b, 0x2b, 0x4e, 0x08, - 0x8f, 0xc9, 0x3b, 0xfd, 0x15, 0x34, 0xca, 0x06, 0x29, 0x13, 0xf8, 0xd7, 0x00, 0x2a, 0x6f, 0x44, - 0xc8, 0x8d, 0x6b, 0x35, 0xe2, 0x32, 0x75, 0xd5, 0x5f, 0x1d, 0x74, 0xda, 0xf1, 0xfd, 0x54, 0xe2, - 0x51, 0x78, 0x59, 0x40, 0x91, 0xea, 0x4c, 0x28, 0xe1, 0xa1, 0x94, 0xef, 0x99, 0xe0, 0x54, 0xee, - 0xa9, 0xcb, 0xbd, 0x2f, 0x37, 0xe1, 0x96, 0xca, 0x1d, 0x04, 0x95, 0x61, 0x44, 0x06, 0x6f, 0xf2, - 0xc8, 0xcc, 0x38, 0xb4, 0x6c, 0xd3, 0x39, 0xf4, 0x0c, 0x7c, 0x80, 0xad, 0x3a, 0xde, 0x56, 0x45, - 0xbd, 0x04, 0x82, 0xb4, 0xf5, 0x58, 0xaa, 0xca, 0xbe, 0x66, 0xe6, 0x5f, 0x35, 0x00, 0x22, 0xfe, - 0xcc, 0x81, 0x71, 0x57, 0x86, 0xfd, 0x62, 0xc7, 0x4f, 0x54, 0x12, 0x9d, 0x17, 0x85, 0x51, 0x37, - 0xd5, 0x7a, 0x0d, 0xf9, 0x0a, 0xf8, 0x5d, 0x30, 0xee, 0xbb, 0x19, 0x7f, 0xa5, 0x9b, 0x6a, 0xff, - 0xfa, 0x16, 0xf0, 0xed, 0xd3, 0x7f, 0x4f, 0x90, 0x96, 0x02, 0xae, 0x12, 0x8c, 0xff, 0xbb, 0x04, - 0x92, 0x41, 0x86, 0x0d, 0xdf, 0x8b, 0x66, 0xe2, 0xd7, 0x86, 0x66, 0xe2, 0x27, 0xa4, 0xe0, 0xcb, - 0x00, 0xd4, 0x28, 0xc1, 0xaa, 0xf4, 0x1f, 0x3f, 0x4b, 0xe9, 0x5f, 0xd9, 0x95, 0x19, 0x27, 0x69, - 0xba, 0xa6, 0x4f, 0x32, 0x72, 0x16, 0x12, 0x65, 0x57, 0x66, 0x41, 0x59, 0x66, 0x34, 0x52, 0x2d, - 0x9a, 0x05, 0x29, 0x93, 0x78, 0x35, 0x6a, 0xb9, 0x7c, 0x4f, 0x88, 0xe3, 0x23, 0x89, 0xa2, 0x22, - 0x11, 0x75, 0x31, 0x46, 0xad, 0xed, 0x26, 0x23, 0x9e, 0x3e, 0x26, 0x56, 0xf4, 0xf5, 0xa1, 0x03, - 0x51, 0x2a, 0x07, 0xd8, 0x15, 0x9b, 0xd1, 0x23, 0x14, 0x31, 0x86, 0x4f, 0x41, 0x4a, 0x9d, 0x85, - 0x06, 0x1f, 0xd4, 0xf1, 0xb3, 0x97, 0x37, 0x44, 0xa9, 0xde, 0x97, 0x57, 0x3d, 0x04, 0x0e, 0x7c, - 0x8c, 0x07, 0x2b, 0x00, 0x7a, 0x84, 0x8a, 0xc3, 0xda, 0xa5, 0xce, 0x8e, 0x55, 0x27, 0x86, 0x65, - 0x8a, 0x43, 0x22, 0x29, 0x3f, 0x31, 0x6c, 0x4a, 0xed, 0x86, 0x54, 0xae, 0x56, 0x51, 0xd6, 0xeb, - 0x96, 0x98, 0xf0, 0x7f, 0x34, 0x70, 0x41, 0x7d, 0xbe, 0x32, 0xb8, 0x92, 0x50, 0xf1, 0xb9, 0x8b, - 0x78, 0x9e, 0x88, 0xe8, 0x93, 0x95, 0xbf, 0xd7, 0x3a, 0x2f, 0x0a, 0x7f, 0xa7, 0x81, 0xbf, 0xd5, - 0x9e, 0x17, 0x97, 0xee, 0x16, 0x97, 0xee, 0x7e, 0x82, 0xe7, 0x7f, 0x50, 0x9e, 0x7f, 0x72, 0x73, - 0xfe, 0x9d, 0x67, 0x9f, 0x45, 0x9e, 0xc3, 0xc7, 0xa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55, 0x1c, 0xfc, 0x2e, 0x2a, 0xa6, 0x8c, 0x34, 0xf4, - 0xc5, 0x1e, 0x4f, 0xb4, 0x54, 0xce, 0x31, 0x28, 0xcf, 0xf2, 0xf4, 0xa2, 0xe0, 0x3d, 0x5d, 0xa2, - 0x25, 0x89, 0x06, 0xa8, 0x3c, 0xf8, 0x01, 0x00, 0x91, 0xef, 0x02, 0xd7, 0xcf, 0xf6, 0x5d, 0x00, - 0x45, 0x6c, 0x21, 0x06, 0x69, 0x97, 0x3a, 0x07, 0x16, 0xdf, 0x8f, 0x84, 0xf2, 0xd3, 0xee, 0x86, - 0x38, 0xf7, 0xef, 0x76, 0xda, 0x85, 0xc9, 0x8d, 0x50, 0x73, 0x96, 0xef, 0x7c, 0x93, 0x11, 0xc6, - 0x55, 0x13, 0x56, 0x41, 0x2e, 0x10, 0xf0, 0xc3, 0xc2, 0xc4, 0x0c, 0xeb, 0xdf, 0x56, 0x27, 0x45, - 0xef, 0x9a, 0xdf, 0x14, 0xff, 0x1c, 0x43, 0xd9, 0xa8, 0x45, 0x15, 0x33, 0x3c, 0xf3, 0x3d, 0x90, - 0xe9, 0x09, 0x88, 0x61, 0x16, 0x8c, 0xec, 0x13, 0xf9, 0xdd, 0x3b, 0x89, 0xf8, 0x23, 0x3c, 0xef, - 0x17, 0x52, 0xe4, 0x67, 0x5c, 0xf9, 0x72, 0x37, 0xfe, 0x1d, 0x6d, 0xe6, 0x11, 0x48, 0x77, 0xc7, - 0x03, 0x03, 0xac, 0x4b, 0x51, 0xeb, 0x01, 0x87, 0xa8, 0x4f, 0x10, 0xe1, 0x55, 0x99, 0xce, 0x07, - 0x00, 0x04, 0x71, 0x87, 0x07, 0xef, 0x82, 0x54, 0xf8, 0xcf, 0x3f, 0x9e, 0xf1, 0x8c, 0x88, 0x42, - 0xe6, 0xb0, 0x40, 0x05, 0x01, 0x12, 0xd8, 0xce, 0x3d, 0x05, 0x17, 0x96, 0x45, 0xae, 0x12, 0xaa, - 0x55, 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e5, 0xad, 0xad, 0x15, 0xf4, 0x71, 0x56, 0x83, 0x10, 0xa4, 0xa5, - 0x68, 0xe5, 0x6f, 0xb6, 0x56, 0xd0, 0x7a, 0x79, 0x2d, 0x1b, 0xaf, 0xfc, 0x8b, 0xf6, 0xc5, 0xcb, - 0xbc, 0xf6, 0xe5, 0xcb, 0xbc, 0xf6, 0xeb, 0x97, 0xf9, 0xd8, 0x6f, 0x5f, 0xe6, 0x63, 0xbf, 0x7b, - 0x99, 0x8f, 0xfd, 0xfe, 0x65, 0x3e, 0xf6, 0x87, 0x97, 0x79, 0xed, 0xc7, 0x9d, 0xbc, 0xf6, 0x93, - 0x4e, 0x3e, 0xf6, 0x8b, 0x4e, 0x5e, 0xfb, 0x65, 0x27, 0x1f, 0xfb, 0xbc, 0x93, 0x8f, 0xfd, 0xaa, - 0x93, 0x8f, 0x7d, 0xd1, 0xc9, 0x6b, 0x5f, 0x76, 0xf2, 0xda, 0xaf, 0x3b, 0xf9, 0xd8, 0x6f, 0x3b, - 0x79, 0xed, 0x77, 0x9d, 0x7c, 0xec, 0xf7, 0x9d, 0xbc, 0xf6, 0x87, 0x4e, 0x3e, 0xf6, 0xe3, 0xe3, - 0x7c, 0xec, 0x27, 0xc7, 0x79, 0xed, 0xa7, 0xc7, 0xf9, 0xd8, 0xcf, 0x8e, 0xf3, 0xda, 0xcf, 0x8f, - 0xf3, 0xb1, 0x5f, 0x1c, 0xe7, 0x63, 0xbf, 0x3c, 0xce, 0x6b, 0x9f, 0x1f, 0xe7, 0xb5, 0x5f, 0x1d, - 0xe7, 0xb5, 0x27, 0x6f, 0x9d, 0x36, 0xb8, 0x64, 0xb6, 0xbb, 0xbd, 0x3d, 0x26, 0x46, 0xe4, 0xf6, - 0x1f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xb8, 0x23, 0xb1, 0x0f, 0x77, 0x2c, 0x00, 0x00, + golang_proto.RegisterFile("lorawan-stack/api/end_device.proto", fileDescriptor_end_device_6bafadec442a1d5e) +} + +var fileDescriptor_end_device_6bafadec442a1d5e = []byte{ + // 3964 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0x4b, 0x6c, 0x5b, 0x57, + 0x7a, 0xe6, 0xa5, 0x64, 0x89, 0xfc, 0x45, 0xf1, 0x71, 0x24, 0xd9, 0x37, 0xb2, 0x43, 0x2a, 0x8a, + 0x93, 0xd0, 0x9e, 0x88, 0xb6, 0xe5, 0x64, 0x66, 0xa2, 0x26, 0x50, 0x48, 0x51, 0x4e, 0xe4, 0xb1, + 0x15, 0xcd, 0xf1, 0x2b, 0x0f, 0xdb, 0x17, 0x47, 0xbc, 0x87, 0xf2, 0x8d, 0xc8, 0x7b, 0x39, 0xf7, + 0x1e, 0xea, 0x91, 0xc9, 0x00, 0x46, 0x51, 0xa0, 0x83, 0x01, 0x0a, 0x04, 0x5d, 0x4d, 0xd1, 0x4d, + 0xd0, 0x4d, 0x67, 0x39, 0xab, 0x22, 0x68, 0x37, 0xe9, 0xaa, 0xd9, 0x35, 0x5d, 0x14, 0x18, 0x0c, + 0x0a, 0x76, 0x4c, 0x6f, 0xa6, 0xbb, 0xc1, 0xac, 0x66, 0x53, 0xa0, 0x38, 0x8f, 0xfb, 0xe0, 0x43, + 0xb2, 0x98, 0x49, 0x07, 0xb3, 0x21, 0x2e, 0xff, 0xf3, 0xfd, 0xdf, 0xf9, 0xcf, 0xeb, 0x3f, 0xff, + 0xff, 0xdf, 0x0b, 0x8b, 0x0d, 0xc7, 0x25, 0xfb, 0xc4, 0x5e, 0xf2, 0x18, 0xa9, 0xed, 0x5e, 0x22, + 0x2d, 0xeb, 0x12, 0xb5, 0x4d, 0xc3, 0xa4, 0x7b, 0x56, 0x8d, 0x96, 0x5a, 0xae, 0xc3, 0x1c, 0x94, + 0x66, 0xcc, 0x2e, 0x29, 0x5c, 0x69, 0xef, 0xea, 0xfc, 0xd2, 0x8e, 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, 0x8c, 0x92, 0xb6, 0x04, 0xb9, 0x07, 0x56, 0x0c, 0x65, + 0x86, 0xde, 0x81, 0x29, 0xf9, 0x41, 0x88, 0xdc, 0x03, 0x8b, 0x47, 0x38, 0x09, 0x0e, 0x91, 0xbb, + 0x20, 0x9a, 0x71, 0x40, 0x2b, 0x90, 0xa3, 0x07, 0x80, 0xb6, 0x45, 0x59, 0xfd, 0x90, 0xa7, 0x31, + 0x35, 0x6a, 0x33, 0xb2, 0x43, 0xf5, 0x17, 0x9f, 0x5d, 0xf1, 0xca, 0x71, 0xc2, 0x14, 0xc0, 0xf3, + 0xb1, 0xd8, 0xe3, 0xd5, 0xa5, 0x58, 0x2c, 0x16, 0xc3, 0x39, 0xc5, 0xb4, 0x15, 0x10, 0xa1, 0x57, + 0x20, 0x13, 0xa4, 0x6b, 0xaa, 0x9a, 0x76, 0x7e, 0x41, 0x2b, 0x9e, 0xc2, 0x69, 0x5f, 0xac, 0xca, + 0x64, 0x84, 0x1f, 0x70, 0xae, 0x65, 0x10, 0xd3, 0x55, 0x6f, 0x53, 0x3d, 0xfd, 0x25, 0x71, 0x0b, + 0x0c, 0x64, 0xbb, 0xf2, 0xc5, 0xaa, 0x7a, 0x85, 0x20, 0xe3, 0x17, 0x2c, 0x94, 0xcb, 0x55, 0x2c, + 0xdb, 0x3c, 0xee, 0x15, 0x84, 0xc4, 0x74, 0x95, 0x04, 0x55, 0x21, 0xad, 0xba, 0xf0, 0xe9, 0x5f, + 0x3e, 0x01, 0x3d, 0x9e, 0x96, 0x4a, 0x3e, 0xcb, 0x75, 0x50, 0xcc, 0x41, 0x32, 0xe6, 0xe9, 0xaf, + 0x08, 0x9e, 0xc2, 0x40, 0x51, 0xc5, 0x1f, 0xa2, 0x62, 0xca, 0x48, 0x45, 0x5f, 0xec, 0xf1, 0x2c, + 0x4f, 0x25, 0x3c, 0xc3, 0x92, 0x3c, 0x4f, 0x2f, 0x0a, 0xde, 0x93, 0x65, 0x79, 0x92, 0x68, 0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f, 0x9e, 0xe4, 0xb5, 0xaf, + 0x9f, 0xe4, 0xb5, 0x5f, 0x3d, 0xc9, 0xc7, 0x7e, 0xf3, 0x24, 0x1f, 0xfb, 0xed, 0x93, 0x7c, 0xec, + 0x77, 0x4f, 0xf2, 0xb1, 0x3f, 0x3c, 0xc9, 0x6b, 0x8f, 0xbb, 0x79, 0xed, 0xa7, 0xdd, 0x7c, 0xec, + 0x17, 0xdd, 0xbc, 0xf6, 0xcb, 0x6e, 0x3e, 0xf6, 0x45, 0x37, 0x1f, 0xfb, 0xb2, 0x9b, 0x8f, 0x7d, + 0xd5, 0xcd, 0x6b, 0x5f, 0x77, 0xf3, 0xda, 0xaf, 0xba, 0xf9, 0xd8, 0x6f, 0xba, 0x79, 0xed, 0xb7, + 0xdd, 0x7c, 0xec, 0x77, 0xdd, 0xbc, 0xf6, 0x87, 0x6e, 0x3e, 0xf6, 0xf8, 0x69, 0x3e, 0xf6, 0xd3, + 0xa7, 0x79, 0xed, 0xb3, 0xa7, 0xf9, 0xd8, 0xcf, 0x9f, 0xe6, 0xb5, 0xcf, 0x9f, 0xe6, 0x63, 0xbf, + 0x78, 0x9a, 0x8f, 0xfd, 0xf2, 0x69, 0x5e, 0xfb, 0xe2, 0x69, 0x5e, 0xfb, 0xf2, 0x69, 0x5e, 0xfb, + 0xf0, 0xd5, 0x93, 0x46, 0xb3, 0xcc, 0x6e, 0x6d, 0x6f, 0x4f, 0x88, 0x19, 0xb9, 0xfa, 0x7f, 0x01, + 0x00, 0x00, 0xff, 0xff, 0x6b, 0xd9, 0x09, 0x84, 0x4a, 0x2f, 0x00, 0x00, } diff --git a/pkg/ttnpb/end_device.pb.fm.go b/pkg/ttnpb/end_device.pb.paths.fm.go similarity index 65% rename from pkg/ttnpb/end_device.pb.fm.go rename to pkg/ttnpb/end_device.pb.paths.fm.go index 9f7d1884f2..0fa205caea 100644 --- a/pkg/ttnpb/end_device.pb.fm.go +++ b/pkg/ttnpb/end_device.pb.paths.fm.go @@ -2,14 +2,6 @@ package ttnpb -import ( - fmt "fmt" - time "time" - - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - go_thethings_network_lorawan_stack_pkg_types "go.thethings.network/lorawan-stack/pkg/types" -) - var SessionFieldPathsNested = []string{ "dev_addr", "keys", @@ -42,96 +34,6 @@ var SessionFieldPathsTopLevel = []string{ "last_n_f_cnt_down", "started_at", } - -func (dst *Session) SetFields(src *Session, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "dev_addr": - if len(subs) > 0 { - return fmt.Errorf("'dev_addr' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.DevAddr = src.DevAddr - } else { - var zero go_thethings_network_lorawan_stack_pkg_types.DevAddr - dst.DevAddr = zero - } - case "keys": - if len(subs) > 0 { - newDst := &dst.SessionKeys - var newSrc *SessionKeys - if src != nil { - newSrc = &src.SessionKeys - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.SessionKeys = src.SessionKeys - } else { - var zero SessionKeys - dst.SessionKeys = zero - } - } - case "last_f_cnt_up": - if len(subs) > 0 { - return fmt.Errorf("'last_f_cnt_up' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.LastFCntUp = src.LastFCntUp - } else { - var zero uint32 - dst.LastFCntUp = zero - } - case "last_n_f_cnt_down": - if len(subs) > 0 { - return fmt.Errorf("'last_n_f_cnt_down' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.LastNFCntDown = src.LastNFCntDown - } else { - var zero uint32 - dst.LastNFCntDown = zero - } - case "last_a_f_cnt_down": - if len(subs) > 0 { - return fmt.Errorf("'last_a_f_cnt_down' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.LastAFCntDown = src.LastAFCntDown - } else { - var zero uint32 - dst.LastAFCntDown = zero - } - case "last_conf_f_cnt_down": - if len(subs) > 0 { - return fmt.Errorf("'last_conf_f_cnt_down' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.LastConfFCntDown = src.LastConfFCntDown - } else { - var zero uint32 - dst.LastConfFCntDown = zero - } - case "started_at": - if len(subs) > 0 { - return fmt.Errorf("'started_at' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.StartedAt = src.StartedAt - } else { - var zero time.Time - dst.StartedAt = zero - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - var MACParametersFieldPathsNested = []string{ "adr_ack_delay", "adr_ack_limit", @@ -175,284 +77,6 @@ var MACParametersFieldPathsTopLevel = []string{ "rx2_frequency", "uplink_dwell_time", } - -func (dst *MACParameters) SetFields(src *MACParameters, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "max_eirp": - if len(subs) > 0 { - return fmt.Errorf("'max_eirp' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.MaxEIRP = src.MaxEIRP - } else { - var zero float32 - dst.MaxEIRP = zero - } - case "uplink_dwell_time": - if len(subs) > 0 { - return fmt.Errorf("'uplink_dwell_time' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.UplinkDwellTime = src.UplinkDwellTime - } else { - var zero bool - dst.UplinkDwellTime = zero - } - case "downlink_dwell_time": - if len(subs) > 0 { - return fmt.Errorf("'downlink_dwell_time' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.DownlinkDwellTime = src.DownlinkDwellTime - } else { - var zero bool - dst.DownlinkDwellTime = zero - } - case "adr_data_rate_index": - if len(subs) > 0 { - return fmt.Errorf("'adr_data_rate_index' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.ADRDataRateIndex = src.ADRDataRateIndex - } else { - var zero DataRateIndex - dst.ADRDataRateIndex = zero - } - case "adr_tx_power_index": - if len(subs) > 0 { - return fmt.Errorf("'adr_tx_power_index' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.ADRTxPowerIndex = src.ADRTxPowerIndex - } else { - var zero uint32 - dst.ADRTxPowerIndex = zero - } - case "adr_nb_trans": - if len(subs) > 0 { - return fmt.Errorf("'adr_nb_trans' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.ADRNbTrans = src.ADRNbTrans - } else { - var zero uint32 - dst.ADRNbTrans = zero - } - case "adr_ack_limit": - if len(subs) > 0 { - return fmt.Errorf("'adr_ack_limit' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.ADRAckLimit = src.ADRAckLimit - } else { - var zero uint32 - dst.ADRAckLimit = zero - } - case "adr_ack_delay": - if len(subs) > 0 { - return fmt.Errorf("'adr_ack_delay' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.ADRAckDelay = src.ADRAckDelay - } else { - var zero uint32 - dst.ADRAckDelay = zero - } - case "rx1_delay": - if len(subs) > 0 { - return fmt.Errorf("'rx1_delay' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Rx1Delay = src.Rx1Delay - } else { - var zero RxDelay - dst.Rx1Delay = zero - } - case "rx1_data_rate_offset": - if len(subs) > 0 { - return fmt.Errorf("'rx1_data_rate_offset' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Rx1DataRateOffset = src.Rx1DataRateOffset - } else { - var zero uint32 - dst.Rx1DataRateOffset = zero - } - case "rx2_data_rate_index": - if len(subs) > 0 { - return fmt.Errorf("'rx2_data_rate_index' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Rx2DataRateIndex = src.Rx2DataRateIndex - } else { - var zero DataRateIndex - dst.Rx2DataRateIndex = zero - } - case "rx2_frequency": - if len(subs) > 0 { - return fmt.Errorf("'rx2_frequency' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Rx2Frequency = src.Rx2Frequency - } else { - var zero uint64 - dst.Rx2Frequency = zero - } - case "max_duty_cycle": - if len(subs) > 0 { - return fmt.Errorf("'max_duty_cycle' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.MaxDutyCycle = src.MaxDutyCycle - } else { - var zero AggregatedDutyCycle - dst.MaxDutyCycle = zero - } - case "rejoin_time_periodicity": - if len(subs) > 0 { - return fmt.Errorf("'rejoin_time_periodicity' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.RejoinTimePeriodicity = src.RejoinTimePeriodicity - } else { - var zero RejoinTimeExponent - dst.RejoinTimePeriodicity = zero - } - case "rejoin_count_periodicity": - if len(subs) > 0 { - return fmt.Errorf("'rejoin_count_periodicity' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.RejoinCountPeriodicity = src.RejoinCountPeriodicity - } else { - var zero RejoinCountExponent - dst.RejoinCountPeriodicity = zero - } - case "ping_slot_frequency": - if len(subs) > 0 { - return fmt.Errorf("'ping_slot_frequency' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.PingSlotFrequency = src.PingSlotFrequency - } else { - var zero uint64 - dst.PingSlotFrequency = zero - } - case "ping_slot_data_rate_index": - if len(subs) > 0 { - return fmt.Errorf("'ping_slot_data_rate_index' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.PingSlotDataRateIndex = src.PingSlotDataRateIndex - } else { - var zero DataRateIndex - dst.PingSlotDataRateIndex = zero - } - case "beacon_frequency": - if len(subs) > 0 { - return fmt.Errorf("'beacon_frequency' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.BeaconFrequency = src.BeaconFrequency - } else { - var zero uint64 - dst.BeaconFrequency = zero - } - case "channels": - if len(subs) > 0 { - return fmt.Errorf("'channels' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Channels = src.Channels - } else { - dst.Channels = nil - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - -var MACParameters_ChannelFieldPathsNested = []string{ - "downlink_frequency", - "enable_uplink", - "max_data_rate_index", - "min_data_rate_index", - "uplink_frequency", -} - -var MACParameters_ChannelFieldPathsTopLevel = []string{ - "downlink_frequency", - "enable_uplink", - "max_data_rate_index", - "min_data_rate_index", - "uplink_frequency", -} - -func (dst *MACParameters_Channel) SetFields(src *MACParameters_Channel, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "uplink_frequency": - if len(subs) > 0 { - return fmt.Errorf("'uplink_frequency' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.UplinkFrequency = src.UplinkFrequency - } else { - var zero uint64 - dst.UplinkFrequency = zero - } - case "downlink_frequency": - if len(subs) > 0 { - return fmt.Errorf("'downlink_frequency' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.DownlinkFrequency = src.DownlinkFrequency - } else { - var zero uint64 - dst.DownlinkFrequency = zero - } - case "min_data_rate_index": - if len(subs) > 0 { - return fmt.Errorf("'min_data_rate_index' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.MinDataRateIndex = src.MinDataRateIndex - } else { - var zero DataRateIndex - dst.MinDataRateIndex = zero - } - case "max_data_rate_index": - if len(subs) > 0 { - return fmt.Errorf("'max_data_rate_index' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.MaxDataRateIndex = src.MaxDataRateIndex - } else { - var zero DataRateIndex - dst.MaxDataRateIndex = zero - } - case "enable_uplink": - if len(subs) > 0 { - return fmt.Errorf("'enable_uplink' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.EnableUplink = src.EnableUplink - } else { - var zero bool - dst.EnableUplink = zero - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - var EndDeviceBrandFieldPathsNested = []string{ "id", "logos", @@ -466,57 +90,6 @@ var EndDeviceBrandFieldPathsTopLevel = []string{ "name", "url", } - -func (dst *EndDeviceBrand) SetFields(src *EndDeviceBrand, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "id": - if len(subs) > 0 { - return fmt.Errorf("'id' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.ID = src.ID - } else { - var zero string - dst.ID = zero - } - case "name": - if len(subs) > 0 { - return fmt.Errorf("'name' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Name = src.Name - } else { - var zero string - dst.Name = zero - } - case "url": - if len(subs) > 0 { - return fmt.Errorf("'url' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.URL = src.URL - } else { - var zero string - dst.URL = zero - } - case "logos": - if len(subs) > 0 { - return fmt.Errorf("'logos' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Logos = src.Logos - } else { - dst.Logos = nil - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - var EndDeviceModelFieldPathsNested = []string{ "brand_id", "id", @@ -528,48 +101,6 @@ var EndDeviceModelFieldPathsTopLevel = []string{ "id", "name", } - -func (dst *EndDeviceModel) SetFields(src *EndDeviceModel, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "brand_id": - if len(subs) > 0 { - return fmt.Errorf("'brand_id' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.BrandID = src.BrandID - } else { - var zero string - dst.BrandID = zero - } - case "id": - if len(subs) > 0 { - return fmt.Errorf("'id' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.ID = src.ID - } else { - var zero string - dst.ID = zero - } - case "name": - if len(subs) > 0 { - return fmt.Errorf("'name' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Name = src.Name - } else { - var zero string - dst.Name = zero - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - var EndDeviceVersionIdentifiersFieldPathsNested = []string{ "brand_id", "firmware_version", @@ -583,58 +114,6 @@ var EndDeviceVersionIdentifiersFieldPathsTopLevel = []string{ "hardware_version", "model_id", } - -func (dst *EndDeviceVersionIdentifiers) SetFields(src *EndDeviceVersionIdentifiers, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "brand_id": - if len(subs) > 0 { - return fmt.Errorf("'brand_id' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.BrandID = src.BrandID - } else { - var zero string - dst.BrandID = zero - } - case "model_id": - if len(subs) > 0 { - return fmt.Errorf("'model_id' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.ModelID = src.ModelID - } else { - var zero string - dst.ModelID = zero - } - case "hardware_version": - if len(subs) > 0 { - return fmt.Errorf("'hardware_version' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.HardwareVersion = src.HardwareVersion - } else { - var zero string - dst.HardwareVersion = zero - } - case "firmware_version": - if len(subs) > 0 { - return fmt.Errorf("'firmware_version' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.FirmwareVersion = src.FirmwareVersion - } else { - var zero string - dst.FirmwareVersion = zero - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - var EndDeviceVersionFieldPathsNested = []string{ "default_formatters", "default_formatters.down_formatter", @@ -702,174 +181,6 @@ var EndDeviceVersionFieldPathsTopLevel = []string{ "supports_class_c", "supports_join", } - -func (dst *EndDeviceVersion) SetFields(src *EndDeviceVersion, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "ids": - if len(subs) > 0 { - newDst := &dst.EndDeviceVersionIdentifiers - var newSrc *EndDeviceVersionIdentifiers - if src != nil { - newSrc = &src.EndDeviceVersionIdentifiers - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.EndDeviceVersionIdentifiers = src.EndDeviceVersionIdentifiers - } else { - var zero EndDeviceVersionIdentifiers - dst.EndDeviceVersionIdentifiers = zero - } - } - case "lorawan_version": - if len(subs) > 0 { - return fmt.Errorf("'lorawan_version' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.LoRaWANVersion = src.LoRaWANVersion - } else { - var zero MACVersion - dst.LoRaWANVersion = zero - } - case "lorawan_phy_version": - if len(subs) > 0 { - return fmt.Errorf("'lorawan_phy_version' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.LoRaWANPHYVersion = src.LoRaWANPHYVersion - } else { - var zero PHYVersion - dst.LoRaWANPHYVersion = zero - } - case "frequency_plan_id": - if len(subs) > 0 { - return fmt.Errorf("'frequency_plan_id' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.FrequencyPlanID = src.FrequencyPlanID - } else { - var zero string - dst.FrequencyPlanID = zero - } - case "photos": - if len(subs) > 0 { - return fmt.Errorf("'photos' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Photos = src.Photos - } else { - dst.Photos = nil - } - case "supports_class_b": - if len(subs) > 0 { - return fmt.Errorf("'supports_class_b' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.SupportsClassB = src.SupportsClassB - } else { - var zero bool - dst.SupportsClassB = zero - } - case "supports_class_c": - if len(subs) > 0 { - return fmt.Errorf("'supports_class_c' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.SupportsClassC = src.SupportsClassC - } else { - var zero bool - dst.SupportsClassC = zero - } - case "default_mac_settings": - if len(subs) > 0 { - newDst := dst.DefaultMACSettings - if newDst == nil { - newDst = &MACSettings{} - dst.DefaultMACSettings = newDst - } - var newSrc *MACSettings - if src != nil { - newSrc = src.DefaultMACSettings - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.DefaultMACSettings = src.DefaultMACSettings - } else { - dst.DefaultMACSettings = nil - } - } - case "min_frequency": - if len(subs) > 0 { - return fmt.Errorf("'min_frequency' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.MinFrequency = src.MinFrequency - } else { - var zero uint64 - dst.MinFrequency = zero - } - case "max_frequency": - if len(subs) > 0 { - return fmt.Errorf("'max_frequency' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.MaxFrequency = src.MaxFrequency - } else { - var zero uint64 - dst.MaxFrequency = zero - } - case "supports_join": - if len(subs) > 0 { - return fmt.Errorf("'supports_join' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.SupportsJoin = src.SupportsJoin - } else { - var zero bool - dst.SupportsJoin = zero - } - case "resets_join_nonces": - if len(subs) > 0 { - return fmt.Errorf("'resets_join_nonces' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.ResetsJoinNonces = src.ResetsJoinNonces - } else { - var zero bool - dst.ResetsJoinNonces = zero - } - case "default_formatters": - if len(subs) > 0 { - newDst := &dst.DefaultFormatters - var newSrc *MessagePayloadFormatters - if src != nil { - newSrc = &src.DefaultFormatters - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.DefaultFormatters = src.DefaultFormatters - } else { - var zero MessagePayloadFormatters - dst.DefaultFormatters = zero - } - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - var MACSettingsFieldPathsNested = []string{ "adr_margin", "class_b_timeout", @@ -924,410 +235,6 @@ var MACSettingsFieldPathsTopLevel = []string{ "supports_32_bit_f_cnt", "use_adr", } - -func (dst *MACSettings) SetFields(src *MACSettings, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "class_b_timeout": - if len(subs) > 0 { - return fmt.Errorf("'class_b_timeout' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.ClassBTimeout = src.ClassBTimeout - } else { - dst.ClassBTimeout = nil - } - case "ping_slot_periodicity": - if len(subs) > 0 { - newDst := dst.PingSlotPeriodicity - if newDst == nil { - newDst = &MACSettings_PingSlotPeriodValue{} - dst.PingSlotPeriodicity = newDst - } - var newSrc *MACSettings_PingSlotPeriodValue - if src != nil { - newSrc = src.PingSlotPeriodicity - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.PingSlotPeriodicity = src.PingSlotPeriodicity - } else { - dst.PingSlotPeriodicity = nil - } - } - case "ping_slot_data_rate_index": - if len(subs) > 0 { - newDst := dst.PingSlotDataRateIndex - if newDst == nil { - newDst = &MACSettings_DataRateIndexValue{} - dst.PingSlotDataRateIndex = newDst - } - var newSrc *MACSettings_DataRateIndexValue - if src != nil { - newSrc = src.PingSlotDataRateIndex - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.PingSlotDataRateIndex = src.PingSlotDataRateIndex - } else { - dst.PingSlotDataRateIndex = nil - } - } - case "ping_slot_frequency": - if len(subs) > 0 { - return fmt.Errorf("'ping_slot_frequency' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.PingSlotFrequency = src.PingSlotFrequency - } else { - var zero uint64 - dst.PingSlotFrequency = zero - } - case "class_c_timeout": - if len(subs) > 0 { - return fmt.Errorf("'class_c_timeout' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.ClassCTimeout = src.ClassCTimeout - } else { - dst.ClassCTimeout = nil - } - case "rx1_delay": - if len(subs) > 0 { - newDst := dst.Rx1Delay - if newDst == nil { - newDst = &MACSettings_RxDelayValue{} - dst.Rx1Delay = newDst - } - var newSrc *MACSettings_RxDelayValue - if src != nil { - newSrc = src.Rx1Delay - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.Rx1Delay = src.Rx1Delay - } else { - dst.Rx1Delay = nil - } - } - case "rx1_data_rate_offset": - if len(subs) > 0 { - return fmt.Errorf("'rx1_data_rate_offset' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Rx1DataRateOffset = src.Rx1DataRateOffset - } else { - dst.Rx1DataRateOffset = nil - } - case "rx2_data_rate_index": - if len(subs) > 0 { - newDst := dst.Rx2DataRateIndex - if newDst == nil { - newDst = &MACSettings_DataRateIndexValue{} - dst.Rx2DataRateIndex = newDst - } - var newSrc *MACSettings_DataRateIndexValue - if src != nil { - newSrc = src.Rx2DataRateIndex - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.Rx2DataRateIndex = src.Rx2DataRateIndex - } else { - dst.Rx2DataRateIndex = nil - } - } - case "rx2_frequency": - if len(subs) > 0 { - return fmt.Errorf("'rx2_frequency' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Rx2Frequency = src.Rx2Frequency - } else { - var zero uint64 - dst.Rx2Frequency = zero - } - case "factory_preset_frequencies": - if len(subs) > 0 { - return fmt.Errorf("'factory_preset_frequencies' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.FactoryPresetFrequencies = src.FactoryPresetFrequencies - } else { - dst.FactoryPresetFrequencies = nil - } - case "max_duty_cycle": - if len(subs) > 0 { - newDst := dst.MaxDutyCycle - if newDst == nil { - newDst = &MACSettings_AggregatedDutyCycleValue{} - dst.MaxDutyCycle = newDst - } - var newSrc *MACSettings_AggregatedDutyCycleValue - if src != nil { - newSrc = src.MaxDutyCycle - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.MaxDutyCycle = src.MaxDutyCycle - } else { - dst.MaxDutyCycle = nil - } - } - case "supports_32_bit_f_cnt": - if len(subs) > 0 { - return fmt.Errorf("'supports_32_bit_f_cnt' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Supports32BitFCnt = src.Supports32BitFCnt - } else { - dst.Supports32BitFCnt = nil - } - case "use_adr": - if len(subs) > 0 { - return fmt.Errorf("'use_adr' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.UseADR = src.UseADR - } else { - dst.UseADR = nil - } - case "adr_margin": - if len(subs) > 0 { - return fmt.Errorf("'adr_margin' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.ADRMargin = src.ADRMargin - } else { - dst.ADRMargin = nil - } - case "resets_f_cnt": - if len(subs) > 0 { - return fmt.Errorf("'resets_f_cnt' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.ResetsFCnt = src.ResetsFCnt - } else { - dst.ResetsFCnt = nil - } - case "status_time_periodicity": - if len(subs) > 0 { - return fmt.Errorf("'status_time_periodicity' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.StatusTimePeriodicity = src.StatusTimePeriodicity - } else { - dst.StatusTimePeriodicity = nil - } - case "status_count_periodicity": - if len(subs) > 0 { - return fmt.Errorf("'status_count_periodicity' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.StatusCountPeriodicity = src.StatusCountPeriodicity - } else { - dst.StatusCountPeriodicity = nil - } - case "desired_rx1_delay": - if len(subs) > 0 { - newDst := dst.DesiredRx1Delay - if newDst == nil { - newDst = &MACSettings_RxDelayValue{} - dst.DesiredRx1Delay = newDst - } - var newSrc *MACSettings_RxDelayValue - if src != nil { - newSrc = src.DesiredRx1Delay - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.DesiredRx1Delay = src.DesiredRx1Delay - } else { - dst.DesiredRx1Delay = nil - } - } - case "desired_rx1_data_rate_offset": - if len(subs) > 0 { - return fmt.Errorf("'desired_rx1_data_rate_offset' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.DesiredRx1DataRateOffset = src.DesiredRx1DataRateOffset - } else { - dst.DesiredRx1DataRateOffset = nil - } - case "desired_rx2_data_rate_index": - if len(subs) > 0 { - newDst := dst.DesiredRx2DataRateIndex - if newDst == nil { - newDst = &MACSettings_DataRateIndexValue{} - dst.DesiredRx2DataRateIndex = newDst - } - var newSrc *MACSettings_DataRateIndexValue - if src != nil { - newSrc = src.DesiredRx2DataRateIndex - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.DesiredRx2DataRateIndex = src.DesiredRx2DataRateIndex - } else { - dst.DesiredRx2DataRateIndex = nil - } - } - case "desired_rx2_frequency": - if len(subs) > 0 { - return fmt.Errorf("'desired_rx2_frequency' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.DesiredRx2Frequency = src.DesiredRx2Frequency - } else { - var zero uint64 - dst.DesiredRx2Frequency = zero - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - -var MACSettings_DataRateIndexValueFieldPathsNested = []string{ - "value", -} - -var MACSettings_DataRateIndexValueFieldPathsTopLevel = []string{ - "value", -} - -func (dst *MACSettings_DataRateIndexValue) SetFields(src *MACSettings_DataRateIndexValue, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "value": - if len(subs) > 0 { - return fmt.Errorf("'value' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Value = src.Value - } else { - var zero DataRateIndex - dst.Value = zero - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - -var MACSettings_PingSlotPeriodValueFieldPathsNested = []string{ - "value", -} - -var MACSettings_PingSlotPeriodValueFieldPathsTopLevel = []string{ - "value", -} - -func (dst *MACSettings_PingSlotPeriodValue) SetFields(src *MACSettings_PingSlotPeriodValue, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "value": - if len(subs) > 0 { - return fmt.Errorf("'value' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Value = src.Value - } else { - var zero PingSlotPeriod - dst.Value = zero - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - -var MACSettings_AggregatedDutyCycleValueFieldPathsNested = []string{ - "value", -} - -var MACSettings_AggregatedDutyCycleValueFieldPathsTopLevel = []string{ - "value", -} - -func (dst *MACSettings_AggregatedDutyCycleValue) SetFields(src *MACSettings_AggregatedDutyCycleValue, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "value": - if len(subs) > 0 { - return fmt.Errorf("'value' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Value = src.Value - } else { - var zero AggregatedDutyCycle - dst.Value = zero - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - -var MACSettings_RxDelayValueFieldPathsNested = []string{ - "value", -} - -var MACSettings_RxDelayValueFieldPathsTopLevel = []string{ - "value", -} - -func (dst *MACSettings_RxDelayValue) SetFields(src *MACSettings_RxDelayValue, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "value": - if len(subs) > 0 { - return fmt.Errorf("'value' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Value = src.Value - } else { - var zero RxDelay - dst.Value = zero - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - var MACStateFieldPathsNested = []string{ "current_parameters", "current_parameters.adr_ack_delay", @@ -1540,334 +447,6 @@ var MACStateFieldPathsTopLevel = []string{ "queued_responses", "rx_windows_available", } - -func (dst *MACState) SetFields(src *MACState, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "current_parameters": - if len(subs) > 0 { - newDst := &dst.CurrentParameters - var newSrc *MACParameters - if src != nil { - newSrc = &src.CurrentParameters - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.CurrentParameters = src.CurrentParameters - } else { - var zero MACParameters - dst.CurrentParameters = zero - } - } - case "desired_parameters": - if len(subs) > 0 { - newDst := &dst.DesiredParameters - var newSrc *MACParameters - if src != nil { - newSrc = &src.DesiredParameters - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.DesiredParameters = src.DesiredParameters - } else { - var zero MACParameters - dst.DesiredParameters = zero - } - } - case "device_class": - if len(subs) > 0 { - return fmt.Errorf("'device_class' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.DeviceClass = src.DeviceClass - } else { - var zero Class - dst.DeviceClass = zero - } - case "lorawan_version": - if len(subs) > 0 { - return fmt.Errorf("'lorawan_version' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.LoRaWANVersion = src.LoRaWANVersion - } else { - var zero MACVersion - dst.LoRaWANVersion = zero - } - case "last_confirmed_downlink_at": - if len(subs) > 0 { - return fmt.Errorf("'last_confirmed_downlink_at' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.LastConfirmedDownlinkAt = src.LastConfirmedDownlinkAt - } else { - dst.LastConfirmedDownlinkAt = nil - } - case "last_dev_status_f_cnt_up": - if len(subs) > 0 { - return fmt.Errorf("'last_dev_status_f_cnt_up' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.LastDevStatusFCntUp = src.LastDevStatusFCntUp - } else { - var zero uint32 - dst.LastDevStatusFCntUp = zero - } - case "ping_slot_periodicity": - if len(subs) > 0 { - return fmt.Errorf("'ping_slot_periodicity' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.PingSlotPeriodicity = src.PingSlotPeriodicity - } else { - var zero PingSlotPeriod - dst.PingSlotPeriodicity = zero - } - case "pending_application_downlink": - if len(subs) > 0 { - newDst := dst.PendingApplicationDownlink - if newDst == nil { - newDst = &ApplicationDownlink{} - dst.PendingApplicationDownlink = newDst - } - var newSrc *ApplicationDownlink - if src != nil { - newSrc = src.PendingApplicationDownlink - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.PendingApplicationDownlink = src.PendingApplicationDownlink - } else { - dst.PendingApplicationDownlink = nil - } - } - case "queued_responses": - if len(subs) > 0 { - return fmt.Errorf("'queued_responses' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.QueuedResponses = src.QueuedResponses - } else { - dst.QueuedResponses = nil - } - case "pending_requests": - if len(subs) > 0 { - return fmt.Errorf("'pending_requests' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.PendingRequests = src.PendingRequests - } else { - dst.PendingRequests = nil - } - case "queued_join_accept": - if len(subs) > 0 { - newDst := dst.QueuedJoinAccept - if newDst == nil { - newDst = &MACState_JoinAccept{} - dst.QueuedJoinAccept = newDst - } - var newSrc *MACState_JoinAccept - if src != nil { - newSrc = src.QueuedJoinAccept - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.QueuedJoinAccept = src.QueuedJoinAccept - } else { - dst.QueuedJoinAccept = nil - } - } - case "pending_join_request": - if len(subs) > 0 { - newDst := dst.PendingJoinRequest - if newDst == nil { - newDst = &JoinRequest{} - dst.PendingJoinRequest = newDst - } - var newSrc *JoinRequest - if src != nil { - newSrc = src.PendingJoinRequest - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.PendingJoinRequest = src.PendingJoinRequest - } else { - dst.PendingJoinRequest = nil - } - } - case "rx_windows_available": - if len(subs) > 0 { - return fmt.Errorf("'rx_windows_available' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.RxWindowsAvailable = src.RxWindowsAvailable - } else { - var zero bool - dst.RxWindowsAvailable = zero - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - -var MACState_JoinAcceptFieldPathsNested = []string{ - "keys", - "keys.app_s_key", - "keys.app_s_key.kek_label", - "keys.app_s_key.key", - "keys.f_nwk_s_int_key", - "keys.f_nwk_s_int_key.kek_label", - "keys.f_nwk_s_int_key.key", - "keys.nwk_s_enc_key", - "keys.nwk_s_enc_key.kek_label", - "keys.nwk_s_enc_key.key", - "keys.s_nwk_s_int_key", - "keys.s_nwk_s_int_key.kek_label", - "keys.s_nwk_s_int_key.key", - "keys.session_key_id", - "payload", - "request", - "request.cf_list", - "request.cf_list.ch_masks", - "request.cf_list.freq", - "request.cf_list.type", - "request.correlation_ids", - "request.dev_addr", - "request.downlink_settings", - "request.downlink_settings.opt_neg", - "request.downlink_settings.rx1_dr_offset", - "request.downlink_settings.rx2_dr", - "request.net_id", - "request.payload", - "request.payload.Payload", - "request.payload.Payload.join_accept_payload", - "request.payload.Payload.join_accept_payload.cf_list", - "request.payload.Payload.join_accept_payload.cf_list.ch_masks", - "request.payload.Payload.join_accept_payload.cf_list.freq", - "request.payload.Payload.join_accept_payload.cf_list.type", - "request.payload.Payload.join_accept_payload.dev_addr", - "request.payload.Payload.join_accept_payload.dl_settings", - "request.payload.Payload.join_accept_payload.dl_settings.opt_neg", - "request.payload.Payload.join_accept_payload.dl_settings.rx1_dr_offset", - "request.payload.Payload.join_accept_payload.dl_settings.rx2_dr", - "request.payload.Payload.join_accept_payload.encrypted", - "request.payload.Payload.join_accept_payload.join_nonce", - "request.payload.Payload.join_accept_payload.net_id", - "request.payload.Payload.join_accept_payload.rx_delay", - "request.payload.Payload.join_request_payload", - "request.payload.Payload.join_request_payload.dev_eui", - "request.payload.Payload.join_request_payload.dev_nonce", - "request.payload.Payload.join_request_payload.join_eui", - "request.payload.Payload.mac_payload", - "request.payload.Payload.mac_payload.decoded_payload", - "request.payload.Payload.mac_payload.f_hdr", - "request.payload.Payload.mac_payload.f_hdr.dev_addr", - "request.payload.Payload.mac_payload.f_hdr.f_cnt", - "request.payload.Payload.mac_payload.f_hdr.f_ctrl", - "request.payload.Payload.mac_payload.f_hdr.f_ctrl.ack", - "request.payload.Payload.mac_payload.f_hdr.f_ctrl.adr", - "request.payload.Payload.mac_payload.f_hdr.f_ctrl.adr_ack_req", - "request.payload.Payload.mac_payload.f_hdr.f_ctrl.class_b", - "request.payload.Payload.mac_payload.f_hdr.f_ctrl.f_pending", - "request.payload.Payload.mac_payload.f_hdr.f_opts", - "request.payload.Payload.mac_payload.f_port", - "request.payload.Payload.mac_payload.frm_payload", - "request.payload.Payload.rejoin_request_payload", - "request.payload.Payload.rejoin_request_payload.dev_eui", - "request.payload.Payload.rejoin_request_payload.join_eui", - "request.payload.Payload.rejoin_request_payload.net_id", - "request.payload.Payload.rejoin_request_payload.rejoin_cnt", - "request.payload.Payload.rejoin_request_payload.rejoin_type", - "request.payload.m_hdr", - "request.payload.m_hdr.m_type", - "request.payload.m_hdr.major", - "request.payload.mic", - "request.raw_payload", - "request.rx_delay", - "request.selected_mac_version", -} - -var MACState_JoinAcceptFieldPathsTopLevel = []string{ - "keys", - "payload", - "request", -} - -func (dst *MACState_JoinAccept) SetFields(src *MACState_JoinAccept, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "payload": - if len(subs) > 0 { - return fmt.Errorf("'payload' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Payload = src.Payload - } else { - var zero []byte - dst.Payload = zero - } - case "request": - if len(subs) > 0 { - newDst := &dst.Request - var newSrc *JoinRequest - if src != nil { - newSrc = &src.Request - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.Request = src.Request - } else { - var zero JoinRequest - dst.Request = zero - } - } - case "keys": - if len(subs) > 0 { - newDst := &dst.Keys - var newSrc *SessionKeys - if src != nil { - newSrc = &src.Keys - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.Keys = src.Keys - } else { - var zero SessionKeys - dst.Keys = zero - } - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - var EndDeviceFieldPathsNested = []string{ "application_server_address", "attributes", @@ -2242,523 +821,6 @@ var EndDeviceFieldPathsTopLevel = []string{ "used_dev_nonces", "version_ids", } - -func (dst *EndDevice) SetFields(src *EndDevice, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "ids": - if len(subs) > 0 { - newDst := &dst.EndDeviceIdentifiers - var newSrc *EndDeviceIdentifiers - if src != nil { - newSrc = &src.EndDeviceIdentifiers - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.EndDeviceIdentifiers = src.EndDeviceIdentifiers - } else { - var zero EndDeviceIdentifiers - dst.EndDeviceIdentifiers = zero - } - } - case "created_at": - if len(subs) > 0 { - return fmt.Errorf("'created_at' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.CreatedAt = src.CreatedAt - } else { - var zero time.Time - dst.CreatedAt = zero - } - case "updated_at": - if len(subs) > 0 { - return fmt.Errorf("'updated_at' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.UpdatedAt = src.UpdatedAt - } else { - var zero time.Time - dst.UpdatedAt = zero - } - case "name": - if len(subs) > 0 { - return fmt.Errorf("'name' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Name = src.Name - } else { - var zero string - dst.Name = zero - } - case "description": - if len(subs) > 0 { - return fmt.Errorf("'description' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Description = src.Description - } else { - var zero string - dst.Description = zero - } - case "attributes": - if len(subs) > 0 { - return fmt.Errorf("'attributes' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Attributes = src.Attributes - } else { - dst.Attributes = nil - } - case "version_ids": - if len(subs) > 0 { - newDst := dst.VersionIDs - if newDst == nil { - newDst = &EndDeviceVersionIdentifiers{} - dst.VersionIDs = newDst - } - var newSrc *EndDeviceVersionIdentifiers - if src != nil { - newSrc = src.VersionIDs - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.VersionIDs = src.VersionIDs - } else { - dst.VersionIDs = nil - } - } - case "service_profile_id": - if len(subs) > 0 { - return fmt.Errorf("'service_profile_id' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.ServiceProfileID = src.ServiceProfileID - } else { - var zero string - dst.ServiceProfileID = zero - } - case "network_server_address": - if len(subs) > 0 { - return fmt.Errorf("'network_server_address' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.NetworkServerAddress = src.NetworkServerAddress - } else { - var zero string - dst.NetworkServerAddress = zero - } - case "application_server_address": - if len(subs) > 0 { - return fmt.Errorf("'application_server_address' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.ApplicationServerAddress = src.ApplicationServerAddress - } else { - var zero string - dst.ApplicationServerAddress = zero - } - case "join_server_address": - if len(subs) > 0 { - return fmt.Errorf("'join_server_address' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.JoinServerAddress = src.JoinServerAddress - } else { - var zero string - dst.JoinServerAddress = zero - } - case "locations": - if len(subs) > 0 { - return fmt.Errorf("'locations' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Locations = src.Locations - } else { - dst.Locations = nil - } - case "supports_class_b": - if len(subs) > 0 { - return fmt.Errorf("'supports_class_b' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.SupportsClassB = src.SupportsClassB - } else { - var zero bool - dst.SupportsClassB = zero - } - case "supports_class_c": - if len(subs) > 0 { - return fmt.Errorf("'supports_class_c' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.SupportsClassC = src.SupportsClassC - } else { - var zero bool - dst.SupportsClassC = zero - } - case "lorawan_version": - if len(subs) > 0 { - return fmt.Errorf("'lorawan_version' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.LoRaWANVersion = src.LoRaWANVersion - } else { - var zero MACVersion - dst.LoRaWANVersion = zero - } - case "lorawan_phy_version": - if len(subs) > 0 { - return fmt.Errorf("'lorawan_phy_version' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.LoRaWANPHYVersion = src.LoRaWANPHYVersion - } else { - var zero PHYVersion - dst.LoRaWANPHYVersion = zero - } - case "frequency_plan_id": - if len(subs) > 0 { - return fmt.Errorf("'frequency_plan_id' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.FrequencyPlanID = src.FrequencyPlanID - } else { - var zero string - dst.FrequencyPlanID = zero - } - case "min_frequency": - if len(subs) > 0 { - return fmt.Errorf("'min_frequency' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.MinFrequency = src.MinFrequency - } else { - var zero uint64 - dst.MinFrequency = zero - } - case "max_frequency": - if len(subs) > 0 { - return fmt.Errorf("'max_frequency' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.MaxFrequency = src.MaxFrequency - } else { - var zero uint64 - dst.MaxFrequency = zero - } - case "supports_join": - if len(subs) > 0 { - return fmt.Errorf("'supports_join' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.SupportsJoin = src.SupportsJoin - } else { - var zero bool - dst.SupportsJoin = zero - } - case "resets_join_nonces": - if len(subs) > 0 { - return fmt.Errorf("'resets_join_nonces' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.ResetsJoinNonces = src.ResetsJoinNonces - } else { - var zero bool - dst.ResetsJoinNonces = zero - } - case "root_keys": - if len(subs) > 0 { - newDst := dst.RootKeys - if newDst == nil { - newDst = &RootKeys{} - dst.RootKeys = newDst - } - var newSrc *RootKeys - if src != nil { - newSrc = src.RootKeys - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.RootKeys = src.RootKeys - } else { - dst.RootKeys = nil - } - } - case "net_id": - if len(subs) > 0 { - return fmt.Errorf("'net_id' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.NetID = src.NetID - } else { - dst.NetID = nil - } - case "mac_settings": - if len(subs) > 0 { - newDst := dst.MACSettings - if newDst == nil { - newDst = &MACSettings{} - dst.MACSettings = newDst - } - var newSrc *MACSettings - if src != nil { - newSrc = src.MACSettings - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.MACSettings = src.MACSettings - } else { - dst.MACSettings = nil - } - } - case "mac_state": - if len(subs) > 0 { - newDst := dst.MACState - if newDst == nil { - newDst = &MACState{} - dst.MACState = newDst - } - var newSrc *MACState - if src != nil { - newSrc = src.MACState - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.MACState = src.MACState - } else { - dst.MACState = nil - } - } - case "session": - if len(subs) > 0 { - newDst := dst.Session - if newDst == nil { - newDst = &Session{} - dst.Session = newDst - } - var newSrc *Session - if src != nil { - newSrc = src.Session - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.Session = src.Session - } else { - dst.Session = nil - } - } - case "pending_session": - if len(subs) > 0 { - newDst := dst.PendingSession - if newDst == nil { - newDst = &Session{} - dst.PendingSession = newDst - } - var newSrc *Session - if src != nil { - newSrc = src.PendingSession - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.PendingSession = src.PendingSession - } else { - dst.PendingSession = nil - } - } - case "last_dev_nonce": - if len(subs) > 0 { - return fmt.Errorf("'last_dev_nonce' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.LastDevNonce = src.LastDevNonce - } else { - var zero uint32 - dst.LastDevNonce = zero - } - case "used_dev_nonces": - if len(subs) > 0 { - return fmt.Errorf("'used_dev_nonces' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.UsedDevNonces = src.UsedDevNonces - } else { - dst.UsedDevNonces = nil - } - case "last_join_nonce": - if len(subs) > 0 { - return fmt.Errorf("'last_join_nonce' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.LastJoinNonce = src.LastJoinNonce - } else { - var zero uint32 - dst.LastJoinNonce = zero - } - case "last_rj_count_0": - if len(subs) > 0 { - return fmt.Errorf("'last_rj_count_0' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.LastRJCount0 = src.LastRJCount0 - } else { - var zero uint32 - dst.LastRJCount0 = zero - } - case "last_rj_count_1": - if len(subs) > 0 { - return fmt.Errorf("'last_rj_count_1' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.LastRJCount1 = src.LastRJCount1 - } else { - var zero uint32 - dst.LastRJCount1 = zero - } - case "last_dev_status_received_at": - if len(subs) > 0 { - return fmt.Errorf("'last_dev_status_received_at' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.LastDevStatusReceivedAt = src.LastDevStatusReceivedAt - } else { - dst.LastDevStatusReceivedAt = nil - } - case "power_state": - if len(subs) > 0 { - return fmt.Errorf("'power_state' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.PowerState = src.PowerState - } else { - var zero PowerState - dst.PowerState = zero - } - case "battery_percentage": - if len(subs) > 0 { - return fmt.Errorf("'battery_percentage' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.BatteryPercentage = src.BatteryPercentage - } else { - var zero float32 - dst.BatteryPercentage = zero - } - case "downlink_margin": - if len(subs) > 0 { - return fmt.Errorf("'downlink_margin' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.DownlinkMargin = src.DownlinkMargin - } else { - var zero int32 - dst.DownlinkMargin = zero - } - case "recent_adr_uplinks": - if len(subs) > 0 { - return fmt.Errorf("'recent_adr_uplinks' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.RecentADRUplinks = src.RecentADRUplinks - } else { - dst.RecentADRUplinks = nil - } - case "recent_uplinks": - if len(subs) > 0 { - return fmt.Errorf("'recent_uplinks' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.RecentUplinks = src.RecentUplinks - } else { - dst.RecentUplinks = nil - } - case "recent_downlinks": - if len(subs) > 0 { - return fmt.Errorf("'recent_downlinks' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.RecentDownlinks = src.RecentDownlinks - } else { - dst.RecentDownlinks = nil - } - case "queued_application_downlinks": - if len(subs) > 0 { - return fmt.Errorf("'queued_application_downlinks' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.QueuedApplicationDownlinks = src.QueuedApplicationDownlinks - } else { - dst.QueuedApplicationDownlinks = nil - } - case "formatters": - if len(subs) > 0 { - newDst := dst.Formatters - if newDst == nil { - newDst = &MessagePayloadFormatters{} - dst.Formatters = newDst - } - var newSrc *MessagePayloadFormatters - if src != nil { - newSrc = src.Formatters - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.Formatters = src.Formatters - } else { - dst.Formatters = nil - } - } - case "provisioner_id": - if len(subs) > 0 { - return fmt.Errorf("'provisioner_id' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.ProvisionerID = src.ProvisionerID - } else { - var zero string - dst.ProvisionerID = zero - } - case "provisioning_data": - if len(subs) > 0 { - return fmt.Errorf("'provisioning_data' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.ProvisioningData = src.ProvisioningData - } else { - dst.ProvisioningData = nil - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - var EndDevicesFieldPathsNested = []string{ "end_devices", } @@ -2766,27 +828,6 @@ var EndDevicesFieldPathsNested = []string{ var EndDevicesFieldPathsTopLevel = []string{ "end_devices", } - -func (dst *EndDevices) SetFields(src *EndDevices, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "end_devices": - if len(subs) > 0 { - return fmt.Errorf("'end_devices' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.EndDevices = src.EndDevices - } else { - dst.EndDevices = nil - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - var CreateEndDeviceRequestFieldPathsNested = []string{ "end_device", "end_device.application_server_address", @@ -3120,36 +1161,6 @@ var CreateEndDeviceRequestFieldPathsNested = []string{ var CreateEndDeviceRequestFieldPathsTopLevel = []string{ "end_device", } - -func (dst *CreateEndDeviceRequest) SetFields(src *CreateEndDeviceRequest, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "end_device": - if len(subs) > 0 { - newDst := &dst.EndDevice - var newSrc *EndDevice - if src != nil { - newSrc = &src.EndDevice - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.EndDevice = src.EndDevice - } else { - var zero EndDevice - dst.EndDevice = zero - } - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - var UpdateEndDeviceRequestFieldPathsNested = []string{ "end_device", "end_device.application_server_address", @@ -3485,46 +1496,6 @@ var UpdateEndDeviceRequestFieldPathsTopLevel = []string{ "end_device", "field_mask", } - -func (dst *UpdateEndDeviceRequest) SetFields(src *UpdateEndDeviceRequest, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "end_device": - if len(subs) > 0 { - newDst := &dst.EndDevice - var newSrc *EndDevice - if src != nil { - newSrc = &src.EndDevice - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.EndDevice = src.EndDevice - } else { - var zero EndDevice - dst.EndDevice = zero - } - } - case "field_mask": - if len(subs) > 0 { - return fmt.Errorf("'field_mask' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.FieldMask = src.FieldMask - } else { - var zero github_com_gogo_protobuf_types.FieldMask - dst.FieldMask = zero - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - var GetEndDeviceRequestFieldPathsNested = []string{ "end_device_ids", "end_device_ids.application_ids", @@ -3540,46 +1511,6 @@ var GetEndDeviceRequestFieldPathsTopLevel = []string{ "end_device_ids", "field_mask", } - -func (dst *GetEndDeviceRequest) SetFields(src *GetEndDeviceRequest, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "end_device_ids": - if len(subs) > 0 { - newDst := &dst.EndDeviceIdentifiers - var newSrc *EndDeviceIdentifiers - if src != nil { - newSrc = &src.EndDeviceIdentifiers - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.EndDeviceIdentifiers = src.EndDeviceIdentifiers - } else { - var zero EndDeviceIdentifiers - dst.EndDeviceIdentifiers = zero - } - } - case "field_mask": - if len(subs) > 0 { - return fmt.Errorf("'field_mask' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.FieldMask = src.FieldMask - } else { - var zero github_com_gogo_protobuf_types.FieldMask - dst.FieldMask = zero - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - var ListEndDevicesRequestFieldPathsNested = []string{ "application_ids", "application_ids.application_id", @@ -3596,76 +1527,6 @@ var ListEndDevicesRequestFieldPathsTopLevel = []string{ "order", "page", } - -func (dst *ListEndDevicesRequest) SetFields(src *ListEndDevicesRequest, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "application_ids": - if len(subs) > 0 { - newDst := &dst.ApplicationIdentifiers - var newSrc *ApplicationIdentifiers - if src != nil { - newSrc = &src.ApplicationIdentifiers - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.ApplicationIdentifiers = src.ApplicationIdentifiers - } else { - var zero ApplicationIdentifiers - dst.ApplicationIdentifiers = zero - } - } - case "field_mask": - if len(subs) > 0 { - return fmt.Errorf("'field_mask' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.FieldMask = src.FieldMask - } else { - var zero github_com_gogo_protobuf_types.FieldMask - dst.FieldMask = zero - } - case "order": - if len(subs) > 0 { - return fmt.Errorf("'order' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Order = src.Order - } else { - var zero string - dst.Order = zero - } - case "limit": - if len(subs) > 0 { - return fmt.Errorf("'limit' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Limit = src.Limit - } else { - var zero uint32 - dst.Limit = zero - } - case "page": - if len(subs) > 0 { - return fmt.Errorf("'page' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Page = src.Page - } else { - var zero uint32 - dst.Page = zero - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - var SetEndDeviceRequestFieldPathsNested = []string{ "end_device", "end_device.application_server_address", @@ -4001,42 +1862,128 @@ var SetEndDeviceRequestFieldPathsTopLevel = []string{ "end_device", "field_mask", } +var MACParameters_ChannelFieldPathsNested = []string{ + "downlink_frequency", + "enable_uplink", + "max_data_rate_index", + "min_data_rate_index", + "uplink_frequency", +} -func (dst *SetEndDeviceRequest) SetFields(src *SetEndDeviceRequest, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "end_device": - if len(subs) > 0 { - newDst := &dst.EndDevice - var newSrc *EndDevice - if src != nil { - newSrc = &src.EndDevice - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.EndDevice = src.EndDevice - } else { - var zero EndDevice - dst.EndDevice = zero - } - } - case "field_mask": - if len(subs) > 0 { - return fmt.Errorf("'field_mask' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.FieldMask = src.FieldMask - } else { - var zero github_com_gogo_protobuf_types.FieldMask - dst.FieldMask = zero - } +var MACParameters_ChannelFieldPathsTopLevel = []string{ + "downlink_frequency", + "enable_uplink", + "max_data_rate_index", + "min_data_rate_index", + "uplink_frequency", +} +var MACSettings_DataRateIndexValueFieldPathsNested = []string{ + "value", +} + +var MACSettings_DataRateIndexValueFieldPathsTopLevel = []string{ + "value", +} +var MACSettings_PingSlotPeriodValueFieldPathsNested = []string{ + "value", +} + +var MACSettings_PingSlotPeriodValueFieldPathsTopLevel = []string{ + "value", +} +var MACSettings_AggregatedDutyCycleValueFieldPathsNested = []string{ + "value", +} + +var MACSettings_AggregatedDutyCycleValueFieldPathsTopLevel = []string{ + "value", +} +var MACSettings_RxDelayValueFieldPathsNested = []string{ + "value", +} + +var MACSettings_RxDelayValueFieldPathsTopLevel = []string{ + "value", +} +var MACState_JoinAcceptFieldPathsNested = []string{ + "keys", + "keys.app_s_key", + "keys.app_s_key.kek_label", + "keys.app_s_key.key", + "keys.f_nwk_s_int_key", + "keys.f_nwk_s_int_key.kek_label", + "keys.f_nwk_s_int_key.key", + "keys.nwk_s_enc_key", + "keys.nwk_s_enc_key.kek_label", + "keys.nwk_s_enc_key.key", + "keys.s_nwk_s_int_key", + "keys.s_nwk_s_int_key.kek_label", + "keys.s_nwk_s_int_key.key", + "keys.session_key_id", + "payload", + "request", + "request.cf_list", + "request.cf_list.ch_masks", + "request.cf_list.freq", + "request.cf_list.type", + "request.correlation_ids", + "request.dev_addr", + "request.downlink_settings", + "request.downlink_settings.opt_neg", + "request.downlink_settings.rx1_dr_offset", + "request.downlink_settings.rx2_dr", + "request.net_id", + "request.payload", + "request.payload.Payload", + "request.payload.Payload.join_accept_payload", + "request.payload.Payload.join_accept_payload.cf_list", + "request.payload.Payload.join_accept_payload.cf_list.ch_masks", + "request.payload.Payload.join_accept_payload.cf_list.freq", + "request.payload.Payload.join_accept_payload.cf_list.type", + "request.payload.Payload.join_accept_payload.dev_addr", + "request.payload.Payload.join_accept_payload.dl_settings", + "request.payload.Payload.join_accept_payload.dl_settings.opt_neg", + "request.payload.Payload.join_accept_payload.dl_settings.rx1_dr_offset", + "request.payload.Payload.join_accept_payload.dl_settings.rx2_dr", + "request.payload.Payload.join_accept_payload.encrypted", + "request.payload.Payload.join_accept_payload.join_nonce", + "request.payload.Payload.join_accept_payload.net_id", + "request.payload.Payload.join_accept_payload.rx_delay", + "request.payload.Payload.join_request_payload", + "request.payload.Payload.join_request_payload.dev_eui", + "request.payload.Payload.join_request_payload.dev_nonce", + "request.payload.Payload.join_request_payload.join_eui", + "request.payload.Payload.mac_payload", + "request.payload.Payload.mac_payload.decoded_payload", + "request.payload.Payload.mac_payload.f_hdr", + "request.payload.Payload.mac_payload.f_hdr.dev_addr", + "request.payload.Payload.mac_payload.f_hdr.f_cnt", + "request.payload.Payload.mac_payload.f_hdr.f_ctrl", + "request.payload.Payload.mac_payload.f_hdr.f_ctrl.ack", + "request.payload.Payload.mac_payload.f_hdr.f_ctrl.adr", + "request.payload.Payload.mac_payload.f_hdr.f_ctrl.adr_ack_req", + "request.payload.Payload.mac_payload.f_hdr.f_ctrl.class_b", + "request.payload.Payload.mac_payload.f_hdr.f_ctrl.f_pending", + "request.payload.Payload.mac_payload.f_hdr.f_opts", + "request.payload.Payload.mac_payload.f_port", + "request.payload.Payload.mac_payload.frm_payload", + "request.payload.Payload.rejoin_request_payload", + "request.payload.Payload.rejoin_request_payload.dev_eui", + "request.payload.Payload.rejoin_request_payload.join_eui", + "request.payload.Payload.rejoin_request_payload.net_id", + "request.payload.Payload.rejoin_request_payload.rejoin_cnt", + "request.payload.Payload.rejoin_request_payload.rejoin_type", + "request.payload.m_hdr", + "request.payload.m_hdr.m_type", + "request.payload.m_hdr.major", + "request.payload.mic", + "request.raw_payload", + "request.rx_delay", + "request.selected_mac_version", +} - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil +var MACState_JoinAcceptFieldPathsTopLevel = []string{ + "keys", + "payload", + "request", } diff --git a/pkg/ttnpb/end_device.pb.setters.fm.go b/pkg/ttnpb/end_device.pb.setters.fm.go new file mode 100644 index 0000000000..1b07ee66ac --- /dev/null +++ b/pkg/ttnpb/end_device.pb.setters.fm.go @@ -0,0 +1,2031 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + fmt "fmt" + time "time" + + types "github.com/gogo/protobuf/types" + go_thethings_network_lorawan_stack_pkg_types "go.thethings.network/lorawan-stack/pkg/types" +) + +func (dst *Session) SetFields(src *Session, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "dev_addr": + if len(subs) > 0 { + return fmt.Errorf("'dev_addr' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.DevAddr = src.DevAddr + } else { + var zero go_thethings_network_lorawan_stack_pkg_types.DevAddr + dst.DevAddr = zero + } + case "keys": + if len(subs) > 0 { + newDst := &dst.SessionKeys + var newSrc *SessionKeys + if src != nil { + newSrc = &src.SessionKeys + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.SessionKeys = src.SessionKeys + } else { + var zero SessionKeys + dst.SessionKeys = zero + } + } + case "last_f_cnt_up": + if len(subs) > 0 { + return fmt.Errorf("'last_f_cnt_up' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.LastFCntUp = src.LastFCntUp + } else { + var zero uint32 + dst.LastFCntUp = zero + } + case "last_n_f_cnt_down": + if len(subs) > 0 { + return fmt.Errorf("'last_n_f_cnt_down' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.LastNFCntDown = src.LastNFCntDown + } else { + var zero uint32 + dst.LastNFCntDown = zero + } + case "last_a_f_cnt_down": + if len(subs) > 0 { + return fmt.Errorf("'last_a_f_cnt_down' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.LastAFCntDown = src.LastAFCntDown + } else { + var zero uint32 + dst.LastAFCntDown = zero + } + case "last_conf_f_cnt_down": + if len(subs) > 0 { + return fmt.Errorf("'last_conf_f_cnt_down' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.LastConfFCntDown = src.LastConfFCntDown + } else { + var zero uint32 + dst.LastConfFCntDown = zero + } + case "started_at": + if len(subs) > 0 { + return fmt.Errorf("'started_at' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.StartedAt = src.StartedAt + } else { + var zero time.Time + dst.StartedAt = zero + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *MACParameters) SetFields(src *MACParameters, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "max_eirp": + if len(subs) > 0 { + return fmt.Errorf("'max_eirp' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.MaxEIRP = src.MaxEIRP + } else { + var zero float32 + dst.MaxEIRP = zero + } + case "uplink_dwell_time": + if len(subs) > 0 { + return fmt.Errorf("'uplink_dwell_time' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.UplinkDwellTime = src.UplinkDwellTime + } else { + var zero bool + dst.UplinkDwellTime = zero + } + case "downlink_dwell_time": + if len(subs) > 0 { + return fmt.Errorf("'downlink_dwell_time' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.DownlinkDwellTime = src.DownlinkDwellTime + } else { + var zero bool + dst.DownlinkDwellTime = zero + } + case "adr_data_rate_index": + if len(subs) > 0 { + return fmt.Errorf("'adr_data_rate_index' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.ADRDataRateIndex = src.ADRDataRateIndex + } else { + var zero DataRateIndex + dst.ADRDataRateIndex = zero + } + case "adr_tx_power_index": + if len(subs) > 0 { + return fmt.Errorf("'adr_tx_power_index' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.ADRTxPowerIndex = src.ADRTxPowerIndex + } else { + var zero uint32 + dst.ADRTxPowerIndex = zero + } + case "adr_nb_trans": + if len(subs) > 0 { + return fmt.Errorf("'adr_nb_trans' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.ADRNbTrans = src.ADRNbTrans + } else { + var zero uint32 + dst.ADRNbTrans = zero + } + case "adr_ack_limit": + if len(subs) > 0 { + return fmt.Errorf("'adr_ack_limit' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.ADRAckLimit = src.ADRAckLimit + } else { + var zero uint32 + dst.ADRAckLimit = zero + } + case "adr_ack_delay": + if len(subs) > 0 { + return fmt.Errorf("'adr_ack_delay' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.ADRAckDelay = src.ADRAckDelay + } else { + var zero uint32 + dst.ADRAckDelay = zero + } + case "rx1_delay": + if len(subs) > 0 { + return fmt.Errorf("'rx1_delay' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Rx1Delay = src.Rx1Delay + } else { + var zero RxDelay + dst.Rx1Delay = zero + } + case "rx1_data_rate_offset": + if len(subs) > 0 { + return fmt.Errorf("'rx1_data_rate_offset' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Rx1DataRateOffset = src.Rx1DataRateOffset + } else { + var zero uint32 + dst.Rx1DataRateOffset = zero + } + case "rx2_data_rate_index": + if len(subs) > 0 { + return fmt.Errorf("'rx2_data_rate_index' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Rx2DataRateIndex = src.Rx2DataRateIndex + } else { + var zero DataRateIndex + dst.Rx2DataRateIndex = zero + } + case "rx2_frequency": + if len(subs) > 0 { + return fmt.Errorf("'rx2_frequency' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Rx2Frequency = src.Rx2Frequency + } else { + var zero uint64 + dst.Rx2Frequency = zero + } + case "max_duty_cycle": + if len(subs) > 0 { + return fmt.Errorf("'max_duty_cycle' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.MaxDutyCycle = src.MaxDutyCycle + } else { + var zero AggregatedDutyCycle + dst.MaxDutyCycle = zero + } + case "rejoin_time_periodicity": + if len(subs) > 0 { + return fmt.Errorf("'rejoin_time_periodicity' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.RejoinTimePeriodicity = src.RejoinTimePeriodicity + } else { + var zero RejoinTimeExponent + dst.RejoinTimePeriodicity = zero + } + case "rejoin_count_periodicity": + if len(subs) > 0 { + return fmt.Errorf("'rejoin_count_periodicity' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.RejoinCountPeriodicity = src.RejoinCountPeriodicity + } else { + var zero RejoinCountExponent + dst.RejoinCountPeriodicity = zero + } + case "ping_slot_frequency": + if len(subs) > 0 { + return fmt.Errorf("'ping_slot_frequency' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.PingSlotFrequency = src.PingSlotFrequency + } else { + var zero uint64 + dst.PingSlotFrequency = zero + } + case "ping_slot_data_rate_index": + if len(subs) > 0 { + return fmt.Errorf("'ping_slot_data_rate_index' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.PingSlotDataRateIndex = src.PingSlotDataRateIndex + } else { + var zero DataRateIndex + dst.PingSlotDataRateIndex = zero + } + case "beacon_frequency": + if len(subs) > 0 { + return fmt.Errorf("'beacon_frequency' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.BeaconFrequency = src.BeaconFrequency + } else { + var zero uint64 + dst.BeaconFrequency = zero + } + case "channels": + if len(subs) > 0 { + return fmt.Errorf("'channels' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Channels = src.Channels + } else { + dst.Channels = nil + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *EndDeviceBrand) SetFields(src *EndDeviceBrand, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "id": + if len(subs) > 0 { + return fmt.Errorf("'id' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.ID = src.ID + } else { + var zero string + dst.ID = zero + } + case "name": + if len(subs) > 0 { + return fmt.Errorf("'name' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Name = src.Name + } else { + var zero string + dst.Name = zero + } + case "url": + if len(subs) > 0 { + return fmt.Errorf("'url' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.URL = src.URL + } else { + var zero string + dst.URL = zero + } + case "logos": + if len(subs) > 0 { + return fmt.Errorf("'logos' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Logos = src.Logos + } else { + dst.Logos = nil + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *EndDeviceModel) SetFields(src *EndDeviceModel, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "brand_id": + if len(subs) > 0 { + return fmt.Errorf("'brand_id' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.BrandID = src.BrandID + } else { + var zero string + dst.BrandID = zero + } + case "id": + if len(subs) > 0 { + return fmt.Errorf("'id' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.ID = src.ID + } else { + var zero string + dst.ID = zero + } + case "name": + if len(subs) > 0 { + return fmt.Errorf("'name' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Name = src.Name + } else { + var zero string + dst.Name = zero + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *EndDeviceVersionIdentifiers) SetFields(src *EndDeviceVersionIdentifiers, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "brand_id": + if len(subs) > 0 { + return fmt.Errorf("'brand_id' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.BrandID = src.BrandID + } else { + var zero string + dst.BrandID = zero + } + case "model_id": + if len(subs) > 0 { + return fmt.Errorf("'model_id' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.ModelID = src.ModelID + } else { + var zero string + dst.ModelID = zero + } + case "hardware_version": + if len(subs) > 0 { + return fmt.Errorf("'hardware_version' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.HardwareVersion = src.HardwareVersion + } else { + var zero string + dst.HardwareVersion = zero + } + case "firmware_version": + if len(subs) > 0 { + return fmt.Errorf("'firmware_version' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.FirmwareVersion = src.FirmwareVersion + } else { + var zero string + dst.FirmwareVersion = zero + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *EndDeviceVersion) SetFields(src *EndDeviceVersion, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "ids": + if len(subs) > 0 { + newDst := &dst.EndDeviceVersionIdentifiers + var newSrc *EndDeviceVersionIdentifiers + if src != nil { + newSrc = &src.EndDeviceVersionIdentifiers + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.EndDeviceVersionIdentifiers = src.EndDeviceVersionIdentifiers + } else { + var zero EndDeviceVersionIdentifiers + dst.EndDeviceVersionIdentifiers = zero + } + } + case "lorawan_version": + if len(subs) > 0 { + return fmt.Errorf("'lorawan_version' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.LoRaWANVersion = src.LoRaWANVersion + } else { + var zero MACVersion + dst.LoRaWANVersion = zero + } + case "lorawan_phy_version": + if len(subs) > 0 { + return fmt.Errorf("'lorawan_phy_version' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.LoRaWANPHYVersion = src.LoRaWANPHYVersion + } else { + var zero PHYVersion + dst.LoRaWANPHYVersion = zero + } + case "frequency_plan_id": + if len(subs) > 0 { + return fmt.Errorf("'frequency_plan_id' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.FrequencyPlanID = src.FrequencyPlanID + } else { + var zero string + dst.FrequencyPlanID = zero + } + case "photos": + if len(subs) > 0 { + return fmt.Errorf("'photos' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Photos = src.Photos + } else { + dst.Photos = nil + } + case "supports_class_b": + if len(subs) > 0 { + return fmt.Errorf("'supports_class_b' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.SupportsClassB = src.SupportsClassB + } else { + var zero bool + dst.SupportsClassB = zero + } + case "supports_class_c": + if len(subs) > 0 { + return fmt.Errorf("'supports_class_c' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.SupportsClassC = src.SupportsClassC + } else { + var zero bool + dst.SupportsClassC = zero + } + case "default_mac_settings": + if len(subs) > 0 { + newDst := dst.DefaultMACSettings + if newDst == nil { + newDst = &MACSettings{} + dst.DefaultMACSettings = newDst + } + var newSrc *MACSettings + if src != nil { + newSrc = src.DefaultMACSettings + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.DefaultMACSettings = src.DefaultMACSettings + } else { + dst.DefaultMACSettings = nil + } + } + case "min_frequency": + if len(subs) > 0 { + return fmt.Errorf("'min_frequency' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.MinFrequency = src.MinFrequency + } else { + var zero uint64 + dst.MinFrequency = zero + } + case "max_frequency": + if len(subs) > 0 { + return fmt.Errorf("'max_frequency' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.MaxFrequency = src.MaxFrequency + } else { + var zero uint64 + dst.MaxFrequency = zero + } + case "supports_join": + if len(subs) > 0 { + return fmt.Errorf("'supports_join' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.SupportsJoin = src.SupportsJoin + } else { + var zero bool + dst.SupportsJoin = zero + } + case "resets_join_nonces": + if len(subs) > 0 { + return fmt.Errorf("'resets_join_nonces' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.ResetsJoinNonces = src.ResetsJoinNonces + } else { + var zero bool + dst.ResetsJoinNonces = zero + } + case "default_formatters": + if len(subs) > 0 { + newDst := &dst.DefaultFormatters + var newSrc *MessagePayloadFormatters + if src != nil { + newSrc = &src.DefaultFormatters + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.DefaultFormatters = src.DefaultFormatters + } else { + var zero MessagePayloadFormatters + dst.DefaultFormatters = zero + } + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *MACSettings) SetFields(src *MACSettings, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "class_b_timeout": + if len(subs) > 0 { + return fmt.Errorf("'class_b_timeout' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.ClassBTimeout = src.ClassBTimeout + } else { + dst.ClassBTimeout = nil + } + case "ping_slot_periodicity": + if len(subs) > 0 { + newDst := dst.PingSlotPeriodicity + if newDst == nil { + newDst = &MACSettings_PingSlotPeriodValue{} + dst.PingSlotPeriodicity = newDst + } + var newSrc *MACSettings_PingSlotPeriodValue + if src != nil { + newSrc = src.PingSlotPeriodicity + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.PingSlotPeriodicity = src.PingSlotPeriodicity + } else { + dst.PingSlotPeriodicity = nil + } + } + case "ping_slot_data_rate_index": + if len(subs) > 0 { + newDst := dst.PingSlotDataRateIndex + if newDst == nil { + newDst = &MACSettings_DataRateIndexValue{} + dst.PingSlotDataRateIndex = newDst + } + var newSrc *MACSettings_DataRateIndexValue + if src != nil { + newSrc = src.PingSlotDataRateIndex + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.PingSlotDataRateIndex = src.PingSlotDataRateIndex + } else { + dst.PingSlotDataRateIndex = nil + } + } + case "ping_slot_frequency": + if len(subs) > 0 { + return fmt.Errorf("'ping_slot_frequency' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.PingSlotFrequency = src.PingSlotFrequency + } else { + dst.PingSlotFrequency = nil + } + case "class_c_timeout": + if len(subs) > 0 { + return fmt.Errorf("'class_c_timeout' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.ClassCTimeout = src.ClassCTimeout + } else { + dst.ClassCTimeout = nil + } + case "rx1_delay": + if len(subs) > 0 { + newDst := dst.Rx1Delay + if newDst == nil { + newDst = &MACSettings_RxDelayValue{} + dst.Rx1Delay = newDst + } + var newSrc *MACSettings_RxDelayValue + if src != nil { + newSrc = src.Rx1Delay + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.Rx1Delay = src.Rx1Delay + } else { + dst.Rx1Delay = nil + } + } + case "rx1_data_rate_offset": + if len(subs) > 0 { + return fmt.Errorf("'rx1_data_rate_offset' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Rx1DataRateOffset = src.Rx1DataRateOffset + } else { + dst.Rx1DataRateOffset = nil + } + case "rx2_data_rate_index": + if len(subs) > 0 { + newDst := dst.Rx2DataRateIndex + if newDst == nil { + newDst = &MACSettings_DataRateIndexValue{} + dst.Rx2DataRateIndex = newDst + } + var newSrc *MACSettings_DataRateIndexValue + if src != nil { + newSrc = src.Rx2DataRateIndex + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.Rx2DataRateIndex = src.Rx2DataRateIndex + } else { + dst.Rx2DataRateIndex = nil + } + } + case "rx2_frequency": + if len(subs) > 0 { + return fmt.Errorf("'rx2_frequency' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Rx2Frequency = src.Rx2Frequency + } else { + dst.Rx2Frequency = nil + } + case "factory_preset_frequencies": + if len(subs) > 0 { + return fmt.Errorf("'factory_preset_frequencies' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.FactoryPresetFrequencies = src.FactoryPresetFrequencies + } else { + dst.FactoryPresetFrequencies = nil + } + case "max_duty_cycle": + if len(subs) > 0 { + newDst := dst.MaxDutyCycle + if newDst == nil { + newDst = &MACSettings_AggregatedDutyCycleValue{} + dst.MaxDutyCycle = newDst + } + var newSrc *MACSettings_AggregatedDutyCycleValue + if src != nil { + newSrc = src.MaxDutyCycle + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.MaxDutyCycle = src.MaxDutyCycle + } else { + dst.MaxDutyCycle = nil + } + } + case "supports_32_bit_f_cnt": + if len(subs) > 0 { + return fmt.Errorf("'supports_32_bit_f_cnt' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Supports32BitFCnt = src.Supports32BitFCnt + } else { + dst.Supports32BitFCnt = nil + } + case "use_adr": + if len(subs) > 0 { + return fmt.Errorf("'use_adr' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.UseADR = src.UseADR + } else { + dst.UseADR = nil + } + case "adr_margin": + if len(subs) > 0 { + return fmt.Errorf("'adr_margin' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.ADRMargin = src.ADRMargin + } else { + dst.ADRMargin = nil + } + case "resets_f_cnt": + if len(subs) > 0 { + return fmt.Errorf("'resets_f_cnt' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.ResetsFCnt = src.ResetsFCnt + } else { + dst.ResetsFCnt = nil + } + case "status_time_periodicity": + if len(subs) > 0 { + return fmt.Errorf("'status_time_periodicity' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.StatusTimePeriodicity = src.StatusTimePeriodicity + } else { + dst.StatusTimePeriodicity = nil + } + case "status_count_periodicity": + if len(subs) > 0 { + return fmt.Errorf("'status_count_periodicity' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.StatusCountPeriodicity = src.StatusCountPeriodicity + } else { + dst.StatusCountPeriodicity = nil + } + case "desired_rx1_delay": + if len(subs) > 0 { + newDst := dst.DesiredRx1Delay + if newDst == nil { + newDst = &MACSettings_RxDelayValue{} + dst.DesiredRx1Delay = newDst + } + var newSrc *MACSettings_RxDelayValue + if src != nil { + newSrc = src.DesiredRx1Delay + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.DesiredRx1Delay = src.DesiredRx1Delay + } else { + dst.DesiredRx1Delay = nil + } + } + case "desired_rx1_data_rate_offset": + if len(subs) > 0 { + return fmt.Errorf("'desired_rx1_data_rate_offset' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.DesiredRx1DataRateOffset = src.DesiredRx1DataRateOffset + } else { + dst.DesiredRx1DataRateOffset = nil + } + case "desired_rx2_data_rate_index": + if len(subs) > 0 { + newDst := dst.DesiredRx2DataRateIndex + if newDst == nil { + newDst = &MACSettings_DataRateIndexValue{} + dst.DesiredRx2DataRateIndex = newDst + } + var newSrc *MACSettings_DataRateIndexValue + if src != nil { + newSrc = src.DesiredRx2DataRateIndex + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.DesiredRx2DataRateIndex = src.DesiredRx2DataRateIndex + } else { + dst.DesiredRx2DataRateIndex = nil + } + } + case "desired_rx2_frequency": + if len(subs) > 0 { + return fmt.Errorf("'desired_rx2_frequency' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.DesiredRx2Frequency = src.DesiredRx2Frequency + } else { + dst.DesiredRx2Frequency = nil + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *MACState) SetFields(src *MACState, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "current_parameters": + if len(subs) > 0 { + newDst := &dst.CurrentParameters + var newSrc *MACParameters + if src != nil { + newSrc = &src.CurrentParameters + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.CurrentParameters = src.CurrentParameters + } else { + var zero MACParameters + dst.CurrentParameters = zero + } + } + case "desired_parameters": + if len(subs) > 0 { + newDst := &dst.DesiredParameters + var newSrc *MACParameters + if src != nil { + newSrc = &src.DesiredParameters + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.DesiredParameters = src.DesiredParameters + } else { + var zero MACParameters + dst.DesiredParameters = zero + } + } + case "device_class": + if len(subs) > 0 { + return fmt.Errorf("'device_class' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.DeviceClass = src.DeviceClass + } else { + var zero Class + dst.DeviceClass = zero + } + case "lorawan_version": + if len(subs) > 0 { + return fmt.Errorf("'lorawan_version' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.LoRaWANVersion = src.LoRaWANVersion + } else { + var zero MACVersion + dst.LoRaWANVersion = zero + } + case "last_confirmed_downlink_at": + if len(subs) > 0 { + return fmt.Errorf("'last_confirmed_downlink_at' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.LastConfirmedDownlinkAt = src.LastConfirmedDownlinkAt + } else { + dst.LastConfirmedDownlinkAt = nil + } + case "last_dev_status_f_cnt_up": + if len(subs) > 0 { + return fmt.Errorf("'last_dev_status_f_cnt_up' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.LastDevStatusFCntUp = src.LastDevStatusFCntUp + } else { + var zero uint32 + dst.LastDevStatusFCntUp = zero + } + case "ping_slot_periodicity": + if len(subs) > 0 { + return fmt.Errorf("'ping_slot_periodicity' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.PingSlotPeriodicity = src.PingSlotPeriodicity + } else { + var zero PingSlotPeriod + dst.PingSlotPeriodicity = zero + } + case "pending_application_downlink": + if len(subs) > 0 { + newDst := dst.PendingApplicationDownlink + if newDst == nil { + newDst = &ApplicationDownlink{} + dst.PendingApplicationDownlink = newDst + } + var newSrc *ApplicationDownlink + if src != nil { + newSrc = src.PendingApplicationDownlink + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.PendingApplicationDownlink = src.PendingApplicationDownlink + } else { + dst.PendingApplicationDownlink = nil + } + } + case "queued_responses": + if len(subs) > 0 { + return fmt.Errorf("'queued_responses' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.QueuedResponses = src.QueuedResponses + } else { + dst.QueuedResponses = nil + } + case "pending_requests": + if len(subs) > 0 { + return fmt.Errorf("'pending_requests' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.PendingRequests = src.PendingRequests + } else { + dst.PendingRequests = nil + } + case "queued_join_accept": + if len(subs) > 0 { + newDst := dst.QueuedJoinAccept + if newDst == nil { + newDst = &MACState_JoinAccept{} + dst.QueuedJoinAccept = newDst + } + var newSrc *MACState_JoinAccept + if src != nil { + newSrc = src.QueuedJoinAccept + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.QueuedJoinAccept = src.QueuedJoinAccept + } else { + dst.QueuedJoinAccept = nil + } + } + case "pending_join_request": + if len(subs) > 0 { + newDst := dst.PendingJoinRequest + if newDst == nil { + newDst = &JoinRequest{} + dst.PendingJoinRequest = newDst + } + var newSrc *JoinRequest + if src != nil { + newSrc = src.PendingJoinRequest + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.PendingJoinRequest = src.PendingJoinRequest + } else { + dst.PendingJoinRequest = nil + } + } + case "rx_windows_available": + if len(subs) > 0 { + return fmt.Errorf("'rx_windows_available' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.RxWindowsAvailable = src.RxWindowsAvailable + } else { + var zero bool + dst.RxWindowsAvailable = zero + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *EndDevice) SetFields(src *EndDevice, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "ids": + if len(subs) > 0 { + newDst := &dst.EndDeviceIdentifiers + var newSrc *EndDeviceIdentifiers + if src != nil { + newSrc = &src.EndDeviceIdentifiers + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.EndDeviceIdentifiers = src.EndDeviceIdentifiers + } else { + var zero EndDeviceIdentifiers + dst.EndDeviceIdentifiers = zero + } + } + case "created_at": + if len(subs) > 0 { + return fmt.Errorf("'created_at' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.CreatedAt = src.CreatedAt + } else { + var zero time.Time + dst.CreatedAt = zero + } + case "updated_at": + if len(subs) > 0 { + return fmt.Errorf("'updated_at' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.UpdatedAt = src.UpdatedAt + } else { + var zero time.Time + dst.UpdatedAt = zero + } + case "name": + if len(subs) > 0 { + return fmt.Errorf("'name' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Name = src.Name + } else { + var zero string + dst.Name = zero + } + case "description": + if len(subs) > 0 { + return fmt.Errorf("'description' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Description = src.Description + } else { + var zero string + dst.Description = zero + } + case "attributes": + if len(subs) > 0 { + return fmt.Errorf("'attributes' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Attributes = src.Attributes + } else { + dst.Attributes = nil + } + case "version_ids": + if len(subs) > 0 { + newDst := dst.VersionIDs + if newDst == nil { + newDst = &EndDeviceVersionIdentifiers{} + dst.VersionIDs = newDst + } + var newSrc *EndDeviceVersionIdentifiers + if src != nil { + newSrc = src.VersionIDs + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.VersionIDs = src.VersionIDs + } else { + dst.VersionIDs = nil + } + } + case "service_profile_id": + if len(subs) > 0 { + return fmt.Errorf("'service_profile_id' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.ServiceProfileID = src.ServiceProfileID + } else { + var zero string + dst.ServiceProfileID = zero + } + case "network_server_address": + if len(subs) > 0 { + return fmt.Errorf("'network_server_address' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.NetworkServerAddress = src.NetworkServerAddress + } else { + var zero string + dst.NetworkServerAddress = zero + } + case "application_server_address": + if len(subs) > 0 { + return fmt.Errorf("'application_server_address' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.ApplicationServerAddress = src.ApplicationServerAddress + } else { + var zero string + dst.ApplicationServerAddress = zero + } + case "join_server_address": + if len(subs) > 0 { + return fmt.Errorf("'join_server_address' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.JoinServerAddress = src.JoinServerAddress + } else { + var zero string + dst.JoinServerAddress = zero + } + case "locations": + if len(subs) > 0 { + return fmt.Errorf("'locations' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Locations = src.Locations + } else { + dst.Locations = nil + } + case "supports_class_b": + if len(subs) > 0 { + return fmt.Errorf("'supports_class_b' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.SupportsClassB = src.SupportsClassB + } else { + var zero bool + dst.SupportsClassB = zero + } + case "supports_class_c": + if len(subs) > 0 { + return fmt.Errorf("'supports_class_c' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.SupportsClassC = src.SupportsClassC + } else { + var zero bool + dst.SupportsClassC = zero + } + case "lorawan_version": + if len(subs) > 0 { + return fmt.Errorf("'lorawan_version' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.LoRaWANVersion = src.LoRaWANVersion + } else { + var zero MACVersion + dst.LoRaWANVersion = zero + } + case "lorawan_phy_version": + if len(subs) > 0 { + return fmt.Errorf("'lorawan_phy_version' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.LoRaWANPHYVersion = src.LoRaWANPHYVersion + } else { + var zero PHYVersion + dst.LoRaWANPHYVersion = zero + } + case "frequency_plan_id": + if len(subs) > 0 { + return fmt.Errorf("'frequency_plan_id' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.FrequencyPlanID = src.FrequencyPlanID + } else { + var zero string + dst.FrequencyPlanID = zero + } + case "min_frequency": + if len(subs) > 0 { + return fmt.Errorf("'min_frequency' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.MinFrequency = src.MinFrequency + } else { + var zero uint64 + dst.MinFrequency = zero + } + case "max_frequency": + if len(subs) > 0 { + return fmt.Errorf("'max_frequency' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.MaxFrequency = src.MaxFrequency + } else { + var zero uint64 + dst.MaxFrequency = zero + } + case "supports_join": + if len(subs) > 0 { + return fmt.Errorf("'supports_join' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.SupportsJoin = src.SupportsJoin + } else { + var zero bool + dst.SupportsJoin = zero + } + case "resets_join_nonces": + if len(subs) > 0 { + return fmt.Errorf("'resets_join_nonces' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.ResetsJoinNonces = src.ResetsJoinNonces + } else { + var zero bool + dst.ResetsJoinNonces = zero + } + case "root_keys": + if len(subs) > 0 { + newDst := dst.RootKeys + if newDst == nil { + newDst = &RootKeys{} + dst.RootKeys = newDst + } + var newSrc *RootKeys + if src != nil { + newSrc = src.RootKeys + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.RootKeys = src.RootKeys + } else { + dst.RootKeys = nil + } + } + case "net_id": + if len(subs) > 0 { + return fmt.Errorf("'net_id' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.NetID = src.NetID + } else { + dst.NetID = nil + } + case "mac_settings": + if len(subs) > 0 { + newDst := dst.MACSettings + if newDst == nil { + newDst = &MACSettings{} + dst.MACSettings = newDst + } + var newSrc *MACSettings + if src != nil { + newSrc = src.MACSettings + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.MACSettings = src.MACSettings + } else { + dst.MACSettings = nil + } + } + case "mac_state": + if len(subs) > 0 { + newDst := dst.MACState + if newDst == nil { + newDst = &MACState{} + dst.MACState = newDst + } + var newSrc *MACState + if src != nil { + newSrc = src.MACState + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.MACState = src.MACState + } else { + dst.MACState = nil + } + } + case "session": + if len(subs) > 0 { + newDst := dst.Session + if newDst == nil { + newDst = &Session{} + dst.Session = newDst + } + var newSrc *Session + if src != nil { + newSrc = src.Session + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.Session = src.Session + } else { + dst.Session = nil + } + } + case "pending_session": + if len(subs) > 0 { + newDst := dst.PendingSession + if newDst == nil { + newDst = &Session{} + dst.PendingSession = newDst + } + var newSrc *Session + if src != nil { + newSrc = src.PendingSession + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.PendingSession = src.PendingSession + } else { + dst.PendingSession = nil + } + } + case "last_dev_nonce": + if len(subs) > 0 { + return fmt.Errorf("'last_dev_nonce' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.LastDevNonce = src.LastDevNonce + } else { + var zero uint32 + dst.LastDevNonce = zero + } + case "used_dev_nonces": + if len(subs) > 0 { + return fmt.Errorf("'used_dev_nonces' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.UsedDevNonces = src.UsedDevNonces + } else { + dst.UsedDevNonces = nil + } + case "last_join_nonce": + if len(subs) > 0 { + return fmt.Errorf("'last_join_nonce' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.LastJoinNonce = src.LastJoinNonce + } else { + var zero uint32 + dst.LastJoinNonce = zero + } + case "last_rj_count_0": + if len(subs) > 0 { + return fmt.Errorf("'last_rj_count_0' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.LastRJCount0 = src.LastRJCount0 + } else { + var zero uint32 + dst.LastRJCount0 = zero + } + case "last_rj_count_1": + if len(subs) > 0 { + return fmt.Errorf("'last_rj_count_1' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.LastRJCount1 = src.LastRJCount1 + } else { + var zero uint32 + dst.LastRJCount1 = zero + } + case "last_dev_status_received_at": + if len(subs) > 0 { + return fmt.Errorf("'last_dev_status_received_at' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.LastDevStatusReceivedAt = src.LastDevStatusReceivedAt + } else { + dst.LastDevStatusReceivedAt = nil + } + case "power_state": + if len(subs) > 0 { + return fmt.Errorf("'power_state' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.PowerState = src.PowerState + } else { + var zero PowerState + dst.PowerState = zero + } + case "battery_percentage": + if len(subs) > 0 { + return fmt.Errorf("'battery_percentage' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.BatteryPercentage = src.BatteryPercentage + } else { + dst.BatteryPercentage = nil + } + case "downlink_margin": + if len(subs) > 0 { + return fmt.Errorf("'downlink_margin' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.DownlinkMargin = src.DownlinkMargin + } else { + var zero int32 + dst.DownlinkMargin = zero + } + case "recent_adr_uplinks": + if len(subs) > 0 { + return fmt.Errorf("'recent_adr_uplinks' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.RecentADRUplinks = src.RecentADRUplinks + } else { + dst.RecentADRUplinks = nil + } + case "recent_uplinks": + if len(subs) > 0 { + return fmt.Errorf("'recent_uplinks' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.RecentUplinks = src.RecentUplinks + } else { + dst.RecentUplinks = nil + } + case "recent_downlinks": + if len(subs) > 0 { + return fmt.Errorf("'recent_downlinks' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.RecentDownlinks = src.RecentDownlinks + } else { + dst.RecentDownlinks = nil + } + case "queued_application_downlinks": + if len(subs) > 0 { + return fmt.Errorf("'queued_application_downlinks' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.QueuedApplicationDownlinks = src.QueuedApplicationDownlinks + } else { + dst.QueuedApplicationDownlinks = nil + } + case "formatters": + if len(subs) > 0 { + newDst := dst.Formatters + if newDst == nil { + newDst = &MessagePayloadFormatters{} + dst.Formatters = newDst + } + var newSrc *MessagePayloadFormatters + if src != nil { + newSrc = src.Formatters + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.Formatters = src.Formatters + } else { + dst.Formatters = nil + } + } + case "provisioner_id": + if len(subs) > 0 { + return fmt.Errorf("'provisioner_id' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.ProvisionerID = src.ProvisionerID + } else { + var zero string + dst.ProvisionerID = zero + } + case "provisioning_data": + if len(subs) > 0 { + return fmt.Errorf("'provisioning_data' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.ProvisioningData = src.ProvisioningData + } else { + dst.ProvisioningData = nil + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *EndDevices) SetFields(src *EndDevices, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "end_devices": + if len(subs) > 0 { + return fmt.Errorf("'end_devices' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.EndDevices = src.EndDevices + } else { + dst.EndDevices = nil + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *CreateEndDeviceRequest) SetFields(src *CreateEndDeviceRequest, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "end_device": + if len(subs) > 0 { + newDst := &dst.EndDevice + var newSrc *EndDevice + if src != nil { + newSrc = &src.EndDevice + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.EndDevice = src.EndDevice + } else { + var zero EndDevice + dst.EndDevice = zero + } + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *UpdateEndDeviceRequest) SetFields(src *UpdateEndDeviceRequest, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "end_device": + if len(subs) > 0 { + newDst := &dst.EndDevice + var newSrc *EndDevice + if src != nil { + newSrc = &src.EndDevice + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.EndDevice = src.EndDevice + } else { + var zero EndDevice + dst.EndDevice = zero + } + } + case "field_mask": + if len(subs) > 0 { + return fmt.Errorf("'field_mask' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.FieldMask = src.FieldMask + } else { + var zero types.FieldMask + dst.FieldMask = zero + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *GetEndDeviceRequest) SetFields(src *GetEndDeviceRequest, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "end_device_ids": + if len(subs) > 0 { + newDst := &dst.EndDeviceIdentifiers + var newSrc *EndDeviceIdentifiers + if src != nil { + newSrc = &src.EndDeviceIdentifiers + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.EndDeviceIdentifiers = src.EndDeviceIdentifiers + } else { + var zero EndDeviceIdentifiers + dst.EndDeviceIdentifiers = zero + } + } + case "field_mask": + if len(subs) > 0 { + return fmt.Errorf("'field_mask' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.FieldMask = src.FieldMask + } else { + var zero types.FieldMask + dst.FieldMask = zero + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *ListEndDevicesRequest) SetFields(src *ListEndDevicesRequest, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "application_ids": + if len(subs) > 0 { + newDst := &dst.ApplicationIdentifiers + var newSrc *ApplicationIdentifiers + if src != nil { + newSrc = &src.ApplicationIdentifiers + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.ApplicationIdentifiers = src.ApplicationIdentifiers + } else { + var zero ApplicationIdentifiers + dst.ApplicationIdentifiers = zero + } + } + case "field_mask": + if len(subs) > 0 { + return fmt.Errorf("'field_mask' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.FieldMask = src.FieldMask + } else { + var zero types.FieldMask + dst.FieldMask = zero + } + case "order": + if len(subs) > 0 { + return fmt.Errorf("'order' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Order = src.Order + } else { + var zero string + dst.Order = zero + } + case "limit": + if len(subs) > 0 { + return fmt.Errorf("'limit' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Limit = src.Limit + } else { + var zero uint32 + dst.Limit = zero + } + case "page": + if len(subs) > 0 { + return fmt.Errorf("'page' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Page = src.Page + } else { + var zero uint32 + dst.Page = zero + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *SetEndDeviceRequest) SetFields(src *SetEndDeviceRequest, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "end_device": + if len(subs) > 0 { + newDst := &dst.EndDevice + var newSrc *EndDevice + if src != nil { + newSrc = &src.EndDevice + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.EndDevice = src.EndDevice + } else { + var zero EndDevice + dst.EndDevice = zero + } + } + case "field_mask": + if len(subs) > 0 { + return fmt.Errorf("'field_mask' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.FieldMask = src.FieldMask + } else { + var zero types.FieldMask + dst.FieldMask = zero + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *MACParameters_Channel) SetFields(src *MACParameters_Channel, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "uplink_frequency": + if len(subs) > 0 { + return fmt.Errorf("'uplink_frequency' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.UplinkFrequency = src.UplinkFrequency + } else { + var zero uint64 + dst.UplinkFrequency = zero + } + case "downlink_frequency": + if len(subs) > 0 { + return fmt.Errorf("'downlink_frequency' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.DownlinkFrequency = src.DownlinkFrequency + } else { + var zero uint64 + dst.DownlinkFrequency = zero + } + case "min_data_rate_index": + if len(subs) > 0 { + return fmt.Errorf("'min_data_rate_index' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.MinDataRateIndex = src.MinDataRateIndex + } else { + var zero DataRateIndex + dst.MinDataRateIndex = zero + } + case "max_data_rate_index": + if len(subs) > 0 { + return fmt.Errorf("'max_data_rate_index' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.MaxDataRateIndex = src.MaxDataRateIndex + } else { + var zero DataRateIndex + dst.MaxDataRateIndex = zero + } + case "enable_uplink": + if len(subs) > 0 { + return fmt.Errorf("'enable_uplink' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.EnableUplink = src.EnableUplink + } else { + var zero bool + dst.EnableUplink = zero + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *MACSettings_DataRateIndexValue) SetFields(src *MACSettings_DataRateIndexValue, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "value": + if len(subs) > 0 { + return fmt.Errorf("'value' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Value = src.Value + } else { + var zero DataRateIndex + dst.Value = zero + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *MACSettings_PingSlotPeriodValue) SetFields(src *MACSettings_PingSlotPeriodValue, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "value": + if len(subs) > 0 { + return fmt.Errorf("'value' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Value = src.Value + } else { + var zero PingSlotPeriod + dst.Value = zero + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *MACSettings_AggregatedDutyCycleValue) SetFields(src *MACSettings_AggregatedDutyCycleValue, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "value": + if len(subs) > 0 { + return fmt.Errorf("'value' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Value = src.Value + } else { + var zero AggregatedDutyCycle + dst.Value = zero + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *MACSettings_RxDelayValue) SetFields(src *MACSettings_RxDelayValue, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "value": + if len(subs) > 0 { + return fmt.Errorf("'value' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Value = src.Value + } else { + var zero RxDelay + dst.Value = zero + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *MACState_JoinAccept) SetFields(src *MACState_JoinAccept, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "payload": + if len(subs) > 0 { + return fmt.Errorf("'payload' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Payload = src.Payload + } else { + dst.Payload = nil + } + case "request": + if len(subs) > 0 { + newDst := &dst.Request + var newSrc *JoinRequest + if src != nil { + newSrc = &src.Request + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.Request = src.Request + } else { + var zero JoinRequest + dst.Request = zero + } + } + case "keys": + if len(subs) > 0 { + newDst := &dst.Keys + var newSrc *SessionKeys + if src != nil { + newSrc = &src.Keys + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.Keys = src.Keys + } else { + var zero SessionKeys + dst.Keys = zero + } + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} diff --git a/pkg/ttnpb/end_device.pb.validate.go b/pkg/ttnpb/end_device.pb.validate.go new file mode 100644 index 0000000000..704c3d26d8 --- /dev/null +++ b/pkg/ttnpb/end_device.pb.validate.go @@ -0,0 +1,3006 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on Session with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *Session) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = SessionFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "dev_addr": + // no validation rules for DevAddr + case "keys": + + if v, ok := interface{}(&m.SessionKeys).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SessionValidationError{ + field: "keys", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "last_f_cnt_up": + // no validation rules for LastFCntUp + case "last_n_f_cnt_down": + // no validation rules for LastNFCntDown + case "last_a_f_cnt_down": + // no validation rules for LastAFCntDown + case "last_conf_f_cnt_down": + // no validation rules for LastConfFCntDown + case "started_at": + + if v, ok := interface{}(&m.StartedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SessionValidationError{ + field: "started_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return SessionValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// SessionValidationError is the validation error returned by +// Session.ValidateFields if the designated constraints aren't met. +type SessionValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SessionValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SessionValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SessionValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SessionValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SessionValidationError) ErrorName() string { return "SessionValidationError" } + +// Error satisfies the builtin error interface +func (e SessionValidationError) 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 %sSession.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SessionValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SessionValidationError{} + +// ValidateFields checks the field values on MACParameters with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACParameters) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACParametersFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "max_eirp": + // no validation rules for MaxEIRP + case "uplink_dwell_time": + // no validation rules for UplinkDwellTime + case "downlink_dwell_time": + // no validation rules for DownlinkDwellTime + case "adr_data_rate_index": + + if _, ok := DataRateIndex_name[int32(m.GetADRDataRateIndex())]; !ok { + return MACParametersValidationError{ + field: "adr_data_rate_index", + reason: "value must be one of the defined enum values", + } + } + + case "adr_tx_power_index": + + if m.GetADRTxPowerIndex() > 15 { + return MACParametersValidationError{ + field: "adr_tx_power_index", + reason: "value must be less than or equal to 15", + } + } + + case "adr_nb_trans": + + if m.GetADRNbTrans() > 15 { + return MACParametersValidationError{ + field: "adr_nb_trans", + reason: "value must be less than or equal to 15", + } + } + + case "adr_ack_limit": + + if val := m.GetADRAckLimit(); val < 1 || val > 32768 { + return MACParametersValidationError{ + field: "adr_ack_limit", + reason: "value must be inside range [1, 32768]", + } + } + + case "adr_ack_delay": + + if val := m.GetADRAckDelay(); val < 1 || val > 32768 { + return MACParametersValidationError{ + field: "adr_ack_delay", + reason: "value must be inside range [1, 32768]", + } + } + + case "rx1_delay": + + if _, ok := RxDelay_name[int32(m.GetRx1Delay())]; !ok { + return MACParametersValidationError{ + field: "rx1_delay", + reason: "value must be one of the defined enum values", + } + } + + case "rx1_data_rate_offset": + + if m.GetRx1DataRateOffset() > 7 { + return MACParametersValidationError{ + field: "rx1_data_rate_offset", + reason: "value must be less than or equal to 7", + } + } + + case "rx2_data_rate_index": + + if _, ok := DataRateIndex_name[int32(m.GetRx2DataRateIndex())]; !ok { + return MACParametersValidationError{ + field: "rx2_data_rate_index", + reason: "value must be one of the defined enum values", + } + } + + case "rx2_frequency": + + if m.GetRx2Frequency() < 100000 { + return MACParametersValidationError{ + field: "rx2_frequency", + reason: "value must be greater than or equal to 100000", + } + } + + case "max_duty_cycle": + + if _, ok := AggregatedDutyCycle_name[int32(m.GetMaxDutyCycle())]; !ok { + return MACParametersValidationError{ + field: "max_duty_cycle", + reason: "value must be one of the defined enum values", + } + } + + case "rejoin_time_periodicity": + + if _, ok := RejoinTimeExponent_name[int32(m.GetRejoinTimePeriodicity())]; !ok { + return MACParametersValidationError{ + field: "rejoin_time_periodicity", + reason: "value must be one of the defined enum values", + } + } + + case "rejoin_count_periodicity": + + if _, ok := RejoinCountExponent_name[int32(m.GetRejoinCountPeriodicity())]; !ok { + return MACParametersValidationError{ + field: "rejoin_count_periodicity", + reason: "value must be one of the defined enum values", + } + } + + case "ping_slot_frequency": + + if val := m.GetPingSlotFrequency(); val > 0 && val < 100000 { + return MACParametersValidationError{ + field: "ping_slot_frequency", + reason: "value must be outside range (0, 100000)", + } + } + + case "ping_slot_data_rate_index": + + if _, ok := DataRateIndex_name[int32(m.GetPingSlotDataRateIndex())]; !ok { + return MACParametersValidationError{ + field: "ping_slot_data_rate_index", + reason: "value must be one of the defined enum values", + } + } + + case "beacon_frequency": + + if val := m.GetBeaconFrequency(); val > 0 && val < 100000 { + return MACParametersValidationError{ + field: "beacon_frequency", + reason: "value must be outside range (0, 100000)", + } + } + + case "channels": + + if len(m.GetChannels()) < 1 { + return MACParametersValidationError{ + field: "channels", + reason: "value must contain at least 1 item(s)", + } + } + + for idx, item := range m.GetChannels() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACParametersValidationError{ + field: fmt.Sprintf("channels[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + default: + return MACParametersValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACParametersValidationError is the validation error returned by +// MACParameters.ValidateFields if the designated constraints aren't met. +type MACParametersValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACParametersValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACParametersValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACParametersValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACParametersValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACParametersValidationError) ErrorName() string { return "MACParametersValidationError" } + +// Error satisfies the builtin error interface +func (e MACParametersValidationError) 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 %sMACParameters.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACParametersValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACParametersValidationError{} + +// ValidateFields checks the field values on EndDeviceBrand with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *EndDeviceBrand) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = EndDeviceBrandFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "id": + // no validation rules for ID + case "name": + // no validation rules for Name + case "url": + // no validation rules for URL + case "logos": + + default: + return EndDeviceBrandValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// EndDeviceBrandValidationError is the validation error returned by +// EndDeviceBrand.ValidateFields if the designated constraints aren't met. +type EndDeviceBrandValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e EndDeviceBrandValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e EndDeviceBrandValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e EndDeviceBrandValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e EndDeviceBrandValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e EndDeviceBrandValidationError) ErrorName() string { return "EndDeviceBrandValidationError" } + +// Error satisfies the builtin error interface +func (e EndDeviceBrandValidationError) 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 %sEndDeviceBrand.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = EndDeviceBrandValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = EndDeviceBrandValidationError{} + +// ValidateFields checks the field values on EndDeviceModel with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *EndDeviceModel) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = EndDeviceModelFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "brand_id": + // no validation rules for BrandID + case "id": + // no validation rules for ID + case "name": + // no validation rules for Name + default: + return EndDeviceModelValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// EndDeviceModelValidationError is the validation error returned by +// EndDeviceModel.ValidateFields if the designated constraints aren't met. +type EndDeviceModelValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e EndDeviceModelValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e EndDeviceModelValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e EndDeviceModelValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e EndDeviceModelValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e EndDeviceModelValidationError) ErrorName() string { return "EndDeviceModelValidationError" } + +// Error satisfies the builtin error interface +func (e EndDeviceModelValidationError) 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 %sEndDeviceModel.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = EndDeviceModelValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = EndDeviceModelValidationError{} + +// ValidateFields checks the field values on EndDeviceVersionIdentifiers with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *EndDeviceVersionIdentifiers) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = EndDeviceVersionIdentifiersFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "brand_id": + + if utf8.RuneCountInString(m.GetBrandID()) > 36 { + return EndDeviceVersionIdentifiersValidationError{ + field: "brand_id", + reason: "value length must be at most 36 runes", + } + } + + if !_EndDeviceVersionIdentifiers_BrandID_Pattern.MatchString(m.GetBrandID()) { + return EndDeviceVersionIdentifiersValidationError{ + field: "brand_id", + reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$\"", + } + } + + case "model_id": + + if utf8.RuneCountInString(m.GetModelID()) > 36 { + return EndDeviceVersionIdentifiersValidationError{ + field: "model_id", + reason: "value length must be at most 36 runes", + } + } + + if !_EndDeviceVersionIdentifiers_ModelID_Pattern.MatchString(m.GetModelID()) { + return EndDeviceVersionIdentifiersValidationError{ + field: "model_id", + reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$\"", + } + } + + case "hardware_version": + // no validation rules for HardwareVersion + case "firmware_version": + // no validation rules for FirmwareVersion + default: + return EndDeviceVersionIdentifiersValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// EndDeviceVersionIdentifiersValidationError is the validation error returned +// by EndDeviceVersionIdentifiers.ValidateFields if the designated constraints +// aren't met. +type EndDeviceVersionIdentifiersValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e EndDeviceVersionIdentifiersValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e EndDeviceVersionIdentifiersValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e EndDeviceVersionIdentifiersValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e EndDeviceVersionIdentifiersValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e EndDeviceVersionIdentifiersValidationError) ErrorName() string { + return "EndDeviceVersionIdentifiersValidationError" +} + +// Error satisfies the builtin error interface +func (e EndDeviceVersionIdentifiersValidationError) 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 %sEndDeviceVersionIdentifiers.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = EndDeviceVersionIdentifiersValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = EndDeviceVersionIdentifiersValidationError{} + +var _EndDeviceVersionIdentifiers_BrandID_Pattern = regexp.MustCompile("^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$") + +var _EndDeviceVersionIdentifiers_ModelID_Pattern = regexp.MustCompile("^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$") + +// ValidateFields checks the field values on EndDeviceVersion with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *EndDeviceVersion) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = EndDeviceVersionFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "ids": + + if v, ok := interface{}(&m.EndDeviceVersionIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EndDeviceVersionValidationError{ + field: "ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "lorawan_version": + + if _, ok := MACVersion_name[int32(m.GetLoRaWANVersion())]; !ok { + return EndDeviceVersionValidationError{ + field: "lorawan_version", + reason: "value must be one of the defined enum values", + } + } + + case "lorawan_phy_version": + + if _, ok := PHYVersion_name[int32(m.GetLoRaWANPHYVersion())]; !ok { + return EndDeviceVersionValidationError{ + field: "lorawan_phy_version", + reason: "value must be one of the defined enum values", + } + } + + case "frequency_plan_id": + // no validation rules for FrequencyPlanID + case "photos": + + case "supports_class_b": + // no validation rules for SupportsClassB + case "supports_class_c": + // no validation rules for SupportsClassC + case "default_mac_settings": + + if v, ok := interface{}(m.GetDefaultMACSettings()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EndDeviceVersionValidationError{ + field: "default_mac_settings", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "min_frequency": + // no validation rules for MinFrequency + case "max_frequency": + // no validation rules for MaxFrequency + case "supports_join": + // no validation rules for SupportsJoin + case "resets_join_nonces": + // no validation rules for ResetsJoinNonces + case "default_formatters": + + if v, ok := interface{}(&m.DefaultFormatters).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EndDeviceVersionValidationError{ + field: "default_formatters", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return EndDeviceVersionValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// EndDeviceVersionValidationError is the validation error returned by +// EndDeviceVersion.ValidateFields if the designated constraints aren't met. +type EndDeviceVersionValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e EndDeviceVersionValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e EndDeviceVersionValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e EndDeviceVersionValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e EndDeviceVersionValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e EndDeviceVersionValidationError) ErrorName() string { return "EndDeviceVersionValidationError" } + +// Error satisfies the builtin error interface +func (e EndDeviceVersionValidationError) 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 %sEndDeviceVersion.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = EndDeviceVersionValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = EndDeviceVersionValidationError{} + +// ValidateFields checks the field values on MACSettings with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *MACSettings) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACSettingsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "class_b_timeout": + + if v, ok := interface{}(m.GetClassBTimeout()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACSettingsValidationError{ + field: "class_b_timeout", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "ping_slot_periodicity": + + if v, ok := interface{}(m.GetPingSlotPeriodicity()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACSettingsValidationError{ + field: "ping_slot_periodicity", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "ping_slot_data_rate_index": + + if v, ok := interface{}(m.GetPingSlotDataRateIndex()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACSettingsValidationError{ + field: "ping_slot_data_rate_index", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "ping_slot_frequency": + + if wrapper := m.GetPingSlotFrequency(); wrapper != nil { + + if wrapper.GetValue() < 100000 { + return MACSettingsValidationError{ + field: "ping_slot_frequency", + reason: "value must be greater than or equal to 100000", + } + } + + } + + case "class_c_timeout": + + if v, ok := interface{}(m.GetClassCTimeout()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACSettingsValidationError{ + field: "class_c_timeout", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "rx1_delay": + + if v, ok := interface{}(m.GetRx1Delay()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACSettingsValidationError{ + field: "rx1_delay", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "rx1_data_rate_offset": + + if wrapper := m.GetRx1DataRateOffset(); wrapper != nil { + + if wrapper.GetValue() > 7 { + return MACSettingsValidationError{ + field: "rx1_data_rate_offset", + reason: "value must be less than or equal to 7", + } + } + + } + + case "rx2_data_rate_index": + + if v, ok := interface{}(m.GetRx2DataRateIndex()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACSettingsValidationError{ + field: "rx2_data_rate_index", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "rx2_frequency": + + if wrapper := m.GetRx2Frequency(); wrapper != nil { + + if wrapper.GetValue() < 100000 { + return MACSettingsValidationError{ + field: "rx2_frequency", + reason: "value must be greater than or equal to 100000", + } + } + + } + + case "factory_preset_frequencies": + + case "max_duty_cycle": + + if v, ok := interface{}(m.GetMaxDutyCycle()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACSettingsValidationError{ + field: "max_duty_cycle", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "supports_32_bit_f_cnt": + + if v, ok := interface{}(m.GetSupports32BitFCnt()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACSettingsValidationError{ + field: "supports_32_bit_f_cnt", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "use_adr": + + if v, ok := interface{}(m.GetUseADR()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACSettingsValidationError{ + field: "use_adr", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "adr_margin": + + if v, ok := interface{}(m.GetADRMargin()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACSettingsValidationError{ + field: "adr_margin", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "resets_f_cnt": + + if v, ok := interface{}(m.GetResetsFCnt()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACSettingsValidationError{ + field: "resets_f_cnt", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "status_time_periodicity": + + if v, ok := interface{}(m.GetStatusTimePeriodicity()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACSettingsValidationError{ + field: "status_time_periodicity", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "status_count_periodicity": + + if v, ok := interface{}(m.GetStatusCountPeriodicity()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACSettingsValidationError{ + field: "status_count_periodicity", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "desired_rx1_delay": + + if v, ok := interface{}(m.GetDesiredRx1Delay()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACSettingsValidationError{ + field: "desired_rx1_delay", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "desired_rx1_data_rate_offset": + + if v, ok := interface{}(m.GetDesiredRx1DataRateOffset()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACSettingsValidationError{ + field: "desired_rx1_data_rate_offset", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "desired_rx2_data_rate_index": + + if v, ok := interface{}(m.GetDesiredRx2DataRateIndex()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACSettingsValidationError{ + field: "desired_rx2_data_rate_index", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "desired_rx2_frequency": + + if wrapper := m.GetDesiredRx2Frequency(); wrapper != nil { + + if wrapper.GetValue() < 100000 { + return MACSettingsValidationError{ + field: "desired_rx2_frequency", + reason: "value must be greater than or equal to 100000", + } + } + + } + + default: + return MACSettingsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACSettingsValidationError is the validation error returned by +// MACSettings.ValidateFields if the designated constraints aren't met. +type MACSettingsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACSettingsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACSettingsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACSettingsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACSettingsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACSettingsValidationError) ErrorName() string { return "MACSettingsValidationError" } + +// Error satisfies the builtin error interface +func (e MACSettingsValidationError) 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 %sMACSettings.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACSettingsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACSettingsValidationError{} + +// ValidateFields checks the field values on MACState with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *MACState) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACStateFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "current_parameters": + + if v, ok := interface{}(&m.CurrentParameters).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACStateValidationError{ + field: "current_parameters", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "desired_parameters": + + if v, ok := interface{}(&m.DesiredParameters).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACStateValidationError{ + field: "desired_parameters", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "device_class": + + if _, ok := Class_name[int32(m.GetDeviceClass())]; !ok { + return MACStateValidationError{ + field: "device_class", + reason: "value must be one of the defined enum values", + } + } + + case "lorawan_version": + + if _, ok := MACVersion_name[int32(m.GetLoRaWANVersion())]; !ok { + return MACStateValidationError{ + field: "lorawan_version", + reason: "value must be one of the defined enum values", + } + } + + case "last_confirmed_downlink_at": + + if v, ok := interface{}(m.GetLastConfirmedDownlinkAt()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACStateValidationError{ + field: "last_confirmed_downlink_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "last_dev_status_f_cnt_up": + // no validation rules for LastDevStatusFCntUp + case "ping_slot_periodicity": + + if _, ok := PingSlotPeriod_name[int32(m.GetPingSlotPeriodicity())]; !ok { + return MACStateValidationError{ + field: "ping_slot_periodicity", + reason: "value must be one of the defined enum values", + } + } + + case "pending_application_downlink": + + if v, ok := interface{}(m.GetPendingApplicationDownlink()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACStateValidationError{ + field: "pending_application_downlink", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "queued_responses": + + for idx, item := range m.GetQueuedResponses() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACStateValidationError{ + field: fmt.Sprintf("queued_responses[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "pending_requests": + + for idx, item := range m.GetPendingRequests() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACStateValidationError{ + field: fmt.Sprintf("pending_requests[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "queued_join_accept": + + if v, ok := interface{}(m.GetQueuedJoinAccept()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACStateValidationError{ + field: "queued_join_accept", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "pending_join_request": + + if v, ok := interface{}(m.GetPendingJoinRequest()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACStateValidationError{ + field: "pending_join_request", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "rx_windows_available": + // no validation rules for RxWindowsAvailable + default: + return MACStateValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACStateValidationError is the validation error returned by +// MACState.ValidateFields if the designated constraints aren't met. +type MACStateValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACStateValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACStateValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACStateValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACStateValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACStateValidationError) ErrorName() string { return "MACStateValidationError" } + +// Error satisfies the builtin error interface +func (e MACStateValidationError) 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 %sMACState.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACStateValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACStateValidationError{} + +// ValidateFields checks the field values on EndDevice with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *EndDevice) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = EndDeviceFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "ids": + + if v, ok := interface{}(&m.EndDeviceIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EndDeviceValidationError{ + field: "ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "created_at": + + if v, ok := interface{}(&m.CreatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EndDeviceValidationError{ + field: "created_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "updated_at": + + if v, ok := interface{}(&m.UpdatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EndDeviceValidationError{ + field: "updated_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "name": + // no validation rules for Name + case "description": + // no validation rules for Description + case "attributes": + // no validation rules for Attributes + case "version_ids": + + if v, ok := interface{}(m.GetVersionIDs()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EndDeviceValidationError{ + field: "version_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "service_profile_id": + // no validation rules for ServiceProfileID + case "network_server_address": + + if !_EndDevice_NetworkServerAddress_Pattern.MatchString(m.GetNetworkServerAddress()) { + return EndDeviceValidationError{ + field: "network_server_address", + reason: "value does not match regex pattern \"^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$\"", + } + } + + case "application_server_address": + + if !_EndDevice_ApplicationServerAddress_Pattern.MatchString(m.GetApplicationServerAddress()) { + return EndDeviceValidationError{ + field: "application_server_address", + reason: "value does not match regex pattern \"^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$\"", + } + } + + case "join_server_address": + + if !_EndDevice_JoinServerAddress_Pattern.MatchString(m.GetJoinServerAddress()) { + return EndDeviceValidationError{ + field: "join_server_address", + reason: "value does not match regex pattern \"^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$\"", + } + } + + case "locations": + // no validation rules for Locations + case "supports_class_b": + // no validation rules for SupportsClassB + case "supports_class_c": + // no validation rules for SupportsClassC + case "lorawan_version": + + if _, ok := MACVersion_name[int32(m.GetLoRaWANVersion())]; !ok { + return EndDeviceValidationError{ + field: "lorawan_version", + reason: "value must be one of the defined enum values", + } + } + + case "lorawan_phy_version": + + if _, ok := PHYVersion_name[int32(m.GetLoRaWANPHYVersion())]; !ok { + return EndDeviceValidationError{ + field: "lorawan_phy_version", + reason: "value must be one of the defined enum values", + } + } + + case "frequency_plan_id": + // no validation rules for FrequencyPlanID + case "min_frequency": + // no validation rules for MinFrequency + case "max_frequency": + // no validation rules for MaxFrequency + case "supports_join": + // no validation rules for SupportsJoin + case "resets_join_nonces": + // no validation rules for ResetsJoinNonces + case "root_keys": + + if v, ok := interface{}(m.GetRootKeys()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EndDeviceValidationError{ + field: "root_keys", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "net_id": + // no validation rules for NetID + case "mac_settings": + + if v, ok := interface{}(m.GetMACSettings()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EndDeviceValidationError{ + field: "mac_settings", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "mac_state": + + if v, ok := interface{}(m.GetMACState()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EndDeviceValidationError{ + field: "mac_state", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "session": + + if v, ok := interface{}(m.GetSession()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EndDeviceValidationError{ + field: "session", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "pending_session": + + if v, ok := interface{}(m.GetPendingSession()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EndDeviceValidationError{ + field: "pending_session", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "last_dev_nonce": + // no validation rules for LastDevNonce + case "used_dev_nonces": + + case "last_join_nonce": + // no validation rules for LastJoinNonce + case "last_rj_count_0": + // no validation rules for LastRJCount0 + case "last_rj_count_1": + // no validation rules for LastRJCount1 + case "last_dev_status_received_at": + + if v, ok := interface{}(m.GetLastDevStatusReceivedAt()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EndDeviceValidationError{ + field: "last_dev_status_received_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "power_state": + + if _, ok := PowerState_name[int32(m.GetPowerState())]; !ok { + return EndDeviceValidationError{ + field: "power_state", + reason: "value must be one of the defined enum values", + } + } + + case "battery_percentage": + + if wrapper := m.GetBatteryPercentage(); wrapper != nil { + + if val := wrapper.GetValue(); val < 0 || val > 1 { + return EndDeviceValidationError{ + field: "battery_percentage", + reason: "value must be inside range [0, 1]", + } + } + + } + + case "downlink_margin": + // no validation rules for DownlinkMargin + case "recent_adr_uplinks": + + for idx, item := range m.GetRecentADRUplinks() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EndDeviceValidationError{ + field: fmt.Sprintf("recent_adr_uplinks[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "recent_uplinks": + + for idx, item := range m.GetRecentUplinks() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EndDeviceValidationError{ + field: fmt.Sprintf("recent_uplinks[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "recent_downlinks": + + for idx, item := range m.GetRecentDownlinks() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EndDeviceValidationError{ + field: fmt.Sprintf("recent_downlinks[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "queued_application_downlinks": + + for idx, item := range m.GetQueuedApplicationDownlinks() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EndDeviceValidationError{ + field: fmt.Sprintf("queued_application_downlinks[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "formatters": + + if v, ok := interface{}(m.GetFormatters()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EndDeviceValidationError{ + field: "formatters", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "provisioner_id": + + if utf8.RuneCountInString(m.GetProvisionerID()) > 36 { + return EndDeviceValidationError{ + field: "provisioner_id", + reason: "value length must be at most 36 runes", + } + } + + if !_EndDevice_ProvisionerID_Pattern.MatchString(m.GetProvisionerID()) { + return EndDeviceValidationError{ + field: "provisioner_id", + reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$\"", + } + } + + case "provisioning_data": + + if v, ok := interface{}(m.GetProvisioningData()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EndDeviceValidationError{ + field: "provisioning_data", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return EndDeviceValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// EndDeviceValidationError is the validation error returned by +// EndDevice.ValidateFields if the designated constraints aren't met. +type EndDeviceValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e EndDeviceValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e EndDeviceValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e EndDeviceValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e EndDeviceValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e EndDeviceValidationError) ErrorName() string { return "EndDeviceValidationError" } + +// Error satisfies the builtin error interface +func (e EndDeviceValidationError) 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 %sEndDevice.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = EndDeviceValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = EndDeviceValidationError{} + +var _EndDevice_NetworkServerAddress_Pattern = regexp.MustCompile("^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$") + +var _EndDevice_ApplicationServerAddress_Pattern = regexp.MustCompile("^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$") + +var _EndDevice_JoinServerAddress_Pattern = regexp.MustCompile("^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$") + +var _EndDevice_ProvisionerID_Pattern = regexp.MustCompile("^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$") + +// ValidateFields checks the field values on EndDevices with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *EndDevices) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = EndDevicesFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "end_devices": + + for idx, item := range m.GetEndDevices() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EndDevicesValidationError{ + field: fmt.Sprintf("end_devices[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + default: + return EndDevicesValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// EndDevicesValidationError is the validation error returned by +// EndDevices.ValidateFields if the designated constraints aren't met. +type EndDevicesValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e EndDevicesValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e EndDevicesValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e EndDevicesValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e EndDevicesValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e EndDevicesValidationError) ErrorName() string { return "EndDevicesValidationError" } + +// Error satisfies the builtin error interface +func (e EndDevicesValidationError) 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 %sEndDevices.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = EndDevicesValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = EndDevicesValidationError{} + +// ValidateFields checks the field values on CreateEndDeviceRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *CreateEndDeviceRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = CreateEndDeviceRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "end_device": + + if v, ok := interface{}(&m.EndDevice).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return CreateEndDeviceRequestValidationError{ + field: "end_device", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return CreateEndDeviceRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// CreateEndDeviceRequestValidationError is the validation error returned by +// CreateEndDeviceRequest.ValidateFields if the designated constraints aren't met. +type CreateEndDeviceRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CreateEndDeviceRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CreateEndDeviceRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CreateEndDeviceRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CreateEndDeviceRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CreateEndDeviceRequestValidationError) ErrorName() string { + return "CreateEndDeviceRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e CreateEndDeviceRequestValidationError) 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 %sCreateEndDeviceRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CreateEndDeviceRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CreateEndDeviceRequestValidationError{} + +// ValidateFields checks the field values on UpdateEndDeviceRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *UpdateEndDeviceRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = UpdateEndDeviceRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "end_device": + + if v, ok := interface{}(&m.EndDevice).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UpdateEndDeviceRequestValidationError{ + field: "end_device", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UpdateEndDeviceRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return UpdateEndDeviceRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// UpdateEndDeviceRequestValidationError is the validation error returned by +// UpdateEndDeviceRequest.ValidateFields if the designated constraints aren't met. +type UpdateEndDeviceRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UpdateEndDeviceRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UpdateEndDeviceRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UpdateEndDeviceRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UpdateEndDeviceRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UpdateEndDeviceRequestValidationError) ErrorName() string { + return "UpdateEndDeviceRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e UpdateEndDeviceRequestValidationError) 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 %sUpdateEndDeviceRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UpdateEndDeviceRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UpdateEndDeviceRequestValidationError{} + +// ValidateFields checks the field values on GetEndDeviceRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GetEndDeviceRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GetEndDeviceRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "end_device_ids": + + if v, ok := interface{}(&m.EndDeviceIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GetEndDeviceRequestValidationError{ + field: "end_device_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GetEndDeviceRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return GetEndDeviceRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GetEndDeviceRequestValidationError is the validation error returned by +// GetEndDeviceRequest.ValidateFields if the designated constraints aren't met. +type GetEndDeviceRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetEndDeviceRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetEndDeviceRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetEndDeviceRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetEndDeviceRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetEndDeviceRequestValidationError) ErrorName() string { + return "GetEndDeviceRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetEndDeviceRequestValidationError) 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 %sGetEndDeviceRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetEndDeviceRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetEndDeviceRequestValidationError{} + +// ValidateFields checks the field values on ListEndDevicesRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ListEndDevicesRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ListEndDevicesRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "application_ids": + + if v, ok := interface{}(&m.ApplicationIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ListEndDevicesRequestValidationError{ + field: "application_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ListEndDevicesRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "order": + // no validation rules for Order + case "limit": + // no validation rules for Limit + case "page": + // no validation rules for Page + default: + return ListEndDevicesRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ListEndDevicesRequestValidationError is the validation error returned by +// ListEndDevicesRequest.ValidateFields if the designated constraints aren't met. +type ListEndDevicesRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListEndDevicesRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListEndDevicesRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListEndDevicesRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListEndDevicesRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListEndDevicesRequestValidationError) ErrorName() string { + return "ListEndDevicesRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e ListEndDevicesRequestValidationError) 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 %sListEndDevicesRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListEndDevicesRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListEndDevicesRequestValidationError{} + +// ValidateFields checks the field values on SetEndDeviceRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *SetEndDeviceRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = SetEndDeviceRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "end_device": + + if v, ok := interface{}(&m.EndDevice).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SetEndDeviceRequestValidationError{ + field: "end_device", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SetEndDeviceRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return SetEndDeviceRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// SetEndDeviceRequestValidationError is the validation error returned by +// SetEndDeviceRequest.ValidateFields if the designated constraints aren't met. +type SetEndDeviceRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SetEndDeviceRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SetEndDeviceRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SetEndDeviceRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SetEndDeviceRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SetEndDeviceRequestValidationError) ErrorName() string { + return "SetEndDeviceRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e SetEndDeviceRequestValidationError) 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 %sSetEndDeviceRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SetEndDeviceRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SetEndDeviceRequestValidationError{} + +// ValidateFields checks the field values on MACParameters_Channel with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACParameters_Channel) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACParameters_ChannelFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "uplink_frequency": + + if m.GetUplinkFrequency() < 100000 { + return MACParameters_ChannelValidationError{ + field: "uplink_frequency", + reason: "value must be greater than or equal to 100000", + } + } + + case "downlink_frequency": + + if m.GetDownlinkFrequency() < 100000 { + return MACParameters_ChannelValidationError{ + field: "downlink_frequency", + reason: "value must be greater than or equal to 100000", + } + } + + case "min_data_rate_index": + + if _, ok := DataRateIndex_name[int32(m.GetMinDataRateIndex())]; !ok { + return MACParameters_ChannelValidationError{ + field: "min_data_rate_index", + reason: "value must be one of the defined enum values", + } + } + + case "max_data_rate_index": + + if _, ok := DataRateIndex_name[int32(m.GetMaxDataRateIndex())]; !ok { + return MACParameters_ChannelValidationError{ + field: "max_data_rate_index", + reason: "value must be one of the defined enum values", + } + } + + case "enable_uplink": + // no validation rules for EnableUplink + default: + return MACParameters_ChannelValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACParameters_ChannelValidationError is the validation error returned by +// MACParameters_Channel.ValidateFields if the designated constraints aren't met. +type MACParameters_ChannelValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACParameters_ChannelValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACParameters_ChannelValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACParameters_ChannelValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACParameters_ChannelValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACParameters_ChannelValidationError) ErrorName() string { + return "MACParameters_ChannelValidationError" +} + +// Error satisfies the builtin error interface +func (e MACParameters_ChannelValidationError) 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 %sMACParameters_Channel.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACParameters_ChannelValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACParameters_ChannelValidationError{} + +// ValidateFields checks the field values on MACSettings_DataRateIndexValue +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *MACSettings_DataRateIndexValue) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACSettings_DataRateIndexValueFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "value": + + if _, ok := DataRateIndex_name[int32(m.GetValue())]; !ok { + return MACSettings_DataRateIndexValueValidationError{ + field: "value", + reason: "value must be one of the defined enum values", + } + } + + default: + return MACSettings_DataRateIndexValueValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACSettings_DataRateIndexValueValidationError is the validation error +// returned by MACSettings_DataRateIndexValue.ValidateFields if the designated +// constraints aren't met. +type MACSettings_DataRateIndexValueValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACSettings_DataRateIndexValueValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACSettings_DataRateIndexValueValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACSettings_DataRateIndexValueValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACSettings_DataRateIndexValueValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACSettings_DataRateIndexValueValidationError) ErrorName() string { + return "MACSettings_DataRateIndexValueValidationError" +} + +// Error satisfies the builtin error interface +func (e MACSettings_DataRateIndexValueValidationError) 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 %sMACSettings_DataRateIndexValue.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACSettings_DataRateIndexValueValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACSettings_DataRateIndexValueValidationError{} + +// ValidateFields checks the field values on MACSettings_PingSlotPeriodValue +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *MACSettings_PingSlotPeriodValue) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACSettings_PingSlotPeriodValueFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "value": + + if _, ok := PingSlotPeriod_name[int32(m.GetValue())]; !ok { + return MACSettings_PingSlotPeriodValueValidationError{ + field: "value", + reason: "value must be one of the defined enum values", + } + } + + default: + return MACSettings_PingSlotPeriodValueValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACSettings_PingSlotPeriodValueValidationError is the validation error +// returned by MACSettings_PingSlotPeriodValue.ValidateFields if the +// designated constraints aren't met. +type MACSettings_PingSlotPeriodValueValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACSettings_PingSlotPeriodValueValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACSettings_PingSlotPeriodValueValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACSettings_PingSlotPeriodValueValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACSettings_PingSlotPeriodValueValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACSettings_PingSlotPeriodValueValidationError) ErrorName() string { + return "MACSettings_PingSlotPeriodValueValidationError" +} + +// Error satisfies the builtin error interface +func (e MACSettings_PingSlotPeriodValueValidationError) 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 %sMACSettings_PingSlotPeriodValue.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACSettings_PingSlotPeriodValueValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACSettings_PingSlotPeriodValueValidationError{} + +// ValidateFields checks the field values on +// MACSettings_AggregatedDutyCycleValue with the rules defined in the proto +// definition for this message. If any rules are violated, an error is returned. +func (m *MACSettings_AggregatedDutyCycleValue) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACSettings_AggregatedDutyCycleValueFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "value": + + if _, ok := AggregatedDutyCycle_name[int32(m.GetValue())]; !ok { + return MACSettings_AggregatedDutyCycleValueValidationError{ + field: "value", + reason: "value must be one of the defined enum values", + } + } + + default: + return MACSettings_AggregatedDutyCycleValueValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACSettings_AggregatedDutyCycleValueValidationError is the validation error +// returned by MACSettings_AggregatedDutyCycleValue.ValidateFields if the +// designated constraints aren't met. +type MACSettings_AggregatedDutyCycleValueValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACSettings_AggregatedDutyCycleValueValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACSettings_AggregatedDutyCycleValueValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACSettings_AggregatedDutyCycleValueValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACSettings_AggregatedDutyCycleValueValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACSettings_AggregatedDutyCycleValueValidationError) ErrorName() string { + return "MACSettings_AggregatedDutyCycleValueValidationError" +} + +// Error satisfies the builtin error interface +func (e MACSettings_AggregatedDutyCycleValueValidationError) 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 %sMACSettings_AggregatedDutyCycleValue.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACSettings_AggregatedDutyCycleValueValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACSettings_AggregatedDutyCycleValueValidationError{} + +// ValidateFields checks the field values on MACSettings_RxDelayValue with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACSettings_RxDelayValue) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACSettings_RxDelayValueFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "value": + + if _, ok := RxDelay_name[int32(m.GetValue())]; !ok { + return MACSettings_RxDelayValueValidationError{ + field: "value", + reason: "value must be one of the defined enum values", + } + } + + default: + return MACSettings_RxDelayValueValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACSettings_RxDelayValueValidationError is the validation error returned by +// MACSettings_RxDelayValue.ValidateFields if the designated constraints +// aren't met. +type MACSettings_RxDelayValueValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACSettings_RxDelayValueValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACSettings_RxDelayValueValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACSettings_RxDelayValueValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACSettings_RxDelayValueValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACSettings_RxDelayValueValidationError) ErrorName() string { + return "MACSettings_RxDelayValueValidationError" +} + +// Error satisfies the builtin error interface +func (e MACSettings_RxDelayValueValidationError) 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 %sMACSettings_RxDelayValue.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACSettings_RxDelayValueValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACSettings_RxDelayValueValidationError{} + +// ValidateFields checks the field values on MACState_JoinAccept with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACState_JoinAccept) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACState_JoinAcceptFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "payload": + + if l := len(m.GetPayload()); l < 17 || l > 33 { + return MACState_JoinAcceptValidationError{ + field: "payload", + reason: "value length must be between 17 and 33 bytes, inclusive", + } + } + + case "request": + + if v, ok := interface{}(&m.Request).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACState_JoinAcceptValidationError{ + field: "request", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "keys": + + if v, ok := interface{}(&m.Keys).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACState_JoinAcceptValidationError{ + field: "keys", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return MACState_JoinAcceptValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACState_JoinAcceptValidationError is the validation error returned by +// MACState_JoinAccept.ValidateFields if the designated constraints aren't met. +type MACState_JoinAcceptValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACState_JoinAcceptValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACState_JoinAcceptValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACState_JoinAcceptValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACState_JoinAcceptValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACState_JoinAcceptValidationError) ErrorName() string { + return "MACState_JoinAcceptValidationError" +} + +// Error satisfies the builtin error interface +func (e MACState_JoinAcceptValidationError) 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 %sMACState_JoinAccept.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACState_JoinAcceptValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACState_JoinAcceptValidationError{} diff --git a/pkg/ttnpb/end_device.validator.pb.go b/pkg/ttnpb/end_device.validator.pb.go deleted file mode 100644 index 618e5da7ec..0000000000 --- a/pkg/ttnpb/end_device.validator.pb.go +++ /dev/null @@ -1,406 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/end_device.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import regexp "regexp" -import fmt "fmt" -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/duration" -import _ "github.com/golang/protobuf/ptypes/struct" -import _ "github.com/golang/protobuf/ptypes/timestamp" -import _ "github.com/golang/protobuf/ptypes/wrappers" -import _ "github.com/mwitkow/go-proto-validators" -import _ "google.golang.org/genproto/googleapis/api/annotations" -import _ "google.golang.org/genproto/protobuf/field_mask" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *Session) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.SessionKeys)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("SessionKeys", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.StartedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("StartedAt", err) - } - return nil -} -func (this *MACParameters) Validate() error { - for _, item := range this.Channels { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Channels", err) - } - } - } - return nil -} -func (this *MACParameters_Channel) Validate() error { - return nil -} -func (this *EndDeviceBrand) Validate() error { - return nil -} -func (this *EndDeviceModel) Validate() error { - return nil -} - -var _regex_EndDeviceVersionIdentifiers_BrandID = regexp.MustCompile(`^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$`) -var _regex_EndDeviceVersionIdentifiers_ModelID = regexp.MustCompile(`^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$`) - -func (this *EndDeviceVersionIdentifiers) Validate() error { - if !_regex_EndDeviceVersionIdentifiers_BrandID.MatchString(this.BrandID) { - return github_com_mwitkow_go_proto_validators.FieldError("BrandID", fmt.Errorf(`value '%v' must be a string conforming to regex "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$"`, this.BrandID)) - } - if !(len(this.BrandID) < 37) { - return github_com_mwitkow_go_proto_validators.FieldError("BrandID", fmt.Errorf(`value '%v' must length be less than '37'`, this.BrandID)) - } - if !_regex_EndDeviceVersionIdentifiers_ModelID.MatchString(this.ModelID) { - return github_com_mwitkow_go_proto_validators.FieldError("ModelID", fmt.Errorf(`value '%v' must be a string conforming to regex "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$"`, this.ModelID)) - } - if !(len(this.ModelID) < 37) { - return github_com_mwitkow_go_proto_validators.FieldError("ModelID", fmt.Errorf(`value '%v' must length be less than '37'`, this.ModelID)) - } - return nil -} -func (this *EndDeviceVersion) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.EndDeviceVersionIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("EndDeviceVersionIdentifiers", err) - } - if this.DefaultMACSettings != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.DefaultMACSettings); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DefaultMACSettings", err) - } - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.DefaultFormatters)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DefaultFormatters", err) - } - return nil -} -func (this *MACSettings) Validate() error { - if this.ClassBTimeout != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ClassBTimeout); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ClassBTimeout", err) - } - } - if this.PingSlotPeriodicity != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.PingSlotPeriodicity); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("PingSlotPeriodicity", err) - } - } - if this.PingSlotDataRateIndex != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.PingSlotDataRateIndex); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("PingSlotDataRateIndex", err) - } - } - if this.ClassCTimeout != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ClassCTimeout); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ClassCTimeout", err) - } - } - if this.Rx1Delay != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Rx1Delay); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Rx1Delay", err) - } - } - if this.Rx1DataRateOffset != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Rx1DataRateOffset); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Rx1DataRateOffset", err) - } - } - if this.Rx2DataRateIndex != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Rx2DataRateIndex); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Rx2DataRateIndex", err) - } - } - if this.MaxDutyCycle != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.MaxDutyCycle); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("MaxDutyCycle", err) - } - } - if this.Supports32BitFCnt != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Supports32BitFCnt); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Supports32BitFCnt", err) - } - } - if this.UseADR != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.UseADR); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UseADR", err) - } - } - if this.ADRMargin != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ADRMargin); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ADRMargin", err) - } - } - if this.ResetsFCnt != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ResetsFCnt); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ResetsFCnt", err) - } - } - if this.StatusTimePeriodicity != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.StatusTimePeriodicity); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("StatusTimePeriodicity", err) - } - } - if this.StatusCountPeriodicity != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.StatusCountPeriodicity); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("StatusCountPeriodicity", err) - } - } - if this.DesiredRx1Delay != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.DesiredRx1Delay); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DesiredRx1Delay", err) - } - } - if this.DesiredRx1DataRateOffset != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.DesiredRx1DataRateOffset); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DesiredRx1DataRateOffset", err) - } - } - if this.DesiredRx2DataRateIndex != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.DesiredRx2DataRateIndex); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DesiredRx2DataRateIndex", err) - } - } - return nil -} -func (this *MACSettings_DataRateIndexValue) Validate() error { - return nil -} -func (this *MACSettings_PingSlotPeriodValue) Validate() error { - return nil -} -func (this *MACSettings_AggregatedDutyCycleValue) Validate() error { - return nil -} -func (this *MACSettings_RxDelayValue) Validate() error { - return nil -} -func (this *MACState) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.CurrentParameters)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("CurrentParameters", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.DesiredParameters)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DesiredParameters", err) - } - if this.LastConfirmedDownlinkAt != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.LastConfirmedDownlinkAt); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("LastConfirmedDownlinkAt", err) - } - } - if this.PendingApplicationDownlink != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.PendingApplicationDownlink); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("PendingApplicationDownlink", err) - } - } - for _, item := range this.QueuedResponses { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("QueuedResponses", err) - } - } - } - for _, item := range this.PendingRequests { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("PendingRequests", err) - } - } - } - if this.QueuedJoinAccept != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.QueuedJoinAccept); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("QueuedJoinAccept", err) - } - } - if this.PendingJoinRequest != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.PendingJoinRequest); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("PendingJoinRequest", err) - } - } - return nil -} -func (this *MACState_JoinAccept) Validate() error { - if !(len(this.Payload) > 11) { - return github_com_mwitkow_go_proto_validators.FieldError("Payload", fmt.Errorf(`value '%v' must length be greater than '11'`, this.Payload)) - } - if !(len(this.Payload) < 29) { - return github_com_mwitkow_go_proto_validators.FieldError("Payload", fmt.Errorf(`value '%v' must length be less than '29'`, this.Payload)) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Request)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Request", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Keys)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Keys", err) - } - return nil -} - -var _regex_EndDevice_NetworkServerAddress = regexp.MustCompile(`^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$`) -var _regex_EndDevice_ApplicationServerAddress = regexp.MustCompile(`^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$`) -var _regex_EndDevice_JoinServerAddress = regexp.MustCompile(`^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$`) -var _regex_EndDevice_ProvisionerID = regexp.MustCompile(`^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$`) - -func (this *EndDevice) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.EndDeviceIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("EndDeviceIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.CreatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("CreatedAt", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UpdatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UpdatedAt", err) - } - // Validation of proto3 map<> fields is unsupported. - if this.VersionIDs != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.VersionIDs); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("VersionIDs", err) - } - } - if !_regex_EndDevice_NetworkServerAddress.MatchString(this.NetworkServerAddress) { - return github_com_mwitkow_go_proto_validators.FieldError("NetworkServerAddress", fmt.Errorf(`value '%v' must be a string conforming to regex "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"`, this.NetworkServerAddress)) - } - if !_regex_EndDevice_ApplicationServerAddress.MatchString(this.ApplicationServerAddress) { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationServerAddress", fmt.Errorf(`value '%v' must be a string conforming to regex "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"`, this.ApplicationServerAddress)) - } - if !_regex_EndDevice_JoinServerAddress.MatchString(this.JoinServerAddress) { - return github_com_mwitkow_go_proto_validators.FieldError("JoinServerAddress", fmt.Errorf(`value '%v' must be a string conforming to regex "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"`, this.JoinServerAddress)) - } - // Validation of proto3 map<> fields is unsupported. - if this.RootKeys != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.RootKeys); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("RootKeys", err) - } - } - if this.MACSettings != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.MACSettings); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("MACSettings", err) - } - } - if this.MACState != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.MACState); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("MACState", err) - } - } - if this.Session != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Session); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Session", err) - } - } - if this.PendingSession != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.PendingSession); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("PendingSession", err) - } - } - if this.LastDevStatusReceivedAt != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.LastDevStatusReceivedAt); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("LastDevStatusReceivedAt", err) - } - } - for _, item := range this.RecentADRUplinks { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("RecentADRUplinks", err) - } - } - } - for _, item := range this.RecentUplinks { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("RecentUplinks", err) - } - } - } - for _, item := range this.RecentDownlinks { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("RecentDownlinks", err) - } - } - } - for _, item := range this.QueuedApplicationDownlinks { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("QueuedApplicationDownlinks", err) - } - } - } - if this.Formatters != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Formatters); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Formatters", err) - } - } - if !_regex_EndDevice_ProvisionerID.MatchString(this.ProvisionerID) { - return github_com_mwitkow_go_proto_validators.FieldError("ProvisionerID", fmt.Errorf(`value '%v' must be a string conforming to regex "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$"`, this.ProvisionerID)) - } - if !(len(this.ProvisionerID) < 37) { - return github_com_mwitkow_go_proto_validators.FieldError("ProvisionerID", fmt.Errorf(`value '%v' must length be less than '37'`, this.ProvisionerID)) - } - if this.ProvisioningData != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ProvisioningData); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ProvisioningData", err) - } - } - return nil -} -func (this *EndDevices) Validate() error { - for _, item := range this.EndDevices { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("EndDevices", err) - } - } - } - return nil -} -func (this *CreateEndDeviceRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.EndDevice)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("EndDevice", err) - } - return nil -} -func (this *UpdateEndDeviceRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.EndDevice)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("EndDevice", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *GetEndDeviceRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.EndDeviceIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("EndDeviceIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *ListEndDevicesRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ApplicationIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *SetEndDeviceRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.EndDevice)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("EndDevice", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} diff --git a/pkg/ttnpb/end_device_populate.go b/pkg/ttnpb/end_device_populate.go index 607254baa6..c246a95623 100644 --- a/pkg/ttnpb/end_device_populate.go +++ b/pkg/ttnpb/end_device_populate.go @@ -86,7 +86,6 @@ func NewPopulatedEndDevice(r randyEndDevice, easy bool) *EndDevice { copy(out.EndDeviceIdentifiers.DevAddr[:], out.Session.DevAddr[:]) } - out.BatteryPercentage = r.Float32() out.FrequencyPlanID = "EU_863_870" out.MACSettings = NewPopulatedMACSettings(r, easy) out.MACState = NewPopulatedMACState(r, easy) @@ -136,7 +135,11 @@ func NewPopulatedEndDevice(r randyEndDevice, easy bool) *EndDevice { } } out.LastDevStatusReceivedAt = pbtypes.NewPopulatedStdTime(r, easy) - out.BatteryPercentage = r.Float32() + if r.Intn(2) == 0 { + out.BatteryPercentage = &pbtypes.FloatValue{ + Value: float32(r.Intn(100)) / 100, + } + } out.DownlinkMargin = r.Int31() if r.Intn(2) == 0 { out.DownlinkMargin *= -1 @@ -146,19 +149,15 @@ func NewPopulatedEndDevice(r randyEndDevice, easy bool) *EndDevice { return out } -func NewPopulatedFrequency(r randyEndDevice, _ bool) uint64 { - return uint64(r.Int63()) + uint64(r.Int63()) -} - -func NewPopulatedMACParameters_Channel(r randyEndDevice, _ bool) *MACParameters_Channel { - drMin := NewPopulatedDataRateIndex(r, false) - drMax := NewPopulatedDataRateIndex(r, false) +func NewPopulatedMACParameters_Channel(r randyEndDevice, easy bool) *MACParameters_Channel { + drMin := NewPopulatedDataRateIndex(r, easy) + drMax := NewPopulatedDataRateIndex(r, easy) if drMax < drMin { drMax, drMin = drMin, drMax } return &MACParameters_Channel{ - UplinkFrequency: NewPopulatedFrequency(r, false), - DownlinkFrequency: NewPopulatedFrequency(r, false), + UplinkFrequency: NewPopulatedFrequency(r, easy), + DownlinkFrequency: NewPopulatedFrequency(r, easy), MinDataRateIndex: drMin, MaxDataRateIndex: drMax, } @@ -169,11 +168,11 @@ func NewPopulatedMACParameters(r randyEndDevice, easy bool) *MACParameters { out.MaxEIRP = r.Float32() out.UplinkDwellTime = r.Intn(2) == 0 out.DownlinkDwellTime = r.Intn(2) == 0 - out.ADRDataRateIndex = NewPopulatedDataRateIndex(r, false) - out.ADRTxPowerIndex = r.Uint32() - out.ADRNbTrans = r.Uint32() - out.ADRAckLimit = r.Uint32() - out.ADRAckDelay = r.Uint32() + out.ADRDataRateIndex = NewPopulatedDataRateIndex(r, easy) + out.ADRTxPowerIndex = r.Uint32() % 16 + out.ADRNbTrans = 1 + r.Uint32()%15 + out.ADRAckLimit = 1 + r.Uint32()%32768 + out.ADRAckDelay = 1 + r.Uint32()%32768 out.MaxDutyCycle = AggregatedDutyCycle([]int32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}[r.Intn(16)]) out.Channels = make([]*MACParameters_Channel, r.Intn(255)) for i := range out.Channels { @@ -181,11 +180,11 @@ func NewPopulatedMACParameters(r randyEndDevice, easy bool) *MACParameters { } out.Rx1Delay = RxDelay(r.Uint32() % 16) out.Rx1DataRateOffset = r.Uint32() % 6 - out.Rx2DataRateIndex = NewPopulatedDataRateIndex(r, false) - out.Rx2Frequency = NewPopulatedFrequency(r, false) + out.Rx2DataRateIndex = NewPopulatedDataRateIndex(r, easy) + out.Rx2Frequency = NewPopulatedFrequency(r, easy) out.RejoinTimePeriodicity = RejoinTimeExponent([]int32{0, 1, 2, 3, 4, 5, 6, 7}[r.Intn(8)]) - out.PingSlotFrequency = NewPopulatedFrequency(r, false) - out.PingSlotDataRateIndex = NewPopulatedDataRateIndex(r, false) - out.BeaconFrequency = NewPopulatedFrequency(r, false) + out.PingSlotFrequency = NewPopulatedFrequency(r, easy) + out.PingSlotDataRateIndex = NewPopulatedDataRateIndex(r, easy) + out.BeaconFrequency = NewPopulatedFrequency(r, easy) return out } diff --git a/pkg/ttnpb/end_device_services.pb.gw.go b/pkg/ttnpb/end_device_services.pb.gw.go index f8c78ce6bf..04b09d6e33 100644 --- a/pkg/ttnpb/end_device_services.pb.gw.go +++ b/pkg/ttnpb/end_device_services.pb.gw.go @@ -9,11 +9,10 @@ It translates gRPC into RESTful JSON APIs. package ttnpb import ( + "context" "io" "net/http" - "context" - "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" diff --git a/pkg/ttnpb/end_device_services.pb.validate.go b/pkg/ttnpb/end_device_services.pb.validate.go new file mode 100644 index 0000000000..fb43d9d432 --- /dev/null +++ b/pkg/ttnpb/end_device_services.pb.validate.go @@ -0,0 +1,33 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) diff --git a/pkg/ttnpb/end_device_services.validator.pb.go b/pkg/ttnpb/end_device_services.validator.pb.go deleted file mode 100644 index 5ca1a0363b..0000000000 --- a/pkg/ttnpb/end_device_services.validator.pb.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/end_device_services.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/empty" -import _ "google.golang.org/genproto/googleapis/api/annotations" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen diff --git a/pkg/ttnpb/enums.pb.validate.go b/pkg/ttnpb/enums.pb.validate.go new file mode 100644 index 0000000000..fb43d9d432 --- /dev/null +++ b/pkg/ttnpb/enums.pb.validate.go @@ -0,0 +1,33 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) diff --git a/pkg/ttnpb/enums.validator.pb.go b/pkg/ttnpb/enums.validator.pb.go deleted file mode 100644 index f8f4f4a575..0000000000 --- a/pkg/ttnpb/enums.validator.pb.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/enums.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen diff --git a/pkg/ttnpb/error.pb.paths.fm.go b/pkg/ttnpb/error.pb.paths.fm.go new file mode 100644 index 0000000000..627b55dba5 --- /dev/null +++ b/pkg/ttnpb/error.pb.paths.fm.go @@ -0,0 +1,26 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var ErrorDetailsFieldPathsNested = []string{ + "attributes", + "cause", + "cause.attributes", + "cause.correlation_id", + "cause.message_format", + "cause.name", + "cause.namespace", + "correlation_id", + "message_format", + "name", + "namespace", +} + +var ErrorDetailsFieldPathsTopLevel = []string{ + "attributes", + "cause", + "correlation_id", + "message_format", + "name", + "namespace", +} diff --git a/pkg/ttnpb/error.pb.fm.go b/pkg/ttnpb/error.pb.setters.fm.go similarity index 84% rename from pkg/ttnpb/error.pb.fm.go rename to pkg/ttnpb/error.pb.setters.fm.go index 65e3d657bd..c464e5ae36 100644 --- a/pkg/ttnpb/error.pb.fm.go +++ b/pkg/ttnpb/error.pb.setters.fm.go @@ -4,29 +4,6 @@ package ttnpb import fmt "fmt" -var ErrorDetailsFieldPathsNested = []string{ - "attributes", - "cause", - "cause.attributes", - "cause.correlation_id", - "cause.message_format", - "cause.name", - "cause.namespace", - "correlation_id", - "message_format", - "name", - "namespace", -} - -var ErrorDetailsFieldPathsTopLevel = []string{ - "attributes", - "cause", - "correlation_id", - "message_format", - "name", - "namespace", -} - func (dst *ErrorDetails) SetFields(src *ErrorDetails, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { diff --git a/pkg/ttnpb/error.pb.validate.go b/pkg/ttnpb/error.pb.validate.go new file mode 100644 index 0000000000..3f6ec99a69 --- /dev/null +++ b/pkg/ttnpb/error.pb.validate.go @@ -0,0 +1,144 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on ErrorDetails with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ErrorDetails) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ErrorDetailsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "namespace": + // no validation rules for Namespace + case "name": + // no validation rules for Name + case "message_format": + // no validation rules for MessageFormat + case "attributes": + + if v, ok := interface{}(m.GetAttributes()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ErrorDetailsValidationError{ + field: "attributes", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "correlation_id": + // no validation rules for CorrelationID + case "cause": + + if v, ok := interface{}(m.GetCause()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ErrorDetailsValidationError{ + field: "cause", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return ErrorDetailsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ErrorDetailsValidationError is the validation error returned by +// ErrorDetails.ValidateFields if the designated constraints aren't met. +type ErrorDetailsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ErrorDetailsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ErrorDetailsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ErrorDetailsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ErrorDetailsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ErrorDetailsValidationError) ErrorName() string { return "ErrorDetailsValidationError" } + +// Error satisfies the builtin error interface +func (e ErrorDetailsValidationError) 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 %sErrorDetails.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ErrorDetailsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ErrorDetailsValidationError{} diff --git a/pkg/ttnpb/error.validator.pb.go b/pkg/ttnpb/error.validator.pb.go deleted file mode 100644 index c1dbf51f3e..0000000000 --- a/pkg/ttnpb/error.validator.pb.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/error.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/struct" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *ErrorDetails) Validate() error { - if this.Attributes != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Attributes); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Attributes", err) - } - } - if this.Cause != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Cause); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Cause", err) - } - } - return nil -} diff --git a/pkg/ttnpb/events.pb.go b/pkg/ttnpb/events.pb.go index 44e83565cb..b6a7d05ee3 100644 --- a/pkg/ttnpb/events.pb.go +++ b/pkg/ttnpb/events.pb.go @@ -9,6 +9,7 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" import _ "google.golang.org/genproto/googleapis/api/annotations" import time "time" @@ -57,7 +58,7 @@ type Event struct { func (m *Event) Reset() { *m = Event{} } func (*Event) ProtoMessage() {} func (*Event) Descriptor() ([]byte, []int) { - return fileDescriptor_events_b4f706794a1378d0, []int{0} + return fileDescriptor_events_a80318beafd0be3c, []int{0} } func (m *Event) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -152,7 +153,7 @@ type StreamEventsRequest struct { func (m *StreamEventsRequest) Reset() { *m = StreamEventsRequest{} } func (*StreamEventsRequest) ProtoMessage() {} func (*StreamEventsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_events_b4f706794a1378d0, []int{1} + return fileDescriptor_events_a80318beafd0be3c, []int{1} } func (m *StreamEventsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1377,52 +1378,54 @@ var ( ) func init() { - proto.RegisterFile("lorawan-stack/api/events.proto", fileDescriptor_events_b4f706794a1378d0) + proto.RegisterFile("lorawan-stack/api/events.proto", fileDescriptor_events_a80318beafd0be3c) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/events.proto", fileDescriptor_events_b4f706794a1378d0) + golang_proto.RegisterFile("lorawan-stack/api/events.proto", fileDescriptor_events_a80318beafd0be3c) } -var fileDescriptor_events_b4f706794a1378d0 = []byte{ - // 629 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x31, 0x4c, 0x1b, 0x4b, - 0x10, 0xdd, 0xc5, 0x67, 0xf3, 0x59, 0xf8, 0x24, 0xda, 0x90, 0xe8, 0x62, 0x45, 0x63, 0xcb, 0x34, - 0x56, 0x14, 0xce, 0x11, 0x48, 0x11, 0x22, 0x69, 0x62, 0x42, 0x81, 0xd2, 0x5d, 0x52, 0xd1, 0x44, - 0x6b, 0x7b, 0x39, 0x4e, 0xb6, 0x77, 0x9d, 0xbb, 0x35, 0xc4, 0x1d, 0x4a, 0x45, 0x89, 0x14, 0x45, - 0x4a, 0x19, 0xa5, 0xa2, 0x8a, 0x28, 0x29, 0x29, 0x29, 0x91, 0x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xe6, 0x00, - 0x83, 0x3a, 0x04, 0x00, 0x00, +var fileDescriptor_events_a80318beafd0be3c = []byte{ + // 667 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x3f, 0x4c, 0x1b, 0x3f, + 0x14, 0xc7, 0xed, 0xfc, 0x43, 0x18, 0x7e, 0xf9, 0x21, 0x97, 0x56, 0x69, 0x54, 0xbd, 0x44, 0x61, + 0x89, 0xaa, 0xe6, 0x52, 0x81, 0x54, 0x55, 0xd0, 0xa5, 0xa1, 0x0c, 0xac, 0xd7, 0x76, 0x61, 0xa9, + 0x9c, 0xc4, 0x39, 0x4e, 0x49, 0xec, 0xf4, 0xce, 0x09, 0xcd, 0x86, 0x3a, 0xa1, 0x4e, 0x48, 0x5d, + 0xba, 0xb5, 0xea, 0xc4, 0xc8, 0x88, 0x3a, 0x31, 0x32, 0x22, 0x75, 0x61, 0xa2, 0xc4, 0xd7, 0x81, + 0x6e, 0x8c, 0x8c, 0x55, 0x7c, 0x47, 0x49, 0x08, 0xaa, 0xba, 0xbd, 0xa7, 0xf7, 0x7d, 0x7e, 0xdf, + 0xf7, 0xb1, 0x4d, 0xa0, 0x25, 0x3d, 0xb6, 0xc5, 0x44, 0xc9, 0x57, 0xac, 0xd6, 0x2c, 0xb3, 0x8e, + 0x5b, 0xe6, 0x3d, 0x2e, 0x94, 0x6f, 0x75, 0x3c, 0xa9, 0x24, 0x4d, 0x2b, 0x25, 0xac, 0x48, 0x63, + 0xf5, 0x96, 0xb2, 0x25, 0xc7, 0x55, 0x9b, 0xdd, 0xaa, 0x55, 0x93, 0xed, 0xb2, 0x23, 0x1d, 0x59, + 0x36, 0xb2, 0x6a, 0xb7, 0x61, 0x32, 0x93, 0x98, 0x28, 0x6c, 0xcf, 0xae, 0x8c, 0xc8, 0x5b, 0xfd, + 0x86, 0x0a, 0xe5, 0xb5, 0x92, 0xc3, 0x45, 0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0xef, 0x32, 0x7e, 0xf8, 0x18, 0x57, 0xbe, 0xe2, 0xa3, 0x01, 0xe0, 0xe3, 0x01, 0xe0, + 0x93, 0x01, 0xa0, 0xb3, 0x01, 0xa0, 0xf3, 0x01, 0xa0, 0x8b, 0x01, 0xa0, 0xcb, 0x01, 0xe0, 0x6d, + 0x0d, 0x78, 0x47, 0x03, 0xda, 0xd3, 0x80, 0xf7, 0x35, 0xa0, 0x03, 0x0d, 0xe8, 0x50, 0x03, 0x3a, + 0xd2, 0x80, 0x8f, 0x35, 0xe0, 0x13, 0x0d, 0xe8, 0x4c, 0x03, 0x3e, 0xd7, 0x80, 0x2e, 0x34, 0xe0, + 0x4b, 0x0d, 0x68, 0x3b, 0x00, 0xb4, 0x13, 0x00, 0xde, 0x0d, 0x00, 0x7d, 0x0a, 0x00, 0x7f, 0x09, + 0x00, 0xed, 0x05, 0x80, 0xf6, 0x03, 0xc0, 0x07, 0x01, 0xe0, 0xc3, 0x00, 0xf0, 0xc6, 0x23, 0x47, + 0x5a, 0x6a, 0x93, 0xab, 0x4d, 0x57, 0x38, 0xbe, 0x25, 0xb8, 0xda, 0x92, 0x5e, 0xb3, 0x3c, 0xfe, + 0xe7, 0x3a, 0x4d, 0xa7, 0xac, 0x94, 0xe8, 0x54, 0xab, 0x29, 0xc3, 0x6a, 0xe9, 0x77, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x1c, 0xb1, 0x53, 0xa9, 0x8b, 0x04, 0x00, 0x00, } diff --git a/pkg/ttnpb/events.pb.gw.go b/pkg/ttnpb/events.pb.gw.go index 446a988a37..ada408e051 100644 --- a/pkg/ttnpb/events.pb.gw.go +++ b/pkg/ttnpb/events.pb.gw.go @@ -9,11 +9,10 @@ It translates gRPC into RESTful JSON APIs. package ttnpb import ( + "context" "io" "net/http" - "context" - "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" diff --git a/pkg/ttnpb/events.pb.paths.fm.go b/pkg/ttnpb/events.pb.paths.fm.go new file mode 100644 index 0000000000..a196e17b2f --- /dev/null +++ b/pkg/ttnpb/events.pb.paths.fm.go @@ -0,0 +1,36 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var EventFieldPathsNested = []string{ + "context", + "correlation_ids", + "data", + "identifiers", + "identifiers.entity_identifiers", + "name", + "origin", + "time", +} + +var EventFieldPathsTopLevel = []string{ + "context", + "correlation_ids", + "data", + "identifiers", + "name", + "origin", + "time", +} +var StreamEventsRequestFieldPathsNested = []string{ + "after", + "identifiers", + "identifiers.entity_identifiers", + "tail", +} + +var StreamEventsRequestFieldPathsTopLevel = []string{ + "after", + "identifiers", + "tail", +} diff --git a/pkg/ttnpb/events.pb.fm.go b/pkg/ttnpb/events.pb.setters.fm.go similarity index 86% rename from pkg/ttnpb/events.pb.fm.go rename to pkg/ttnpb/events.pb.setters.fm.go index f5c6dbb66a..f4a8d54440 100644 --- a/pkg/ttnpb/events.pb.fm.go +++ b/pkg/ttnpb/events.pb.setters.fm.go @@ -7,27 +7,6 @@ import ( time "time" ) -var EventFieldPathsNested = []string{ - "context", - "correlation_ids", - "data", - "identifiers", - "identifiers.entity_identifiers", - "name", - "origin", - "time", -} - -var EventFieldPathsTopLevel = []string{ - "context", - "correlation_ids", - "data", - "identifiers", - "name", - "origin", - "time", -} - func (dst *Event) SetFields(src *Event, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -117,19 +96,6 @@ func (dst *Event) SetFields(src *Event, paths ...string) error { return nil } -var StreamEventsRequestFieldPathsNested = []string{ - "after", - "identifiers", - "identifiers.entity_identifiers", - "tail", -} - -var StreamEventsRequestFieldPathsTopLevel = []string{ - "after", - "identifiers", - "tail", -} - func (dst *StreamEventsRequest) SetFields(src *StreamEventsRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { diff --git a/pkg/ttnpb/events.pb.validate.go b/pkg/ttnpb/events.pb.validate.go new file mode 100644 index 0000000000..54053f1a03 --- /dev/null +++ b/pkg/ttnpb/events.pb.validate.go @@ -0,0 +1,263 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on Event with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *Event) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = EventFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "name": + // no validation rules for Name + case "time": + + if v, ok := interface{}(&m.Time).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EventValidationError{ + field: "time", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "identifiers": + + if v, ok := interface{}(m.GetIdentifiers()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EventValidationError{ + field: "identifiers", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "data": + + if v, ok := interface{}(m.GetData()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EventValidationError{ + field: "data", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "correlation_ids": + + case "origin": + // no validation rules for Origin + case "context": + // no validation rules for Context + default: + return EventValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// EventValidationError is the validation error returned by +// Event.ValidateFields if the designated constraints aren't met. +type EventValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e EventValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e EventValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e EventValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e EventValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e EventValidationError) ErrorName() string { return "EventValidationError" } + +// Error satisfies the builtin error interface +func (e EventValidationError) 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 %sEvent.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = EventValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = EventValidationError{} + +// ValidateFields checks the field values on StreamEventsRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *StreamEventsRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = StreamEventsRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "identifiers": + + if v, ok := interface{}(&m.Identifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return StreamEventsRequestValidationError{ + field: "identifiers", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "tail": + // no validation rules for Tail + case "after": + + if v, ok := interface{}(m.GetAfter()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return StreamEventsRequestValidationError{ + field: "after", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return StreamEventsRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// StreamEventsRequestValidationError is the validation error returned by +// StreamEventsRequest.ValidateFields if the designated constraints aren't met. +type StreamEventsRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e StreamEventsRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e StreamEventsRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e StreamEventsRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e StreamEventsRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e StreamEventsRequestValidationError) ErrorName() string { + return "StreamEventsRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e StreamEventsRequestValidationError) 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 %sStreamEventsRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = StreamEventsRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = StreamEventsRequestValidationError{} diff --git a/pkg/ttnpb/events.validator.pb.go b/pkg/ttnpb/events.validator.pb.go deleted file mode 100644 index 92f5df6eb5..0000000000 --- a/pkg/ttnpb/events.validator.pb.go +++ /dev/null @@ -1,50 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/events.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/any" -import _ "github.com/golang/protobuf/ptypes/timestamp" -import _ "google.golang.org/genproto/googleapis/api/annotations" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *Event) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Time)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Time", err) - } - if this.Identifiers != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Identifiers); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Identifiers", err) - } - } - if this.Data != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Data); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Data", err) - } - } - // Validation of proto3 map<> fields is unsupported. - return nil -} -func (this *StreamEventsRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Identifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Identifiers", err) - } - if this.After != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.After); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("After", err) - } - } - return nil -} diff --git a/pkg/ttnpb/fieldmask_utils.go b/pkg/ttnpb/fieldmask_utils.go index d5b3f1bbcb..0ca1adda3d 100644 --- a/pkg/ttnpb/fieldmask_utils.go +++ b/pkg/ttnpb/fieldmask_utils.go @@ -108,3 +108,11 @@ func ProhibitFields(requested []string, search ...string) error { } return nil } + +func fieldsWithPrefix(prefix string, paths ...string) []string { + ret := make([]string, 0, len(paths)) + for _, p := range paths { + ret = append(ret, prefix+"."+p) + } + return ret +} diff --git a/pkg/ttnpb/gateway.go b/pkg/ttnpb/gateway.go new file mode 100644 index 0000000000..c958988ef9 --- /dev/null +++ b/pkg/ttnpb/gateway.go @@ -0,0 +1,29 @@ +// Copyright © 2019 The Things Network Foundation, The Things Industries B.V. +// +// 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. + +package ttnpb + +import ( + "context" +) + +// ValidateContext wraps the generated validator with (optionally context-based) custom checks. +func (m *UpdateGatewayRequest) ValidateContext(context.Context) error { + if len(m.FieldMask.Paths) == 0 { + return m.ValidateFields() + } + return m.ValidateFields(append(fieldsWithPrefix("gateway", m.FieldMask.Paths...), + "gateway.ids", + )...) +} diff --git a/pkg/ttnpb/gateway.pb.go b/pkg/ttnpb/gateway.pb.go index 0ee5a3574a..b45c34fe33 100644 --- a/pkg/ttnpb/gateway.pb.go +++ b/pkg/ttnpb/gateway.pb.go @@ -9,7 +9,7 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import types "github.com/gogo/protobuf/types" -import _ "github.com/mwitkow/go-proto-validators" +import _ "github.com/lyft/protoc-gen-validate/validate" import time "time" import go_thethings_network_lorawan_stack_pkg_types "go.thethings.network/lorawan-stack/pkg/types" @@ -49,7 +49,7 @@ type GatewayBrand struct { func (m *GatewayBrand) Reset() { *m = GatewayBrand{} } func (*GatewayBrand) ProtoMessage() {} func (*GatewayBrand) Descriptor() ([]byte, []int) { - return fileDescriptor_gateway_31a6f1d9453c83a3, []int{0} + return fileDescriptor_gateway_65378ed07c220f51, []int{0} } func (m *GatewayBrand) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -117,7 +117,7 @@ type GatewayModel struct { func (m *GatewayModel) Reset() { *m = GatewayModel{} } func (*GatewayModel) ProtoMessage() {} func (*GatewayModel) Descriptor() ([]byte, []int) { - return fileDescriptor_gateway_31a6f1d9453c83a3, []int{1} + return fileDescriptor_gateway_65378ed07c220f51, []int{1} } func (m *GatewayModel) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -180,7 +180,7 @@ type GatewayVersionIdentifiers struct { func (m *GatewayVersionIdentifiers) Reset() { *m = GatewayVersionIdentifiers{} } func (*GatewayVersionIdentifiers) ProtoMessage() {} func (*GatewayVersionIdentifiers) Descriptor() ([]byte, []int) { - return fileDescriptor_gateway_31a6f1d9453c83a3, []int{2} + return fileDescriptor_gateway_65378ed07c220f51, []int{2} } func (m *GatewayVersionIdentifiers) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -250,7 +250,7 @@ type GatewayRadio struct { func (m *GatewayRadio) Reset() { *m = GatewayRadio{} } func (*GatewayRadio) ProtoMessage() {} func (*GatewayRadio) Descriptor() ([]byte, []int) { - return fileDescriptor_gateway_31a6f1d9453c83a3, []int{3} + return fileDescriptor_gateway_65378ed07c220f51, []int{3} } func (m *GatewayRadio) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -325,7 +325,7 @@ type GatewayRadio_TxConfiguration struct { func (m *GatewayRadio_TxConfiguration) Reset() { *m = GatewayRadio_TxConfiguration{} } func (*GatewayRadio_TxConfiguration) ProtoMessage() {} func (*GatewayRadio_TxConfiguration) Descriptor() ([]byte, []int) { - return fileDescriptor_gateway_31a6f1d9453c83a3, []int{3, 0} + return fileDescriptor_gateway_65378ed07c220f51, []int{3, 0} } func (m *GatewayRadio_TxConfiguration) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -390,7 +390,7 @@ type GatewayVersion struct { func (m *GatewayVersion) Reset() { *m = GatewayVersion{} } func (*GatewayVersion) ProtoMessage() {} func (*GatewayVersion) Descriptor() ([]byte, []int) { - return fileDescriptor_gateway_31a6f1d9453c83a3, []int{4} + return fileDescriptor_gateway_65378ed07c220f51, []int{4} } func (m *GatewayVersion) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -480,7 +480,7 @@ type Gateway struct { func (m *Gateway) Reset() { *m = Gateway{} } func (*Gateway) ProtoMessage() {} func (*Gateway) Descriptor() ([]byte, []int) { - return fileDescriptor_gateway_31a6f1d9453c83a3, []int{5} + return fileDescriptor_gateway_65378ed07c220f51, []int{5} } func (m *Gateway) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -630,7 +630,7 @@ type Gateways struct { func (m *Gateways) Reset() { *m = Gateways{} } func (*Gateways) ProtoMessage() {} func (*Gateways) Descriptor() ([]byte, []int) { - return fileDescriptor_gateway_31a6f1d9453c83a3, []int{6} + return fileDescriptor_gateway_65378ed07c220f51, []int{6} } func (m *Gateways) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -676,7 +676,7 @@ type GetGatewayRequest struct { func (m *GetGatewayRequest) Reset() { *m = GetGatewayRequest{} } func (*GetGatewayRequest) ProtoMessage() {} func (*GetGatewayRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_gateway_31a6f1d9453c83a3, []int{7} + return fileDescriptor_gateway_65378ed07c220f51, []int{7} } func (m *GetGatewayRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -721,7 +721,7 @@ type GetGatewayIdentifiersForEUIRequest struct { func (m *GetGatewayIdentifiersForEUIRequest) Reset() { *m = GetGatewayIdentifiersForEUIRequest{} } func (*GetGatewayIdentifiersForEUIRequest) ProtoMessage() {} func (*GetGatewayIdentifiersForEUIRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_gateway_31a6f1d9453c83a3, []int{8} + return fileDescriptor_gateway_65378ed07c220f51, []int{8} } func (m *GetGatewayIdentifiersForEUIRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -767,7 +767,7 @@ type ListGatewaysRequest struct { func (m *ListGatewaysRequest) Reset() { *m = ListGatewaysRequest{} } func (*ListGatewaysRequest) ProtoMessage() {} func (*ListGatewaysRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_gateway_31a6f1d9453c83a3, []int{9} + return fileDescriptor_gateway_65378ed07c220f51, []int{9} } func (m *ListGatewaysRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -842,7 +842,7 @@ type CreateGatewayRequest struct { func (m *CreateGatewayRequest) Reset() { *m = CreateGatewayRequest{} } func (*CreateGatewayRequest) ProtoMessage() {} func (*CreateGatewayRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_gateway_31a6f1d9453c83a3, []int{10} + return fileDescriptor_gateway_65378ed07c220f51, []int{10} } func (m *CreateGatewayRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -888,7 +888,7 @@ type UpdateGatewayRequest struct { func (m *UpdateGatewayRequest) Reset() { *m = UpdateGatewayRequest{} } func (*UpdateGatewayRequest) ProtoMessage() {} func (*UpdateGatewayRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_gateway_31a6f1d9453c83a3, []int{11} + return fileDescriptor_gateway_65378ed07c220f51, []int{11} } func (m *UpdateGatewayRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -935,7 +935,7 @@ type CreateGatewayAPIKeyRequest struct { func (m *CreateGatewayAPIKeyRequest) Reset() { *m = CreateGatewayAPIKeyRequest{} } func (*CreateGatewayAPIKeyRequest) ProtoMessage() {} func (*CreateGatewayAPIKeyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_gateway_31a6f1d9453c83a3, []int{12} + return fileDescriptor_gateway_65378ed07c220f51, []int{12} } func (m *CreateGatewayAPIKeyRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -988,7 +988,7 @@ type UpdateGatewayAPIKeyRequest struct { func (m *UpdateGatewayAPIKeyRequest) Reset() { *m = UpdateGatewayAPIKeyRequest{} } func (*UpdateGatewayAPIKeyRequest) ProtoMessage() {} func (*UpdateGatewayAPIKeyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_gateway_31a6f1d9453c83a3, []int{13} + return fileDescriptor_gateway_65378ed07c220f51, []int{13} } func (m *UpdateGatewayAPIKeyRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1027,7 +1027,7 @@ type SetGatewayCollaboratorRequest struct { func (m *SetGatewayCollaboratorRequest) Reset() { *m = SetGatewayCollaboratorRequest{} } func (*SetGatewayCollaboratorRequest) ProtoMessage() {} func (*SetGatewayCollaboratorRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_gateway_31a6f1d9453c83a3, []int{14} + return fileDescriptor_gateway_65378ed07c220f51, []int{14} } func (m *SetGatewayCollaboratorRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1077,7 +1077,7 @@ type GatewayAntenna struct { func (m *GatewayAntenna) Reset() { *m = GatewayAntenna{} } func (*GatewayAntenna) ProtoMessage() {} func (*GatewayAntenna) Descriptor() ([]byte, []int) { - return fileDescriptor_gateway_31a6f1d9453c83a3, []int{15} + return fileDescriptor_gateway_65378ed07c220f51, []int{15} } func (m *GatewayAntenna) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1164,7 +1164,7 @@ type GatewayStatus struct { func (m *GatewayStatus) Reset() { *m = GatewayStatus{} } func (*GatewayStatus) ProtoMessage() {} func (*GatewayStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_gateway_31a6f1d9453c83a3, []int{16} + return fileDescriptor_gateway_65378ed07c220f51, []int{16} } func (m *GatewayStatus) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1259,7 +1259,7 @@ type GatewayConnectionStats struct { func (m *GatewayConnectionStats) Reset() { *m = GatewayConnectionStats{} } func (*GatewayConnectionStats) ProtoMessage() {} func (*GatewayConnectionStats) Descriptor() ([]byte, []int) { - return fileDescriptor_gateway_31a6f1d9453c83a3, []int{17} + return fileDescriptor_gateway_65378ed07c220f51, []int{17} } func (m *GatewayConnectionStats) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -7890,144 +7890,146 @@ var ( ) func init() { - proto.RegisterFile("lorawan-stack/api/gateway.proto", fileDescriptor_gateway_31a6f1d9453c83a3) + proto.RegisterFile("lorawan-stack/api/gateway.proto", fileDescriptor_gateway_65378ed07c220f51) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/gateway.proto", fileDescriptor_gateway_31a6f1d9453c83a3) -} - -var fileDescriptor_gateway_31a6f1d9453c83a3 = []byte{ - // 2111 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x4d, 0x6c, 0x1b, 0xc7, - 0x15, 0xe6, 0x92, 0xb4, 0x44, 0x3e, 0xea, 0xcf, 0x13, 0x55, 0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, 0xa3, - 0xcc, 0x16, 0x16, 0xce, 0x55, 0xfa, 0x0f, 0x72, 0x25, 0xc9, 0xbd, 0x72, 0xf3, 0xee, 0x4a, 0xd2, - 0x46, 0x1f, 0x67, 0xfd, 0x82, 0xe9, 0x0f, 0x15, 0x18, 0x1f, 0x00, 0xa1, 0x57, 0x60, 0xb4, 0x4d, - 0x1d, 0xa3, 0xc7, 0x5f, 0x11, 0xfc, 0x47, 0xda, 0xd4, 0xb9, 0x1c, 0x4f, 0x81, 0x83, 0xf0, 0xdd, - 0x04, 0x28, 0x2d, 0x41, 0xf8, 0x6e, 0x0f, 0xf4, 0x1a, 0x8c, 0x3b, 0x2e, 0x33, 0x5b, 0xc6, 0x60, - 0x2e, 0xc6, 0x84, 0x38, 0x06, 0x96, 0xfe, 0xa5, 0xc0, 0x58, 0xff, 0xc6, 0x41, 0x97, 0x20, 0x43, - 0x2d, 0x5f, 0xc4, 0x2e, 0x2c, 0xcc, 0x1d, 0x30, 0xcb, 0xfd, 0xbb, 0x6c, 0x39, 0xf7, 0x70, 0xa7, - 0x98, 0x7a, 0xb4, 0x53, 0x54, 0x74, 0x6e, 0xcf, 0x57, 0xaf, 0xd3, 0x72, 0x99, 0xeb, 0xab, 0x69, - 0x71, 0x1a, 0xe4, 0x17, 0xba, 0x00, 0x43, 0x1e, 0x4f, 0x91, 0xaf, 0x66, 0x66, 0x32, 0xb3, 0x85, - 0x85, 0x93, 0x87, 0xe5, 0x51, 0x97, 0x58, 0xf4, 0x32, 0x8c, 0x98, 0xb6, 0x6b, 0x6e, 0x18, 0xbe, - 0x1b, 0x78, 0x26, 0x51, 0x87, 0x67, 0x94, 0xd9, 0x51, 0xbd, 0x20, 0x64, 0x6b, 0x42, 0xb4, 0x98, - 0x7d, 0xf0, 0x49, 0x31, 0x55, 0xfa, 0x67, 0x1e, 0x86, 0xa5, 0x07, 0x74, 0x31, 0x39, 0x93, 0xd2, - 0x01, 0x71, 0x0e, 0x99, 0xc2, 0x0a, 0x80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, 0xf0, 0x22, 0xd8, 0xb8, 0x80, 0x8d, 0x45, 0x62, 0x09, 0xbc, 0x00, 0x53, 0xbe, 0xd9, - 0x22, 0x56, 0x60, 0x13, 0xc3, 0x72, 0xb7, 0x1c, 0x9b, 0x3a, 0x1b, 0x86, 0xcd, 0x73, 0x34, 0x21, - 0xf0, 0x93, 0x91, 0x76, 0x55, 0x2a, 0xaf, 0xf2, 0x6c, 0x9d, 0x03, 0x44, 0x9c, 0x86, 0xeb, 0x99, - 0xc4, 0xb0, 0x02, 0xb6, 0x6d, 0x98, 0xdb, 0xa6, 0x4d, 0xd4, 0xe3, 0xc2, 0x62, 0x42, 0x6a, 0x56, - 0x03, 0xb6, 0xbd, 0xc2, 0xe5, 0xe8, 0x17, 0xa0, 0xc6, 0xae, 0x3b, 0x98, 0xb5, 0x78, 0xa5, 0xf7, - 0x99, 0x87, 0xa9, 0xc3, 0x54, 0x34, 0xa3, 0xcc, 0x8e, 0x2d, 0x9c, 0x19, 0xcc, 0x41, 0x14, 0xed, - 0x06, 0x66, 0xad, 0x95, 0x18, 0xad, 0x4f, 0x59, 0x8f, 0x95, 0x4f, 0xff, 0x18, 0xc6, 0x07, 0x4e, - 0x16, 0x9a, 0x80, 0xcc, 0x06, 0x09, 0x8b, 0x7b, 0x5e, 0xe7, 0x43, 0xde, 0x38, 0x6c, 0x62, 0x3b, - 0x88, 0x6e, 0xb3, 0xf0, 0x63, 0x31, 0xfd, 0x86, 0x52, 0x5a, 0x82, 0x9c, 0x4c, 0xba, 0x8f, 0xce, - 0x43, 0x4e, 0xee, 0x20, 0x5e, 0xd3, 0xf8, 0x02, 0xbd, 0x78, 0x50, 0xed, 0x8c, 0x81, 0xa5, 0x3f, - 0x29, 0x70, 0xfc, 0x0a, 0x61, 0x91, 0x82, 0x2f, 0xb9, 0xcf, 0xd0, 0x35, 0x28, 0x44, 0x27, 0xe7, - 0x69, 0x2b, 0x24, 0x34, 0x23, 0xad, 0x8f, 0x96, 0x00, 0x7a, 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 0xb5, 0xd4, 0x97, 0x5d, 0x4d, 0xf9, 0xaa, 0xab, 0xa5, 0xbe, 0xee, 0x6a, 0xca, 0x37, 0x5d, - 0x2d, 0xf5, 0xc1, 0x9e, 0x96, 0xfa, 0x68, 0x4f, 0x53, 0x3e, 0xde, 0xd3, 0x52, 0x7f, 0xd8, 0xd3, - 0x94, 0x4f, 0xf6, 0xb4, 0xd4, 0xfd, 0x3d, 0x2d, 0xf5, 0xe9, 0x9e, 0xa6, 0x3c, 0xd8, 0xd3, 0x94, - 0xcf, 0xf6, 0x34, 0xe5, 0xf6, 0xb9, 0xa3, 0x76, 0x8b, 0xcc, 0xe9, 0xd4, 0xeb, 0x43, 0x62, 0xf6, - 0xe7, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xdf, 0x6a, 0xa8, 0xd5, 0x15, 0x00, 0x00, + golang_proto.RegisterFile("lorawan-stack/api/gateway.proto", fileDescriptor_gateway_65378ed07c220f51) +} + +var fileDescriptor_gateway_65378ed07c220f51 = []byte{ + // 2135 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x41, 0x6c, 0x1b, 0xc7, + 0x15, 0xe5, 0x92, 0xb4, 0x44, 0x7e, 0x4a, 0x94, 0x3c, 0x51, 0x95, 0xb5, 0x62, 0x2f, 0x15, 0xc6, + 0x71, 0x24, 0xd7, 0xa4, 0x5a, 0xd9, 0x2d, 0x5a, 0x05, 0x8d, 0x4a, 0x52, 0xb6, 0x4b, 0xc4, 0xae, + 0xd5, 0x95, 0xd5, 0x00, 0x76, 0xe2, 0xc5, 0x70, 0x77, 0x48, 0x2e, 0xb4, 0xdc, 0x65, 0x77, 0x67, + 0x65, 0xd3, 0x4d, 0x81, 0xa0, 0x08, 0xd0, 0x20, 0x27, 0xa3, 0xa7, 0x9e, 0x8a, 0xa0, 0xa7, 0x5c, + 0x0a, 0x04, 0x3d, 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f, 0x7b, 0x8a, 0xf4, 0xd9, 0x9e, 0x92, 0xf8, 0x7c, 0x4f, 0x49, + 0x7c, 0xb1, 0xa7, 0x48, 0xf7, 0xf7, 0x14, 0xe9, 0xc1, 0x9e, 0x22, 0xdd, 0x38, 0x77, 0xd4, 0x89, + 0x94, 0xda, 0xdd, 0x46, 0x63, 0x8c, 0x9f, 0xfe, 0xfc, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x3b, + 0xe3, 0x6c, 0xfc, 0x76, 0x16, 0x00, 0x00, } diff --git a/pkg/ttnpb/gateway.pb.paths.fm.go b/pkg/ttnpb/gateway.pb.paths.fm.go new file mode 100644 index 0000000000..98f92342a3 --- /dev/null +++ b/pkg/ttnpb/gateway.pb.paths.fm.go @@ -0,0 +1,362 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var GatewayBrandFieldPathsNested = []string{ + "id", + "logos", + "name", + "url", +} + +var GatewayBrandFieldPathsTopLevel = []string{ + "id", + "logos", + "name", + "url", +} +var GatewayModelFieldPathsNested = []string{ + "brand_id", + "id", + "name", +} + +var GatewayModelFieldPathsTopLevel = []string{ + "brand_id", + "id", + "name", +} +var GatewayVersionIdentifiersFieldPathsNested = []string{ + "brand_id", + "firmware_version", + "hardware_version", + "model_id", +} + +var GatewayVersionIdentifiersFieldPathsTopLevel = []string{ + "brand_id", + "firmware_version", + "hardware_version", + "model_id", +} +var GatewayRadioFieldPathsNested = []string{ + "chip_type", + "enable", + "frequency", + "rssi_offset", + "tx_configuration", + "tx_configuration.max_frequency", + "tx_configuration.min_frequency", + "tx_configuration.notch_frequency", +} + +var GatewayRadioFieldPathsTopLevel = []string{ + "chip_type", + "enable", + "frequency", + "rssi_offset", + "tx_configuration", +} +var GatewayVersionFieldPathsNested = []string{ + "clock_source", + "ids", + "ids.brand_id", + "ids.firmware_version", + "ids.hardware_version", + "ids.model_id", + "photos", + "radios", +} + +var GatewayVersionFieldPathsTopLevel = []string{ + "clock_source", + "ids", + "photos", + "radios", +} +var GatewayFieldPathsNested = []string{ + "antennas", + "attributes", + "auto_update", + "contact_info", + "created_at", + "description", + "downlink_path_constraint", + "enforce_duty_cycle", + "frequency_plan_id", + "gateway_server_address", + "ids", + "ids.eui", + "ids.gateway_id", + "location_public", + "name", + "schedule_downlink_late", + "status_public", + "update_channel", + "updated_at", + "version_ids", + "version_ids.brand_id", + "version_ids.firmware_version", + "version_ids.hardware_version", + "version_ids.model_id", +} + +var GatewayFieldPathsTopLevel = []string{ + "antennas", + "attributes", + "auto_update", + "contact_info", + "created_at", + "description", + "downlink_path_constraint", + "enforce_duty_cycle", + "frequency_plan_id", + "gateway_server_address", + "ids", + "location_public", + "name", + "schedule_downlink_late", + "status_public", + "update_channel", + "updated_at", + "version_ids", +} +var GatewaysFieldPathsNested = []string{ + "gateways", +} + +var GatewaysFieldPathsTopLevel = []string{ + "gateways", +} +var GetGatewayRequestFieldPathsNested = []string{ + "field_mask", + "gateway_ids", + "gateway_ids.eui", + "gateway_ids.gateway_id", +} + +var GetGatewayRequestFieldPathsTopLevel = []string{ + "field_mask", + "gateway_ids", +} +var GetGatewayIdentifiersForEUIRequestFieldPathsNested = []string{ + "eui", +} + +var GetGatewayIdentifiersForEUIRequestFieldPathsTopLevel = []string{ + "eui", +} +var ListGatewaysRequestFieldPathsNested = []string{ + "collaborator", + "collaborator.ids", + "collaborator.ids.organization_ids", + "collaborator.ids.organization_ids.organization_id", + "collaborator.ids.user_ids", + "collaborator.ids.user_ids.email", + "collaborator.ids.user_ids.user_id", + "field_mask", + "limit", + "order", + "page", +} + +var ListGatewaysRequestFieldPathsTopLevel = []string{ + "collaborator", + "field_mask", + "limit", + "order", + "page", +} +var CreateGatewayRequestFieldPathsNested = []string{ + "collaborator", + "collaborator.ids", + "collaborator.ids.organization_ids", + "collaborator.ids.organization_ids.organization_id", + "collaborator.ids.user_ids", + "collaborator.ids.user_ids.email", + "collaborator.ids.user_ids.user_id", + "gateway", + "gateway.antennas", + "gateway.attributes", + "gateway.auto_update", + "gateway.contact_info", + "gateway.created_at", + "gateway.description", + "gateway.downlink_path_constraint", + "gateway.enforce_duty_cycle", + "gateway.frequency_plan_id", + "gateway.gateway_server_address", + "gateway.ids", + "gateway.ids.eui", + "gateway.ids.gateway_id", + "gateway.location_public", + "gateway.name", + "gateway.schedule_downlink_late", + "gateway.status_public", + "gateway.update_channel", + "gateway.updated_at", + "gateway.version_ids", + "gateway.version_ids.brand_id", + "gateway.version_ids.firmware_version", + "gateway.version_ids.hardware_version", + "gateway.version_ids.model_id", +} + +var CreateGatewayRequestFieldPathsTopLevel = []string{ + "collaborator", + "gateway", +} +var UpdateGatewayRequestFieldPathsNested = []string{ + "field_mask", + "gateway", + "gateway.antennas", + "gateway.attributes", + "gateway.auto_update", + "gateway.contact_info", + "gateway.created_at", + "gateway.description", + "gateway.downlink_path_constraint", + "gateway.enforce_duty_cycle", + "gateway.frequency_plan_id", + "gateway.gateway_server_address", + "gateway.ids", + "gateway.ids.eui", + "gateway.ids.gateway_id", + "gateway.location_public", + "gateway.name", + "gateway.schedule_downlink_late", + "gateway.status_public", + "gateway.update_channel", + "gateway.updated_at", + "gateway.version_ids", + "gateway.version_ids.brand_id", + "gateway.version_ids.firmware_version", + "gateway.version_ids.hardware_version", + "gateway.version_ids.model_id", +} + +var UpdateGatewayRequestFieldPathsTopLevel = []string{ + "field_mask", + "gateway", +} +var CreateGatewayAPIKeyRequestFieldPathsNested = []string{ + "gateway_ids", + "gateway_ids.eui", + "gateway_ids.gateway_id", + "name", + "rights", +} + +var CreateGatewayAPIKeyRequestFieldPathsTopLevel = []string{ + "gateway_ids", + "name", + "rights", +} +var UpdateGatewayAPIKeyRequestFieldPathsNested = []string{ + "api_key", + "api_key.id", + "api_key.key", + "api_key.name", + "api_key.rights", + "gateway_ids", + "gateway_ids.eui", + "gateway_ids.gateway_id", +} + +var UpdateGatewayAPIKeyRequestFieldPathsTopLevel = []string{ + "api_key", + "gateway_ids", +} +var SetGatewayCollaboratorRequestFieldPathsNested = []string{ + "collaborator", + "collaborator.ids", + "collaborator.ids.ids", + "collaborator.ids.ids.organization_ids", + "collaborator.ids.ids.organization_ids.organization_id", + "collaborator.ids.ids.user_ids", + "collaborator.ids.ids.user_ids.email", + "collaborator.ids.ids.user_ids.user_id", + "collaborator.rights", + "gateway_ids", + "gateway_ids.eui", + "gateway_ids.gateway_id", +} + +var SetGatewayCollaboratorRequestFieldPathsTopLevel = []string{ + "collaborator", + "gateway_ids", +} +var GatewayAntennaFieldPathsNested = []string{ + "attributes", + "gain", + "location", + "location.accuracy", + "location.altitude", + "location.latitude", + "location.longitude", + "location.source", +} + +var GatewayAntennaFieldPathsTopLevel = []string{ + "attributes", + "gain", + "location", +} +var GatewayStatusFieldPathsNested = []string{ + "advanced", + "antenna_locations", + "boot_time", + "ip", + "metrics", + "time", + "versions", +} + +var GatewayStatusFieldPathsTopLevel = []string{ + "advanced", + "antenna_locations", + "boot_time", + "ip", + "metrics", + "time", + "versions", +} +var GatewayConnectionStatsFieldPathsNested = []string{ + "connected_at", + "downlink_count", + "last_downlink_received_at", + "last_status", + "last_status.advanced", + "last_status.antenna_locations", + "last_status.boot_time", + "last_status.ip", + "last_status.metrics", + "last_status.time", + "last_status.versions", + "last_status_received_at", + "last_uplink_received_at", + "protocol", + "uplink_count", +} + +var GatewayConnectionStatsFieldPathsTopLevel = []string{ + "connected_at", + "downlink_count", + "last_downlink_received_at", + "last_status", + "last_status_received_at", + "last_uplink_received_at", + "protocol", + "uplink_count", +} +var GatewayRadio_TxConfigurationFieldPathsNested = []string{ + "max_frequency", + "min_frequency", + "notch_frequency", +} + +var GatewayRadio_TxConfigurationFieldPathsTopLevel = []string{ + "max_frequency", + "min_frequency", + "notch_frequency", +} diff --git a/pkg/ttnpb/gateway.pb.fm.go b/pkg/ttnpb/gateway.pb.setters.fm.go similarity index 78% rename from pkg/ttnpb/gateway.pb.fm.go rename to pkg/ttnpb/gateway.pb.setters.fm.go index 4860ae3967..30a40ca70d 100644 --- a/pkg/ttnpb/gateway.pb.fm.go +++ b/pkg/ttnpb/gateway.pb.setters.fm.go @@ -6,24 +6,10 @@ import ( fmt "fmt" time "time" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + types "github.com/gogo/protobuf/types" go_thethings_network_lorawan_stack_pkg_types "go.thethings.network/lorawan-stack/pkg/types" ) -var GatewayBrandFieldPathsNested = []string{ - "id", - "logos", - "name", - "url", -} - -var GatewayBrandFieldPathsTopLevel = []string{ - "id", - "logos", - "name", - "url", -} - func (dst *GatewayBrand) SetFields(src *GatewayBrand, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -74,18 +60,6 @@ func (dst *GatewayBrand) SetFields(src *GatewayBrand, paths ...string) error { return nil } -var GatewayModelFieldPathsNested = []string{ - "brand_id", - "id", - "name", -} - -var GatewayModelFieldPathsTopLevel = []string{ - "brand_id", - "id", - "name", -} - func (dst *GatewayModel) SetFields(src *GatewayModel, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -127,20 +101,6 @@ func (dst *GatewayModel) SetFields(src *GatewayModel, paths ...string) error { return nil } -var GatewayVersionIdentifiersFieldPathsNested = []string{ - "brand_id", - "firmware_version", - "hardware_version", - "model_id", -} - -var GatewayVersionIdentifiersFieldPathsTopLevel = []string{ - "brand_id", - "firmware_version", - "hardware_version", - "model_id", -} - func (dst *GatewayVersionIdentifiers) SetFields(src *GatewayVersionIdentifiers, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -192,25 +152,6 @@ func (dst *GatewayVersionIdentifiers) SetFields(src *GatewayVersionIdentifiers, return nil } -var GatewayRadioFieldPathsNested = []string{ - "chip_type", - "enable", - "frequency", - "rssi_offset", - "tx_configuration", - "tx_configuration.max_frequency", - "tx_configuration.min_frequency", - "tx_configuration.notch_frequency", -} - -var GatewayRadioFieldPathsTopLevel = []string{ - "chip_type", - "enable", - "frequency", - "rssi_offset", - "tx_configuration", -} - func (dst *GatewayRadio) SetFields(src *GatewayRadio, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -283,77 +224,6 @@ func (dst *GatewayRadio) SetFields(src *GatewayRadio, paths ...string) error { return nil } -var GatewayRadio_TxConfigurationFieldPathsNested = []string{ - "max_frequency", - "min_frequency", - "notch_frequency", -} - -var GatewayRadio_TxConfigurationFieldPathsTopLevel = []string{ - "max_frequency", - "min_frequency", - "notch_frequency", -} - -func (dst *GatewayRadio_TxConfiguration) SetFields(src *GatewayRadio_TxConfiguration, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "min_frequency": - if len(subs) > 0 { - return fmt.Errorf("'min_frequency' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.MinFrequency = src.MinFrequency - } else { - var zero uint64 - dst.MinFrequency = zero - } - case "max_frequency": - if len(subs) > 0 { - return fmt.Errorf("'max_frequency' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.MaxFrequency = src.MaxFrequency - } else { - var zero uint64 - dst.MaxFrequency = zero - } - case "notch_frequency": - if len(subs) > 0 { - return fmt.Errorf("'notch_frequency' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.NotchFrequency = src.NotchFrequency - } else { - var zero uint64 - dst.NotchFrequency = zero - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - -var GatewayVersionFieldPathsNested = []string{ - "clock_source", - "ids", - "ids.brand_id", - "ids.firmware_version", - "ids.hardware_version", - "ids.model_id", - "photos", - "radios", -} - -var GatewayVersionFieldPathsTopLevel = []string{ - "clock_source", - "ids", - "photos", - "radios", -} - func (dst *GatewayVersion) SetFields(src *GatewayVersion, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -411,54 +281,6 @@ func (dst *GatewayVersion) SetFields(src *GatewayVersion, paths ...string) error return nil } -var GatewayFieldPathsNested = []string{ - "antennas", - "attributes", - "auto_update", - "contact_info", - "created_at", - "description", - "downlink_path_constraint", - "enforce_duty_cycle", - "frequency_plan_id", - "gateway_server_address", - "ids", - "ids.eui", - "ids.gateway_id", - "location_public", - "name", - "schedule_downlink_late", - "status_public", - "update_channel", - "updated_at", - "version_ids", - "version_ids.brand_id", - "version_ids.firmware_version", - "version_ids.hardware_version", - "version_ids.model_id", -} - -var GatewayFieldPathsTopLevel = []string{ - "antennas", - "attributes", - "auto_update", - "contact_info", - "created_at", - "description", - "downlink_path_constraint", - "enforce_duty_cycle", - "frequency_plan_id", - "gateway_server_address", - "ids", - "location_public", - "name", - "schedule_downlink_late", - "status_public", - "update_channel", - "updated_at", - "version_ids", -} - func (dst *Gateway) SetFields(src *Gateway, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -663,14 +485,6 @@ func (dst *Gateway) SetFields(src *Gateway, paths ...string) error { return nil } -var GatewaysFieldPathsNested = []string{ - "gateways", -} - -var GatewaysFieldPathsTopLevel = []string{ - "gateways", -} - func (dst *Gateways) SetFields(src *Gateways, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -691,18 +505,6 @@ func (dst *Gateways) SetFields(src *Gateways, paths ...string) error { return nil } -var GetGatewayRequestFieldPathsNested = []string{ - "field_mask", - "gateway_ids", - "gateway_ids.eui", - "gateway_ids.gateway_id", -} - -var GetGatewayRequestFieldPathsTopLevel = []string{ - "field_mask", - "gateway_ids", -} - func (dst *GetGatewayRequest) SetFields(src *GetGatewayRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -731,7 +533,7 @@ func (dst *GetGatewayRequest) SetFields(src *GetGatewayRequest, paths ...string) if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } @@ -742,14 +544,6 @@ func (dst *GetGatewayRequest) SetFields(src *GetGatewayRequest, paths ...string) return nil } -var GetGatewayIdentifiersForEUIRequestFieldPathsNested = []string{ - "eui", -} - -var GetGatewayIdentifiersForEUIRequestFieldPathsTopLevel = []string{ - "eui", -} - func (dst *GetGatewayIdentifiersForEUIRequest) SetFields(src *GetGatewayIdentifiersForEUIRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -771,28 +565,6 @@ func (dst *GetGatewayIdentifiersForEUIRequest) SetFields(src *GetGatewayIdentifi return nil } -var ListGatewaysRequestFieldPathsNested = []string{ - "collaborator", - "collaborator.ids", - "collaborator.ids.organization_ids", - "collaborator.ids.organization_ids.organization_id", - "collaborator.ids.user_ids", - "collaborator.ids.user_ids.email", - "collaborator.ids.user_ids.user_id", - "field_mask", - "limit", - "order", - "page", -} - -var ListGatewaysRequestFieldPathsTopLevel = []string{ - "collaborator", - "field_mask", - "limit", - "order", - "page", -} - func (dst *ListGatewaysRequest) SetFields(src *ListGatewaysRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -824,7 +596,7 @@ func (dst *ListGatewaysRequest) SetFields(src *ListGatewaysRequest, paths ...str if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } case "order": @@ -865,46 +637,6 @@ func (dst *ListGatewaysRequest) SetFields(src *ListGatewaysRequest, paths ...str return nil } -var CreateGatewayRequestFieldPathsNested = []string{ - "collaborator", - "collaborator.ids", - "collaborator.ids.organization_ids", - "collaborator.ids.organization_ids.organization_id", - "collaborator.ids.user_ids", - "collaborator.ids.user_ids.email", - "collaborator.ids.user_ids.user_id", - "gateway", - "gateway.antennas", - "gateway.attributes", - "gateway.auto_update", - "gateway.contact_info", - "gateway.created_at", - "gateway.description", - "gateway.downlink_path_constraint", - "gateway.enforce_duty_cycle", - "gateway.frequency_plan_id", - "gateway.gateway_server_address", - "gateway.ids", - "gateway.ids.eui", - "gateway.ids.gateway_id", - "gateway.location_public", - "gateway.name", - "gateway.schedule_downlink_late", - "gateway.status_public", - "gateway.update_channel", - "gateway.updated_at", - "gateway.version_ids", - "gateway.version_ids.brand_id", - "gateway.version_ids.firmware_version", - "gateway.version_ids.hardware_version", - "gateway.version_ids.model_id", -} - -var CreateGatewayRequestFieldPathsTopLevel = []string{ - "collaborator", - "gateway", -} - func (dst *CreateGatewayRequest) SetFields(src *CreateGatewayRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -952,40 +684,6 @@ func (dst *CreateGatewayRequest) SetFields(src *CreateGatewayRequest, paths ...s return nil } -var UpdateGatewayRequestFieldPathsNested = []string{ - "field_mask", - "gateway", - "gateway.antennas", - "gateway.attributes", - "gateway.auto_update", - "gateway.contact_info", - "gateway.created_at", - "gateway.description", - "gateway.downlink_path_constraint", - "gateway.enforce_duty_cycle", - "gateway.frequency_plan_id", - "gateway.gateway_server_address", - "gateway.ids", - "gateway.ids.eui", - "gateway.ids.gateway_id", - "gateway.location_public", - "gateway.name", - "gateway.schedule_downlink_late", - "gateway.status_public", - "gateway.update_channel", - "gateway.updated_at", - "gateway.version_ids", - "gateway.version_ids.brand_id", - "gateway.version_ids.firmware_version", - "gateway.version_ids.hardware_version", - "gateway.version_ids.model_id", -} - -var UpdateGatewayRequestFieldPathsTopLevel = []string{ - "field_mask", - "gateway", -} - func (dst *UpdateGatewayRequest) SetFields(src *UpdateGatewayRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1014,7 +712,7 @@ func (dst *UpdateGatewayRequest) SetFields(src *UpdateGatewayRequest, paths ...s if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } @@ -1025,20 +723,6 @@ func (dst *UpdateGatewayRequest) SetFields(src *UpdateGatewayRequest, paths ...s return nil } -var CreateGatewayAPIKeyRequestFieldPathsNested = []string{ - "gateway_ids", - "gateway_ids.eui", - "gateway_ids.gateway_id", - "name", - "rights", -} - -var CreateGatewayAPIKeyRequestFieldPathsTopLevel = []string{ - "gateway_ids", - "name", - "rights", -} - func (dst *CreateGatewayAPIKeyRequest) SetFields(src *CreateGatewayAPIKeyRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1087,22 +771,6 @@ func (dst *CreateGatewayAPIKeyRequest) SetFields(src *CreateGatewayAPIKeyRequest return nil } -var UpdateGatewayAPIKeyRequestFieldPathsNested = []string{ - "api_key", - "api_key.id", - "api_key.key", - "api_key.name", - "api_key.rights", - "gateway_ids", - "gateway_ids.eui", - "gateway_ids.gateway_id", -} - -var UpdateGatewayAPIKeyRequestFieldPathsTopLevel = []string{ - "api_key", - "gateway_ids", -} - func (dst *UpdateGatewayAPIKeyRequest) SetFields(src *UpdateGatewayAPIKeyRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1150,26 +818,6 @@ func (dst *UpdateGatewayAPIKeyRequest) SetFields(src *UpdateGatewayAPIKeyRequest return nil } -var SetGatewayCollaboratorRequestFieldPathsNested = []string{ - "collaborator", - "collaborator.ids", - "collaborator.ids.ids", - "collaborator.ids.ids.organization_ids", - "collaborator.ids.ids.organization_ids.organization_id", - "collaborator.ids.ids.user_ids", - "collaborator.ids.ids.user_ids.email", - "collaborator.ids.ids.user_ids.user_id", - "collaborator.rights", - "gateway_ids", - "gateway_ids.eui", - "gateway_ids.gateway_id", -} - -var SetGatewayCollaboratorRequestFieldPathsTopLevel = []string{ - "collaborator", - "gateway_ids", -} - func (dst *SetGatewayCollaboratorRequest) SetFields(src *SetGatewayCollaboratorRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1217,23 +865,6 @@ func (dst *SetGatewayCollaboratorRequest) SetFields(src *SetGatewayCollaboratorR return nil } -var GatewayAntennaFieldPathsNested = []string{ - "attributes", - "gain", - "location", - "location.accuracy", - "location.altitude", - "location.latitude", - "location.longitude", - "location.source", -} - -var GatewayAntennaFieldPathsTopLevel = []string{ - "attributes", - "gain", - "location", -} - func (dst *GatewayAntenna) SetFields(src *GatewayAntenna, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1282,26 +913,6 @@ func (dst *GatewayAntenna) SetFields(src *GatewayAntenna, paths ...string) error return nil } -var GatewayStatusFieldPathsNested = []string{ - "advanced", - "antenna_locations", - "boot_time", - "ip", - "metrics", - "time", - "versions", -} - -var GatewayStatusFieldPathsTopLevel = []string{ - "advanced", - "antenna_locations", - "boot_time", - "ip", - "metrics", - "time", - "versions", -} - func (dst *GatewayStatus) SetFields(src *GatewayStatus, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1378,35 +989,6 @@ func (dst *GatewayStatus) SetFields(src *GatewayStatus, paths ...string) error { return nil } -var GatewayConnectionStatsFieldPathsNested = []string{ - "connected_at", - "downlink_count", - "last_downlink_received_at", - "last_status", - "last_status.advanced", - "last_status.antenna_locations", - "last_status.boot_time", - "last_status.ip", - "last_status.metrics", - "last_status.time", - "last_status.versions", - "last_status_received_at", - "last_uplink_received_at", - "protocol", - "uplink_count", -} - -var GatewayConnectionStatsFieldPathsTopLevel = []string{ - "connected_at", - "downlink_count", - "last_downlink_received_at", - "last_status", - "last_status_received_at", - "last_uplink_received_at", - "protocol", - "uplink_count", -} - func (dst *GatewayConnectionStats) SetFields(src *GatewayConnectionStats, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1504,3 +1086,44 @@ func (dst *GatewayConnectionStats) SetFields(src *GatewayConnectionStats, paths } return nil } + +func (dst *GatewayRadio_TxConfiguration) SetFields(src *GatewayRadio_TxConfiguration, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "min_frequency": + if len(subs) > 0 { + return fmt.Errorf("'min_frequency' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.MinFrequency = src.MinFrequency + } else { + var zero uint64 + dst.MinFrequency = zero + } + case "max_frequency": + if len(subs) > 0 { + return fmt.Errorf("'max_frequency' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.MaxFrequency = src.MaxFrequency + } else { + var zero uint64 + dst.MaxFrequency = zero + } + case "notch_frequency": + if len(subs) > 0 { + return fmt.Errorf("'notch_frequency' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.NotchFrequency = src.NotchFrequency + } else { + var zero uint64 + dst.NotchFrequency = zero + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} diff --git a/pkg/ttnpb/gateway.pb.validate.go b/pkg/ttnpb/gateway.pb.validate.go new file mode 100644 index 0000000000..7035f6c4cb --- /dev/null +++ b/pkg/ttnpb/gateway.pb.validate.go @@ -0,0 +1,2091 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on GatewayBrand with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GatewayBrand) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GatewayBrandFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "id": + // no validation rules for ID + case "name": + // no validation rules for Name + case "url": + // no validation rules for URL + case "logos": + + default: + return GatewayBrandValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GatewayBrandValidationError is the validation error returned by +// GatewayBrand.ValidateFields if the designated constraints aren't met. +type GatewayBrandValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GatewayBrandValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GatewayBrandValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GatewayBrandValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GatewayBrandValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GatewayBrandValidationError) ErrorName() string { return "GatewayBrandValidationError" } + +// Error satisfies the builtin error interface +func (e GatewayBrandValidationError) 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 %sGatewayBrand.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GatewayBrandValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GatewayBrandValidationError{} + +// ValidateFields checks the field values on GatewayModel with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GatewayModel) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GatewayModelFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "brand_id": + // no validation rules for BrandID + case "id": + // no validation rules for ID + case "name": + // no validation rules for Name + default: + return GatewayModelValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GatewayModelValidationError is the validation error returned by +// GatewayModel.ValidateFields if the designated constraints aren't met. +type GatewayModelValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GatewayModelValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GatewayModelValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GatewayModelValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GatewayModelValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GatewayModelValidationError) ErrorName() string { return "GatewayModelValidationError" } + +// Error satisfies the builtin error interface +func (e GatewayModelValidationError) 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 %sGatewayModel.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GatewayModelValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GatewayModelValidationError{} + +// ValidateFields checks the field values on GatewayVersionIdentifiers with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GatewayVersionIdentifiers) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GatewayVersionIdentifiersFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "brand_id": + // no validation rules for BrandID + case "model_id": + // no validation rules for ModelID + case "hardware_version": + // no validation rules for HardwareVersion + case "firmware_version": + // no validation rules for FirmwareVersion + default: + return GatewayVersionIdentifiersValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GatewayVersionIdentifiersValidationError is the validation error returned by +// GatewayVersionIdentifiers.ValidateFields if the designated constraints +// aren't met. +type GatewayVersionIdentifiersValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GatewayVersionIdentifiersValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GatewayVersionIdentifiersValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GatewayVersionIdentifiersValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GatewayVersionIdentifiersValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GatewayVersionIdentifiersValidationError) ErrorName() string { + return "GatewayVersionIdentifiersValidationError" +} + +// Error satisfies the builtin error interface +func (e GatewayVersionIdentifiersValidationError) 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 %sGatewayVersionIdentifiers.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GatewayVersionIdentifiersValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GatewayVersionIdentifiersValidationError{} + +// ValidateFields checks the field values on GatewayRadio with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GatewayRadio) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GatewayRadioFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "enable": + // no validation rules for Enable + case "chip_type": + // no validation rules for ChipType + case "frequency": + // no validation rules for Frequency + case "rssi_offset": + // no validation rules for RSSIOffset + case "tx_configuration": + + if v, ok := interface{}(m.GetTxConfiguration()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayRadioValidationError{ + field: "tx_configuration", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return GatewayRadioValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GatewayRadioValidationError is the validation error returned by +// GatewayRadio.ValidateFields if the designated constraints aren't met. +type GatewayRadioValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GatewayRadioValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GatewayRadioValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GatewayRadioValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GatewayRadioValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GatewayRadioValidationError) ErrorName() string { return "GatewayRadioValidationError" } + +// Error satisfies the builtin error interface +func (e GatewayRadioValidationError) 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 %sGatewayRadio.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GatewayRadioValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GatewayRadioValidationError{} + +// ValidateFields checks the field values on GatewayVersion with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GatewayVersion) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GatewayVersionFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "ids": + + if v, ok := interface{}(&m.GatewayVersionIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayVersionValidationError{ + field: "ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "photos": + + case "radios": + + for idx, item := range m.GetRadios() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayVersionValidationError{ + field: fmt.Sprintf("radios[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "clock_source": + // no validation rules for ClockSource + default: + return GatewayVersionValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GatewayVersionValidationError is the validation error returned by +// GatewayVersion.ValidateFields if the designated constraints aren't met. +type GatewayVersionValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GatewayVersionValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GatewayVersionValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GatewayVersionValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GatewayVersionValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GatewayVersionValidationError) ErrorName() string { return "GatewayVersionValidationError" } + +// Error satisfies the builtin error interface +func (e GatewayVersionValidationError) 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 %sGatewayVersion.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GatewayVersionValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GatewayVersionValidationError{} + +// ValidateFields checks the field values on Gateway with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *Gateway) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GatewayFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "ids": + + if v, ok := interface{}(&m.GatewayIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayValidationError{ + field: "ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "created_at": + + if v, ok := interface{}(&m.CreatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayValidationError{ + field: "created_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "updated_at": + + if v, ok := interface{}(&m.UpdatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayValidationError{ + field: "updated_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "name": + // no validation rules for Name + case "description": + // no validation rules for Description + case "attributes": + // no validation rules for Attributes + case "contact_info": + + for idx, item := range m.GetContactInfo() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayValidationError{ + field: fmt.Sprintf("contact_info[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "version_ids": + + if v, ok := interface{}(&m.GatewayVersionIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayValidationError{ + field: "version_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "gateway_server_address": + + if !_Gateway_GatewayServerAddress_Pattern.MatchString(m.GetGatewayServerAddress()) { + return GatewayValidationError{ + field: "gateway_server_address", + reason: "value does not match regex pattern \"^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$\"", + } + } + + case "auto_update": + // no validation rules for AutoUpdate + case "update_channel": + // no validation rules for UpdateChannel + case "frequency_plan_id": + // no validation rules for FrequencyPlanID + case "antennas": + + for idx, item := range m.Antennas { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayValidationError{ + field: fmt.Sprintf("antennas[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "status_public": + // no validation rules for StatusPublic + case "location_public": + // no validation rules for LocationPublic + case "schedule_downlink_late": + // no validation rules for ScheduleDownlinkLate + case "enforce_duty_cycle": + // no validation rules for EnforceDutyCycle + case "downlink_path_constraint": + + if _, ok := DownlinkPathConstraint_name[int32(m.GetDownlinkPathConstraint())]; !ok { + return GatewayValidationError{ + field: "downlink_path_constraint", + reason: "value must be one of the defined enum values", + } + } + + default: + return GatewayValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GatewayValidationError is the validation error returned by +// Gateway.ValidateFields if the designated constraints aren't met. +type GatewayValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GatewayValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GatewayValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GatewayValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GatewayValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GatewayValidationError) ErrorName() string { return "GatewayValidationError" } + +// Error satisfies the builtin error interface +func (e GatewayValidationError) 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 %sGateway.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GatewayValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GatewayValidationError{} + +var _Gateway_GatewayServerAddress_Pattern = regexp.MustCompile("^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$") + +// ValidateFields checks the field values on Gateways with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *Gateways) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GatewaysFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "gateways": + + for idx, item := range m.GetGateways() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewaysValidationError{ + field: fmt.Sprintf("gateways[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + default: + return GatewaysValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GatewaysValidationError is the validation error returned by +// Gateways.ValidateFields if the designated constraints aren't met. +type GatewaysValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GatewaysValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GatewaysValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GatewaysValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GatewaysValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GatewaysValidationError) ErrorName() string { return "GatewaysValidationError" } + +// Error satisfies the builtin error interface +func (e GatewaysValidationError) 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 %sGateways.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GatewaysValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GatewaysValidationError{} + +// ValidateFields checks the field values on GetGatewayRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GetGatewayRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GetGatewayRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "gateway_ids": + + if v, ok := interface{}(&m.GatewayIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GetGatewayRequestValidationError{ + field: "gateway_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GetGatewayRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return GetGatewayRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GetGatewayRequestValidationError is the validation error returned by +// GetGatewayRequest.ValidateFields if the designated constraints aren't met. +type GetGatewayRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetGatewayRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetGatewayRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetGatewayRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetGatewayRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetGatewayRequestValidationError) ErrorName() string { + return "GetGatewayRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetGatewayRequestValidationError) 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 %sGetGatewayRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetGatewayRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetGatewayRequestValidationError{} + +// ValidateFields checks the field values on GetGatewayIdentifiersForEUIRequest +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *GetGatewayIdentifiersForEUIRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GetGatewayIdentifiersForEUIRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "eui": + // no validation rules for EUI + default: + return GetGatewayIdentifiersForEUIRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GetGatewayIdentifiersForEUIRequestValidationError is the validation error +// returned by GetGatewayIdentifiersForEUIRequest.ValidateFields if the +// designated constraints aren't met. +type GetGatewayIdentifiersForEUIRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetGatewayIdentifiersForEUIRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetGatewayIdentifiersForEUIRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetGatewayIdentifiersForEUIRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetGatewayIdentifiersForEUIRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetGatewayIdentifiersForEUIRequestValidationError) ErrorName() string { + return "GetGatewayIdentifiersForEUIRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetGatewayIdentifiersForEUIRequestValidationError) 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 %sGetGatewayIdentifiersForEUIRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetGatewayIdentifiersForEUIRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetGatewayIdentifiersForEUIRequestValidationError{} + +// ValidateFields checks the field values on ListGatewaysRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ListGatewaysRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ListGatewaysRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "collaborator": + + if v, ok := interface{}(m.GetCollaborator()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ListGatewaysRequestValidationError{ + field: "collaborator", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ListGatewaysRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "order": + // no validation rules for Order + case "limit": + // no validation rules for Limit + case "page": + // no validation rules for Page + default: + return ListGatewaysRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ListGatewaysRequestValidationError is the validation error returned by +// ListGatewaysRequest.ValidateFields if the designated constraints aren't met. +type ListGatewaysRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListGatewaysRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListGatewaysRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListGatewaysRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListGatewaysRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListGatewaysRequestValidationError) ErrorName() string { + return "ListGatewaysRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e ListGatewaysRequestValidationError) 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 %sListGatewaysRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListGatewaysRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListGatewaysRequestValidationError{} + +// ValidateFields checks the field values on CreateGatewayRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *CreateGatewayRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = CreateGatewayRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "gateway": + + if v, ok := interface{}(&m.Gateway).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return CreateGatewayRequestValidationError{ + field: "gateway", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "collaborator": + + if v, ok := interface{}(&m.Collaborator).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return CreateGatewayRequestValidationError{ + field: "collaborator", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return CreateGatewayRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// CreateGatewayRequestValidationError is the validation error returned by +// CreateGatewayRequest.ValidateFields if the designated constraints aren't met. +type CreateGatewayRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CreateGatewayRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CreateGatewayRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CreateGatewayRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CreateGatewayRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CreateGatewayRequestValidationError) ErrorName() string { + return "CreateGatewayRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e CreateGatewayRequestValidationError) 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 %sCreateGatewayRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CreateGatewayRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CreateGatewayRequestValidationError{} + +// ValidateFields checks the field values on UpdateGatewayRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *UpdateGatewayRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = UpdateGatewayRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "gateway": + + if v, ok := interface{}(&m.Gateway).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UpdateGatewayRequestValidationError{ + field: "gateway", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UpdateGatewayRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return UpdateGatewayRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// UpdateGatewayRequestValidationError is the validation error returned by +// UpdateGatewayRequest.ValidateFields if the designated constraints aren't met. +type UpdateGatewayRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UpdateGatewayRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UpdateGatewayRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UpdateGatewayRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UpdateGatewayRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UpdateGatewayRequestValidationError) ErrorName() string { + return "UpdateGatewayRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e UpdateGatewayRequestValidationError) 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 %sUpdateGatewayRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UpdateGatewayRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UpdateGatewayRequestValidationError{} + +// ValidateFields checks the field values on CreateGatewayAPIKeyRequest with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *CreateGatewayAPIKeyRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = CreateGatewayAPIKeyRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "gateway_ids": + + if v, ok := interface{}(&m.GatewayIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return CreateGatewayAPIKeyRequestValidationError{ + field: "gateway_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "name": + // no validation rules for Name + case "rights": + + default: + return CreateGatewayAPIKeyRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// CreateGatewayAPIKeyRequestValidationError is the validation error returned +// by CreateGatewayAPIKeyRequest.ValidateFields if the designated constraints +// aren't met. +type CreateGatewayAPIKeyRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CreateGatewayAPIKeyRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CreateGatewayAPIKeyRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CreateGatewayAPIKeyRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CreateGatewayAPIKeyRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CreateGatewayAPIKeyRequestValidationError) ErrorName() string { + return "CreateGatewayAPIKeyRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e CreateGatewayAPIKeyRequestValidationError) 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 %sCreateGatewayAPIKeyRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CreateGatewayAPIKeyRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CreateGatewayAPIKeyRequestValidationError{} + +// ValidateFields checks the field values on UpdateGatewayAPIKeyRequest with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *UpdateGatewayAPIKeyRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = UpdateGatewayAPIKeyRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "gateway_ids": + + if v, ok := interface{}(&m.GatewayIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UpdateGatewayAPIKeyRequestValidationError{ + field: "gateway_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "api_key": + + if v, ok := interface{}(&m.APIKey).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UpdateGatewayAPIKeyRequestValidationError{ + field: "api_key", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return UpdateGatewayAPIKeyRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// UpdateGatewayAPIKeyRequestValidationError is the validation error returned +// by UpdateGatewayAPIKeyRequest.ValidateFields if the designated constraints +// aren't met. +type UpdateGatewayAPIKeyRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UpdateGatewayAPIKeyRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UpdateGatewayAPIKeyRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UpdateGatewayAPIKeyRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UpdateGatewayAPIKeyRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UpdateGatewayAPIKeyRequestValidationError) ErrorName() string { + return "UpdateGatewayAPIKeyRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e UpdateGatewayAPIKeyRequestValidationError) 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 %sUpdateGatewayAPIKeyRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UpdateGatewayAPIKeyRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UpdateGatewayAPIKeyRequestValidationError{} + +// ValidateFields checks the field values on SetGatewayCollaboratorRequest with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *SetGatewayCollaboratorRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = SetGatewayCollaboratorRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "gateway_ids": + + if v, ok := interface{}(&m.GatewayIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SetGatewayCollaboratorRequestValidationError{ + field: "gateway_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "collaborator": + + if v, ok := interface{}(&m.Collaborator).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SetGatewayCollaboratorRequestValidationError{ + field: "collaborator", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return SetGatewayCollaboratorRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// SetGatewayCollaboratorRequestValidationError is the validation error +// returned by SetGatewayCollaboratorRequest.ValidateFields if the designated +// constraints aren't met. +type SetGatewayCollaboratorRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SetGatewayCollaboratorRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SetGatewayCollaboratorRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SetGatewayCollaboratorRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SetGatewayCollaboratorRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SetGatewayCollaboratorRequestValidationError) ErrorName() string { + return "SetGatewayCollaboratorRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e SetGatewayCollaboratorRequestValidationError) 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 %sSetGatewayCollaboratorRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SetGatewayCollaboratorRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SetGatewayCollaboratorRequestValidationError{} + +// ValidateFields checks the field values on GatewayAntenna with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GatewayAntenna) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GatewayAntennaFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "gain": + // no validation rules for Gain + case "location": + + if v, ok := interface{}(&m.Location).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayAntennaValidationError{ + field: "location", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "attributes": + // no validation rules for Attributes + default: + return GatewayAntennaValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GatewayAntennaValidationError is the validation error returned by +// GatewayAntenna.ValidateFields if the designated constraints aren't met. +type GatewayAntennaValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GatewayAntennaValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GatewayAntennaValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GatewayAntennaValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GatewayAntennaValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GatewayAntennaValidationError) ErrorName() string { return "GatewayAntennaValidationError" } + +// Error satisfies the builtin error interface +func (e GatewayAntennaValidationError) 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 %sGatewayAntenna.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GatewayAntennaValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GatewayAntennaValidationError{} + +// ValidateFields checks the field values on GatewayStatus with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GatewayStatus) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GatewayStatusFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "time": + + if v, ok := interface{}(&m.Time).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayStatusValidationError{ + field: "time", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "boot_time": + + if v, ok := interface{}(&m.BootTime).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayStatusValidationError{ + field: "boot_time", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "versions": + // no validation rules for Versions + case "antenna_locations": + + for idx, item := range m.GetAntennaLocations() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayStatusValidationError{ + field: fmt.Sprintf("antenna_locations[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "ip": + + case "metrics": + // no validation rules for Metrics + case "advanced": + + if v, ok := interface{}(m.GetAdvanced()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayStatusValidationError{ + field: "advanced", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return GatewayStatusValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GatewayStatusValidationError is the validation error returned by +// GatewayStatus.ValidateFields if the designated constraints aren't met. +type GatewayStatusValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GatewayStatusValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GatewayStatusValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GatewayStatusValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GatewayStatusValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GatewayStatusValidationError) ErrorName() string { return "GatewayStatusValidationError" } + +// Error satisfies the builtin error interface +func (e GatewayStatusValidationError) 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 %sGatewayStatus.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GatewayStatusValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GatewayStatusValidationError{} + +// ValidateFields checks the field values on GatewayConnectionStats with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GatewayConnectionStats) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GatewayConnectionStatsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "connected_at": + + if v, ok := interface{}(m.GetConnectedAt()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayConnectionStatsValidationError{ + field: "connected_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "protocol": + // no validation rules for Protocol + case "last_status_received_at": + + if v, ok := interface{}(m.GetLastStatusReceivedAt()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayConnectionStatsValidationError{ + field: "last_status_received_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "last_status": + + if v, ok := interface{}(m.GetLastStatus()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayConnectionStatsValidationError{ + field: "last_status", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "last_uplink_received_at": + + if v, ok := interface{}(m.GetLastUplinkReceivedAt()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayConnectionStatsValidationError{ + field: "last_uplink_received_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "uplink_count": + // no validation rules for UplinkCount + case "last_downlink_received_at": + + if v, ok := interface{}(m.GetLastDownlinkReceivedAt()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayConnectionStatsValidationError{ + field: "last_downlink_received_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "downlink_count": + // no validation rules for DownlinkCount + default: + return GatewayConnectionStatsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GatewayConnectionStatsValidationError is the validation error returned by +// GatewayConnectionStats.ValidateFields if the designated constraints aren't met. +type GatewayConnectionStatsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GatewayConnectionStatsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GatewayConnectionStatsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GatewayConnectionStatsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GatewayConnectionStatsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GatewayConnectionStatsValidationError) ErrorName() string { + return "GatewayConnectionStatsValidationError" +} + +// Error satisfies the builtin error interface +func (e GatewayConnectionStatsValidationError) 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 %sGatewayConnectionStats.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GatewayConnectionStatsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GatewayConnectionStatsValidationError{} + +// ValidateFields checks the field values on GatewayRadio_TxConfiguration with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *GatewayRadio_TxConfiguration) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GatewayRadio_TxConfigurationFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "min_frequency": + // no validation rules for MinFrequency + case "max_frequency": + // no validation rules for MaxFrequency + case "notch_frequency": + // no validation rules for NotchFrequency + default: + return GatewayRadio_TxConfigurationValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GatewayRadio_TxConfigurationValidationError is the validation error returned +// by GatewayRadio_TxConfiguration.ValidateFields if the designated +// constraints aren't met. +type GatewayRadio_TxConfigurationValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GatewayRadio_TxConfigurationValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GatewayRadio_TxConfigurationValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GatewayRadio_TxConfigurationValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GatewayRadio_TxConfigurationValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GatewayRadio_TxConfigurationValidationError) ErrorName() string { + return "GatewayRadio_TxConfigurationValidationError" +} + +// Error satisfies the builtin error interface +func (e GatewayRadio_TxConfigurationValidationError) 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 %sGatewayRadio_TxConfiguration.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GatewayRadio_TxConfigurationValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GatewayRadio_TxConfigurationValidationError{} diff --git a/pkg/ttnpb/gateway.validator.pb.go b/pkg/ttnpb/gateway.validator.pb.go deleted file mode 100644 index a4f4e0dd6b..0000000000 --- a/pkg/ttnpb/gateway.validator.pb.go +++ /dev/null @@ -1,224 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/gateway.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import regexp "regexp" -import fmt "fmt" -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/struct" -import _ "github.com/golang/protobuf/ptypes/timestamp" -import _ "github.com/mwitkow/go-proto-validators" -import _ "google.golang.org/genproto/protobuf/field_mask" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *GatewayBrand) Validate() error { - return nil -} -func (this *GatewayModel) Validate() error { - return nil -} -func (this *GatewayVersionIdentifiers) Validate() error { - return nil -} -func (this *GatewayRadio) Validate() error { - if this.TxConfiguration != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.TxConfiguration); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("TxConfiguration", err) - } - } - return nil -} -func (this *GatewayRadio_TxConfiguration) Validate() error { - return nil -} -func (this *GatewayVersion) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.GatewayVersionIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("GatewayVersionIdentifiers", err) - } - for _, item := range this.Radios { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Radios", err) - } - } - } - return nil -} - -var _regex_Gateway_GatewayServerAddress = regexp.MustCompile(`^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$`) - -func (this *Gateway) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.GatewayIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("GatewayIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.CreatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("CreatedAt", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UpdatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UpdatedAt", err) - } - // Validation of proto3 map<> fields is unsupported. - for _, item := range this.ContactInfo { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ContactInfo", err) - } - } - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.GatewayVersionIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("GatewayVersionIdentifiers", err) - } - if !_regex_Gateway_GatewayServerAddress.MatchString(this.GatewayServerAddress) { - return github_com_mwitkow_go_proto_validators.FieldError("GatewayServerAddress", fmt.Errorf(`value '%v' must be a string conforming to regex "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"`, this.GatewayServerAddress)) - } - for _, item := range this.Antennas { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(item)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Antennas", err) - } - } - return nil -} -func (this *Gateways) Validate() error { - for _, item := range this.Gateways { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Gateways", err) - } - } - } - return nil -} -func (this *GetGatewayRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.GatewayIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("GatewayIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *GetGatewayIdentifiersForEUIRequest) Validate() error { - return nil -} -func (this *ListGatewaysRequest) Validate() error { - if this.Collaborator != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Collaborator); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Collaborator", err) - } - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *CreateGatewayRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Gateway)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Gateway", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Collaborator)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Collaborator", err) - } - return nil -} -func (this *UpdateGatewayRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Gateway)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Gateway", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *CreateGatewayAPIKeyRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.GatewayIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("GatewayIdentifiers", err) - } - return nil -} -func (this *UpdateGatewayAPIKeyRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.GatewayIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("GatewayIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.APIKey)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("APIKey", err) - } - return nil -} -func (this *SetGatewayCollaboratorRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.GatewayIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("GatewayIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Collaborator)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Collaborator", err) - } - return nil -} -func (this *GatewayAntenna) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Location)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Location", err) - } - // Validation of proto3 map<> fields is unsupported. - return nil -} -func (this *GatewayStatus) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Time)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Time", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.BootTime)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("BootTime", err) - } - // Validation of proto3 map<> fields is unsupported. - for _, item := range this.AntennaLocations { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("AntennaLocations", err) - } - } - } - // Validation of proto3 map<> fields is unsupported. - if this.Advanced != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Advanced); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Advanced", err) - } - } - return nil -} -func (this *GatewayConnectionStats) Validate() error { - if this.ConnectedAt != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ConnectedAt); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ConnectedAt", err) - } - } - if this.LastStatusReceivedAt != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.LastStatusReceivedAt); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("LastStatusReceivedAt", err) - } - } - if this.LastStatus != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.LastStatus); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("LastStatus", err) - } - } - if this.LastUplinkReceivedAt != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.LastUplinkReceivedAt); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("LastUplinkReceivedAt", err) - } - } - if this.LastDownlinkReceivedAt != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.LastDownlinkReceivedAt); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("LastDownlinkReceivedAt", err) - } - } - return nil -} diff --git a/pkg/ttnpb/gateway_services.pb.gw.go b/pkg/ttnpb/gateway_services.pb.gw.go index 804b8062b2..29ce856ea5 100644 --- a/pkg/ttnpb/gateway_services.pb.gw.go +++ b/pkg/ttnpb/gateway_services.pb.gw.go @@ -9,11 +9,10 @@ It translates gRPC into RESTful JSON APIs. package ttnpb import ( + "context" "io" "net/http" - "context" - "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" diff --git a/pkg/ttnpb/gateway_services.pb.paths.fm.go b/pkg/ttnpb/gateway_services.pb.paths.fm.go new file mode 100644 index 0000000000..78f683e9f6 --- /dev/null +++ b/pkg/ttnpb/gateway_services.pb.paths.fm.go @@ -0,0 +1,15 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var PullGatewayConfigurationRequestFieldPathsNested = []string{ + "field_mask", + "gateway_ids", + "gateway_ids.eui", + "gateway_ids.gateway_id", +} + +var PullGatewayConfigurationRequestFieldPathsTopLevel = []string{ + "field_mask", + "gateway_ids", +} diff --git a/pkg/ttnpb/gateway_services.pb.fm.go b/pkg/ttnpb/gateway_services.pb.setters.fm.go similarity index 74% rename from pkg/ttnpb/gateway_services.pb.fm.go rename to pkg/ttnpb/gateway_services.pb.setters.fm.go index 98e8661ad4..62d4192510 100644 --- a/pkg/ttnpb/gateway_services.pb.fm.go +++ b/pkg/ttnpb/gateway_services.pb.setters.fm.go @@ -5,21 +5,9 @@ package ttnpb import ( fmt "fmt" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + types "github.com/gogo/protobuf/types" ) -var PullGatewayConfigurationRequestFieldPathsNested = []string{ - "field_mask", - "gateway_ids", - "gateway_ids.eui", - "gateway_ids.gateway_id", -} - -var PullGatewayConfigurationRequestFieldPathsTopLevel = []string{ - "field_mask", - "gateway_ids", -} - func (dst *PullGatewayConfigurationRequest) SetFields(src *PullGatewayConfigurationRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -48,7 +36,7 @@ func (dst *PullGatewayConfigurationRequest) SetFields(src *PullGatewayConfigurat if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } diff --git a/pkg/ttnpb/gateway_services.pb.validate.go b/pkg/ttnpb/gateway_services.pb.validate.go new file mode 100644 index 0000000000..1630fd2f23 --- /dev/null +++ b/pkg/ttnpb/gateway_services.pb.validate.go @@ -0,0 +1,139 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on PullGatewayConfigurationRequest +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *PullGatewayConfigurationRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = PullGatewayConfigurationRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "gateway_ids": + + if v, ok := interface{}(&m.GatewayIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return PullGatewayConfigurationRequestValidationError{ + field: "gateway_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return PullGatewayConfigurationRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return PullGatewayConfigurationRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// PullGatewayConfigurationRequestValidationError is the validation error +// returned by PullGatewayConfigurationRequest.ValidateFields if the +// designated constraints aren't met. +type PullGatewayConfigurationRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e PullGatewayConfigurationRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e PullGatewayConfigurationRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e PullGatewayConfigurationRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e PullGatewayConfigurationRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e PullGatewayConfigurationRequestValidationError) ErrorName() string { + return "PullGatewayConfigurationRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e PullGatewayConfigurationRequestValidationError) 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 %sPullGatewayConfigurationRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = PullGatewayConfigurationRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = PullGatewayConfigurationRequestValidationError{} diff --git a/pkg/ttnpb/gateway_services.validator.pb.go b/pkg/ttnpb/gateway_services.validator.pb.go deleted file mode 100644 index 1a4726cf67..0000000000 --- a/pkg/ttnpb/gateway_services.validator.pb.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/gateway_services.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/empty" -import _ "google.golang.org/genproto/googleapis/api/annotations" -import _ "google.golang.org/genproto/protobuf/field_mask" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *PullGatewayConfigurationRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.GatewayIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("GatewayIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} diff --git a/pkg/ttnpb/gatewayserver.pb.gw.go b/pkg/ttnpb/gatewayserver.pb.gw.go index bb4f995e8c..2c4731ccca 100644 --- a/pkg/ttnpb/gatewayserver.pb.gw.go +++ b/pkg/ttnpb/gatewayserver.pb.gw.go @@ -9,11 +9,10 @@ It translates gRPC into RESTful JSON APIs. package ttnpb import ( + "context" "io" "net/http" - "context" - "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" diff --git a/pkg/ttnpb/gatewayserver.pb.fm.go b/pkg/ttnpb/gatewayserver.pb.paths.fm.go similarity index 67% rename from pkg/ttnpb/gatewayserver.pb.fm.go rename to pkg/ttnpb/gatewayserver.pb.paths.fm.go index 6119839dd7..3af3a4698b 100644 --- a/pkg/ttnpb/gatewayserver.pb.fm.go +++ b/pkg/ttnpb/gatewayserver.pb.paths.fm.go @@ -2,11 +2,6 @@ package ttnpb -import ( - fmt "fmt" - time "time" -) - var GatewayUpFieldPathsNested = []string{ "gateway_status", "gateway_status.advanced", @@ -27,69 +22,6 @@ var GatewayUpFieldPathsTopLevel = []string{ "tx_acknowledgment", "uplink_messages", } - -func (dst *GatewayUp) SetFields(src *GatewayUp, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "uplink_messages": - if len(subs) > 0 { - return fmt.Errorf("'uplink_messages' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.UplinkMessages = src.UplinkMessages - } else { - dst.UplinkMessages = nil - } - case "gateway_status": - if len(subs) > 0 { - newDst := dst.GatewayStatus - if newDst == nil { - newDst = &GatewayStatus{} - dst.GatewayStatus = newDst - } - var newSrc *GatewayStatus - if src != nil { - newSrc = src.GatewayStatus - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.GatewayStatus = src.GatewayStatus - } else { - dst.GatewayStatus = nil - } - } - case "tx_acknowledgment": - if len(subs) > 0 { - newDst := dst.TxAcknowledgment - if newDst == nil { - newDst = &TxAcknowledgment{} - dst.TxAcknowledgment = newDst - } - var newSrc *TxAcknowledgment - if src != nil { - newSrc = src.TxAcknowledgment - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.TxAcknowledgment = src.TxAcknowledgment - } else { - dst.TxAcknowledgment = nil - } - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - var GatewayDownFieldPathsNested = []string{ "downlink_message", "downlink_message.correlation_ids", @@ -180,39 +112,6 @@ var GatewayDownFieldPathsNested = []string{ var GatewayDownFieldPathsTopLevel = []string{ "downlink_message", } - -func (dst *GatewayDown) SetFields(src *GatewayDown, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "downlink_message": - if len(subs) > 0 { - newDst := dst.DownlinkMessage - if newDst == nil { - newDst = &DownlinkMessage{} - dst.DownlinkMessage = newDst - } - var newSrc *DownlinkMessage - if src != nil { - newSrc = src.DownlinkMessage - } - if err := newDst.SetFields(newSrc, subs...); err != nil { - return err - } - } else { - if src != nil { - dst.DownlinkMessage = src.DownlinkMessage - } else { - dst.DownlinkMessage = nil - } - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - var ScheduleDownlinkResponseFieldPathsNested = []string{ "delay", } @@ -220,24 +119,3 @@ var ScheduleDownlinkResponseFieldPathsNested = []string{ var ScheduleDownlinkResponseFieldPathsTopLevel = []string{ "delay", } - -func (dst *ScheduleDownlinkResponse) SetFields(src *ScheduleDownlinkResponse, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "delay": - if len(subs) > 0 { - return fmt.Errorf("'delay' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Delay = src.Delay - } else { - var zero time.Duration - dst.Delay = zero - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} diff --git a/pkg/ttnpb/gatewayserver.pb.setters.fm.go b/pkg/ttnpb/gatewayserver.pb.setters.fm.go new file mode 100644 index 0000000000..c46cbf3044 --- /dev/null +++ b/pkg/ttnpb/gatewayserver.pb.setters.fm.go @@ -0,0 +1,123 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + fmt "fmt" + time "time" +) + +func (dst *GatewayUp) SetFields(src *GatewayUp, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "uplink_messages": + if len(subs) > 0 { + return fmt.Errorf("'uplink_messages' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.UplinkMessages = src.UplinkMessages + } else { + dst.UplinkMessages = nil + } + case "gateway_status": + if len(subs) > 0 { + newDst := dst.GatewayStatus + if newDst == nil { + newDst = &GatewayStatus{} + dst.GatewayStatus = newDst + } + var newSrc *GatewayStatus + if src != nil { + newSrc = src.GatewayStatus + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.GatewayStatus = src.GatewayStatus + } else { + dst.GatewayStatus = nil + } + } + case "tx_acknowledgment": + if len(subs) > 0 { + newDst := dst.TxAcknowledgment + if newDst == nil { + newDst = &TxAcknowledgment{} + dst.TxAcknowledgment = newDst + } + var newSrc *TxAcknowledgment + if src != nil { + newSrc = src.TxAcknowledgment + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.TxAcknowledgment = src.TxAcknowledgment + } else { + dst.TxAcknowledgment = nil + } + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *GatewayDown) SetFields(src *GatewayDown, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "downlink_message": + if len(subs) > 0 { + newDst := dst.DownlinkMessage + if newDst == nil { + newDst = &DownlinkMessage{} + dst.DownlinkMessage = newDst + } + var newSrc *DownlinkMessage + if src != nil { + newSrc = src.DownlinkMessage + } + if err := newDst.SetFields(newSrc, subs...); err != nil { + return err + } + } else { + if src != nil { + dst.DownlinkMessage = src.DownlinkMessage + } else { + dst.DownlinkMessage = nil + } + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} + +func (dst *ScheduleDownlinkResponse) SetFields(src *ScheduleDownlinkResponse, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "delay": + if len(subs) > 0 { + return fmt.Errorf("'delay' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Delay = src.Delay + } else { + var zero time.Duration + dst.Delay = zero + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} diff --git a/pkg/ttnpb/gatewayserver.pb.validate.go b/pkg/ttnpb/gatewayserver.pb.validate.go new file mode 100644 index 0000000000..a53089470b --- /dev/null +++ b/pkg/ttnpb/gatewayserver.pb.validate.go @@ -0,0 +1,338 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on GatewayUp with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *GatewayUp) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GatewayUpFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "uplink_messages": + + for idx, item := range m.GetUplinkMessages() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayUpValidationError{ + field: fmt.Sprintf("uplink_messages[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "gateway_status": + + if v, ok := interface{}(m.GetGatewayStatus()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayUpValidationError{ + field: "gateway_status", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "tx_acknowledgment": + + if v, ok := interface{}(m.GetTxAcknowledgment()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayUpValidationError{ + field: "tx_acknowledgment", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return GatewayUpValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GatewayUpValidationError is the validation error returned by +// GatewayUp.ValidateFields if the designated constraints aren't met. +type GatewayUpValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GatewayUpValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GatewayUpValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GatewayUpValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GatewayUpValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GatewayUpValidationError) ErrorName() string { return "GatewayUpValidationError" } + +// Error satisfies the builtin error interface +func (e GatewayUpValidationError) 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 %sGatewayUp.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GatewayUpValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GatewayUpValidationError{} + +// ValidateFields checks the field values on GatewayDown with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *GatewayDown) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GatewayDownFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "downlink_message": + + if v, ok := interface{}(m.GetDownlinkMessage()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayDownValidationError{ + field: "downlink_message", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return GatewayDownValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GatewayDownValidationError is the validation error returned by +// GatewayDown.ValidateFields if the designated constraints aren't met. +type GatewayDownValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GatewayDownValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GatewayDownValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GatewayDownValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GatewayDownValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GatewayDownValidationError) ErrorName() string { return "GatewayDownValidationError" } + +// Error satisfies the builtin error interface +func (e GatewayDownValidationError) 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 %sGatewayDown.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GatewayDownValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GatewayDownValidationError{} + +// ValidateFields checks the field values on ScheduleDownlinkResponse with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ScheduleDownlinkResponse) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ScheduleDownlinkResponseFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "delay": + + if v, ok := interface{}(&m.Delay).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ScheduleDownlinkResponseValidationError{ + field: "delay", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return ScheduleDownlinkResponseValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ScheduleDownlinkResponseValidationError is the validation error returned by +// ScheduleDownlinkResponse.ValidateFields if the designated constraints +// aren't met. +type ScheduleDownlinkResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ScheduleDownlinkResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ScheduleDownlinkResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ScheduleDownlinkResponseValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ScheduleDownlinkResponseValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ScheduleDownlinkResponseValidationError) ErrorName() string { + return "ScheduleDownlinkResponseValidationError" +} + +// Error satisfies the builtin error interface +func (e ScheduleDownlinkResponseValidationError) 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 %sScheduleDownlinkResponse.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ScheduleDownlinkResponseValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ScheduleDownlinkResponseValidationError{} diff --git a/pkg/ttnpb/gatewayserver.validator.pb.go b/pkg/ttnpb/gatewayserver.validator.pb.go deleted file mode 100644 index 4cec92742a..0000000000 --- a/pkg/ttnpb/gatewayserver.validator.pb.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/gatewayserver.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/duration" -import _ "github.com/golang/protobuf/ptypes/empty" -import _ "google.golang.org/genproto/googleapis/api/annotations" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *GatewayUp) Validate() error { - for _, item := range this.UplinkMessages { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UplinkMessages", err) - } - } - } - if this.GatewayStatus != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.GatewayStatus); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("GatewayStatus", err) - } - } - if this.TxAcknowledgment != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.TxAcknowledgment); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("TxAcknowledgment", err) - } - } - return nil -} -func (this *GatewayDown) Validate() error { - if this.DownlinkMessage != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.DownlinkMessage); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DownlinkMessage", err) - } - } - return nil -} -func (this *ScheduleDownlinkResponse) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Delay)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Delay", err) - } - return nil -} diff --git a/pkg/ttnpb/identifiers.go b/pkg/ttnpb/identifiers.go index 6843fd780a..b5748793f0 100644 --- a/pkg/ttnpb/identifiers.go +++ b/pkg/ttnpb/identifiers.go @@ -15,8 +15,10 @@ package ttnpb import ( + "context" "fmt" + "go.thethings.network/lorawan-stack/pkg/errors" "go.thethings.network/lorawan-stack/pkg/types" ) @@ -360,3 +362,37 @@ func (ids EndDeviceIdentifiers) Copy(x *EndDeviceIdentifiers) *EndDeviceIdentifi } return x } + +var errIdentifiers = errors.DefineInvalidArgument("identifiers", "invalid identifiers") + +// ValidateContext wraps the generated validator with (optionally context-based) custom checks. +func (ids *EndDeviceIdentifiers) ValidateContext(context.Context) error { + if err := ids.ValidateFields(); err != nil { + return errIdentifiers.WithCause(err) + } + return nil +} + +// ValidateContext wraps the generated validator with (optionally context-based) custom checks. +func (ids *ApplicationIdentifiers) ValidateContext(context.Context) error { + if err := ids.ValidateFields(); err != nil { + return errIdentifiers.WithCause(err) + } + return nil +} + +// ValidateContext wraps the generated validator with (optionally context-based) custom checks. +func (ids *GatewayIdentifiers) ValidateContext(context.Context) error { + if err := ids.ValidateFields(); err != nil { + return errIdentifiers.WithCause(err) + } + return nil +} + +// ValidateContext wraps the generated validator with (optionally context-based) custom checks. +func (ids *UserIdentifiers) ValidateContext(context.Context) error { + if err := ids.ValidateFields(); err != nil { + return errIdentifiers.WithCause(err) + } + return nil +} diff --git a/pkg/ttnpb/identifiers.pb.go b/pkg/ttnpb/identifiers.pb.go index 1a19e1c87a..cf11bb21f7 100644 --- a/pkg/ttnpb/identifiers.pb.go +++ b/pkg/ttnpb/identifiers.pb.go @@ -8,7 +8,7 @@ import golang_proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/mwitkow/go-proto-validators" +import _ "github.com/lyft/protoc-gen-validate/validate" import go_thethings_network_lorawan_stack_pkg_types "go.thethings.network/lorawan-stack/pkg/types" @@ -38,7 +38,7 @@ type ApplicationIdentifiers struct { func (m *ApplicationIdentifiers) Reset() { *m = ApplicationIdentifiers{} } func (*ApplicationIdentifiers) ProtoMessage() {} func (*ApplicationIdentifiers) Descriptor() ([]byte, []int) { - return fileDescriptor_identifiers_4cebea0e91b300a8, []int{0} + return fileDescriptor_identifiers_7cb160c39908ffad, []int{0} } func (m *ApplicationIdentifiers) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -83,7 +83,7 @@ type ClientIdentifiers struct { func (m *ClientIdentifiers) Reset() { *m = ClientIdentifiers{} } func (*ClientIdentifiers) ProtoMessage() {} func (*ClientIdentifiers) Descriptor() ([]byte, []int) { - return fileDescriptor_identifiers_4cebea0e91b300a8, []int{1} + return fileDescriptor_identifiers_7cb160c39908ffad, []int{1} } func (m *ClientIdentifiers) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -135,7 +135,7 @@ type EndDeviceIdentifiers struct { func (m *EndDeviceIdentifiers) Reset() { *m = EndDeviceIdentifiers{} } func (*EndDeviceIdentifiers) ProtoMessage() {} func (*EndDeviceIdentifiers) Descriptor() ([]byte, []int) { - return fileDescriptor_identifiers_4cebea0e91b300a8, []int{2} + return fileDescriptor_identifiers_7cb160c39908ffad, []int{2} } func (m *EndDeviceIdentifiers) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -182,7 +182,7 @@ type GatewayIdentifiers struct { func (m *GatewayIdentifiers) Reset() { *m = GatewayIdentifiers{} } func (*GatewayIdentifiers) ProtoMessage() {} func (*GatewayIdentifiers) Descriptor() ([]byte, []int) { - return fileDescriptor_identifiers_4cebea0e91b300a8, []int{3} + return fileDescriptor_identifiers_7cb160c39908ffad, []int{3} } func (m *GatewayIdentifiers) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -228,7 +228,7 @@ type OrganizationIdentifiers struct { func (m *OrganizationIdentifiers) Reset() { *m = OrganizationIdentifiers{} } func (*OrganizationIdentifiers) ProtoMessage() {} func (*OrganizationIdentifiers) Descriptor() ([]byte, []int) { - return fileDescriptor_identifiers_4cebea0e91b300a8, []int{4} + return fileDescriptor_identifiers_7cb160c39908ffad, []int{4} } func (m *OrganizationIdentifiers) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -276,7 +276,7 @@ type UserIdentifiers struct { func (m *UserIdentifiers) Reset() { *m = UserIdentifiers{} } func (*UserIdentifiers) ProtoMessage() {} func (*UserIdentifiers) Descriptor() ([]byte, []int) { - return fileDescriptor_identifiers_4cebea0e91b300a8, []int{5} + return fileDescriptor_identifiers_7cb160c39908ffad, []int{5} } func (m *UserIdentifiers) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -332,7 +332,7 @@ type OrganizationOrUserIdentifiers struct { func (m *OrganizationOrUserIdentifiers) Reset() { *m = OrganizationOrUserIdentifiers{} } func (*OrganizationOrUserIdentifiers) ProtoMessage() {} func (*OrganizationOrUserIdentifiers) Descriptor() ([]byte, []int) { - return fileDescriptor_identifiers_4cebea0e91b300a8, []int{6} + return fileDescriptor_identifiers_7cb160c39908ffad, []int{6} } func (m *OrganizationOrUserIdentifiers) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -490,7 +490,7 @@ type EntityIdentifiers struct { func (m *EntityIdentifiers) Reset() { *m = EntityIdentifiers{} } func (*EntityIdentifiers) ProtoMessage() {} func (*EntityIdentifiers) Descriptor() ([]byte, []int) { - return fileDescriptor_identifiers_4cebea0e91b300a8, []int{7} + return fileDescriptor_identifiers_7cb160c39908ffad, []int{7} } func (m *EntityIdentifiers) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -762,7 +762,7 @@ type CombinedIdentifiers struct { func (m *CombinedIdentifiers) Reset() { *m = CombinedIdentifiers{} } func (*CombinedIdentifiers) ProtoMessage() {} func (*CombinedIdentifiers) Descriptor() ([]byte, []int) { - return fileDescriptor_identifiers_4cebea0e91b300a8, []int{8} + return fileDescriptor_identifiers_7cb160c39908ffad, []int{8} } func (m *CombinedIdentifiers) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3474,71 +3474,72 @@ var ( ) func init() { - proto.RegisterFile("lorawan-stack/api/identifiers.proto", fileDescriptor_identifiers_4cebea0e91b300a8) + proto.RegisterFile("lorawan-stack/api/identifiers.proto", fileDescriptor_identifiers_7cb160c39908ffad) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/identifiers.proto", fileDescriptor_identifiers_4cebea0e91b300a8) -} - -var fileDescriptor_identifiers_4cebea0e91b300a8 = []byte{ - // 943 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4d, 0x6c, 0x1b, 0x45, - 0x14, 0x9e, 0xa9, 0x13, 0xff, 0x8c, 0x89, 0x4d, 0xb6, 0x15, 0x58, 0x95, 0x98, 0x0d, 0xa6, 0x40, - 0x90, 0xea, 0x75, 0xe5, 0x54, 0xa5, 0x54, 0x42, 0x25, 0xdb, 0x58, 0x10, 0x2e, 0x01, 0x43, 0x0e, - 0xa5, 0xb4, 0xd1, 0xda, 0x3b, 0xdd, 0x4c, 0xe3, 0xec, 0x5a, 0xbb, 0x63, 0xbb, 0x2d, 0x02, 0x55, - 0x9c, 0x7a, 0xe4, 0xc8, 0xb1, 0xe2, 0xd4, 0x63, 0x6f, 0xe4, 0x46, 0x8f, 0x39, 0xe6, 0x84, 0xaa, - 0x0a, 0x2d, 0xf5, 0xec, 0xa5, 0xc7, 0x1e, 0x7b, 0x44, 0x33, 0xde, 0xb5, 0x77, 0xd7, 0x41, 0x72, - 0x2b, 0xb8, 0xed, 0xcc, 0xbc, 0xf9, 0xbe, 0x79, 0xdf, 0x7b, 0xef, 0xd3, 0xa2, 0xf7, 0xba, 0x8e, - 0x6b, 0x0c, 0x0d, 0xbb, 0xe6, 0x31, 0xa3, 0xb3, 0x57, 0x37, 0x7a, 0xb4, 0x4e, 0x4d, 0x62, 0x33, - 0x7a, 0x93, 0x12, 0xd7, 0xd3, 0x7a, 0xae, 0xc3, 0x1c, 0xa5, 0xc4, 0x98, 0xad, 0x85, 0x81, 0xda, - 0x60, 0xed, 0x74, 0xcd, 0xa2, 0x6c, 0xb7, 0xdf, 0xd6, 0x3a, 0xce, 0x7e, 0xdd, 0x72, 0x2c, 0xa7, - 0x2e, 0xc3, 0xda, 0xfd, 0x9b, 0x72, 0x25, 0x17, 0xf2, 0x6b, 0x7c, 0xfd, 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e1, 0x83, 0x00, 0x83, 0x87, 0x01, 0x06, 0x8f, 0x02, 0x0c, 0x0f, 0x02, 0x0c, - 0x1f, 0x07, 0x18, 0x7e, 0x77, 0x76, 0x5e, 0xf7, 0x64, 0x76, 0xaf, 0xdd, 0xce, 0xca, 0x7f, 0x96, - 0xb5, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x69, 0x4c, 0x89, 0x77, 0x51, 0x09, 0x00, 0x00, + golang_proto.RegisterFile("lorawan-stack/api/identifiers.proto", fileDescriptor_identifiers_7cb160c39908ffad) +} + +var fileDescriptor_identifiers_7cb160c39908ffad = []byte{ + // 953 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x41, 0x6c, 0x1b, 0x45, + 0x17, 0x9e, 0x89, 0x63, 0x3b, 0x1e, 0xff, 0xb1, 0x9b, 0x6d, 0xf5, 0x63, 0x55, 0x62, 0x36, 0x98, + 0x08, 0x82, 0x54, 0xaf, 0x91, 0x53, 0x2a, 0x48, 0x85, 0x4a, 0xb6, 0xb1, 0x20, 0x08, 0x29, 0x60, + 0xc8, 0x01, 0x4a, 0x89, 0xd6, 0xde, 0xc9, 0x66, 0x88, 0xb3, 0x6b, 0xed, 0x8e, 0x1d, 0xa5, 0x15, + 0x52, 0x39, 0x20, 0x55, 0x9c, 0x38, 0x72, 0xac, 0x38, 0xf5, 0xd8, 0x1b, 0x11, 0xa7, 0x88, 0x53, + 0x8e, 0x39, 0x56, 0x15, 0x5a, 0xd5, 0xb3, 0x97, 0x72, 0xeb, 0xb1, 0x47, 0x34, 0xe3, 0xdd, 0x78, + 0x77, 0x1d, 0x24, 0x5c, 0xc1, 0x6d, 0x66, 0xf6, 0xcd, 0xf7, 0xcd, 0xfb, 0xde, 0x7b, 0x9f, 0x16, + 0xbd, 0xde, 0x75, 0x5c, 0xe3, 0xc0, 0xb0, 0x6b, 0x1e, 0x33, 0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d, 0x62, + 0xf0, 0x6c, 0x88, 0xc1, 0xf3, 0x21, 0x06, 0x2f, 0x86, 0x18, 0xde, 0xe3, 0x18, 0xde, 0xe7, 0x18, + 0x3c, 0xe4, 0x18, 0x3e, 0xe2, 0x18, 0x1c, 0x71, 0x0c, 0x8e, 0x39, 0x06, 0x27, 0x1c, 0xc3, 0x53, + 0x8e, 0xe1, 0x63, 0x8e, 0xc1, 0x53, 0x8e, 0xe1, 0x33, 0x8e, 0xc1, 0x73, 0x8e, 0xe1, 0x0b, 0x8e, + 0xc1, 0xbd, 0x00, 0x83, 0xfb, 0x01, 0x86, 0x3f, 0x05, 0x18, 0xfc, 0x1c, 0x60, 0xf8, 0x20, 0xc0, + 0xe0, 0x61, 0x80, 0xc1, 0xa3, 0x00, 0xc3, 0xa3, 0x00, 0xc3, 0xe3, 0x00, 0xc3, 0xaf, 0xae, 0xfc, + 0x53, 0x0f, 0x65, 0x76, 0xaf, 0xdd, 0xce, 0xc9, 0x1f, 0x9a, 0x95, 0xbf, 0x02, 0x00, 0x00, 0xff, + 0xff, 0xe6, 0x59, 0xcd, 0xe7, 0x73, 0x09, 0x00, 0x00, } diff --git a/pkg/ttnpb/identifiers.pb.paths.fm.go b/pkg/ttnpb/identifiers.pb.paths.fm.go new file mode 100644 index 0000000000..635f48027e --- /dev/null +++ b/pkg/ttnpb/identifiers.pb.paths.fm.go @@ -0,0 +1,104 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var ApplicationIdentifiersFieldPathsNested = []string{ + "application_id", +} + +var ApplicationIdentifiersFieldPathsTopLevel = []string{ + "application_id", +} +var ClientIdentifiersFieldPathsNested = []string{ + "client_id", +} + +var ClientIdentifiersFieldPathsTopLevel = []string{ + "client_id", +} +var EndDeviceIdentifiersFieldPathsNested = []string{ + "application_ids", + "application_ids.application_id", + "dev_addr", + "dev_eui", + "device_id", + "join_eui", +} + +var EndDeviceIdentifiersFieldPathsTopLevel = []string{ + "application_ids", + "dev_addr", + "dev_eui", + "device_id", + "join_eui", +} +var GatewayIdentifiersFieldPathsNested = []string{ + "eui", + "gateway_id", +} + +var GatewayIdentifiersFieldPathsTopLevel = []string{ + "eui", + "gateway_id", +} +var OrganizationIdentifiersFieldPathsNested = []string{ + "organization_id", +} + +var OrganizationIdentifiersFieldPathsTopLevel = []string{ + "organization_id", +} +var UserIdentifiersFieldPathsNested = []string{ + "email", + "user_id", +} + +var UserIdentifiersFieldPathsTopLevel = []string{ + "email", + "user_id", +} +var OrganizationOrUserIdentifiersFieldPathsNested = []string{ + "ids", + "ids.organization_ids", + "ids.organization_ids.organization_id", + "ids.user_ids", + "ids.user_ids.email", + "ids.user_ids.user_id", +} + +var OrganizationOrUserIdentifiersFieldPathsTopLevel = []string{ + "ids", +} +var EntityIdentifiersFieldPathsNested = []string{ + "ids", + "ids.application_ids", + "ids.application_ids.application_id", + "ids.client_ids", + "ids.client_ids.client_id", + "ids.device_ids", + "ids.device_ids.application_ids", + "ids.device_ids.application_ids.application_id", + "ids.device_ids.dev_addr", + "ids.device_ids.dev_eui", + "ids.device_ids.device_id", + "ids.device_ids.join_eui", + "ids.gateway_ids", + "ids.gateway_ids.eui", + "ids.gateway_ids.gateway_id", + "ids.organization_ids", + "ids.organization_ids.organization_id", + "ids.user_ids", + "ids.user_ids.email", + "ids.user_ids.user_id", +} + +var EntityIdentifiersFieldPathsTopLevel = []string{ + "ids", +} +var CombinedIdentifiersFieldPathsNested = []string{ + "entity_identifiers", +} + +var CombinedIdentifiersFieldPathsTopLevel = []string{ + "entity_identifiers", +} diff --git a/pkg/ttnpb/identifiers.pb.fm.go b/pkg/ttnpb/identifiers.pb.setters.fm.go similarity index 86% rename from pkg/ttnpb/identifiers.pb.fm.go rename to pkg/ttnpb/identifiers.pb.setters.fm.go index 85add9c950..304962ab38 100644 --- a/pkg/ttnpb/identifiers.pb.fm.go +++ b/pkg/ttnpb/identifiers.pb.setters.fm.go @@ -4,14 +4,6 @@ package ttnpb import fmt "fmt" -var ApplicationIdentifiersFieldPathsNested = []string{ - "application_id", -} - -var ApplicationIdentifiersFieldPathsTopLevel = []string{ - "application_id", -} - func (dst *ApplicationIdentifiers) SetFields(src *ApplicationIdentifiers, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -33,14 +25,6 @@ func (dst *ApplicationIdentifiers) SetFields(src *ApplicationIdentifiers, paths return nil } -var ClientIdentifiersFieldPathsNested = []string{ - "client_id", -} - -var ClientIdentifiersFieldPathsTopLevel = []string{ - "client_id", -} - func (dst *ClientIdentifiers) SetFields(src *ClientIdentifiers, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -62,23 +46,6 @@ func (dst *ClientIdentifiers) SetFields(src *ClientIdentifiers, paths ...string) return nil } -var EndDeviceIdentifiersFieldPathsNested = []string{ - "application_ids", - "application_ids.application_id", - "dev_addr", - "dev_eui", - "device_id", - "join_eui", -} - -var EndDeviceIdentifiersFieldPathsTopLevel = []string{ - "application_ids", - "dev_addr", - "dev_eui", - "device_id", - "join_eui", -} - func (dst *EndDeviceIdentifiers) SetFields(src *EndDeviceIdentifiers, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -145,16 +112,6 @@ func (dst *EndDeviceIdentifiers) SetFields(src *EndDeviceIdentifiers, paths ...s return nil } -var GatewayIdentifiersFieldPathsNested = []string{ - "eui", - "gateway_id", -} - -var GatewayIdentifiersFieldPathsTopLevel = []string{ - "eui", - "gateway_id", -} - func (dst *GatewayIdentifiers) SetFields(src *GatewayIdentifiers, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -185,14 +142,6 @@ func (dst *GatewayIdentifiers) SetFields(src *GatewayIdentifiers, paths ...strin return nil } -var OrganizationIdentifiersFieldPathsNested = []string{ - "organization_id", -} - -var OrganizationIdentifiersFieldPathsTopLevel = []string{ - "organization_id", -} - func (dst *OrganizationIdentifiers) SetFields(src *OrganizationIdentifiers, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -214,16 +163,6 @@ func (dst *OrganizationIdentifiers) SetFields(src *OrganizationIdentifiers, path return nil } -var UserIdentifiersFieldPathsNested = []string{ - "email", - "user_id", -} - -var UserIdentifiersFieldPathsTopLevel = []string{ - "email", - "user_id", -} - func (dst *UserIdentifiers) SetFields(src *UserIdentifiers, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -255,19 +194,6 @@ func (dst *UserIdentifiers) SetFields(src *UserIdentifiers, paths ...string) err return nil } -var OrganizationOrUserIdentifiersFieldPathsNested = []string{ - "ids", - "ids.organization_ids", - "ids.organization_ids.organization_id", - "ids.user_ids", - "ids.user_ids.email", - "ids.user_ids.user_id", -} - -var OrganizationOrUserIdentifiersFieldPathsTopLevel = []string{ - "ids", -} - func (dst *OrganizationOrUserIdentifiers) SetFields(src *OrganizationOrUserIdentifiers, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -348,33 +274,6 @@ func (dst *OrganizationOrUserIdentifiers) SetFields(src *OrganizationOrUserIdent return nil } -var EntityIdentifiersFieldPathsNested = []string{ - "ids", - "ids.application_ids", - "ids.application_ids.application_id", - "ids.client_ids", - "ids.client_ids.client_id", - "ids.device_ids", - "ids.device_ids.application_ids", - "ids.device_ids.application_ids.application_id", - "ids.device_ids.dev_addr", - "ids.device_ids.dev_eui", - "ids.device_ids.device_id", - "ids.device_ids.join_eui", - "ids.gateway_ids", - "ids.gateway_ids.eui", - "ids.gateway_ids.gateway_id", - "ids.organization_ids", - "ids.organization_ids.organization_id", - "ids.user_ids", - "ids.user_ids.email", - "ids.user_ids.user_id", -} - -var EntityIdentifiersFieldPathsTopLevel = []string{ - "ids", -} - func (dst *EntityIdentifiers) SetFields(src *EntityIdentifiers, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -551,14 +450,6 @@ func (dst *EntityIdentifiers) SetFields(src *EntityIdentifiers, paths ...string) return nil } -var CombinedIdentifiersFieldPathsNested = []string{ - "entity_identifiers", -} - -var CombinedIdentifiersFieldPathsTopLevel = []string{ - "entity_identifiers", -} - func (dst *CombinedIdentifiers) SetFields(src *CombinedIdentifiers, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { diff --git a/pkg/ttnpb/identifiers.pb.validate.go b/pkg/ttnpb/identifiers.pb.validate.go new file mode 100644 index 0000000000..d62b7b8bf6 --- /dev/null +++ b/pkg/ttnpb/identifiers.pb.validate.go @@ -0,0 +1,1026 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on ApplicationIdentifiers with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ApplicationIdentifiers) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ApplicationIdentifiersFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "application_id": + + if utf8.RuneCountInString(m.GetApplicationID()) > 36 { + return ApplicationIdentifiersValidationError{ + field: "application_id", + reason: "value length must be at most 36 runes", + } + } + + if !_ApplicationIdentifiers_ApplicationID_Pattern.MatchString(m.GetApplicationID()) { + return ApplicationIdentifiersValidationError{ + field: "application_id", + reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$\"", + } + } + + default: + return ApplicationIdentifiersValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ApplicationIdentifiersValidationError is the validation error returned by +// ApplicationIdentifiers.ValidateFields if the designated constraints aren't met. +type ApplicationIdentifiersValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ApplicationIdentifiersValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ApplicationIdentifiersValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ApplicationIdentifiersValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ApplicationIdentifiersValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ApplicationIdentifiersValidationError) ErrorName() string { + return "ApplicationIdentifiersValidationError" +} + +// Error satisfies the builtin error interface +func (e ApplicationIdentifiersValidationError) 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 %sApplicationIdentifiers.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ApplicationIdentifiersValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ApplicationIdentifiersValidationError{} + +var _ApplicationIdentifiers_ApplicationID_Pattern = regexp.MustCompile("^[a-z0-9](?:[-]?[a-z0-9]){2,}$") + +// ValidateFields checks the field values on ClientIdentifiers with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ClientIdentifiers) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ClientIdentifiersFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "client_id": + + if utf8.RuneCountInString(m.GetClientID()) > 36 { + return ClientIdentifiersValidationError{ + field: "client_id", + reason: "value length must be at most 36 runes", + } + } + + if !_ClientIdentifiers_ClientID_Pattern.MatchString(m.GetClientID()) { + return ClientIdentifiersValidationError{ + field: "client_id", + reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$\"", + } + } + + default: + return ClientIdentifiersValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ClientIdentifiersValidationError is the validation error returned by +// ClientIdentifiers.ValidateFields if the designated constraints aren't met. +type ClientIdentifiersValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ClientIdentifiersValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ClientIdentifiersValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ClientIdentifiersValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ClientIdentifiersValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ClientIdentifiersValidationError) ErrorName() string { + return "ClientIdentifiersValidationError" +} + +// Error satisfies the builtin error interface +func (e ClientIdentifiersValidationError) 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 %sClientIdentifiers.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ClientIdentifiersValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ClientIdentifiersValidationError{} + +var _ClientIdentifiers_ClientID_Pattern = regexp.MustCompile("^[a-z0-9](?:[-]?[a-z0-9]){2,}$") + +// ValidateFields checks the field values on EndDeviceIdentifiers with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *EndDeviceIdentifiers) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = EndDeviceIdentifiersFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "device_id": + + if utf8.RuneCountInString(m.GetDeviceID()) > 36 { + return EndDeviceIdentifiersValidationError{ + field: "device_id", + reason: "value length must be at most 36 runes", + } + } + + if !_EndDeviceIdentifiers_DeviceID_Pattern.MatchString(m.GetDeviceID()) { + return EndDeviceIdentifiersValidationError{ + field: "device_id", + reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$\"", + } + } + + case "application_ids": + + if v, ok := interface{}(&m.ApplicationIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EndDeviceIdentifiersValidationError{ + field: "application_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "dev_eui": + // no validation rules for DevEUI + case "join_eui": + // no validation rules for JoinEUI + case "dev_addr": + // no validation rules for DevAddr + default: + return EndDeviceIdentifiersValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// EndDeviceIdentifiersValidationError is the validation error returned by +// EndDeviceIdentifiers.ValidateFields if the designated constraints aren't met. +type EndDeviceIdentifiersValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e EndDeviceIdentifiersValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e EndDeviceIdentifiersValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e EndDeviceIdentifiersValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e EndDeviceIdentifiersValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e EndDeviceIdentifiersValidationError) ErrorName() string { + return "EndDeviceIdentifiersValidationError" +} + +// Error satisfies the builtin error interface +func (e EndDeviceIdentifiersValidationError) 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 %sEndDeviceIdentifiers.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = EndDeviceIdentifiersValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = EndDeviceIdentifiersValidationError{} + +var _EndDeviceIdentifiers_DeviceID_Pattern = regexp.MustCompile("^[a-z0-9](?:[-]?[a-z0-9]){2,}$") + +// ValidateFields checks the field values on GatewayIdentifiers with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GatewayIdentifiers) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GatewayIdentifiersFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "gateway_id": + + if utf8.RuneCountInString(m.GetGatewayID()) > 36 { + return GatewayIdentifiersValidationError{ + field: "gateway_id", + reason: "value length must be at most 36 runes", + } + } + + if !_GatewayIdentifiers_GatewayID_Pattern.MatchString(m.GetGatewayID()) { + return GatewayIdentifiersValidationError{ + field: "gateway_id", + reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$\"", + } + } + + case "eui": + // no validation rules for EUI + default: + return GatewayIdentifiersValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GatewayIdentifiersValidationError is the validation error returned by +// GatewayIdentifiers.ValidateFields if the designated constraints aren't met. +type GatewayIdentifiersValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GatewayIdentifiersValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GatewayIdentifiersValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GatewayIdentifiersValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GatewayIdentifiersValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GatewayIdentifiersValidationError) ErrorName() string { + return "GatewayIdentifiersValidationError" +} + +// Error satisfies the builtin error interface +func (e GatewayIdentifiersValidationError) 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 %sGatewayIdentifiers.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GatewayIdentifiersValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GatewayIdentifiersValidationError{} + +var _GatewayIdentifiers_GatewayID_Pattern = regexp.MustCompile("^[a-z0-9](?:[-]?[a-z0-9]){2,}$") + +// ValidateFields checks the field values on OrganizationIdentifiers with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *OrganizationIdentifiers) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = OrganizationIdentifiersFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "organization_id": + + if utf8.RuneCountInString(m.GetOrganizationID()) > 36 { + return OrganizationIdentifiersValidationError{ + field: "organization_id", + reason: "value length must be at most 36 runes", + } + } + + if !_OrganizationIdentifiers_OrganizationID_Pattern.MatchString(m.GetOrganizationID()) { + return OrganizationIdentifiersValidationError{ + field: "organization_id", + reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$\"", + } + } + + default: + return OrganizationIdentifiersValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// OrganizationIdentifiersValidationError is the validation error returned by +// OrganizationIdentifiers.ValidateFields if the designated constraints aren't met. +type OrganizationIdentifiersValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e OrganizationIdentifiersValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e OrganizationIdentifiersValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e OrganizationIdentifiersValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e OrganizationIdentifiersValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e OrganizationIdentifiersValidationError) ErrorName() string { + return "OrganizationIdentifiersValidationError" +} + +// Error satisfies the builtin error interface +func (e OrganizationIdentifiersValidationError) 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 %sOrganizationIdentifiers.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = OrganizationIdentifiersValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = OrganizationIdentifiersValidationError{} + +var _OrganizationIdentifiers_OrganizationID_Pattern = regexp.MustCompile("^[a-z0-9](?:[-]?[a-z0-9]){2,}$") + +// ValidateFields checks the field values on UserIdentifiers with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *UserIdentifiers) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = UserIdentifiersFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "user_id": + + if utf8.RuneCountInString(m.GetUserID()) > 36 { + return UserIdentifiersValidationError{ + field: "user_id", + reason: "value length must be at most 36 runes", + } + } + + if !_UserIdentifiers_UserID_Pattern.MatchString(m.GetUserID()) { + return UserIdentifiersValidationError{ + field: "user_id", + reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$\"", + } + } + + case "email": + // no validation rules for Email + default: + return UserIdentifiersValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// UserIdentifiersValidationError is the validation error returned by +// UserIdentifiers.ValidateFields if the designated constraints aren't met. +type UserIdentifiersValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UserIdentifiersValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UserIdentifiersValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UserIdentifiersValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UserIdentifiersValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UserIdentifiersValidationError) ErrorName() string { return "UserIdentifiersValidationError" } + +// Error satisfies the builtin error interface +func (e UserIdentifiersValidationError) 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 %sUserIdentifiers.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UserIdentifiersValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UserIdentifiersValidationError{} + +var _UserIdentifiers_UserID_Pattern = regexp.MustCompile("^[a-z0-9](?:[-]?[a-z0-9]){2,}$") + +// ValidateFields checks the field values on OrganizationOrUserIdentifiers with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *OrganizationOrUserIdentifiers) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = OrganizationOrUserIdentifiersFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "ids": + if len(subs) == 0 { + subs = []string{ + "organization_ids", "user_ids", + } + } + for name, subs := range _processPaths(subs) { + _ = subs + switch name { + case "organization_ids": + + if v, ok := interface{}(m.GetOrganizationIDs()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OrganizationOrUserIdentifiersValidationError{ + field: "organization_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "user_ids": + + if v, ok := interface{}(m.GetUserIDs()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OrganizationOrUserIdentifiersValidationError{ + field: "user_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + } + default: + return OrganizationOrUserIdentifiersValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// OrganizationOrUserIdentifiersValidationError is the validation error +// returned by OrganizationOrUserIdentifiers.ValidateFields if the designated +// constraints aren't met. +type OrganizationOrUserIdentifiersValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e OrganizationOrUserIdentifiersValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e OrganizationOrUserIdentifiersValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e OrganizationOrUserIdentifiersValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e OrganizationOrUserIdentifiersValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e OrganizationOrUserIdentifiersValidationError) ErrorName() string { + return "OrganizationOrUserIdentifiersValidationError" +} + +// Error satisfies the builtin error interface +func (e OrganizationOrUserIdentifiersValidationError) 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 %sOrganizationOrUserIdentifiers.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = OrganizationOrUserIdentifiersValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = OrganizationOrUserIdentifiersValidationError{} + +// ValidateFields checks the field values on EntityIdentifiers with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *EntityIdentifiers) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = EntityIdentifiersFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "ids": + if len(subs) == 0 { + subs = []string{ + "application_ids", "client_ids", "device_ids", "gateway_ids", "organization_ids", "user_ids", + } + } + for name, subs := range _processPaths(subs) { + _ = subs + switch name { + case "application_ids": + + if v, ok := interface{}(m.GetApplicationIDs()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EntityIdentifiersValidationError{ + field: "application_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "client_ids": + + if v, ok := interface{}(m.GetClientIDs()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EntityIdentifiersValidationError{ + field: "client_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "device_ids": + + if v, ok := interface{}(m.GetDeviceIDs()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EntityIdentifiersValidationError{ + field: "device_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "gateway_ids": + + if v, ok := interface{}(m.GetGatewayIDs()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EntityIdentifiersValidationError{ + field: "gateway_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "organization_ids": + + if v, ok := interface{}(m.GetOrganizationIDs()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EntityIdentifiersValidationError{ + field: "organization_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "user_ids": + + if v, ok := interface{}(m.GetUserIDs()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return EntityIdentifiersValidationError{ + field: "user_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + } + default: + return EntityIdentifiersValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// EntityIdentifiersValidationError is the validation error returned by +// EntityIdentifiers.ValidateFields if the designated constraints aren't met. +type EntityIdentifiersValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e EntityIdentifiersValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e EntityIdentifiersValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e EntityIdentifiersValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e EntityIdentifiersValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e EntityIdentifiersValidationError) ErrorName() string { + return "EntityIdentifiersValidationError" +} + +// Error satisfies the builtin error interface +func (e EntityIdentifiersValidationError) 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 %sEntityIdentifiers.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = EntityIdentifiersValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = EntityIdentifiersValidationError{} + +// ValidateFields checks the field values on CombinedIdentifiers with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *CombinedIdentifiers) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = CombinedIdentifiersFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "entity_identifiers": + + for idx, item := range m.GetEntityIdentifiers() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return CombinedIdentifiersValidationError{ + field: fmt.Sprintf("entity_identifiers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + default: + return CombinedIdentifiersValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// CombinedIdentifiersValidationError is the validation error returned by +// CombinedIdentifiers.ValidateFields if the designated constraints aren't met. +type CombinedIdentifiersValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CombinedIdentifiersValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CombinedIdentifiersValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CombinedIdentifiersValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CombinedIdentifiersValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CombinedIdentifiersValidationError) ErrorName() string { + return "CombinedIdentifiersValidationError" +} + +// Error satisfies the builtin error interface +func (e CombinedIdentifiersValidationError) 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 %sCombinedIdentifiers.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CombinedIdentifiersValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CombinedIdentifiersValidationError{} diff --git a/pkg/ttnpb/identifiers.validator.pb.go b/pkg/ttnpb/identifiers.validator.pb.go deleted file mode 100644 index 7737b0a4d0..0000000000 --- a/pkg/ttnpb/identifiers.validator.pb.go +++ /dev/null @@ -1,164 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/identifiers.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import regexp "regexp" -import fmt "fmt" -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/mwitkow/go-proto-validators" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -var _regex_ApplicationIdentifiers_ApplicationID = regexp.MustCompile(`^[a-z0-9](?:[-]?[a-z0-9]){2,}$`) - -func (this *ApplicationIdentifiers) Validate() error { - if !_regex_ApplicationIdentifiers_ApplicationID.MatchString(this.ApplicationID) { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationID", fmt.Errorf(`value '%v' must be a string conforming to regex "^[a-z0-9](?:[-]?[a-z0-9]){2,}$"`, this.ApplicationID)) - } - if !(len(this.ApplicationID) < 37) { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationID", fmt.Errorf(`value '%v' must length be less than '37'`, this.ApplicationID)) - } - return nil -} - -var _regex_ClientIdentifiers_ClientID = regexp.MustCompile(`^[a-z0-9](?:[-]?[a-z0-9]){2,}$`) - -func (this *ClientIdentifiers) Validate() error { - if !_regex_ClientIdentifiers_ClientID.MatchString(this.ClientID) { - return github_com_mwitkow_go_proto_validators.FieldError("ClientID", fmt.Errorf(`value '%v' must be a string conforming to regex "^[a-z0-9](?:[-]?[a-z0-9]){2,}$"`, this.ClientID)) - } - if !(len(this.ClientID) < 37) { - return github_com_mwitkow_go_proto_validators.FieldError("ClientID", fmt.Errorf(`value '%v' must length be less than '37'`, this.ClientID)) - } - return nil -} - -var _regex_EndDeviceIdentifiers_DeviceID = regexp.MustCompile(`^[a-z0-9](?:[-]?[a-z0-9]){2,}$`) - -func (this *EndDeviceIdentifiers) Validate() error { - if !_regex_EndDeviceIdentifiers_DeviceID.MatchString(this.DeviceID) { - return github_com_mwitkow_go_proto_validators.FieldError("DeviceID", fmt.Errorf(`value '%v' must be a string conforming to regex "^[a-z0-9](?:[-]?[a-z0-9]){2,}$"`, this.DeviceID)) - } - if !(len(this.DeviceID) < 37) { - return github_com_mwitkow_go_proto_validators.FieldError("DeviceID", fmt.Errorf(`value '%v' must length be less than '37'`, this.DeviceID)) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ApplicationIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationIdentifiers", err) - } - return nil -} - -var _regex_GatewayIdentifiers_GatewayID = regexp.MustCompile(`^[a-z0-9](?:[-]?[a-z0-9]){2,}$`) - -func (this *GatewayIdentifiers) Validate() error { - if !_regex_GatewayIdentifiers_GatewayID.MatchString(this.GatewayID) { - return github_com_mwitkow_go_proto_validators.FieldError("GatewayID", fmt.Errorf(`value '%v' must be a string conforming to regex "^[a-z0-9](?:[-]?[a-z0-9]){2,}$"`, this.GatewayID)) - } - if !(len(this.GatewayID) < 37) { - return github_com_mwitkow_go_proto_validators.FieldError("GatewayID", fmt.Errorf(`value '%v' must length be less than '37'`, this.GatewayID)) - } - return nil -} - -var _regex_OrganizationIdentifiers_OrganizationID = regexp.MustCompile(`^[a-z0-9](?:[-]?[a-z0-9]){2,}$`) - -func (this *OrganizationIdentifiers) Validate() error { - if !_regex_OrganizationIdentifiers_OrganizationID.MatchString(this.OrganizationID) { - return github_com_mwitkow_go_proto_validators.FieldError("OrganizationID", fmt.Errorf(`value '%v' must be a string conforming to regex "^[a-z0-9](?:[-]?[a-z0-9]){2,}$"`, this.OrganizationID)) - } - if !(len(this.OrganizationID) < 37) { - return github_com_mwitkow_go_proto_validators.FieldError("OrganizationID", fmt.Errorf(`value '%v' must length be less than '37'`, this.OrganizationID)) - } - return nil -} - -var _regex_UserIdentifiers_UserID = regexp.MustCompile(`^[a-z0-9](?:[-]?[a-z0-9]){2,}$`) - -func (this *UserIdentifiers) Validate() error { - if !_regex_UserIdentifiers_UserID.MatchString(this.UserID) { - return github_com_mwitkow_go_proto_validators.FieldError("UserID", fmt.Errorf(`value '%v' must be a string conforming to regex "^[a-z0-9](?:[-]?[a-z0-9]){2,}$"`, this.UserID)) - } - if !(len(this.UserID) < 37) { - return github_com_mwitkow_go_proto_validators.FieldError("UserID", fmt.Errorf(`value '%v' must length be less than '37'`, this.UserID)) - } - return nil -} -func (this *OrganizationOrUserIdentifiers) Validate() error { - if oneOfNester, ok := this.GetIds().(*OrganizationOrUserIdentifiers_OrganizationIDs); ok { - if oneOfNester.OrganizationIDs != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.OrganizationIDs); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("OrganizationIDs", err) - } - } - } - if oneOfNester, ok := this.GetIds().(*OrganizationOrUserIdentifiers_UserIDs); ok { - if oneOfNester.UserIDs != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.UserIDs); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UserIDs", err) - } - } - } - return nil -} -func (this *EntityIdentifiers) Validate() error { - if oneOfNester, ok := this.GetIds().(*EntityIdentifiers_ApplicationIDs); ok { - if oneOfNester.ApplicationIDs != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.ApplicationIDs); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationIDs", err) - } - } - } - if oneOfNester, ok := this.GetIds().(*EntityIdentifiers_ClientIDs); ok { - if oneOfNester.ClientIDs != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.ClientIDs); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ClientIDs", err) - } - } - } - if oneOfNester, ok := this.GetIds().(*EntityIdentifiers_DeviceIDs); ok { - if oneOfNester.DeviceIDs != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.DeviceIDs); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DeviceIDs", err) - } - } - } - if oneOfNester, ok := this.GetIds().(*EntityIdentifiers_GatewayIDs); ok { - if oneOfNester.GatewayIDs != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.GatewayIDs); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("GatewayIDs", err) - } - } - } - if oneOfNester, ok := this.GetIds().(*EntityIdentifiers_OrganizationIDs); ok { - if oneOfNester.OrganizationIDs != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.OrganizationIDs); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("OrganizationIDs", err) - } - } - } - if oneOfNester, ok := this.GetIds().(*EntityIdentifiers_UserIDs); ok { - if oneOfNester.UserIDs != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.UserIDs); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UserIDs", err) - } - } - } - return nil -} -func (this *CombinedIdentifiers) Validate() error { - for _, item := range this.EntityIdentifiers { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("EntityIdentifiers", err) - } - } - } - return nil -} diff --git a/pkg/ttnpb/identifiers_test.go b/pkg/ttnpb/identifiers_test.go index 082d414af7..028301a939 100644 --- a/pkg/ttnpb/identifiers_test.go +++ b/pkg/ttnpb/identifiers_test.go @@ -202,5 +202,81 @@ func TestEntityIdentifiers(t *testing.T) { eID = ouID.EntityIdentifiers() a.So(eID, should.NotBeNil) a.So(eID.Identifiers(), should.Resemble, usrID) +} + +func TestUserIdentifiersValidate(t *testing.T) { + a := assertions.New(t) + + ids := UserIdentifiers{ + UserID: "foo", + Email: "foo@bar.com", + } + a.So(ids.ValidateFields(), should.BeNil) + + ids = UserIdentifiers{ + UserID: "foo", + } + a.So(ids.ValidateFields(), should.BeNil) + + ids = UserIdentifiers{ + Email: "foo@bar.com", + } + a.So(ids.ValidateFields(), should.NotBeNil) + + ids = UserIdentifiers{} + err := ids.ValidateFields() + a.So(err, should.NotBeNil) + + ids = UserIdentifiers{ + UserID: "foo", + Email: "foobar.com", + } + a.So(ids.ValidateFields(), should.BeNil) + + ids = UserIdentifiers{ + UserID: "_foo", + Email: "foo@bar.com", + } + a.So(ids.ValidateFields(), should.NotBeNil) +} +func TestGatewayIdentifiersValidate(t *testing.T) { + a := assertions.New(t) + + ids := GatewayIdentifiers{ + GatewayID: "foo-gtw", + EUI: &types.EUI64{0x26, 0x12, 0x34, 0x56, 0x42, 0x42, 0x42, 0x42}, + } + a.So(ids.ValidateFields(), should.BeNil) + + ids = GatewayIdentifiers{ + GatewayID: "foo-gtw", + } + a.So(ids.ValidateFields(), should.BeNil) + + ids = GatewayIdentifiers{ + EUI: &types.EUI64{0x26, 0x12, 0x34, 0x56, 0x42, 0x42, 0x42, 0x42}, + } + a.So(ids.ValidateFields(), should.NotBeNil) + + ids = GatewayIdentifiers{} + err := ids.ValidateFields() + a.So(err, should.NotBeNil) + + ids = GatewayIdentifiers{ + GatewayID: "_foo-gtw", + EUI: &types.EUI64{0x26, 0x12, 0x34, 0x56, 0x42, 0x42, 0x42, 0x42}, + } + a.So(ids.ValidateFields(), should.NotBeNil) + + ids = GatewayIdentifiers{ + GatewayID: "foo-gtw", + EUI: &types.EUI64{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + } + a.So(ids.ValidateFields(), should.BeNil) + + ids = GatewayIdentifiers{ + EUI: new(types.EUI64), + } + a.So(ids.ValidateFields(), should.NotBeNil) } diff --git a/pkg/ttnpb/identifiers_validators.go b/pkg/ttnpb/identifiers_validators.go deleted file mode 100644 index 05708e3132..0000000000 --- a/pkg/ttnpb/identifiers_validators.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright © 2019 The Things Network Foundation, The Things Industries B.V. -// -// 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. - -package ttnpb - -import ( - "context" - - "go.thethings.network/lorawan-stack/pkg/errors" -) - -var errIdentifiers = errors.DefineInvalidArgument("identifiers", "invalid identifiers") - -// ValidateContext wraps the generated validator with (optionally context-based) custom checks. -func (ids *EndDeviceIdentifiers) ValidateContext(context.Context) error { - if err := ids.Validate(); err != nil { - return errIdentifiers.WithCause(err) - } - return nil -} - -// ValidateContext wraps the generated validator with (optionally context-based) custom checks. -func (ids *ApplicationIdentifiers) ValidateContext(context.Context) error { - if err := ids.Validate(); err != nil { - return errIdentifiers.WithCause(err) - } - return nil -} - -// ValidateContext wraps the generated validator with (optionally context-based) custom checks. -func (ids *GatewayIdentifiers) ValidateContext(context.Context) error { - if err := ids.Validate(); err != nil { - return errIdentifiers.WithCause(err) - } - return nil -} - -// ValidateContext wraps the generated validator with (optionally context-based) custom checks. -func (ids *UserIdentifiers) ValidateContext(context.Context) error { - if err := ids.Validate(); err != nil { - return errIdentifiers.WithCause(err) - } - return nil -} diff --git a/pkg/ttnpb/identifiers_validators_test.go b/pkg/ttnpb/identifiers_validators_test.go deleted file mode 100644 index 9a4a8f3bc3..0000000000 --- a/pkg/ttnpb/identifiers_validators_test.go +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright © 2019 The Things Network Foundation, The Things Industries B.V. -// -// 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. - -package ttnpb - -import ( - "testing" - - "github.com/smartystreets/assertions" - "go.thethings.network/lorawan-stack/pkg/types" - "go.thethings.network/lorawan-stack/pkg/util/test/assertions/should" -) - -func TestUserIdentifiersValidate(t *testing.T) { - a := assertions.New(t) - - ids := UserIdentifiers{ - UserID: "foo", - Email: "foo@bar.com", - } - a.So(ids.Validate(), should.BeNil) - - ids = UserIdentifiers{ - UserID: "foo", - } - a.So(ids.Validate(), should.BeNil) - - ids = UserIdentifiers{ - Email: "foo@bar.com", - } - a.So(ids.Validate(), should.NotBeNil) - - ids = UserIdentifiers{} - err := ids.Validate() - a.So(err, should.NotBeNil) - - ids = UserIdentifiers{ - UserID: "foo", - Email: "foobar.com", - } - a.So(ids.Validate(), should.BeNil) - - ids = UserIdentifiers{ - UserID: "_foo", - Email: "foo@bar.com", - } - a.So(ids.Validate(), should.NotBeNil) -} - -func TestGatewayIdentifiersValidate(t *testing.T) { - a := assertions.New(t) - - ids := GatewayIdentifiers{ - GatewayID: "foo-gtw", - EUI: &types.EUI64{0x26, 0x12, 0x34, 0x56, 0x42, 0x42, 0x42, 0x42}, - } - a.So(ids.Validate(), should.BeNil) - - ids = GatewayIdentifiers{ - GatewayID: "foo-gtw", - } - a.So(ids.Validate(), should.BeNil) - - ids = GatewayIdentifiers{ - EUI: &types.EUI64{0x26, 0x12, 0x34, 0x56, 0x42, 0x42, 0x42, 0x42}, - } - a.So(ids.Validate(), should.NotBeNil) - - ids = GatewayIdentifiers{} - err := ids.Validate() - a.So(err, should.NotBeNil) - - ids = GatewayIdentifiers{ - GatewayID: "_foo-gtw", - EUI: &types.EUI64{0x26, 0x12, 0x34, 0x56, 0x42, 0x42, 0x42, 0x42}, - } - a.So(ids.Validate(), should.NotBeNil) - - ids = GatewayIdentifiers{ - GatewayID: "foo-gtw", - EUI: &types.EUI64{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - } - a.So(ids.Validate(), should.BeNil) - - ids = GatewayIdentifiers{ - EUI: new(types.EUI64), - } - a.So(ids.Validate(), should.NotBeNil) -} diff --git a/pkg/ttnpb/identityserver.pb.go b/pkg/ttnpb/identityserver.pb.go index 3e48a2dc50..fb431401e4 100644 --- a/pkg/ttnpb/identityserver.pb.go +++ b/pkg/ttnpb/identityserver.pb.go @@ -9,6 +9,7 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" import _ "google.golang.org/genproto/googleapis/api/annotations" import ( @@ -47,7 +48,7 @@ type AuthInfoResponse struct { func (m *AuthInfoResponse) Reset() { *m = AuthInfoResponse{} } func (*AuthInfoResponse) ProtoMessage() {} func (*AuthInfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_identityserver_f7dc84ee4809122e, []int{0} + return fileDescriptor_identityserver_e68f152b10e6a639, []int{0} } func (m *AuthInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -205,7 +206,7 @@ type AuthInfoResponse_APIKeyAccess struct { func (m *AuthInfoResponse_APIKeyAccess) Reset() { *m = AuthInfoResponse_APIKeyAccess{} } func (*AuthInfoResponse_APIKeyAccess) ProtoMessage() {} func (*AuthInfoResponse_APIKeyAccess) Descriptor() ([]byte, []int) { - return fileDescriptor_identityserver_f7dc84ee4809122e, []int{0, 0} + return fileDescriptor_identityserver_e68f152b10e6a639, []int{0, 0} } func (m *AuthInfoResponse_APIKeyAccess) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1125,49 +1126,51 @@ var ( ) func init() { - proto.RegisterFile("lorawan-stack/api/identityserver.proto", fileDescriptor_identityserver_f7dc84ee4809122e) + proto.RegisterFile("lorawan-stack/api/identityserver.proto", fileDescriptor_identityserver_e68f152b10e6a639) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/identityserver.proto", fileDescriptor_identityserver_f7dc84ee4809122e) + golang_proto.RegisterFile("lorawan-stack/api/identityserver.proto", fileDescriptor_identityserver_e68f152b10e6a639) } -var fileDescriptor_identityserver_f7dc84ee4809122e = []byte{ - // 581 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0x3f, 0x48, 0x1c, 0x4f, - 0x14, 0x9e, 0x51, 0xf0, 0xa7, 0xf3, 0x33, 0xf1, 0xb2, 0x04, 0x91, 0x4b, 0xf2, 0xce, 0x18, 0x08, - 0x29, 0xe2, 0x2c, 0x68, 0x95, 0xf2, 0x96, 0x08, 0x8a, 0x45, 0xc2, 0xc6, 0x22, 0xa4, 0x39, 0xf6, - 0xce, 0xb9, 0xdd, 0xe1, 0x74, 0x66, 0xd9, 0x99, 0x53, 0xae, 0x93, 0x54, 0x96, 0x81, 0x34, 0xa9, - 0x42, 0x48, 0x65, 0x69, 0x69, 0x69, 0x13, 0xb0, 0x14, 0xd2, 0x58, 0x1d, 0xee, 0x6c, 0x0a, 0x4b, - 0x4b, 0xcb, 0x70, 0xb3, 0x7b, 0x17, 0xdd, 0x23, 0xa4, 0x9b, 0x79, 0xdf, 0xf7, 0xbe, 0xf7, 0xef, - 0x23, 0xcf, 0x77, 0x64, 0x12, 0xec, 0x07, 0x62, 0x59, 0xe9, 0xa0, 0xd5, 0x71, 0x83, 0x98, 0xbb, - 0x7c, 0x9b, 0x09, 0xcd, 0x75, 0x4f, 0xb1, 0x64, 0x8f, 0x25, 0x34, 0x4e, 0xa4, 0x96, 0xce, 0x7d, - 0xad, 0x05, 0x2d, 0xb8, 0x74, 0x6f, 0xb5, 0xba, 0x1c, 0x72, 0x1d, 0x75, 0x9b, 0xb4, 0x25, 0x77, - 0xdd, 0x50, 0x86, 0xd2, 0xb5, 0xb4, 0x66, 0xb7, 0x6d, 0x7f, 0xf6, 0x63, 0x5f, 0x79, 0x7a, 0xf5, - 0x71, 0x28, 0x65, 0xb8, 0xc3, 0xac, 0x7e, 0x20, 0x84, 0xd4, 0x81, 0xe6, 0x52, 0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0x65, 0x28, 0xa9, 0x8e, 0x98, 0x8e, - 0xb8, 0x08, 0x15, 0x15, 0x4c, 0xef, 0xcb, 0xa4, 0xe3, 0xde, 0x75, 0x77, 0xdc, 0x09, 0x5d, 0xad, - 0x45, 0xdc, 0x6c, 0x4e, 0xd9, 0x51, 0x57, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0xea, 0xef, 0xf4, - 0xeb, 0xe5, 0x03, 0x00, 0x00, +var fileDescriptor_identityserver_e68f152b10e6a639 = []byte{ + // 619 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0x31, 0x68, 0x14, 0x4d, + 0x14, 0x9e, 0x49, 0xf8, 0xf3, 0x9b, 0x31, 0x9a, 0x63, 0x91, 0x10, 0x2e, 0xfa, 0x2e, 0x46, 0x10, + 0x0b, 0x6f, 0x17, 0x92, 0xd2, 0xea, 0x4e, 0x03, 0x09, 0x29, 0x94, 0x23, 0x85, 0x08, 0x72, 0xcc, + 0xdd, 0xcd, 0xed, 0x0e, 0x77, 0x99, 0x59, 0x76, 0xe7, 0x2e, 0x5c, 0x17, 0xac, 0x82, 0x95, 0x60, + 0x63, 0x29, 0x56, 0x29, 0x83, 0x55, 0xb0, 0x4a, 0x99, 0x32, 0x60, 0x13, 0x9b, 0x23, 0x3b, 0x6b, + 0x11, 0xbb, 0x94, 0x29, 0xe5, 0x66, 0x27, 0xe7, 0xe5, 0x0e, 0xb1, 0x9b, 0x79, 0xdf, 0xf7, 0xbe, + 0xf7, 0xbe, 0xf7, 0x1e, 0x79, 0xdc, 0x96, 0x11, 0xdd, 0xa5, 0xa2, 0x18, 0x2b, 0x5a, 0x6f, 0x79, + 0x34, 0xe4, 0x1e, 0x6f, 0x30, 0xa1, 0xb8, 0xea, 0xc5, 0x2c, 0xea, 0xb2, 0xc8, 0x0d, 0x23, 0xa9, + 0xa4, 0x73, 0x57, 0x29, 0xe1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0x09, 0xe0, 0xd3, + 0x04, 0xf0, 0x59, 0x02, 0xe8, 0x3c, 0x01, 0x74, 0x91, 0x00, 0xba, 0x4c, 0x00, 0x5d, 0x25, 0x80, + 0xf7, 0x34, 0xe0, 0x7d, 0x0d, 0xe8, 0x40, 0x03, 0x3e, 0xd4, 0x80, 0x8e, 0x34, 0xa0, 0x63, 0x0d, + 0xe8, 0x44, 0x03, 0x3e, 0xd5, 0x80, 0xcf, 0x34, 0xa0, 0x73, 0x0d, 0xf8, 0x42, 0x03, 0xba, 0xd4, + 0x80, 0xaf, 0x34, 0xa0, 0xbd, 0x14, 0xd0, 0x7e, 0x0a, 0xf8, 0x43, 0x0a, 0xe8, 0x53, 0x0a, 0xf8, + 0x73, 0x0a, 0xe8, 0x20, 0x05, 0x74, 0x98, 0x02, 0x3e, 0x4a, 0x01, 0x1f, 0xa7, 0x80, 0xdf, 0x3c, + 0xf5, 0xa5, 0xab, 0x02, 0xa6, 0x02, 0x2e, 0xfc, 0xd8, 0x15, 0x4c, 0xed, 0xca, 0xa8, 0xe5, 0xdd, + 0xbc, 0xf8, 0xb0, 0xe5, 0x7b, 0x4a, 0x89, 0xb0, 0x56, 0x9b, 0x31, 0x56, 0xd7, 0x7e, 0x07, 0x00, + 0x00, 0xff, 0xff, 0xb4, 0x9b, 0x8f, 0x17, 0x36, 0x04, 0x00, 0x00, } diff --git a/pkg/ttnpb/identityserver.pb.gw.go b/pkg/ttnpb/identityserver.pb.gw.go index 172204de9f..be9d83a46a 100644 --- a/pkg/ttnpb/identityserver.pb.gw.go +++ b/pkg/ttnpb/identityserver.pb.gw.go @@ -9,11 +9,10 @@ It translates gRPC into RESTful JSON APIs. package ttnpb import ( + "context" "io" "net/http" - "context" - "github.com/gogo/protobuf/types" "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" diff --git a/pkg/ttnpb/identityserver.pb.paths.fm.go b/pkg/ttnpb/identityserver.pb.paths.fm.go new file mode 100644 index 0000000000..5e69c1f46d --- /dev/null +++ b/pkg/ttnpb/identityserver.pb.paths.fm.go @@ -0,0 +1,86 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var AuthInfoResponseFieldPathsNested = []string{ + "access_method", + "access_method.api_key", + "access_method.api_key.api_key", + "access_method.api_key.api_key.id", + "access_method.api_key.api_key.key", + "access_method.api_key.api_key.name", + "access_method.api_key.api_key.rights", + "access_method.api_key.entity_ids", + "access_method.api_key.entity_ids.ids", + "access_method.api_key.entity_ids.ids.application_ids", + "access_method.api_key.entity_ids.ids.application_ids.application_id", + "access_method.api_key.entity_ids.ids.client_ids", + "access_method.api_key.entity_ids.ids.client_ids.client_id", + "access_method.api_key.entity_ids.ids.device_ids", + "access_method.api_key.entity_ids.ids.device_ids.application_ids", + "access_method.api_key.entity_ids.ids.device_ids.application_ids.application_id", + "access_method.api_key.entity_ids.ids.device_ids.dev_addr", + "access_method.api_key.entity_ids.ids.device_ids.dev_eui", + "access_method.api_key.entity_ids.ids.device_ids.device_id", + "access_method.api_key.entity_ids.ids.device_ids.join_eui", + "access_method.api_key.entity_ids.ids.gateway_ids", + "access_method.api_key.entity_ids.ids.gateway_ids.eui", + "access_method.api_key.entity_ids.ids.gateway_ids.gateway_id", + "access_method.api_key.entity_ids.ids.organization_ids", + "access_method.api_key.entity_ids.ids.organization_ids.organization_id", + "access_method.api_key.entity_ids.ids.user_ids", + "access_method.api_key.entity_ids.ids.user_ids.email", + "access_method.api_key.entity_ids.ids.user_ids.user_id", + "access_method.oauth_access_token", + "access_method.oauth_access_token.access_token", + "access_method.oauth_access_token.client_ids", + "access_method.oauth_access_token.client_ids.client_id", + "access_method.oauth_access_token.created_at", + "access_method.oauth_access_token.expires_at", + "access_method.oauth_access_token.id", + "access_method.oauth_access_token.refresh_token", + "access_method.oauth_access_token.rights", + "access_method.oauth_access_token.user_ids", + "access_method.oauth_access_token.user_ids.email", + "access_method.oauth_access_token.user_ids.user_id", + "universal_rights", + "universal_rights.rights", +} + +var AuthInfoResponseFieldPathsTopLevel = []string{ + "access_method", + "universal_rights", +} +var AuthInfoResponse_APIKeyAccessFieldPathsNested = []string{ + "api_key", + "api_key.id", + "api_key.key", + "api_key.name", + "api_key.rights", + "entity_ids", + "entity_ids.ids", + "entity_ids.ids.application_ids", + "entity_ids.ids.application_ids.application_id", + "entity_ids.ids.client_ids", + "entity_ids.ids.client_ids.client_id", + "entity_ids.ids.device_ids", + "entity_ids.ids.device_ids.application_ids", + "entity_ids.ids.device_ids.application_ids.application_id", + "entity_ids.ids.device_ids.dev_addr", + "entity_ids.ids.device_ids.dev_eui", + "entity_ids.ids.device_ids.device_id", + "entity_ids.ids.device_ids.join_eui", + "entity_ids.ids.gateway_ids", + "entity_ids.ids.gateway_ids.eui", + "entity_ids.ids.gateway_ids.gateway_id", + "entity_ids.ids.organization_ids", + "entity_ids.ids.organization_ids.organization_id", + "entity_ids.ids.user_ids", + "entity_ids.ids.user_ids.email", + "entity_ids.ids.user_ids.user_id", +} + +var AuthInfoResponse_APIKeyAccessFieldPathsTopLevel = []string{ + "api_key", + "entity_ids", +} diff --git a/pkg/ttnpb/identityserver.pb.fm.go b/pkg/ttnpb/identityserver.pb.setters.fm.go similarity index 55% rename from pkg/ttnpb/identityserver.pb.fm.go rename to pkg/ttnpb/identityserver.pb.setters.fm.go index a41147872d..fd51772524 100644 --- a/pkg/ttnpb/identityserver.pb.fm.go +++ b/pkg/ttnpb/identityserver.pb.setters.fm.go @@ -4,56 +4,6 @@ package ttnpb import fmt "fmt" -var AuthInfoResponseFieldPathsNested = []string{ - "access_method", - "access_method.api_key", - "access_method.api_key.api_key", - "access_method.api_key.api_key.id", - "access_method.api_key.api_key.key", - "access_method.api_key.api_key.name", - "access_method.api_key.api_key.rights", - "access_method.api_key.entity_ids", - "access_method.api_key.entity_ids.ids", - "access_method.api_key.entity_ids.ids.application_ids", - "access_method.api_key.entity_ids.ids.application_ids.application_id", - "access_method.api_key.entity_ids.ids.client_ids", - "access_method.api_key.entity_ids.ids.client_ids.client_id", - "access_method.api_key.entity_ids.ids.device_ids", - "access_method.api_key.entity_ids.ids.device_ids.application_ids", - "access_method.api_key.entity_ids.ids.device_ids.application_ids.application_id", - "access_method.api_key.entity_ids.ids.device_ids.dev_addr", - "access_method.api_key.entity_ids.ids.device_ids.dev_eui", - "access_method.api_key.entity_ids.ids.device_ids.device_id", - "access_method.api_key.entity_ids.ids.device_ids.join_eui", - "access_method.api_key.entity_ids.ids.gateway_ids", - "access_method.api_key.entity_ids.ids.gateway_ids.eui", - "access_method.api_key.entity_ids.ids.gateway_ids.gateway_id", - "access_method.api_key.entity_ids.ids.organization_ids", - "access_method.api_key.entity_ids.ids.organization_ids.organization_id", - "access_method.api_key.entity_ids.ids.user_ids", - "access_method.api_key.entity_ids.ids.user_ids.email", - "access_method.api_key.entity_ids.ids.user_ids.user_id", - "access_method.oauth_access_token", - "access_method.oauth_access_token.access_token", - "access_method.oauth_access_token.client_ids", - "access_method.oauth_access_token.client_ids.client_id", - "access_method.oauth_access_token.created_at", - "access_method.oauth_access_token.expires_at", - "access_method.oauth_access_token.id", - "access_method.oauth_access_token.refresh_token", - "access_method.oauth_access_token.rights", - "access_method.oauth_access_token.user_ids", - "access_method.oauth_access_token.user_ids.email", - "access_method.oauth_access_token.user_ids.user_id", - "universal_rights", - "universal_rights.rights", -} - -var AuthInfoResponseFieldPathsTopLevel = []string{ - "access_method", - "universal_rights", -} - func (dst *AuthInfoResponse) SetFields(src *AuthInfoResponse, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -155,40 +105,6 @@ func (dst *AuthInfoResponse) SetFields(src *AuthInfoResponse, paths ...string) e return nil } -var AuthInfoResponse_APIKeyAccessFieldPathsNested = []string{ - "api_key", - "api_key.id", - "api_key.key", - "api_key.name", - "api_key.rights", - "entity_ids", - "entity_ids.ids", - "entity_ids.ids.application_ids", - "entity_ids.ids.application_ids.application_id", - "entity_ids.ids.client_ids", - "entity_ids.ids.client_ids.client_id", - "entity_ids.ids.device_ids", - "entity_ids.ids.device_ids.application_ids", - "entity_ids.ids.device_ids.application_ids.application_id", - "entity_ids.ids.device_ids.dev_addr", - "entity_ids.ids.device_ids.dev_eui", - "entity_ids.ids.device_ids.device_id", - "entity_ids.ids.device_ids.join_eui", - "entity_ids.ids.gateway_ids", - "entity_ids.ids.gateway_ids.eui", - "entity_ids.ids.gateway_ids.gateway_id", - "entity_ids.ids.organization_ids", - "entity_ids.ids.organization_ids.organization_id", - "entity_ids.ids.user_ids", - "entity_ids.ids.user_ids.email", - "entity_ids.ids.user_ids.user_id", -} - -var AuthInfoResponse_APIKeyAccessFieldPathsTopLevel = []string{ - "api_key", - "entity_ids", -} - func (dst *AuthInfoResponse_APIKeyAccess) SetFields(src *AuthInfoResponse_APIKeyAccess, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { diff --git a/pkg/ttnpb/identityserver.pb.validate.go b/pkg/ttnpb/identityserver.pb.validate.go new file mode 100644 index 0000000000..d4cba3cde0 --- /dev/null +++ b/pkg/ttnpb/identityserver.pb.validate.go @@ -0,0 +1,265 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on AuthInfoResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *AuthInfoResponse) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = AuthInfoResponseFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "universal_rights": + + if v, ok := interface{}(m.GetUniversalRights()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return AuthInfoResponseValidationError{ + field: "universal_rights", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "access_method": + if len(subs) == 0 { + subs = []string{ + "api_key", "oauth_access_token", + } + } + for name, subs := range _processPaths(subs) { + _ = subs + switch name { + case "api_key": + + if v, ok := interface{}(m.GetAPIKey()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return AuthInfoResponseValidationError{ + field: "api_key", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "oauth_access_token": + + if v, ok := interface{}(m.GetOAuthAccessToken()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return AuthInfoResponseValidationError{ + field: "oauth_access_token", + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + } + default: + return AuthInfoResponseValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// AuthInfoResponseValidationError is the validation error returned by +// AuthInfoResponse.ValidateFields if the designated constraints aren't met. +type AuthInfoResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e AuthInfoResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e AuthInfoResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e AuthInfoResponseValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e AuthInfoResponseValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e AuthInfoResponseValidationError) ErrorName() string { return "AuthInfoResponseValidationError" } + +// Error satisfies the builtin error interface +func (e AuthInfoResponseValidationError) 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 %sAuthInfoResponse.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = AuthInfoResponseValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = AuthInfoResponseValidationError{} + +// ValidateFields checks the field values on AuthInfoResponse_APIKeyAccess with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *AuthInfoResponse_APIKeyAccess) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = AuthInfoResponse_APIKeyAccessFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "api_key": + + if v, ok := interface{}(&m.APIKey).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return AuthInfoResponse_APIKeyAccessValidationError{ + field: "api_key", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "entity_ids": + + if v, ok := interface{}(&m.EntityIDs).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return AuthInfoResponse_APIKeyAccessValidationError{ + field: "entity_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return AuthInfoResponse_APIKeyAccessValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// AuthInfoResponse_APIKeyAccessValidationError is the validation error +// returned by AuthInfoResponse_APIKeyAccess.ValidateFields if the designated +// constraints aren't met. +type AuthInfoResponse_APIKeyAccessValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e AuthInfoResponse_APIKeyAccessValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e AuthInfoResponse_APIKeyAccessValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e AuthInfoResponse_APIKeyAccessValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e AuthInfoResponse_APIKeyAccessValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e AuthInfoResponse_APIKeyAccessValidationError) ErrorName() string { + return "AuthInfoResponse_APIKeyAccessValidationError" +} + +// Error satisfies the builtin error interface +func (e AuthInfoResponse_APIKeyAccessValidationError) 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 %sAuthInfoResponse_APIKeyAccess.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = AuthInfoResponse_APIKeyAccessValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = AuthInfoResponse_APIKeyAccessValidationError{} diff --git a/pkg/ttnpb/identityserver.validator.pb.go b/pkg/ttnpb/identityserver.validator.pb.go deleted file mode 100644 index 23726d435e..0000000000 --- a/pkg/ttnpb/identityserver.validator.pb.go +++ /dev/null @@ -1,52 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/identityserver.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/empty" -import _ "google.golang.org/genproto/googleapis/api/annotations" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *AuthInfoResponse) Validate() error { - if oneOfNester, ok := this.GetAccessMethod().(*AuthInfoResponse_APIKey); ok { - if oneOfNester.APIKey != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.APIKey); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("APIKey", err) - } - } - } - if oneOfNester, ok := this.GetAccessMethod().(*AuthInfoResponse_OAuthAccessToken); ok { - if oneOfNester.OAuthAccessToken != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.OAuthAccessToken); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("OAuthAccessToken", err) - } - } - } - if this.UniversalRights != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.UniversalRights); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UniversalRights", err) - } - } - return nil -} -func (this *AuthInfoResponse_APIKeyAccess) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.APIKey)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("APIKey", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.EntityIDs)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("EntityIDs", err) - } - return nil -} diff --git a/pkg/ttnpb/join.pb.go b/pkg/ttnpb/join.pb.go index 770a8a3312..0c4ee32ab8 100644 --- a/pkg/ttnpb/join.pb.go +++ b/pkg/ttnpb/join.pb.go @@ -9,7 +9,7 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import _ "github.com/gogo/protobuf/types" -import _ "github.com/mwitkow/go-proto-validators" +import _ "github.com/lyft/protoc-gen-validate/validate" import go_thethings_network_lorawan_stack_pkg_types "go.thethings.network/lorawan-stack/pkg/types" import time "time" @@ -54,7 +54,7 @@ type JoinRequest struct { func (m *JoinRequest) Reset() { *m = JoinRequest{} } func (*JoinRequest) ProtoMessage() {} func (*JoinRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_join_be0cf60f6ae1ac14, []int{0} + return fileDescriptor_join_e5240249b1acb8e5, []int{0} } func (m *JoinRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -144,7 +144,7 @@ type JoinResponse struct { func (m *JoinResponse) Reset() { *m = JoinResponse{} } func (*JoinResponse) ProtoMessage() {} func (*JoinResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_join_be0cf60f6ae1ac14, []int{1} + return fileDescriptor_join_e5240249b1acb8e5, []int{1} } func (m *JoinResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1234,59 +1234,61 @@ var ( ErrIntOverflowJoin = fmt.Errorf("proto: integer overflow") ) -func init() { proto.RegisterFile("lorawan-stack/api/join.proto", fileDescriptor_join_be0cf60f6ae1ac14) } +func init() { proto.RegisterFile("lorawan-stack/api/join.proto", fileDescriptor_join_e5240249b1acb8e5) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/join.proto", fileDescriptor_join_be0cf60f6ae1ac14) + golang_proto.RegisterFile("lorawan-stack/api/join.proto", fileDescriptor_join_e5240249b1acb8e5) } -var fileDescriptor_join_be0cf60f6ae1ac14 = []byte{ - // 765 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x31, 0x6c, 0xdb, 0x46, - 0x14, 0xbd, 0x8b, 0x65, 0x49, 0x39, 0x19, 0xae, 0x4b, 0x14, 0x09, 0xeb, 0x16, 0x47, 0xc1, 0x93, - 0x0a, 0x54, 0x24, 0xaa, 0x14, 0x1d, 0x9a, 0x02, 0x45, 0x24, 0xa1, 0xa8, 0xd2, 0xb8, 0x28, 0x68, - 0xa0, 0x05, 0xb2, 0x10, 0x27, 0xde, 0x89, 0xbe, 0x8a, 0xe2, 0xb1, 0xbc, 0x93, 0x64, 0x6d, 0xee, - 0x96, 0xa9, 0xe8, 0x98, 0x31, 0xe8, 0x94, 0x31, 0xa3, 0xc7, 0x8c, 0x1e, 0x3d, 0x06, 0x1d, 0xe4, - 0xe8, 0xb8, 0x64, 0xcc, 0x98, 0xb1, 0x10, 0x49, 0x45, 0x71, 0xe4, 0x21, 0x9d, 0xf8, 0xef, 0xff, - 0xf7, 0x3f, 0xdf, 0xbd, 0x7b, 0x1f, 0x7d, 0x1e, 0x8a, 0x84, 0x4c, 0x49, 0xd4, 0x94, 0x8a, 0xf8, - 0x43, 0x87, 0xc4, 0xdc, 0xf9, 0x5d, 0xf0, 0xc8, 0x8e, 0x13, 0xa1, 0x84, 0xb1, 0xab, 0x54, 0x64, - 0x17, 0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 0x8d, 0xe1, 0x23, 0x8d, 0xc1, 0x53, 0x8d, 0xe1, 0x33, 0x8d, 0xc1, 0x99, 0xc6, 0xe0, 0xb9, 0xc6, - 0xe0, 0x5c, 0x63, 0x78, 0xa1, 0x31, 0x7c, 0xa1, 0x31, 0x78, 0xa9, 0x31, 0x7c, 0xa5, 0x31, 0x78, - 0xad, 0x31, 0x7c, 0xa3, 0x31, 0x38, 0x4d, 0x31, 0x78, 0x94, 0x62, 0xf8, 0x77, 0x8a, 0xc1, 0xe3, - 0x14, 0xc3, 0x27, 0x29, 0x06, 0x4f, 0x53, 0x0c, 0x9e, 0xa5, 0x18, 0x9e, 0xa5, 0x18, 0x3e, 0x4f, - 0x31, 0x7c, 0xf8, 0xe5, 0x87, 0xfa, 0x58, 0x45, 0x71, 0xbf, 0x5f, 0xce, 0x84, 0xb8, 0xf3, 0x5f, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x88, 0xb8, 0x16, 0x36, 0x05, 0x00, 0x00, +var fileDescriptor_join_e5240249b1acb8e5 = []byte{ + // 786 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x3d, 0x6c, 0xdb, 0x46, + 0x18, 0xbd, 0xb3, 0xf5, 0xe7, 0x93, 0xa1, 0x3a, 0x44, 0x91, 0xb0, 0x6e, 0x71, 0x74, 0x33, 0x19, + 0x45, 0x4c, 0xa1, 0x4e, 0xa7, 0xba, 0x68, 0x11, 0x4a, 0x28, 0xa0, 0x34, 0x29, 0x0a, 0x1a, 0x68, + 0x81, 0x2c, 0xc4, 0x89, 0x77, 0xa2, 0x58, 0xd1, 0x3c, 0x95, 0x77, 0x92, 0xa2, 0x4c, 0x41, 0xa7, + 0xa0, 0x43, 0xd1, 0x31, 0x63, 0xd0, 0xa1, 0xc8, 0x98, 0xd1, 0xe8, 0xe4, 0xd1, 0xa3, 0xc7, 0xa0, + 0x83, 0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 0x04, 0x18, 0x5f, 0xa1, 0x5a, 0x14, 0xf6, 0x98, 0x0c, 0x8f, 0x98, 0x0e, 0x73, 0x7d, 0xff, + 0x03, 0x3b, 0xdf, 0x56, 0x7b, 0xb1, 0xad, 0x76, 0xbb, 0xd8, 0x56, 0xa7, 0x96, 0xb1, 0x3d, 0xfd, + 0xdb, 0x82, 0xee, 0x7f, 0x43, 0x97, 0x99, 0x53, 0xba, 0xaa, 0x39, 0xce, 0xef, 0xf0, 0x74, 0x8e, + 0xe1, 0xd9, 0x1c, 0xc3, 0x97, 0x73, 0x0c, 0x5e, 0xcd, 0x31, 0x78, 0x3d, 0xc7, 0xe0, 0xcd, 0x1c, + 0x83, 0xb7, 0x73, 0x0c, 0x1f, 0x2b, 0x0c, 0x9f, 0x28, 0x0c, 0x9e, 0x2b, 0x0c, 0x5f, 0x28, 0x0c, + 0x8e, 0x15, 0x06, 0x27, 0x0a, 0x83, 0x53, 0x85, 0xe1, 0x99, 0xc2, 0xf0, 0xa5, 0xc2, 0xe0, 0x95, + 0xc2, 0xf0, 0xb5, 0xc2, 0xe0, 0x8d, 0xc2, 0xf0, 0xad, 0xc2, 0xe0, 0x71, 0x8a, 0xc1, 0x93, 0x14, + 0xc3, 0xdf, 0x52, 0x0c, 0x9e, 0xa6, 0x18, 0x3e, 0x4b, 0x31, 0x78, 0x9e, 0x62, 0xf0, 0x22, 0xc5, + 0xf0, 0x38, 0xc5, 0xf0, 0x24, 0xc5, 0xf0, 0xc1, 0xad, 0xab, 0x46, 0x5d, 0xc6, 0xc3, 0x6e, 0xb7, + 0xa2, 0x8d, 0xb8, 0xfd, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xca, 0x99, 0x42, 0x16, 0x60, 0x05, + 0x00, 0x00, } diff --git a/pkg/ttnpb/join.pb.paths.fm.go b/pkg/ttnpb/join.pb.paths.fm.go new file mode 100644 index 0000000000..df6b769b96 --- /dev/null +++ b/pkg/ttnpb/join.pb.paths.fm.go @@ -0,0 +1,102 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var JoinRequestFieldPathsNested = []string{ + "cf_list", + "cf_list.ch_masks", + "cf_list.freq", + "cf_list.type", + "correlation_ids", + "dev_addr", + "downlink_settings", + "downlink_settings.opt_neg", + "downlink_settings.rx1_dr_offset", + "downlink_settings.rx2_dr", + "net_id", + "payload", + "payload.Payload", + "payload.Payload.join_accept_payload", + "payload.Payload.join_accept_payload.cf_list", + "payload.Payload.join_accept_payload.cf_list.ch_masks", + "payload.Payload.join_accept_payload.cf_list.freq", + "payload.Payload.join_accept_payload.cf_list.type", + "payload.Payload.join_accept_payload.dev_addr", + "payload.Payload.join_accept_payload.dl_settings", + "payload.Payload.join_accept_payload.dl_settings.opt_neg", + "payload.Payload.join_accept_payload.dl_settings.rx1_dr_offset", + "payload.Payload.join_accept_payload.dl_settings.rx2_dr", + "payload.Payload.join_accept_payload.encrypted", + "payload.Payload.join_accept_payload.join_nonce", + "payload.Payload.join_accept_payload.net_id", + "payload.Payload.join_accept_payload.rx_delay", + "payload.Payload.join_request_payload", + "payload.Payload.join_request_payload.dev_eui", + "payload.Payload.join_request_payload.dev_nonce", + "payload.Payload.join_request_payload.join_eui", + "payload.Payload.mac_payload", + "payload.Payload.mac_payload.decoded_payload", + "payload.Payload.mac_payload.f_hdr", + "payload.Payload.mac_payload.f_hdr.dev_addr", + "payload.Payload.mac_payload.f_hdr.f_cnt", + "payload.Payload.mac_payload.f_hdr.f_ctrl", + "payload.Payload.mac_payload.f_hdr.f_ctrl.ack", + "payload.Payload.mac_payload.f_hdr.f_ctrl.adr", + "payload.Payload.mac_payload.f_hdr.f_ctrl.adr_ack_req", + "payload.Payload.mac_payload.f_hdr.f_ctrl.class_b", + "payload.Payload.mac_payload.f_hdr.f_ctrl.f_pending", + "payload.Payload.mac_payload.f_hdr.f_opts", + "payload.Payload.mac_payload.f_port", + "payload.Payload.mac_payload.frm_payload", + "payload.Payload.rejoin_request_payload", + "payload.Payload.rejoin_request_payload.dev_eui", + "payload.Payload.rejoin_request_payload.join_eui", + "payload.Payload.rejoin_request_payload.net_id", + "payload.Payload.rejoin_request_payload.rejoin_cnt", + "payload.Payload.rejoin_request_payload.rejoin_type", + "payload.m_hdr", + "payload.m_hdr.m_type", + "payload.m_hdr.major", + "payload.mic", + "raw_payload", + "rx_delay", + "selected_mac_version", +} + +var JoinRequestFieldPathsTopLevel = []string{ + "cf_list", + "correlation_ids", + "dev_addr", + "downlink_settings", + "net_id", + "payload", + "raw_payload", + "rx_delay", + "selected_mac_version", +} +var JoinResponseFieldPathsNested = []string{ + "correlation_ids", + "lifetime", + "raw_payload", + "session_keys", + "session_keys.app_s_key", + "session_keys.app_s_key.kek_label", + "session_keys.app_s_key.key", + "session_keys.f_nwk_s_int_key", + "session_keys.f_nwk_s_int_key.kek_label", + "session_keys.f_nwk_s_int_key.key", + "session_keys.nwk_s_enc_key", + "session_keys.nwk_s_enc_key.kek_label", + "session_keys.nwk_s_enc_key.key", + "session_keys.s_nwk_s_int_key", + "session_keys.s_nwk_s_int_key.kek_label", + "session_keys.s_nwk_s_int_key.key", + "session_keys.session_key_id", +} + +var JoinResponseFieldPathsTopLevel = []string{ + "correlation_ids", + "lifetime", + "raw_payload", + "session_keys", +} diff --git a/pkg/ttnpb/join.pb.fm.go b/pkg/ttnpb/join.pb.setters.fm.go similarity index 58% rename from pkg/ttnpb/join.pb.fm.go rename to pkg/ttnpb/join.pb.setters.fm.go index dde77d37d8..e442dee53b 100644 --- a/pkg/ttnpb/join.pb.fm.go +++ b/pkg/ttnpb/join.pb.setters.fm.go @@ -9,79 +9,6 @@ import ( go_thethings_network_lorawan_stack_pkg_types "go.thethings.network/lorawan-stack/pkg/types" ) -var JoinRequestFieldPathsNested = []string{ - "cf_list", - "cf_list.ch_masks", - "cf_list.freq", - "cf_list.type", - "correlation_ids", - "dev_addr", - "downlink_settings", - "downlink_settings.opt_neg", - "downlink_settings.rx1_dr_offset", - "downlink_settings.rx2_dr", - "net_id", - "payload", - "payload.Payload", - "payload.Payload.join_accept_payload", - "payload.Payload.join_accept_payload.cf_list", - "payload.Payload.join_accept_payload.cf_list.ch_masks", - "payload.Payload.join_accept_payload.cf_list.freq", - "payload.Payload.join_accept_payload.cf_list.type", - "payload.Payload.join_accept_payload.dev_addr", - "payload.Payload.join_accept_payload.dl_settings", - "payload.Payload.join_accept_payload.dl_settings.opt_neg", - "payload.Payload.join_accept_payload.dl_settings.rx1_dr_offset", - "payload.Payload.join_accept_payload.dl_settings.rx2_dr", - "payload.Payload.join_accept_payload.encrypted", - "payload.Payload.join_accept_payload.join_nonce", - "payload.Payload.join_accept_payload.net_id", - "payload.Payload.join_accept_payload.rx_delay", - "payload.Payload.join_request_payload", - "payload.Payload.join_request_payload.dev_eui", - "payload.Payload.join_request_payload.dev_nonce", - "payload.Payload.join_request_payload.join_eui", - "payload.Payload.mac_payload", - "payload.Payload.mac_payload.decoded_payload", - "payload.Payload.mac_payload.f_hdr", - "payload.Payload.mac_payload.f_hdr.dev_addr", - "payload.Payload.mac_payload.f_hdr.f_cnt", - "payload.Payload.mac_payload.f_hdr.f_ctrl", - "payload.Payload.mac_payload.f_hdr.f_ctrl.ack", - "payload.Payload.mac_payload.f_hdr.f_ctrl.adr", - "payload.Payload.mac_payload.f_hdr.f_ctrl.adr_ack_req", - "payload.Payload.mac_payload.f_hdr.f_ctrl.class_b", - "payload.Payload.mac_payload.f_hdr.f_ctrl.f_pending", - "payload.Payload.mac_payload.f_hdr.f_opts", - "payload.Payload.mac_payload.f_port", - "payload.Payload.mac_payload.frm_payload", - "payload.Payload.rejoin_request_payload", - "payload.Payload.rejoin_request_payload.dev_eui", - "payload.Payload.rejoin_request_payload.join_eui", - "payload.Payload.rejoin_request_payload.net_id", - "payload.Payload.rejoin_request_payload.rejoin_cnt", - "payload.Payload.rejoin_request_payload.rejoin_type", - "payload.m_hdr", - "payload.m_hdr.m_type", - "payload.m_hdr.major", - "payload.mic", - "raw_payload", - "rx_delay", - "selected_mac_version", -} - -var JoinRequestFieldPathsTopLevel = []string{ - "cf_list", - "correlation_ids", - "dev_addr", - "downlink_settings", - "net_id", - "payload", - "raw_payload", - "rx_delay", - "selected_mac_version", -} - func (dst *JoinRequest) SetFields(src *JoinRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -92,8 +19,7 @@ func (dst *JoinRequest) SetFields(src *JoinRequest, paths ...string) error { if src != nil { dst.RawPayload = src.RawPayload } else { - var zero []byte - dst.RawPayload = zero + dst.RawPayload = nil } case "payload": if len(subs) > 0 { @@ -212,33 +138,6 @@ func (dst *JoinRequest) SetFields(src *JoinRequest, paths ...string) error { return nil } -var JoinResponseFieldPathsNested = []string{ - "correlation_ids", - "lifetime", - "raw_payload", - "session_keys", - "session_keys.app_s_key", - "session_keys.app_s_key.kek_label", - "session_keys.app_s_key.key", - "session_keys.f_nwk_s_int_key", - "session_keys.f_nwk_s_int_key.kek_label", - "session_keys.f_nwk_s_int_key.key", - "session_keys.nwk_s_enc_key", - "session_keys.nwk_s_enc_key.kek_label", - "session_keys.nwk_s_enc_key.key", - "session_keys.s_nwk_s_int_key", - "session_keys.s_nwk_s_int_key.kek_label", - "session_keys.s_nwk_s_int_key.key", - "session_keys.session_key_id", -} - -var JoinResponseFieldPathsTopLevel = []string{ - "correlation_ids", - "lifetime", - "raw_payload", - "session_keys", -} - func (dst *JoinResponse) SetFields(src *JoinResponse, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -249,8 +148,7 @@ func (dst *JoinResponse) SetFields(src *JoinResponse, paths ...string) error { if src != nil { dst.RawPayload = src.RawPayload } else { - var zero []byte - dst.RawPayload = zero + dst.RawPayload = nil } case "session_keys": if len(subs) > 0 { diff --git a/pkg/ttnpb/join.pb.validate.go b/pkg/ttnpb/join.pb.validate.go new file mode 100644 index 0000000000..08373705ac --- /dev/null +++ b/pkg/ttnpb/join.pb.validate.go @@ -0,0 +1,288 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on JoinRequest with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *JoinRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = JoinRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "raw_payload": + + if len(m.GetRawPayload()) != 23 { + return JoinRequestValidationError{ + field: "raw_payload", + reason: "value length must be 23 bytes", + } + } + + case "payload": + + if v, ok := interface{}(m.GetPayload()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return JoinRequestValidationError{ + field: "payload", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "dev_addr": + // no validation rules for DevAddr + case "selected_mac_version": + // no validation rules for SelectedMACVersion + case "net_id": + // no validation rules for NetID + case "downlink_settings": + + if v, ok := interface{}(&m.DownlinkSettings).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return JoinRequestValidationError{ + field: "downlink_settings", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "rx_delay": + + if _, ok := RxDelay_name[int32(m.GetRxDelay())]; !ok { + return JoinRequestValidationError{ + field: "rx_delay", + reason: "value must be one of the defined enum values", + } + } + + case "cf_list": + + if v, ok := interface{}(m.GetCFList()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return JoinRequestValidationError{ + field: "cf_list", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "correlation_ids": + + default: + return JoinRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// JoinRequestValidationError is the validation error returned by +// JoinRequest.ValidateFields if the designated constraints aren't met. +type JoinRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e JoinRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e JoinRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e JoinRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e JoinRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e JoinRequestValidationError) ErrorName() string { return "JoinRequestValidationError" } + +// Error satisfies the builtin error interface +func (e JoinRequestValidationError) 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 %sJoinRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = JoinRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = JoinRequestValidationError{} + +// ValidateFields checks the field values on JoinResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *JoinResponse) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = JoinResponseFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "raw_payload": + + if l := len(m.GetRawPayload()); l < 17 || l > 33 { + return JoinResponseValidationError{ + field: "raw_payload", + reason: "value length must be between 17 and 33 bytes, inclusive", + } + } + + case "session_keys": + + if v, ok := interface{}(&m.SessionKeys).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return JoinResponseValidationError{ + field: "session_keys", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "lifetime": + + if v, ok := interface{}(&m.Lifetime).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return JoinResponseValidationError{ + field: "lifetime", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "correlation_ids": + + default: + return JoinResponseValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// JoinResponseValidationError is the validation error returned by +// JoinResponse.ValidateFields if the designated constraints aren't met. +type JoinResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e JoinResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e JoinResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e JoinResponseValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e JoinResponseValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e JoinResponseValidationError) ErrorName() string { return "JoinResponseValidationError" } + +// Error satisfies the builtin error interface +func (e JoinResponseValidationError) 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 %sJoinResponse.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = JoinResponseValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = JoinResponseValidationError{} diff --git a/pkg/ttnpb/join.validator.pb.go b/pkg/ttnpb/join.validator.pb.go deleted file mode 100644 index 06b8a3aaa1..0000000000 --- a/pkg/ttnpb/join.validator.pb.go +++ /dev/null @@ -1,55 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/join.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import fmt "fmt" -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/duration" -import _ "github.com/mwitkow/go-proto-validators" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *JoinRequest) Validate() error { - if !(len(this.RawPayload) == 23) { - return github_com_mwitkow_go_proto_validators.FieldError("RawPayload", fmt.Errorf(`value '%v' must length be not equal '23'`, this.RawPayload)) - } - if this.Payload != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Payload); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Payload", err) - } - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.DownlinkSettings)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DownlinkSettings", err) - } - if this.CFList != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.CFList); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("CFList", err) - } - } - return nil -} -func (this *JoinResponse) Validate() error { - if !(len(this.RawPayload) > 16) { - return github_com_mwitkow_go_proto_validators.FieldError("RawPayload", fmt.Errorf(`value '%v' must length be greater than '16'`, this.RawPayload)) - } - if !(len(this.RawPayload) < 34) { - return github_com_mwitkow_go_proto_validators.FieldError("RawPayload", fmt.Errorf(`value '%v' must length be less than '34'`, this.RawPayload)) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.SessionKeys)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("SessionKeys", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Lifetime)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Lifetime", err) - } - return nil -} diff --git a/pkg/ttnpb/joinserver.pb.go b/pkg/ttnpb/joinserver.pb.go index e983f08901..fa718c163c 100644 --- a/pkg/ttnpb/joinserver.pb.go +++ b/pkg/ttnpb/joinserver.pb.go @@ -9,7 +9,7 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import types "github.com/gogo/protobuf/types" -import _ "github.com/mwitkow/go-proto-validators" +import _ "github.com/lyft/protoc-gen-validate/validate" import _ "google.golang.org/genproto/googleapis/api/annotations" import go_thethings_network_lorawan_stack_pkg_types "go.thethings.network/lorawan-stack/pkg/types" @@ -51,7 +51,7 @@ type SessionKeyRequest struct { func (m *SessionKeyRequest) Reset() { *m = SessionKeyRequest{} } func (*SessionKeyRequest) ProtoMessage() {} func (*SessionKeyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_joinserver_c6665bed3643ea1a, []int{0} + return fileDescriptor_joinserver_549ad29080f1d943, []int{0} } func (m *SessionKeyRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -101,7 +101,7 @@ type NwkSKeysResponse struct { func (m *NwkSKeysResponse) Reset() { *m = NwkSKeysResponse{} } func (*NwkSKeysResponse) ProtoMessage() {} func (*NwkSKeysResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_joinserver_c6665bed3643ea1a, []int{1} + return fileDescriptor_joinserver_549ad29080f1d943, []int{1} } func (m *NwkSKeysResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -161,7 +161,7 @@ type AppSKeyResponse struct { func (m *AppSKeyResponse) Reset() { *m = AppSKeyResponse{} } func (*AppSKeyResponse) ProtoMessage() {} func (*AppSKeyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_joinserver_c6665bed3643ea1a, []int{2} + return fileDescriptor_joinserver_549ad29080f1d943, []int{2} } func (m *AppSKeyResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -210,7 +210,7 @@ type CryptoServicePayloadRequest struct { func (m *CryptoServicePayloadRequest) Reset() { *m = CryptoServicePayloadRequest{} } func (*CryptoServicePayloadRequest) ProtoMessage() {} func (*CryptoServicePayloadRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_joinserver_c6665bed3643ea1a, []int{3} + return fileDescriptor_joinserver_549ad29080f1d943, []int{3} } func (m *CryptoServicePayloadRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -276,7 +276,7 @@ type CryptoServicePayloadResponse struct { func (m *CryptoServicePayloadResponse) Reset() { *m = CryptoServicePayloadResponse{} } func (*CryptoServicePayloadResponse) ProtoMessage() {} func (*CryptoServicePayloadResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_joinserver_c6665bed3643ea1a, []int{4} + return fileDescriptor_joinserver_549ad29080f1d943, []int{4} } func (m *CryptoServicePayloadResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -314,7 +314,7 @@ func (m *CryptoServicePayloadResponse) GetPayload() []byte { type JoinAcceptMICRequest struct { CryptoServicePayloadRequest `protobuf:"bytes,1,opt,name=payload_request,json=payloadRequest,proto3,embedded=payload_request" json:"payload_request"` - JoinRequestType uint32 `protobuf:"varint,2,opt,name=join_request_type,json=joinRequestType,proto3" json:"join_request_type,omitempty"` + JoinRequestType RejoinType `protobuf:"varint,2,opt,name=join_request_type,json=joinRequestType,proto3,enum=ttn.lorawan.v3.RejoinType" json:"join_request_type,omitempty"` DevNonce go_thethings_network_lorawan_stack_pkg_types.DevNonce `protobuf:"bytes,3,opt,name=dev_nonce,json=devNonce,proto3,customtype=go.thethings.network/lorawan-stack/pkg/types.DevNonce" json:"dev_nonce"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_sizecache int32 `json:"-"` @@ -323,7 +323,7 @@ type JoinAcceptMICRequest struct { func (m *JoinAcceptMICRequest) Reset() { *m = JoinAcceptMICRequest{} } func (*JoinAcceptMICRequest) ProtoMessage() {} func (*JoinAcceptMICRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_joinserver_c6665bed3643ea1a, []int{5} + return fileDescriptor_joinserver_549ad29080f1d943, []int{5} } func (m *JoinAcceptMICRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -352,11 +352,11 @@ func (m *JoinAcceptMICRequest) XXX_DiscardUnknown() { var xxx_messageInfo_JoinAcceptMICRequest proto.InternalMessageInfo -func (m *JoinAcceptMICRequest) GetJoinRequestType() uint32 { +func (m *JoinAcceptMICRequest) GetJoinRequestType() RejoinType { if m != nil { return m.JoinRequestType } - return 0 + return RejoinType_CONTEXT } type DeriveSessionKeysRequest struct { @@ -374,7 +374,7 @@ type DeriveSessionKeysRequest struct { func (m *DeriveSessionKeysRequest) Reset() { *m = DeriveSessionKeysRequest{} } func (*DeriveSessionKeysRequest) ProtoMessage() {} func (*DeriveSessionKeysRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_joinserver_c6665bed3643ea1a, []int{6} + return fileDescriptor_joinserver_549ad29080f1d943, []int{6} } func (m *DeriveSessionKeysRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -435,7 +435,7 @@ type GetRootKeysRequest struct { func (m *GetRootKeysRequest) Reset() { *m = GetRootKeysRequest{} } func (*GetRootKeysRequest) ProtoMessage() {} func (*GetRootKeysRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_joinserver_c6665bed3643ea1a, []int{7} + return fileDescriptor_joinserver_549ad29080f1d943, []int{7} } func (m *GetRootKeysRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -496,7 +496,7 @@ type ProvisionEndDevicesRequest struct { func (m *ProvisionEndDevicesRequest) Reset() { *m = ProvisionEndDevicesRequest{} } func (*ProvisionEndDevicesRequest) ProtoMessage() {} func (*ProvisionEndDevicesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_joinserver_c6665bed3643ea1a, []int{8} + return fileDescriptor_joinserver_549ad29080f1d943, []int{8} } func (m *ProvisionEndDevicesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -693,7 +693,7 @@ func (m *ProvisionEndDevicesRequest_IdentifiersList) Reset() { } func (*ProvisionEndDevicesRequest_IdentifiersList) ProtoMessage() {} func (*ProvisionEndDevicesRequest_IdentifiersList) Descriptor() ([]byte, []int) { - return fileDescriptor_joinserver_c6665bed3643ea1a, []int{8, 0} + return fileDescriptor_joinserver_549ad29080f1d943, []int{8, 0} } func (m *ProvisionEndDevicesRequest_IdentifiersList) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -742,7 +742,7 @@ func (m *ProvisionEndDevicesRequest_IdentifiersRange) Reset() { } func (*ProvisionEndDevicesRequest_IdentifiersRange) ProtoMessage() {} func (*ProvisionEndDevicesRequest_IdentifiersRange) Descriptor() ([]byte, []int) { - return fileDescriptor_joinserver_c6665bed3643ea1a, []int{8, 1} + return fileDescriptor_joinserver_549ad29080f1d943, []int{8, 1} } func (m *ProvisionEndDevicesRequest_IdentifiersRange) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -782,7 +782,7 @@ func (m *ProvisionEndDevicesRequest_IdentifiersFromData) Reset() { } func (*ProvisionEndDevicesRequest_IdentifiersFromData) ProtoMessage() {} func (*ProvisionEndDevicesRequest_IdentifiersFromData) Descriptor() ([]byte, []int) { - return fileDescriptor_joinserver_c6665bed3643ea1a, []int{8, 2} + return fileDescriptor_joinserver_549ad29080f1d943, []int{8, 2} } func (m *ProvisionEndDevicesRequest_IdentifiersFromData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2591,7 +2591,7 @@ func NewPopulatedJoinAcceptMICRequest(r randyJoinserver, easy bool) *JoinAcceptM this := &JoinAcceptMICRequest{} v10 := NewPopulatedCryptoServicePayloadRequest(r, easy) this.CryptoServicePayloadRequest = *v10 - this.JoinRequestType = r.Uint32() + this.JoinRequestType = RejoinType([]int32{0, 1, 2}[r.Intn(3)]) v11 := go_thethings_network_lorawan_stack_pkg_types.NewPopulatedDevNonce(r) this.DevNonce = *v11 if !easy && r.Intn(10) != 0 { @@ -3895,7 +3895,7 @@ func (m *JoinAcceptMICRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.JoinRequestType |= (uint32(b) & 0x7F) << shift + m.JoinRequestType |= (RejoinType(b) & 0x7F) << shift if b < 0x80 { break } @@ -4993,117 +4993,119 @@ var ( ) func init() { - proto.RegisterFile("lorawan-stack/api/joinserver.proto", fileDescriptor_joinserver_c6665bed3643ea1a) + proto.RegisterFile("lorawan-stack/api/joinserver.proto", fileDescriptor_joinserver_549ad29080f1d943) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/joinserver.proto", fileDescriptor_joinserver_c6665bed3643ea1a) -} - -var fileDescriptor_joinserver_c6665bed3643ea1a = []byte{ - // 1670 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0x4d, 0x6c, 0x1b, 0x45, - 0x14, 0xde, 0x49, 0x1c, 0x27, 0x99, 0xc4, 0x4e, 0x32, 0xad, 0x20, 0xb8, 0xd1, 0x3a, 0x75, 0x53, - 0x14, 0xd2, 0x7a, 0x5d, 0xb9, 0x10, 0x20, 0xa8, 0x2d, 0x76, 0x6c, 0x12, 0x27, 0x4d, 0x14, 0xad, - 0x29, 0x85, 0xb4, 0x89, 0xd9, 0xd8, 0x13, 0x77, 0x63, 0x67, 0x77, 0xd9, 0x19, 0x3b, 0x98, 0x52, - 0xa9, 0xe2, 0x80, 0x7a, 0x44, 0x20, 0x24, 0x8e, 0x08, 0x38, 0x54, 0x9c, 0x2a, 0x2e, 0xf4, 0x84, - 0x7a, 0xe8, 0xa1, 0xc7, 0x22, 0x2e, 0x15, 0x07, 0xb7, 0x59, 0x73, 0xa8, 0x38, 0xf5, 0x02, 0xaa, - 0x84, 0x04, 0x68, 0x7f, 0xfc, 0xb7, 0x76, 0x52, 0x3b, 0xa4, 0x95, 0xb8, 0xed, 0xec, 0xbc, 0xf7, - 0xcd, 0x7b, 0xdf, 0x7b, 0xf3, 0xf6, 0x5b, 0xe8, 0xcb, 0xca, 0xaa, 0xb0, 0x25, 0x48, 0x7e, 0x42, - 0x85, 0x64, 0x26, 0x20, 0x28, 0x62, 0x60, 0x43, 0x16, 0x25, 0x82, 0xd5, 0x3c, 0x56, 0x39, 0x45, - 0x95, 0xa9, 0x8c, 0xdc, 0x94, 0x4a, 0x9c, 0x65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0xd0, - 0x0a, 0xec, 0x4e, 0xe1, 0x7c, 0x02, 0xe7, 0xc4, 0xe1, 0x0e, 0xc3, 0x21, 0x72, 0xa7, 0xe8, 0x65, - 0x7e, 0x2d, 0x7a, 0x83, 0x69, 0x99, 0xa3, 0x97, 0x30, 0xbd, 0x24, 0x4a, 0x69, 0xc2, 0x49, 0x98, - 0x6e, 0xc9, 0x6a, 0x26, 0x50, 0x1f, 0x99, 0x92, 0x49, 0x07, 0x68, 0x41, 0xc1, 0x84, 0x8b, 0x9e, - 0x8b, 0x4d, 0xbe, 0xac, 0x15, 0xbd, 0xce, 0x08, 0xce, 0x47, 0xcf, 0xc5, 0x78, 0x67, 0x0a, 0xe7, - 0xa3, 0x39, 0xd1, 0xf7, 0x3b, 0x80, 0x83, 0x8b, 0x5b, 0x99, 0xf8, 0x3c, 0x2e, 0x10, 0x1e, 0x13, - 0x45, 0x96, 0x08, 0x46, 0x33, 0x70, 0x60, 0x3d, 0x21, 0x6d, 0x65, 0x12, 0x24, 0x21, 0x4a, 0x54, - 0x8f, 0xd7, 0x08, 0xb6, 0x2f, 0x78, 0x88, 0xab, 0xef, 0x28, 0x6e, 0x1e, 0x17, 0xa2, 0x52, 0x1e, - 0x67, 0x65, 0x05, 0x87, 0x1d, 0x7a, 0x60, 0x7c, 0xdf, 0xba, 0x0e, 0x17, 0x93, 0xe8, 0x3c, 0x2e, - 0xe8, 0x40, 0xc4, 0x06, 0xd4, 0xd1, 0x32, 0x10, 0xa9, 0x01, 0x8a, 0x40, 0x97, 0x09, 0x83, 0xa5, - 0xa4, 0x01, 0xd3, 0xd9, 0x2a, 0x0c, 0x94, 0xb6, 0x32, 0xf1, 0xa8, 0x94, 0x9c, 0xc7, 0x05, 0xdf, - 0x12, 0x1c, 0x08, 0x29, 0x4a, 0xdc, 0xa8, 0x8a, 0x95, 0xea, 0x29, 0xd8, 0x2b, 0x28, 0x4a, 0x82, - 0xb4, 0x97, 0x64, 0xb7, 0x60, 0xc2, 0xf8, 0xfe, 0xea, 0x80, 0x87, 0xa6, 0xd5, 0x82, 0x42, 0xe5, - 0x38, 0x56, 0xf5, 0x2e, 0x5c, 0x12, 0x0a, 0x59, 0x59, 0x48, 0x95, 0xab, 0xfe, 0x26, 0xec, 0x14, - 0x53, 0xc4, 0x02, 0x1e, 0xb3, 0x03, 0x47, 0xa5, 0x54, 0xc4, 0xe8, 0xdd, 0x58, 0xb5, 0x43, 0xc3, - 0x3d, 0xfa, 0x09, 0x77, 0x8b, 0x5e, 0xc0, 0xeb, 0xae, 0xe8, 0x3c, 0x1c, 0xb0, 0x3c, 0x12, 0x79, - 0xac, 0xea, 0x7d, 0x61, 0x50, 0xe8, 0x0e, 0x7a, 0xec, 0x68, 0x0b, 0xa1, 0xe9, 0x77, 0x4c, 0x8b, - 0x30, 0xd2, 0x8a, 0x5e, 0xf7, 0x59, 0x99, 0x17, 0xce, 0x87, 0x16, 0xad, 0x77, 0xbc, 0xdb, 0x32, - 0xb5, 0xd6, 0x68, 0x18, 0x76, 0x2b, 0x66, 0xb0, 0x06, 0x99, 0xfd, 0x7c, 0x79, 0x89, 0x04, 0xe8, - 0x56, 0x54, 0x39, 0x2f, 0xea, 0x66, 0x58, 0xd5, 0x5b, 0xd5, 0x31, 0x0a, 0xc6, 0x7b, 0xc3, 0x53, - 0x5a, 0xd1, 0xeb, 0x5a, 0xaa, 0xee, 0xc4, 0x22, 0xda, 0x7d, 0xef, 0x51, 0x78, 0x78, 0xf5, 0x82, - 0xe0, 0xff, 0xe8, 0x84, 0xff, 0xf5, 0x95, 0xf1, 0x33, 0x53, 0x17, 0xfc, 0x2b, 0x67, 0xca, 0xcb, - 0x97, 0x2e, 0x07, 0x8f, 0x5f, 0x19, 0xfb, 0x78, 0x75, 0xec, 0xc3, 0xa3, 0xbc, 0xab, 0x06, 0x31, - 0x96, 0x42, 0x11, 0x38, 0x54, 0x79, 0x21, 0x4a, 0xe9, 0x44, 0x4a, 0xa0, 0xc2, 0x70, 0x97, 0xc1, -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 0x31, 0x46, - 0x9c, 0x2e, 0xf9, 0x4c, 0x8d, 0x18, 0xda, 0xb3, 0xdc, 0xeb, 0xd6, 0xa7, 0x9c, 0xae, 0xf7, 0xba, - 0x75, 0xc8, 0x68, 0x4e, 0x44, 0xef, 0x43, 0x77, 0x55, 0x33, 0x1b, 0xed, 0xd5, 0x31, 0xda, 0xd9, - 0xf2, 0xa5, 0x3b, 0xa8, 0x37, 0x97, 0xae, 0x58, 0xab, 0xbb, 0x11, 0xc2, 0xf7, 0xe3, 0xaa, 0x2d, - 0xf1, 0xdc, 0x07, 0x70, 0xd0, 0x4e, 0xe8, 0x53, 0x4e, 0x6a, 0x13, 0xba, 0x08, 0x15, 0x54, 0x9a, - 0xa8, 0x97, 0xca, 0xb1, 0xff, 0x24, 0x95, 0xfb, 0xe2, 0x3a, 0xa4, 0xa5, 0x97, 0xfb, 0x48, 0x79, - 0x91, 0x13, 0x3d, 0x04, 0x1e, 0x68, 0x52, 0xd8, 0xa7, 0x9b, 0x63, 0xd8, 0x05, 0xfb, 0xaa, 0x85, - 0x23, 0xc1, 0x6f, 0x01, 0x74, 0x2c, 0x92, 0x39, 0x82, 0x66, 0x20, 0x9c, 0x15, 0xa4, 0x54, 0x16, - 0xeb, 0x1e, 0xa8, 0x41, 0xbc, 0xce, 0x55, 0x45, 0x85, 0x67, 0xa4, 0xf9, 0xa6, 0xa5, 0x96, 0x78, - 0xd8, 0x37, 0x83, 0x69, 0xf9, 0x67, 0x00, 0x1d, 0xb6, 0x1b, 0x37, 0xfc, 0xd3, 0x78, 0x46, 0xed, - 0x26, 0xf6, 0x3f, 0x89, 0xe0, 0xbb, 0xd0, 0x11, 0xd2, 0x83, 0x5c, 0x82, 0x70, 0x06, 0x53, 0x4b, - 0x7c, 0xb7, 0x02, 0xed, 0x6d, 0x32, 0xed, 0x6a, 0x85, 0x7b, 0xf0, 0x4f, 0x07, 0x3c, 0xb8, 0x68, - 0x92, 0x59, 0xa7, 0xc4, 0x50, 0x06, 0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, 0x7c, 0x56, 0x62, 0x99, 0xaf, 0x4a, 0x2c, 0xf8, 0xba, 0xc4, 0x32, 0xd7, 0x4b, 0x2c, - 0x73, 0xa3, 0xc4, 0x82, 0x9b, 0x25, 0x16, 0xdc, 0x2a, 0xb1, 0x60, 0xf9, 0x78, 0xab, 0x12, 0x81, - 0x4a, 0xca, 0xda, 0x9a, 0xd3, 0xe0, 0xe0, 0xe4, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x69, 0x91, - 0x9a, 0xaa, 0x02, 0x16, 0x00, 0x00, + golang_proto.RegisterFile("lorawan-stack/api/joinserver.proto", fileDescriptor_joinserver_549ad29080f1d943) +} + +var fileDescriptor_joinserver_549ad29080f1d943 = []byte{ + // 1706 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0x4f, 0x6c, 0x23, 0x57, + 0x19, 0x9f, 0x67, 0x27, 0x4e, 0xf2, 0x92, 0x38, 0xc9, 0xdb, 0x15, 0x18, 0x6f, 0x34, 0x4e, 0xdd, + 0x00, 0x21, 0x5d, 0x8f, 0x2b, 0x17, 0x56, 0x90, 0xaa, 0xad, 0xec, 0xd8, 0x24, 0x4e, 0x36, 0x56, + 0x18, 0x53, 0xfe, 0xa4, 0x4d, 0xcd, 0xc4, 0xf3, 0xe2, 0xcc, 0xda, 0x79, 0x33, 0xcc, 0x7b, 0x76, + 0x64, 0xca, 0x4a, 0x55, 0x0f, 0x68, 0x85, 0x7a, 0x40, 0x45, 0x48, 0x1c, 0x11, 0x70, 0xa8, 0x38, + 0xad, 0xb8, 0x50, 0x71, 0x40, 0x7b, 0x40, 0x62, 0x8f, 0x8b, 0xb8, 0x54, 0x1c, 0x4c, 0x33, 0xe6, + 0x50, 0x6e, 0x7b, 0x42, 0x7b, 0x44, 0x6f, 0x66, 0x6c, 0x8f, 0xc7, 0x4e, 0x36, 0x0e, 0x9b, 0x95, + 0x7a, 0x9b, 0x37, 0xef, 0x7b, 0xbf, 0xef, 0xfb, 0x7e, 0xdf, 0xf7, 0xbe, 0xf9, 0x0d, 0x8c, 0xd7, + 0x74, 0x53, 0x39, 0x51, 0x48, 0x82, 0x32, 0xa5, 0x5c, 0x4d, 0x2a, 0x86, 0x96, 0xbc, 0xa3, 0x6b, + 0x84, 0x62, 0xb3, 0x81, 0x4d, 0xc9, 0x30, 0x75, 0xa6, 0xa3, 0x30, 0x63, 0x44, 0x72, 0xed, 0xa4, + 0xc6, 0x2b, 0xd1, 0x44, 0x45, 0x63, 0x47, 0xf5, 0x03, 0xa9, 0xac, 0x1f, 0x27, 0x2b, 0x7a, 0x45, + 0x4f, 0xda, 0x66, 0x07, 0xf5, 0x43, 0x7b, 0x65, 0x2f, 0xec, 0x27, 0xe7, 0x78, 0xf4, 0x55, 0x8f, + 0x79, 0xad, 0x79, 0xc8, 0x1c, 0xf3, 0x72, 0xa2, 0x82, 0x49, 0xa2, 0xa1, 0xd4, 0x34, 0x55, 0x61, + 0x38, 0x39, 0xf0, 0xe0, 0x1e, 0x5e, 0xac, 0xe8, 0x7a, 0xa5, 0x86, 0xed, 0xc0, 0x14, 0x42, 0x74, + 0xa6, 0x30, 0x4d, 0x27, 0xd4, 0xdd, 0xbd, 0xe1, 0xee, 0x76, 0x03, 0xc0, 0xc7, 0x06, 0x6b, 0xfa, + 0x8e, 0x76, 0x37, 0x29, 0x33, 0xeb, 0x65, 0xe6, 0xee, 0x0e, 0x49, 0x1c, 0x13, 0xb5, 0xa4, 0xe2, + 0x86, 0x56, 0xee, 0x38, 0x7f, 0x71, 0xd0, 0x46, 0x53, 0x31, 0x61, 0xda, 0xa1, 0x86, 0xcd, 0x4e, + 0x0c, 0x8b, 0xc3, 0x19, 0x74, 0x77, 0x63, 0x83, 0xbb, 0x1d, 0x26, 0xcf, 0x3c, 0x5e, 0xc5, 0x4d, + 0x17, 0x3c, 0xfe, 0x07, 0x00, 0x17, 0x8a, 0x98, 0x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4, 0x6e, 0x7d, 0x7a, 0x05, 0xc9, 0xfc, 0x16, 0x3c, 0x3c, 0x15, 0xc1, 0xa3, 0x53, 0x11, + 0x7c, 0x72, 0x2a, 0x0a, 0x9f, 0x9e, 0x8a, 0xc2, 0x67, 0xa7, 0xa2, 0xf0, 0xf8, 0x54, 0x14, 0x9e, + 0x9c, 0x8a, 0xe0, 0x3d, 0x4b, 0x04, 0xf7, 0x2c, 0x51, 0xf8, 0xc8, 0x12, 0xc1, 0x7d, 0x4b, 0x14, + 0x3e, 0xb6, 0x44, 0xe1, 0x81, 0x25, 0x0a, 0x0f, 0x2d, 0x11, 0x3c, 0xb2, 0x44, 0xf0, 0x89, 0x25, + 0x0a, 0x9f, 0x5a, 0x22, 0xf8, 0xcc, 0x12, 0x85, 0xc7, 0x96, 0x08, 0x9e, 0x58, 0xa2, 0xf0, 0x5e, + 0x5b, 0x14, 0xee, 0xb5, 0x45, 0xf0, 0x8b, 0xb6, 0x28, 0xfc, 0xba, 0x2d, 0x82, 0xdf, 0xb4, 0x45, + 0xe1, 0xa3, 0xb6, 0x28, 0xdc, 0x6f, 0x8b, 0xe0, 0xe3, 0xb6, 0x08, 0x1e, 0xb4, 0x45, 0xb0, 0x77, + 0xf3, 0xa2, 0x12, 0x81, 0x11, 0xe3, 0xe0, 0x20, 0x64, 0x73, 0xf0, 0xca, 0xff, 0x02, 0x00, 0x00, + 0xff, 0xff, 0x70, 0x44, 0x40, 0x85, 0x9f, 0x16, 0x00, 0x00, } diff --git a/pkg/ttnpb/joinserver.pb.gw.go b/pkg/ttnpb/joinserver.pb.gw.go index 1fd9316fd7..94c24c6b37 100644 --- a/pkg/ttnpb/joinserver.pb.gw.go +++ b/pkg/ttnpb/joinserver.pb.gw.go @@ -9,11 +9,10 @@ It translates gRPC into RESTful JSON APIs. package ttnpb import ( + "context" "io" "net/http" - "context" - "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" diff --git a/pkg/ttnpb/joinserver.pb.paths.fm.go b/pkg/ttnpb/joinserver.pb.paths.fm.go new file mode 100644 index 0000000000..1f831dfc69 --- /dev/null +++ b/pkg/ttnpb/joinserver.pb.paths.fm.go @@ -0,0 +1,178 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var SessionKeyRequestFieldPathsNested = []string{ + "dev_eui", + "session_key_id", +} + +var SessionKeyRequestFieldPathsTopLevel = []string{ + "dev_eui", + "session_key_id", +} +var NwkSKeysResponseFieldPathsNested = []string{ + "f_nwk_s_int_key", + "f_nwk_s_int_key.kek_label", + "f_nwk_s_int_key.key", + "nwk_s_enc_key", + "nwk_s_enc_key.kek_label", + "nwk_s_enc_key.key", + "s_nwk_s_int_key", + "s_nwk_s_int_key.kek_label", + "s_nwk_s_int_key.key", +} + +var NwkSKeysResponseFieldPathsTopLevel = []string{ + "f_nwk_s_int_key", + "nwk_s_enc_key", + "s_nwk_s_int_key", +} +var AppSKeyResponseFieldPathsNested = []string{ + "app_s_key", + "app_s_key.kek_label", + "app_s_key.key", +} + +var AppSKeyResponseFieldPathsTopLevel = []string{ + "app_s_key", +} +var CryptoServicePayloadRequestFieldPathsNested = []string{ + "ids", + "ids.application_ids", + "ids.application_ids.application_id", + "ids.dev_addr", + "ids.dev_eui", + "ids.device_id", + "ids.join_eui", + "lorawan_version", + "payload", + "provisioner_id", + "provisioning_data", +} + +var CryptoServicePayloadRequestFieldPathsTopLevel = []string{ + "ids", + "lorawan_version", + "payload", + "provisioner_id", + "provisioning_data", +} +var CryptoServicePayloadResponseFieldPathsNested = []string{ + "payload", +} + +var CryptoServicePayloadResponseFieldPathsTopLevel = []string{ + "payload", +} +var JoinAcceptMICRequestFieldPathsNested = []string{ + "dev_nonce", + "join_request_type", + "payload_request", + "payload_request.ids", + "payload_request.ids.application_ids", + "payload_request.ids.application_ids.application_id", + "payload_request.ids.dev_addr", + "payload_request.ids.dev_eui", + "payload_request.ids.device_id", + "payload_request.ids.join_eui", + "payload_request.lorawan_version", + "payload_request.payload", + "payload_request.provisioner_id", + "payload_request.provisioning_data", +} + +var JoinAcceptMICRequestFieldPathsTopLevel = []string{ + "dev_nonce", + "join_request_type", + "payload_request", +} +var DeriveSessionKeysRequestFieldPathsNested = []string{ + "dev_nonce", + "ids", + "ids.application_ids", + "ids.application_ids.application_id", + "ids.dev_addr", + "ids.dev_eui", + "ids.device_id", + "ids.join_eui", + "join_nonce", + "lorawan_version", + "net_id", + "provisioner_id", + "provisioning_data", +} + +var DeriveSessionKeysRequestFieldPathsTopLevel = []string{ + "dev_nonce", + "ids", + "join_nonce", + "lorawan_version", + "net_id", + "provisioner_id", + "provisioning_data", +} +var GetRootKeysRequestFieldPathsNested = []string{ + "ids", + "ids.application_ids", + "ids.application_ids.application_id", + "ids.dev_addr", + "ids.dev_eui", + "ids.device_id", + "ids.join_eui", + "provisioner_id", + "provisioning_data", +} + +var GetRootKeysRequestFieldPathsTopLevel = []string{ + "ids", + "provisioner_id", + "provisioning_data", +} +var ProvisionEndDevicesRequestFieldPathsNested = []string{ + "application_ids", + "application_ids.application_id", + "end_devices", + "end_devices.from_data", + "end_devices.from_data.join_eui", + "end_devices.list", + "end_devices.list.end_device_ids", + "end_devices.list.join_eui", + "end_devices.range", + "end_devices.range.join_eui", + "end_devices.range.start_dev_eui", + "provisioner_id", + "provisioning_data", +} + +var ProvisionEndDevicesRequestFieldPathsTopLevel = []string{ + "application_ids", + "end_devices", + "provisioner_id", + "provisioning_data", +} +var ProvisionEndDevicesRequest_IdentifiersListFieldPathsNested = []string{ + "end_device_ids", + "join_eui", +} + +var ProvisionEndDevicesRequest_IdentifiersListFieldPathsTopLevel = []string{ + "end_device_ids", + "join_eui", +} +var ProvisionEndDevicesRequest_IdentifiersRangeFieldPathsNested = []string{ + "join_eui", + "start_dev_eui", +} + +var ProvisionEndDevicesRequest_IdentifiersRangeFieldPathsTopLevel = []string{ + "join_eui", + "start_dev_eui", +} +var ProvisionEndDevicesRequest_IdentifiersFromDataFieldPathsNested = []string{ + "join_eui", +} + +var ProvisionEndDevicesRequest_IdentifiersFromDataFieldPathsTopLevel = []string{ + "join_eui", +} diff --git a/pkg/ttnpb/joinserver.pb.fm.go b/pkg/ttnpb/joinserver.pb.setters.fm.go similarity index 80% rename from pkg/ttnpb/joinserver.pb.fm.go rename to pkg/ttnpb/joinserver.pb.setters.fm.go index 746c4a5ea6..850d5d1e5d 100644 --- a/pkg/ttnpb/joinserver.pb.fm.go +++ b/pkg/ttnpb/joinserver.pb.setters.fm.go @@ -8,16 +8,6 @@ import ( go_thethings_network_lorawan_stack_pkg_types "go.thethings.network/lorawan-stack/pkg/types" ) -var SessionKeyRequestFieldPathsNested = []string{ - "dev_eui", - "session_key_id", -} - -var SessionKeyRequestFieldPathsTopLevel = []string{ - "dev_eui", - "session_key_id", -} - func (dst *SessionKeyRequest) SetFields(src *SessionKeyRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -28,8 +18,7 @@ func (dst *SessionKeyRequest) SetFields(src *SessionKeyRequest, paths ...string) if src != nil { dst.SessionKeyID = src.SessionKeyID } else { - var zero []byte - dst.SessionKeyID = zero + dst.SessionKeyID = nil } case "dev_eui": if len(subs) > 0 { @@ -49,24 +38,6 @@ func (dst *SessionKeyRequest) SetFields(src *SessionKeyRequest, paths ...string) return nil } -var NwkSKeysResponseFieldPathsNested = []string{ - "f_nwk_s_int_key", - "f_nwk_s_int_key.kek_label", - "f_nwk_s_int_key.key", - "nwk_s_enc_key", - "nwk_s_enc_key.kek_label", - "nwk_s_enc_key.key", - "s_nwk_s_int_key", - "s_nwk_s_int_key.kek_label", - "s_nwk_s_int_key.key", -} - -var NwkSKeysResponseFieldPathsTopLevel = []string{ - "f_nwk_s_int_key", - "nwk_s_enc_key", - "s_nwk_s_int_key", -} - func (dst *NwkSKeysResponse) SetFields(src *NwkSKeysResponse, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -132,16 +103,6 @@ func (dst *NwkSKeysResponse) SetFields(src *NwkSKeysResponse, paths ...string) e return nil } -var AppSKeyResponseFieldPathsNested = []string{ - "app_s_key", - "app_s_key.kek_label", - "app_s_key.key", -} - -var AppSKeyResponseFieldPathsTopLevel = []string{ - "app_s_key", -} - func (dst *AppSKeyResponse) SetFields(src *AppSKeyResponse, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -171,28 +132,6 @@ func (dst *AppSKeyResponse) SetFields(src *AppSKeyResponse, paths ...string) err return nil } -var CryptoServicePayloadRequestFieldPathsNested = []string{ - "ids", - "ids.application_ids", - "ids.application_ids.application_id", - "ids.dev_addr", - "ids.dev_eui", - "ids.device_id", - "ids.join_eui", - "lorawan_version", - "payload", - "provisioner_id", - "provisioning_data", -} - -var CryptoServicePayloadRequestFieldPathsTopLevel = []string{ - "ids", - "lorawan_version", - "payload", - "provisioner_id", - "provisioning_data", -} - func (dst *CryptoServicePayloadRequest) SetFields(src *CryptoServicePayloadRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -231,8 +170,7 @@ func (dst *CryptoServicePayloadRequest) SetFields(src *CryptoServicePayloadReque if src != nil { dst.Payload = src.Payload } else { - var zero []byte - dst.Payload = zero + dst.Payload = nil } case "provisioner_id": if len(subs) > 0 { @@ -261,14 +199,6 @@ func (dst *CryptoServicePayloadRequest) SetFields(src *CryptoServicePayloadReque return nil } -var CryptoServicePayloadResponseFieldPathsNested = []string{ - "payload", -} - -var CryptoServicePayloadResponseFieldPathsTopLevel = []string{ - "payload", -} - func (dst *CryptoServicePayloadResponse) SetFields(src *CryptoServicePayloadResponse, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -279,8 +209,7 @@ func (dst *CryptoServicePayloadResponse) SetFields(src *CryptoServicePayloadResp if src != nil { dst.Payload = src.Payload } else { - var zero []byte - dst.Payload = zero + dst.Payload = nil } default: @@ -290,29 +219,6 @@ func (dst *CryptoServicePayloadResponse) SetFields(src *CryptoServicePayloadResp return nil } -var JoinAcceptMICRequestFieldPathsNested = []string{ - "dev_nonce", - "join_request_type", - "payload_request", - "payload_request.ids", - "payload_request.ids.application_ids", - "payload_request.ids.application_ids.application_id", - "payload_request.ids.dev_addr", - "payload_request.ids.dev_eui", - "payload_request.ids.device_id", - "payload_request.ids.join_eui", - "payload_request.lorawan_version", - "payload_request.payload", - "payload_request.provisioner_id", - "payload_request.provisioning_data", -} - -var JoinAcceptMICRequestFieldPathsTopLevel = []string{ - "dev_nonce", - "join_request_type", - "payload_request", -} - func (dst *JoinAcceptMICRequest) SetFields(src *JoinAcceptMICRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -341,7 +247,7 @@ func (dst *JoinAcceptMICRequest) SetFields(src *JoinAcceptMICRequest, paths ...s if src != nil { dst.JoinRequestType = src.JoinRequestType } else { - var zero uint32 + var zero RejoinType dst.JoinRequestType = zero } case "dev_nonce": @@ -362,32 +268,6 @@ func (dst *JoinAcceptMICRequest) SetFields(src *JoinAcceptMICRequest, paths ...s return nil } -var DeriveSessionKeysRequestFieldPathsNested = []string{ - "dev_nonce", - "ids", - "ids.application_ids", - "ids.application_ids.application_id", - "ids.dev_addr", - "ids.dev_eui", - "ids.device_id", - "ids.join_eui", - "join_nonce", - "lorawan_version", - "net_id", - "provisioner_id", - "provisioning_data", -} - -var DeriveSessionKeysRequestFieldPathsTopLevel = []string{ - "dev_nonce", - "ids", - "join_nonce", - "lorawan_version", - "net_id", - "provisioner_id", - "provisioning_data", -} - func (dst *DeriveSessionKeysRequest) SetFields(src *DeriveSessionKeysRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -476,24 +356,6 @@ func (dst *DeriveSessionKeysRequest) SetFields(src *DeriveSessionKeysRequest, pa return nil } -var GetRootKeysRequestFieldPathsNested = []string{ - "ids", - "ids.application_ids", - "ids.application_ids.application_id", - "ids.dev_addr", - "ids.dev_eui", - "ids.device_id", - "ids.join_eui", - "provisioner_id", - "provisioning_data", -} - -var GetRootKeysRequestFieldPathsTopLevel = []string{ - "ids", - "provisioner_id", - "provisioning_data", -} - func (dst *GetRootKeysRequest) SetFields(src *GetRootKeysRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -542,29 +404,6 @@ func (dst *GetRootKeysRequest) SetFields(src *GetRootKeysRequest, paths ...strin return nil } -var ProvisionEndDevicesRequestFieldPathsNested = []string{ - "application_ids", - "application_ids.application_id", - "end_devices", - "end_devices.from_data", - "end_devices.from_data.join_eui", - "end_devices.list", - "end_devices.list.end_device_ids", - "end_devices.list.join_eui", - "end_devices.range", - "end_devices.range.join_eui", - "end_devices.range.start_dev_eui", - "provisioner_id", - "provisioning_data", -} - -var ProvisionEndDevicesRequestFieldPathsTopLevel = []string{ - "application_ids", - "end_devices", - "provisioner_id", - "provisioning_data", -} - func (dst *ProvisionEndDevicesRequest) SetFields(src *ProvisionEndDevicesRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -603,8 +442,7 @@ func (dst *ProvisionEndDevicesRequest) SetFields(src *ProvisionEndDevicesRequest if src != nil { dst.ProvisioningData = src.ProvisioningData } else { - var zero []byte - dst.ProvisioningData = zero + dst.ProvisioningData = nil } case "end_devices": @@ -707,16 +545,6 @@ func (dst *ProvisionEndDevicesRequest) SetFields(src *ProvisionEndDevicesRequest return nil } -var ProvisionEndDevicesRequest_IdentifiersListFieldPathsNested = []string{ - "end_device_ids", - "join_eui", -} - -var ProvisionEndDevicesRequest_IdentifiersListFieldPathsTopLevel = []string{ - "end_device_ids", - "join_eui", -} - func (dst *ProvisionEndDevicesRequest_IdentifiersList) SetFields(src *ProvisionEndDevicesRequest_IdentifiersList, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -746,16 +574,6 @@ func (dst *ProvisionEndDevicesRequest_IdentifiersList) SetFields(src *ProvisionE return nil } -var ProvisionEndDevicesRequest_IdentifiersRangeFieldPathsNested = []string{ - "join_eui", - "start_dev_eui", -} - -var ProvisionEndDevicesRequest_IdentifiersRangeFieldPathsTopLevel = []string{ - "join_eui", - "start_dev_eui", -} - func (dst *ProvisionEndDevicesRequest_IdentifiersRange) SetFields(src *ProvisionEndDevicesRequest_IdentifiersRange, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -786,14 +604,6 @@ func (dst *ProvisionEndDevicesRequest_IdentifiersRange) SetFields(src *Provision return nil } -var ProvisionEndDevicesRequest_IdentifiersFromDataFieldPathsNested = []string{ - "join_eui", -} - -var ProvisionEndDevicesRequest_IdentifiersFromDataFieldPathsTopLevel = []string{ - "join_eui", -} - func (dst *ProvisionEndDevicesRequest_IdentifiersFromData) SetFields(src *ProvisionEndDevicesRequest_IdentifiersFromData, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { diff --git a/pkg/ttnpb/joinserver.pb.validate.go b/pkg/ttnpb/joinserver.pb.validate.go new file mode 100644 index 0000000000..84cb702ab8 --- /dev/null +++ b/pkg/ttnpb/joinserver.pb.validate.go @@ -0,0 +1,1346 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on SessionKeyRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *SessionKeyRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = SessionKeyRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "session_key_id": + // no validation rules for SessionKeyID + case "dev_eui": + // no validation rules for DevEUI + default: + return SessionKeyRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// SessionKeyRequestValidationError is the validation error returned by +// SessionKeyRequest.ValidateFields if the designated constraints aren't met. +type SessionKeyRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SessionKeyRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SessionKeyRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SessionKeyRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SessionKeyRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SessionKeyRequestValidationError) ErrorName() string { + return "SessionKeyRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e SessionKeyRequestValidationError) 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 %sSessionKeyRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SessionKeyRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SessionKeyRequestValidationError{} + +// ValidateFields checks the field values on NwkSKeysResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *NwkSKeysResponse) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = NwkSKeysResponseFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "f_nwk_s_int_key": + + if v, ok := interface{}(&m.FNwkSIntKey).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return NwkSKeysResponseValidationError{ + field: "f_nwk_s_int_key", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "s_nwk_s_int_key": + + if v, ok := interface{}(&m.SNwkSIntKey).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return NwkSKeysResponseValidationError{ + field: "s_nwk_s_int_key", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "nwk_s_enc_key": + + if v, ok := interface{}(&m.NwkSEncKey).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return NwkSKeysResponseValidationError{ + field: "nwk_s_enc_key", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return NwkSKeysResponseValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// NwkSKeysResponseValidationError is the validation error returned by +// NwkSKeysResponse.ValidateFields if the designated constraints aren't met. +type NwkSKeysResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e NwkSKeysResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e NwkSKeysResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e NwkSKeysResponseValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e NwkSKeysResponseValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e NwkSKeysResponseValidationError) ErrorName() string { return "NwkSKeysResponseValidationError" } + +// Error satisfies the builtin error interface +func (e NwkSKeysResponseValidationError) 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 %sNwkSKeysResponse.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = NwkSKeysResponseValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = NwkSKeysResponseValidationError{} + +// ValidateFields checks the field values on AppSKeyResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *AppSKeyResponse) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = AppSKeyResponseFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "app_s_key": + + if v, ok := interface{}(&m.AppSKey).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return AppSKeyResponseValidationError{ + field: "app_s_key", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return AppSKeyResponseValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// AppSKeyResponseValidationError is the validation error returned by +// AppSKeyResponse.ValidateFields if the designated constraints aren't met. +type AppSKeyResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e AppSKeyResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e AppSKeyResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e AppSKeyResponseValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e AppSKeyResponseValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e AppSKeyResponseValidationError) ErrorName() string { return "AppSKeyResponseValidationError" } + +// Error satisfies the builtin error interface +func (e AppSKeyResponseValidationError) 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 %sAppSKeyResponse.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = AppSKeyResponseValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = AppSKeyResponseValidationError{} + +// ValidateFields checks the field values on CryptoServicePayloadRequest with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *CryptoServicePayloadRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = CryptoServicePayloadRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "ids": + + if v, ok := interface{}(&m.EndDeviceIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return CryptoServicePayloadRequestValidationError{ + field: "ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "lorawan_version": + + if _, ok := MACVersion_name[int32(m.GetLoRaWANVersion())]; !ok { + return CryptoServicePayloadRequestValidationError{ + field: "lorawan_version", + reason: "value must be one of the defined enum values", + } + } + + case "payload": + // no validation rules for Payload + case "provisioner_id": + + if utf8.RuneCountInString(m.GetProvisionerID()) > 36 { + return CryptoServicePayloadRequestValidationError{ + field: "provisioner_id", + reason: "value length must be at most 36 runes", + } + } + + if !_CryptoServicePayloadRequest_ProvisionerID_Pattern.MatchString(m.GetProvisionerID()) { + return CryptoServicePayloadRequestValidationError{ + field: "provisioner_id", + reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$\"", + } + } + + case "provisioning_data": + + if v, ok := interface{}(m.GetProvisioningData()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return CryptoServicePayloadRequestValidationError{ + field: "provisioning_data", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return CryptoServicePayloadRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// CryptoServicePayloadRequestValidationError is the validation error returned +// by CryptoServicePayloadRequest.ValidateFields if the designated constraints +// aren't met. +type CryptoServicePayloadRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CryptoServicePayloadRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CryptoServicePayloadRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CryptoServicePayloadRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CryptoServicePayloadRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CryptoServicePayloadRequestValidationError) ErrorName() string { + return "CryptoServicePayloadRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e CryptoServicePayloadRequestValidationError) 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 %sCryptoServicePayloadRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CryptoServicePayloadRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CryptoServicePayloadRequestValidationError{} + +var _CryptoServicePayloadRequest_ProvisionerID_Pattern = regexp.MustCompile("^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$") + +// ValidateFields checks the field values on CryptoServicePayloadResponse with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *CryptoServicePayloadResponse) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = CryptoServicePayloadResponseFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "payload": + // no validation rules for Payload + default: + return CryptoServicePayloadResponseValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// CryptoServicePayloadResponseValidationError is the validation error returned +// by CryptoServicePayloadResponse.ValidateFields if the designated +// constraints aren't met. +type CryptoServicePayloadResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CryptoServicePayloadResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CryptoServicePayloadResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CryptoServicePayloadResponseValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CryptoServicePayloadResponseValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CryptoServicePayloadResponseValidationError) ErrorName() string { + return "CryptoServicePayloadResponseValidationError" +} + +// Error satisfies the builtin error interface +func (e CryptoServicePayloadResponseValidationError) 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 %sCryptoServicePayloadResponse.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CryptoServicePayloadResponseValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CryptoServicePayloadResponseValidationError{} + +// ValidateFields checks the field values on JoinAcceptMICRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *JoinAcceptMICRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = JoinAcceptMICRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "payload_request": + + if v, ok := interface{}(&m.CryptoServicePayloadRequest).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return JoinAcceptMICRequestValidationError{ + field: "payload_request", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "join_request_type": + + if _, ok := RejoinType_name[int32(m.GetJoinRequestType())]; !ok { + return JoinAcceptMICRequestValidationError{ + field: "join_request_type", + reason: "value must be one of the defined enum values", + } + } + + case "dev_nonce": + // no validation rules for DevNonce + default: + return JoinAcceptMICRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// JoinAcceptMICRequestValidationError is the validation error returned by +// JoinAcceptMICRequest.ValidateFields if the designated constraints aren't met. +type JoinAcceptMICRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e JoinAcceptMICRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e JoinAcceptMICRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e JoinAcceptMICRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e JoinAcceptMICRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e JoinAcceptMICRequestValidationError) ErrorName() string { + return "JoinAcceptMICRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e JoinAcceptMICRequestValidationError) 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 %sJoinAcceptMICRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = JoinAcceptMICRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = JoinAcceptMICRequestValidationError{} + +// ValidateFields checks the field values on DeriveSessionKeysRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *DeriveSessionKeysRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = DeriveSessionKeysRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "ids": + + if v, ok := interface{}(&m.EndDeviceIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return DeriveSessionKeysRequestValidationError{ + field: "ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "lorawan_version": + + if _, ok := MACVersion_name[int32(m.GetLoRaWANVersion())]; !ok { + return DeriveSessionKeysRequestValidationError{ + field: "lorawan_version", + reason: "value must be one of the defined enum values", + } + } + + case "join_nonce": + // no validation rules for JoinNonce + case "dev_nonce": + // no validation rules for DevNonce + case "net_id": + // no validation rules for NetID + case "provisioner_id": + + if utf8.RuneCountInString(m.GetProvisionerID()) > 36 { + return DeriveSessionKeysRequestValidationError{ + field: "provisioner_id", + reason: "value length must be at most 36 runes", + } + } + + if !_DeriveSessionKeysRequest_ProvisionerID_Pattern.MatchString(m.GetProvisionerID()) { + return DeriveSessionKeysRequestValidationError{ + field: "provisioner_id", + reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$\"", + } + } + + case "provisioning_data": + + if v, ok := interface{}(m.GetProvisioningData()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return DeriveSessionKeysRequestValidationError{ + field: "provisioning_data", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return DeriveSessionKeysRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// DeriveSessionKeysRequestValidationError is the validation error returned by +// DeriveSessionKeysRequest.ValidateFields if the designated constraints +// aren't met. +type DeriveSessionKeysRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e DeriveSessionKeysRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e DeriveSessionKeysRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e DeriveSessionKeysRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e DeriveSessionKeysRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e DeriveSessionKeysRequestValidationError) ErrorName() string { + return "DeriveSessionKeysRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e DeriveSessionKeysRequestValidationError) 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 %sDeriveSessionKeysRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = DeriveSessionKeysRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = DeriveSessionKeysRequestValidationError{} + +var _DeriveSessionKeysRequest_ProvisionerID_Pattern = regexp.MustCompile("^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$") + +// ValidateFields checks the field values on GetRootKeysRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GetRootKeysRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GetRootKeysRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "ids": + + if v, ok := interface{}(&m.EndDeviceIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GetRootKeysRequestValidationError{ + field: "ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "provisioner_id": + + if utf8.RuneCountInString(m.GetProvisionerID()) > 36 { + return GetRootKeysRequestValidationError{ + field: "provisioner_id", + reason: "value length must be at most 36 runes", + } + } + + if !_GetRootKeysRequest_ProvisionerID_Pattern.MatchString(m.GetProvisionerID()) { + return GetRootKeysRequestValidationError{ + field: "provisioner_id", + reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$\"", + } + } + + case "provisioning_data": + + if v, ok := interface{}(m.GetProvisioningData()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GetRootKeysRequestValidationError{ + field: "provisioning_data", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return GetRootKeysRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GetRootKeysRequestValidationError is the validation error returned by +// GetRootKeysRequest.ValidateFields if the designated constraints aren't met. +type GetRootKeysRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetRootKeysRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetRootKeysRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetRootKeysRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetRootKeysRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetRootKeysRequestValidationError) ErrorName() string { + return "GetRootKeysRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetRootKeysRequestValidationError) 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 %sGetRootKeysRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetRootKeysRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetRootKeysRequestValidationError{} + +var _GetRootKeysRequest_ProvisionerID_Pattern = regexp.MustCompile("^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$") + +// ValidateFields checks the field values on ProvisionEndDevicesRequest with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *ProvisionEndDevicesRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ProvisionEndDevicesRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "application_ids": + + if v, ok := interface{}(&m.ApplicationIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ProvisionEndDevicesRequestValidationError{ + field: "application_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "provisioner_id": + + if utf8.RuneCountInString(m.GetProvisionerID()) > 36 { + return ProvisionEndDevicesRequestValidationError{ + field: "provisioner_id", + reason: "value length must be at most 36 runes", + } + } + + if !_ProvisionEndDevicesRequest_ProvisionerID_Pattern.MatchString(m.GetProvisionerID()) { + return ProvisionEndDevicesRequestValidationError{ + field: "provisioner_id", + reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$\"", + } + } + + case "provisioning_data": + // no validation rules for ProvisioningData + case "end_devices": + if len(subs) == 0 { + subs = []string{ + "list", "range", "from_data", + } + } + for name, subs := range _processPaths(subs) { + _ = subs + switch name { + case "list": + + if v, ok := interface{}(m.GetList()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ProvisionEndDevicesRequestValidationError{ + field: "list", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "range": + + if v, ok := interface{}(m.GetRange()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ProvisionEndDevicesRequestValidationError{ + field: "range", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "from_data": + + if v, ok := interface{}(m.GetFromData()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ProvisionEndDevicesRequestValidationError{ + field: "from_data", + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + } + default: + return ProvisionEndDevicesRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ProvisionEndDevicesRequestValidationError is the validation error returned +// by ProvisionEndDevicesRequest.ValidateFields if the designated constraints +// aren't met. +type ProvisionEndDevicesRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ProvisionEndDevicesRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ProvisionEndDevicesRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ProvisionEndDevicesRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ProvisionEndDevicesRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ProvisionEndDevicesRequestValidationError) ErrorName() string { + return "ProvisionEndDevicesRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e ProvisionEndDevicesRequestValidationError) 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 %sProvisionEndDevicesRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ProvisionEndDevicesRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ProvisionEndDevicesRequestValidationError{} + +var _ProvisionEndDevicesRequest_ProvisionerID_Pattern = regexp.MustCompile("^[a-z0-9](?:[-]?[a-z0-9]){2,}$") + +// ValidateFields checks the field values on +// ProvisionEndDevicesRequest_IdentifiersList with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *ProvisionEndDevicesRequest_IdentifiersList) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ProvisionEndDevicesRequest_IdentifiersListFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "join_eui": + // no validation rules for JoinEUI + case "end_device_ids": + + for idx, item := range m.EndDeviceIDs { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ProvisionEndDevicesRequest_IdentifiersListValidationError{ + field: fmt.Sprintf("end_device_ids[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + default: + return ProvisionEndDevicesRequest_IdentifiersListValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ProvisionEndDevicesRequest_IdentifiersListValidationError is the validation +// error returned by ProvisionEndDevicesRequest_IdentifiersList.ValidateFields +// if the designated constraints aren't met. +type ProvisionEndDevicesRequest_IdentifiersListValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ProvisionEndDevicesRequest_IdentifiersListValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ProvisionEndDevicesRequest_IdentifiersListValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ProvisionEndDevicesRequest_IdentifiersListValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ProvisionEndDevicesRequest_IdentifiersListValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ProvisionEndDevicesRequest_IdentifiersListValidationError) ErrorName() string { + return "ProvisionEndDevicesRequest_IdentifiersListValidationError" +} + +// Error satisfies the builtin error interface +func (e ProvisionEndDevicesRequest_IdentifiersListValidationError) 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 %sProvisionEndDevicesRequest_IdentifiersList.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ProvisionEndDevicesRequest_IdentifiersListValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ProvisionEndDevicesRequest_IdentifiersListValidationError{} + +// ValidateFields checks the field values on +// ProvisionEndDevicesRequest_IdentifiersRange with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *ProvisionEndDevicesRequest_IdentifiersRange) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ProvisionEndDevicesRequest_IdentifiersRangeFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "join_eui": + // no validation rules for JoinEUI + case "start_dev_eui": + // no validation rules for StartDevEUI + default: + return ProvisionEndDevicesRequest_IdentifiersRangeValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ProvisionEndDevicesRequest_IdentifiersRangeValidationError is the validation +// error returned by +// ProvisionEndDevicesRequest_IdentifiersRange.ValidateFields if the +// designated constraints aren't met. +type ProvisionEndDevicesRequest_IdentifiersRangeValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ProvisionEndDevicesRequest_IdentifiersRangeValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ProvisionEndDevicesRequest_IdentifiersRangeValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ProvisionEndDevicesRequest_IdentifiersRangeValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ProvisionEndDevicesRequest_IdentifiersRangeValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ProvisionEndDevicesRequest_IdentifiersRangeValidationError) ErrorName() string { + return "ProvisionEndDevicesRequest_IdentifiersRangeValidationError" +} + +// Error satisfies the builtin error interface +func (e ProvisionEndDevicesRequest_IdentifiersRangeValidationError) 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 %sProvisionEndDevicesRequest_IdentifiersRange.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ProvisionEndDevicesRequest_IdentifiersRangeValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ProvisionEndDevicesRequest_IdentifiersRangeValidationError{} + +// ValidateFields checks the field values on +// ProvisionEndDevicesRequest_IdentifiersFromData with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *ProvisionEndDevicesRequest_IdentifiersFromData) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ProvisionEndDevicesRequest_IdentifiersFromDataFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "join_eui": + // no validation rules for JoinEUI + default: + return ProvisionEndDevicesRequest_IdentifiersFromDataValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ProvisionEndDevicesRequest_IdentifiersFromDataValidationError is the +// validation error returned by +// ProvisionEndDevicesRequest_IdentifiersFromData.ValidateFields if the +// designated constraints aren't met. +type ProvisionEndDevicesRequest_IdentifiersFromDataValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ProvisionEndDevicesRequest_IdentifiersFromDataValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ProvisionEndDevicesRequest_IdentifiersFromDataValidationError) Reason() string { + return e.reason +} + +// Cause function returns cause value. +func (e ProvisionEndDevicesRequest_IdentifiersFromDataValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ProvisionEndDevicesRequest_IdentifiersFromDataValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ProvisionEndDevicesRequest_IdentifiersFromDataValidationError) ErrorName() string { + return "ProvisionEndDevicesRequest_IdentifiersFromDataValidationError" +} + +// Error satisfies the builtin error interface +func (e ProvisionEndDevicesRequest_IdentifiersFromDataValidationError) 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 %sProvisionEndDevicesRequest_IdentifiersFromData.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ProvisionEndDevicesRequest_IdentifiersFromDataValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ProvisionEndDevicesRequest_IdentifiersFromDataValidationError{} diff --git a/pkg/ttnpb/joinserver.validator.pb.go b/pkg/ttnpb/joinserver.validator.pb.go deleted file mode 100644 index cedab7825c..0000000000 --- a/pkg/ttnpb/joinserver.validator.pb.go +++ /dev/null @@ -1,164 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/joinserver.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import regexp "regexp" -import fmt "fmt" -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/empty" -import _ "github.com/golang/protobuf/ptypes/struct" -import _ "github.com/mwitkow/go-proto-validators" -import _ "google.golang.org/genproto/googleapis/api/annotations" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *SessionKeyRequest) Validate() error { - return nil -} -func (this *NwkSKeysResponse) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FNwkSIntKey)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FNwkSIntKey", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.SNwkSIntKey)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("SNwkSIntKey", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.NwkSEncKey)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("NwkSEncKey", err) - } - return nil -} -func (this *AppSKeyResponse) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.AppSKey)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("AppSKey", err) - } - return nil -} - -var _regex_CryptoServicePayloadRequest_ProvisionerID = regexp.MustCompile(`^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$`) - -func (this *CryptoServicePayloadRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.EndDeviceIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("EndDeviceIdentifiers", err) - } - if !_regex_CryptoServicePayloadRequest_ProvisionerID.MatchString(this.ProvisionerID) { - return github_com_mwitkow_go_proto_validators.FieldError("ProvisionerID", fmt.Errorf(`value '%v' must be a string conforming to regex "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$"`, this.ProvisionerID)) - } - if !(len(this.ProvisionerID) < 37) { - return github_com_mwitkow_go_proto_validators.FieldError("ProvisionerID", fmt.Errorf(`value '%v' must length be less than '37'`, this.ProvisionerID)) - } - if this.ProvisioningData != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ProvisioningData); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ProvisioningData", err) - } - } - return nil -} -func (this *CryptoServicePayloadResponse) Validate() error { - return nil -} -func (this *JoinAcceptMICRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.CryptoServicePayloadRequest)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("CryptoServicePayloadRequest", err) - } - return nil -} - -var _regex_DeriveSessionKeysRequest_ProvisionerID = regexp.MustCompile(`^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$`) - -func (this *DeriveSessionKeysRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.EndDeviceIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("EndDeviceIdentifiers", err) - } - if !_regex_DeriveSessionKeysRequest_ProvisionerID.MatchString(this.ProvisionerID) { - return github_com_mwitkow_go_proto_validators.FieldError("ProvisionerID", fmt.Errorf(`value '%v' must be a string conforming to regex "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$"`, this.ProvisionerID)) - } - if !(len(this.ProvisionerID) < 37) { - return github_com_mwitkow_go_proto_validators.FieldError("ProvisionerID", fmt.Errorf(`value '%v' must length be less than '37'`, this.ProvisionerID)) - } - if this.ProvisioningData != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ProvisioningData); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ProvisioningData", err) - } - } - return nil -} - -var _regex_GetRootKeysRequest_ProvisionerID = regexp.MustCompile(`^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$`) - -func (this *GetRootKeysRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.EndDeviceIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("EndDeviceIdentifiers", err) - } - if !_regex_GetRootKeysRequest_ProvisionerID.MatchString(this.ProvisionerID) { - return github_com_mwitkow_go_proto_validators.FieldError("ProvisionerID", fmt.Errorf(`value '%v' must be a string conforming to regex "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$"`, this.ProvisionerID)) - } - if !(len(this.ProvisionerID) < 37) { - return github_com_mwitkow_go_proto_validators.FieldError("ProvisionerID", fmt.Errorf(`value '%v' must length be less than '37'`, this.ProvisionerID)) - } - if this.ProvisioningData != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ProvisioningData); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ProvisioningData", err) - } - } - return nil -} - -var _regex_ProvisionEndDevicesRequest_ProvisionerID = regexp.MustCompile(`^[a-z0-9](?:[-]?[a-z0-9]){2,}$`) - -func (this *ProvisionEndDevicesRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ApplicationIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationIdentifiers", err) - } - if !_regex_ProvisionEndDevicesRequest_ProvisionerID.MatchString(this.ProvisionerID) { - return github_com_mwitkow_go_proto_validators.FieldError("ProvisionerID", fmt.Errorf(`value '%v' must be a string conforming to regex "^[a-z0-9](?:[-]?[a-z0-9]){2,}$"`, this.ProvisionerID)) - } - if !(len(this.ProvisionerID) < 37) { - return github_com_mwitkow_go_proto_validators.FieldError("ProvisionerID", fmt.Errorf(`value '%v' must length be less than '37'`, this.ProvisionerID)) - } - if oneOfNester, ok := this.GetEndDevices().(*ProvisionEndDevicesRequest_List); ok { - if oneOfNester.List != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.List); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("List", err) - } - } - } - if oneOfNester, ok := this.GetEndDevices().(*ProvisionEndDevicesRequest_Range); ok { - if oneOfNester.Range != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.Range); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Range", err) - } - } - } - if oneOfNester, ok := this.GetEndDevices().(*ProvisionEndDevicesRequest_FromData); ok { - if oneOfNester.FromData != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.FromData); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FromData", err) - } - } - } - return nil -} -func (this *ProvisionEndDevicesRequest_IdentifiersList) Validate() error { - for _, item := range this.EndDeviceIDs { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(item)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("EndDeviceIDs", err) - } - } - return nil -} -func (this *ProvisionEndDevicesRequest_IdentifiersRange) Validate() error { - return nil -} -func (this *ProvisionEndDevicesRequest_IdentifiersFromData) Validate() error { - return nil -} diff --git a/pkg/ttnpb/keys.pb.go b/pkg/ttnpb/keys.pb.go index 80ef5486a6..08b3cba150 100644 --- a/pkg/ttnpb/keys.pb.go +++ b/pkg/ttnpb/keys.pb.go @@ -8,7 +8,6 @@ import golang_proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/mwitkow/go-proto-validators" import bytes "bytes" @@ -41,7 +40,7 @@ type KeyEnvelope struct { func (m *KeyEnvelope) Reset() { *m = KeyEnvelope{} } func (*KeyEnvelope) ProtoMessage() {} func (*KeyEnvelope) Descriptor() ([]byte, []int) { - return fileDescriptor_keys_f05830b2ae3e3987, []int{0} + return fileDescriptor_keys_c00360eac8cb235e, []int{0} } func (m *KeyEnvelope) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -100,7 +99,7 @@ type RootKeys struct { func (m *RootKeys) Reset() { *m = RootKeys{} } func (*RootKeys) ProtoMessage() {} func (*RootKeys) Descriptor() ([]byte, []int) { - return fileDescriptor_keys_f05830b2ae3e3987, []int{1} + return fileDescriptor_keys_c00360eac8cb235e, []int{1} } func (m *RootKeys) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -175,7 +174,7 @@ type SessionKeys struct { func (m *SessionKeys) Reset() { *m = SessionKeys{} } func (*SessionKeys) ProtoMessage() {} func (*SessionKeys) Descriptor() ([]byte, []int) { - return fileDescriptor_keys_f05830b2ae3e3987, []int{2} + return fileDescriptor_keys_c00360eac8cb235e, []int{2} } func (m *SessionKeys) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1284,45 +1283,43 @@ var ( ErrIntOverflowKeys = fmt.Errorf("proto: integer overflow") ) -func init() { proto.RegisterFile("lorawan-stack/api/keys.proto", fileDescriptor_keys_f05830b2ae3e3987) } +func init() { proto.RegisterFile("lorawan-stack/api/keys.proto", fileDescriptor_keys_c00360eac8cb235e) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/keys.proto", fileDescriptor_keys_f05830b2ae3e3987) + golang_proto.RegisterFile("lorawan-stack/api/keys.proto", fileDescriptor_keys_c00360eac8cb235e) } -var fileDescriptor_keys_f05830b2ae3e3987 = []byte{ - // 539 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x31, 0x4c, 0xdb, 0x4c, - 0x1c, 0xc5, 0xef, 0x80, 0x8f, 0x0f, 0x9f, 0x03, 0x45, 0x9e, 0x10, 0xad, 0xfe, 0x41, 0x4c, 0x54, - 0x6a, 0x6c, 0xa9, 0x54, 0x54, 0xea, 0x50, 0xa9, 0x11, 0x0c, 0xd4, 0x55, 0x07, 0x67, 0xeb, 0x12, - 0x39, 0xc9, 0x61, 0xac, 0x0b, 0x77, 0x96, 0xef, 0x88, 0xe5, 0x8d, 0x91, 0xb1, 0x63, 0x47, 0x54, +var fileDescriptor_keys_c00360eac8cb235e = []byte{ + // 512 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x31, 0x4c, 0xdb, 0x4c, + 0x18, 0xbd, 0x03, 0x7e, 0x7e, 0x7c, 0x0e, 0x14, 0x79, 0x42, 0x6d, 0xf5, 0x05, 0x65, 0xa2, 0x52, + 0x63, 0x4b, 0xa5, 0x6a, 0xa5, 0x0e, 0x95, 0x1a, 0x91, 0x21, 0x75, 0xd5, 0xc1, 0xd9, 0xba, 0x44, + 0x4e, 0x72, 0x71, 0xac, 0x4b, 0xef, 0xac, 0xdc, 0x81, 0xe5, 0x8d, 0x91, 0xb1, 0x63, 0x47, 0x54, 0xa9, 0x12, 0x23, 0x63, 0x46, 0x46, 0xd4, 0x89, 0x91, 0x29, 0xc2, 0xe7, 0x85, 0x91, 0x91, 0xb1, - 0xf2, 0x25, 0x2a, 0xa1, 0x0b, 0xd9, 0xde, 0xdf, 0x7e, 0xbf, 0x77, 0xef, 0xce, 0x3e, 0xf2, 0xaa, - 0x2f, 0xd2, 0x30, 0x0b, 0x79, 0x43, 0xaa, 0xb0, 0xcb, 0xbc, 0x30, 0x89, 0x3d, 0x46,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4, 0x8a, 0x1a, 0xbf, + 0xf0, 0x65, 0x0e, 0xf8, 0x2a, 0x07, 0x7c, 0x9d, 0x03, 0xba, 0xc9, 0x01, 0xdd, 0xe6, 0x80, 0xee, + 0x72, 0x40, 0xf7, 0x39, 0xe0, 0x63, 0x0d, 0xf8, 0x44, 0x03, 0x3a, 0xd3, 0x80, 0xcf, 0x35, 0xa0, + 0x89, 0x06, 0x74, 0xa1, 0x01, 0x5d, 0x6a, 0xc0, 0x57, 0x1a, 0xf0, 0xb5, 0x06, 0x74, 0xa3, 0x01, + 0xdf, 0x6a, 0x40, 0x77, 0x1a, 0xf0, 0xbd, 0x06, 0x74, 0x5c, 0x00, 0x3a, 0x29, 0x00, 0xff, 0x28, + 0x00, 0xfd, 0x2c, 0x00, 0x9f, 0x16, 0x80, 0xce, 0x0a, 0x40, 0xe7, 0x05, 0xe0, 0x49, 0x01, 0xf8, + 0xa2, 0x00, 0xfc, 0xed, 0x75, 0x24, 0x5c, 0x35, 0xa4, 0x6a, 0x18, 0xf3, 0x48, 0xba, 0x9c, 0xaa, + 0x54, 0x8c, 0x99, 0xf7, 0xf8, 0xa5, 0x24, 0x2c, 0xf2, 0x94, 0xe2, 0x49, 0xb7, 0xbb, 0x6e, 0x2e, + 0xfb, 0xfe, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2e, 0xea, 0xdd, 0xde, 0x4b, 0x03, 0x00, 0x00, } diff --git a/pkg/ttnpb/keys.pb.paths.fm.go b/pkg/ttnpb/keys.pb.paths.fm.go new file mode 100644 index 0000000000..9b2ba0306d --- /dev/null +++ b/pkg/ttnpb/keys.pb.paths.fm.go @@ -0,0 +1,51 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var KeyEnvelopeFieldPathsNested = []string{ + "kek_label", + "key", +} + +var KeyEnvelopeFieldPathsTopLevel = []string{ + "kek_label", + "key", +} +var RootKeysFieldPathsNested = []string{ + "app_key", + "app_key.kek_label", + "app_key.key", + "nwk_key", + "nwk_key.kek_label", + "nwk_key.key", + "root_key_id", +} + +var RootKeysFieldPathsTopLevel = []string{ + "app_key", + "nwk_key", + "root_key_id", +} +var SessionKeysFieldPathsNested = []string{ + "app_s_key", + "app_s_key.kek_label", + "app_s_key.key", + "f_nwk_s_int_key", + "f_nwk_s_int_key.kek_label", + "f_nwk_s_int_key.key", + "nwk_s_enc_key", + "nwk_s_enc_key.kek_label", + "nwk_s_enc_key.key", + "s_nwk_s_int_key", + "s_nwk_s_int_key.kek_label", + "s_nwk_s_int_key.key", + "session_key_id", +} + +var SessionKeysFieldPathsTopLevel = []string{ + "app_s_key", + "f_nwk_s_int_key", + "nwk_s_enc_key", + "s_nwk_s_int_key", + "session_key_id", +} diff --git a/pkg/ttnpb/keys.pb.fm.go b/pkg/ttnpb/keys.pb.setters.fm.go similarity index 82% rename from pkg/ttnpb/keys.pb.fm.go rename to pkg/ttnpb/keys.pb.setters.fm.go index e8433d49e8..e9c7834ddf 100644 --- a/pkg/ttnpb/keys.pb.fm.go +++ b/pkg/ttnpb/keys.pb.setters.fm.go @@ -4,16 +4,6 @@ package ttnpb import fmt "fmt" -var KeyEnvelopeFieldPathsNested = []string{ - "kek_label", - "key", -} - -var KeyEnvelopeFieldPathsTopLevel = []string{ - "kek_label", - "key", -} - func (dst *KeyEnvelope) SetFields(src *KeyEnvelope, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -24,8 +14,7 @@ func (dst *KeyEnvelope) SetFields(src *KeyEnvelope, paths ...string) error { if src != nil { dst.Key = src.Key } else { - var zero []byte - dst.Key = zero + dst.Key = nil } case "kek_label": if len(subs) > 0 { @@ -45,22 +34,6 @@ func (dst *KeyEnvelope) SetFields(src *KeyEnvelope, paths ...string) error { return nil } -var RootKeysFieldPathsNested = []string{ - "app_key", - "app_key.kek_label", - "app_key.key", - "nwk_key", - "nwk_key.kek_label", - "nwk_key.key", - "root_key_id", -} - -var RootKeysFieldPathsTopLevel = []string{ - "app_key", - "nwk_key", - "root_key_id", -} - func (dst *RootKeys) SetFields(src *RootKeys, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -124,30 +97,6 @@ func (dst *RootKeys) SetFields(src *RootKeys, paths ...string) error { return nil } -var SessionKeysFieldPathsNested = []string{ - "app_s_key", - "app_s_key.kek_label", - "app_s_key.key", - "f_nwk_s_int_key", - "f_nwk_s_int_key.kek_label", - "f_nwk_s_int_key.key", - "nwk_s_enc_key", - "nwk_s_enc_key.kek_label", - "nwk_s_enc_key.key", - "s_nwk_s_int_key", - "s_nwk_s_int_key.kek_label", - "s_nwk_s_int_key.key", - "session_key_id", -} - -var SessionKeysFieldPathsTopLevel = []string{ - "app_s_key", - "f_nwk_s_int_key", - "nwk_s_enc_key", - "s_nwk_s_int_key", - "session_key_id", -} - func (dst *SessionKeys) SetFields(src *SessionKeys, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -158,8 +107,7 @@ func (dst *SessionKeys) SetFields(src *SessionKeys, paths ...string) error { if src != nil { dst.SessionKeyID = src.SessionKeyID } else { - var zero []byte - dst.SessionKeyID = zero + dst.SessionKeyID = nil } case "f_nwk_s_int_key": if len(subs) > 0 { diff --git a/pkg/ttnpb/keys.pb.validate.go b/pkg/ttnpb/keys.pb.validate.go new file mode 100644 index 0000000000..16b3223071 --- /dev/null +++ b/pkg/ttnpb/keys.pb.validate.go @@ -0,0 +1,350 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on KeyEnvelope with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *KeyEnvelope) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = KeyEnvelopeFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "key": + // no validation rules for Key + case "kek_label": + // no validation rules for KEKLabel + default: + return KeyEnvelopeValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// KeyEnvelopeValidationError is the validation error returned by +// KeyEnvelope.ValidateFields if the designated constraints aren't met. +type KeyEnvelopeValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e KeyEnvelopeValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e KeyEnvelopeValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e KeyEnvelopeValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e KeyEnvelopeValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e KeyEnvelopeValidationError) ErrorName() string { return "KeyEnvelopeValidationError" } + +// Error satisfies the builtin error interface +func (e KeyEnvelopeValidationError) 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 %sKeyEnvelope.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = KeyEnvelopeValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = KeyEnvelopeValidationError{} + +// ValidateFields checks the field values on RootKeys with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *RootKeys) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = RootKeysFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "root_key_id": + // no validation rules for RootKeyID + case "app_key": + + if v, ok := interface{}(m.GetAppKey()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return RootKeysValidationError{ + field: "app_key", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "nwk_key": + + if v, ok := interface{}(m.GetNwkKey()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return RootKeysValidationError{ + field: "nwk_key", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return RootKeysValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// RootKeysValidationError is the validation error returned by +// RootKeys.ValidateFields if the designated constraints aren't met. +type RootKeysValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e RootKeysValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e RootKeysValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e RootKeysValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e RootKeysValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e RootKeysValidationError) ErrorName() string { return "RootKeysValidationError" } + +// Error satisfies the builtin error interface +func (e RootKeysValidationError) 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 %sRootKeys.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = RootKeysValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = RootKeysValidationError{} + +// ValidateFields checks the field values on SessionKeys with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *SessionKeys) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = SessionKeysFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "session_key_id": + // no validation rules for SessionKeyID + case "f_nwk_s_int_key": + + if v, ok := interface{}(m.GetFNwkSIntKey()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SessionKeysValidationError{ + field: "f_nwk_s_int_key", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "s_nwk_s_int_key": + + if v, ok := interface{}(m.GetSNwkSIntKey()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SessionKeysValidationError{ + field: "s_nwk_s_int_key", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "nwk_s_enc_key": + + if v, ok := interface{}(m.GetNwkSEncKey()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SessionKeysValidationError{ + field: "nwk_s_enc_key", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "app_s_key": + + if v, ok := interface{}(m.GetAppSKey()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SessionKeysValidationError{ + field: "app_s_key", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return SessionKeysValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// SessionKeysValidationError is the validation error returned by +// SessionKeys.ValidateFields if the designated constraints aren't met. +type SessionKeysValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SessionKeysValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SessionKeysValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SessionKeysValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SessionKeysValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SessionKeysValidationError) ErrorName() string { return "SessionKeysValidationError" } + +// Error satisfies the builtin error interface +func (e SessionKeysValidationError) 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 %sSessionKeys.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SessionKeysValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SessionKeysValidationError{} diff --git a/pkg/ttnpb/keys.validator.pb.go b/pkg/ttnpb/keys.validator.pb.go deleted file mode 100644 index bd2ff95f02..0000000000 --- a/pkg/ttnpb/keys.validator.pb.go +++ /dev/null @@ -1,59 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/keys.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/mwitkow/go-proto-validators" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *KeyEnvelope) Validate() error { - return nil -} -func (this *RootKeys) Validate() error { - if this.AppKey != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.AppKey); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("AppKey", err) - } - } - if this.NwkKey != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.NwkKey); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("NwkKey", err) - } - } - return nil -} -func (this *SessionKeys) Validate() error { - if this.FNwkSIntKey != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.FNwkSIntKey); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FNwkSIntKey", err) - } - } - if this.SNwkSIntKey != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.SNwkSIntKey); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("SNwkSIntKey", err) - } - } - if this.NwkSEncKey != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.NwkSEncKey); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("NwkSEncKey", err) - } - } - if this.AppSKey != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.AppSKey); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("AppSKey", err) - } - } - return nil -} diff --git a/pkg/ttnpb/lorawan.pb.go b/pkg/ttnpb/lorawan.pb.go index acd295d43d..c4ecc3c037 100644 --- a/pkg/ttnpb/lorawan.pb.go +++ b/pkg/ttnpb/lorawan.pb.go @@ -9,7 +9,7 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import types "github.com/gogo/protobuf/types" -import _ "github.com/mwitkow/go-proto-validators" +import _ "github.com/lyft/protoc-gen-validate/validate" import go_thethings_network_lorawan_stack_pkg_types "go.thethings.network/lorawan-stack/pkg/types" import time "time" @@ -73,7 +73,7 @@ var MType_value = map[string]int32{ } func (MType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{0} + return fileDescriptor_lorawan_53bfbc964216b229, []int{0} } type Major int32 @@ -90,7 +90,7 @@ var Major_value = map[string]int32{ } func (Major) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{1} + return fileDescriptor_lorawan_53bfbc964216b229, []int{1} } type MACVersion int32 @@ -119,7 +119,7 @@ var MACVersion_value = map[string]int32{ } func (MACVersion) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{2} + return fileDescriptor_lorawan_53bfbc964216b229, []int{2} } type PHYVersion int32 @@ -154,7 +154,7 @@ var PHYVersion_value = map[string]int32{ } func (PHYVersion) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{3} + return fileDescriptor_lorawan_53bfbc964216b229, []int{3} } type DataRateIndex int32 @@ -216,7 +216,7 @@ var DataRateIndex_value = map[string]int32{ } func (DataRateIndex) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{4} + return fileDescriptor_lorawan_53bfbc964216b229, []int{4} } type RejoinType int32 @@ -239,7 +239,7 @@ var RejoinType_value = map[string]int32{ } func (RejoinType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{5} + return fileDescriptor_lorawan_53bfbc964216b229, []int{5} } type CFListType int32 @@ -259,7 +259,7 @@ var CFListType_value = map[string]int32{ } func (CFListType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{6} + return fileDescriptor_lorawan_53bfbc964216b229, []int{6} } type Class int32 @@ -282,7 +282,7 @@ var Class_value = map[string]int32{ } func (Class) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{7} + return fileDescriptor_lorawan_53bfbc964216b229, []int{7} } type TxSchedulePriority int32 @@ -317,7 +317,7 @@ var TxSchedulePriority_value = map[string]int32{ } func (TxSchedulePriority) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{8} + return fileDescriptor_lorawan_53bfbc964216b229, []int{8} } type MACCommandIdentifier int32 @@ -394,7 +394,7 @@ var MACCommandIdentifier_value = map[string]int32{ } func (MACCommandIdentifier) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{9} + return fileDescriptor_lorawan_53bfbc964216b229, []int{9} } type AggregatedDutyCycle int32 @@ -456,7 +456,7 @@ var AggregatedDutyCycle_value = map[string]int32{ } func (AggregatedDutyCycle) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{10} + return fileDescriptor_lorawan_53bfbc964216b229, []int{10} } type PingSlotPeriod int32 @@ -494,7 +494,7 @@ var PingSlotPeriod_value = map[string]int32{ } func (PingSlotPeriod) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{11} + return fileDescriptor_lorawan_53bfbc964216b229, []int{11} } type RejoinCountExponent int32 @@ -556,7 +556,7 @@ var RejoinCountExponent_value = map[string]int32{ } func (RejoinCountExponent) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{12} + return fileDescriptor_lorawan_53bfbc964216b229, []int{12} } type RejoinTimeExponent int32 @@ -618,7 +618,7 @@ var RejoinTimeExponent_value = map[string]int32{ } func (RejoinTimeExponent) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{13} + return fileDescriptor_lorawan_53bfbc964216b229, []int{13} } type RejoinPeriodExponent int32 @@ -656,7 +656,7 @@ var RejoinPeriodExponent_value = map[string]int32{ } func (RejoinPeriodExponent) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{14} + return fileDescriptor_lorawan_53bfbc964216b229, []int{14} } type DeviceEIRP int32 @@ -718,7 +718,7 @@ var DeviceEIRP_value = map[string]int32{ } func (DeviceEIRP) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{15} + return fileDescriptor_lorawan_53bfbc964216b229, []int{15} } type ADRAckLimitExponent int32 @@ -780,7 +780,7 @@ var ADRAckLimitExponent_value = map[string]int32{ } func (ADRAckLimitExponent) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{16} + return fileDescriptor_lorawan_53bfbc964216b229, []int{16} } type ADRAckDelayExponent int32 @@ -842,7 +842,7 @@ var ADRAckDelayExponent_value = map[string]int32{ } func (ADRAckDelayExponent) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{17} + return fileDescriptor_lorawan_53bfbc964216b229, []int{17} } type RxDelay int32 @@ -904,7 +904,7 @@ var RxDelay_value = map[string]int32{ } func (RxDelay) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18} } type Minor int32 @@ -966,7 +966,7 @@ var Minor_value = map[string]int32{ } func (Minor) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{19} + return fileDescriptor_lorawan_53bfbc964216b229, []int{19} } type Message struct { @@ -991,7 +991,7 @@ type Message struct { func (m *Message) Reset() { *m = Message{} } func (*Message) ProtoMessage() {} func (*Message) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{0} + return fileDescriptor_lorawan_53bfbc964216b229, []int{0} } func (m *Message) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1209,7 +1209,7 @@ type MHDR struct { func (m *MHDR) Reset() { *m = MHDR{} } func (*MHDR) ProtoMessage() {} func (*MHDR) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{1} + return fileDescriptor_lorawan_53bfbc964216b229, []int{1} } func (m *MHDR) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1264,7 +1264,7 @@ type MACPayload struct { func (m *MACPayload) Reset() { *m = MACPayload{} } func (*MACPayload) ProtoMessage() {} func (*MACPayload) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{2} + return fileDescriptor_lorawan_53bfbc964216b229, []int{2} } func (m *MACPayload) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1326,7 +1326,7 @@ type FHDR struct { func (m *FHDR) Reset() { *m = FHDR{} } func (*FHDR) ProtoMessage() {} func (*FHDR) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{3} + return fileDescriptor_lorawan_53bfbc964216b229, []int{3} } func (m *FHDR) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1382,7 +1382,7 @@ type FCtrl struct { func (m *FCtrl) Reset() { *m = FCtrl{} } func (*FCtrl) ProtoMessage() {} func (*FCtrl) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{4} + return fileDescriptor_lorawan_53bfbc964216b229, []int{4} } func (m *FCtrl) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1457,7 +1457,7 @@ type JoinRequestPayload struct { func (m *JoinRequestPayload) Reset() { *m = JoinRequestPayload{} } func (*JoinRequestPayload) ProtoMessage() {} func (*JoinRequestPayload) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{5} + return fileDescriptor_lorawan_53bfbc964216b229, []int{5} } func (m *JoinRequestPayload) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1499,7 +1499,7 @@ type RejoinRequestPayload struct { func (m *RejoinRequestPayload) Reset() { *m = RejoinRequestPayload{} } func (*RejoinRequestPayload) ProtoMessage() {} func (*RejoinRequestPayload) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{6} + return fileDescriptor_lorawan_53bfbc964216b229, []int{6} } func (m *RejoinRequestPayload) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1557,7 +1557,7 @@ type JoinAcceptPayload struct { func (m *JoinAcceptPayload) Reset() { *m = JoinAcceptPayload{} } func (*JoinAcceptPayload) ProtoMessage() {} func (*JoinAcceptPayload) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{7} + return fileDescriptor_lorawan_53bfbc964216b229, []int{7} } func (m *JoinAcceptPayload) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1619,7 +1619,7 @@ type DLSettings struct { func (m *DLSettings) Reset() { *m = DLSettings{} } func (*DLSettings) ProtoMessage() {} func (*DLSettings) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{8} + return fileDescriptor_lorawan_53bfbc964216b229, []int{8} } func (m *DLSettings) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1686,7 +1686,7 @@ type CFList struct { func (m *CFList) Reset() { *m = CFList{} } func (*CFList) ProtoMessage() {} func (*CFList) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{9} + return fileDescriptor_lorawan_53bfbc964216b229, []int{9} } func (m *CFList) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1747,7 +1747,7 @@ type LoRaDataRate struct { func (m *LoRaDataRate) Reset() { *m = LoRaDataRate{} } func (*LoRaDataRate) ProtoMessage() {} func (*LoRaDataRate) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{10} + return fileDescriptor_lorawan_53bfbc964216b229, []int{10} } func (m *LoRaDataRate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1800,7 +1800,7 @@ type FSKDataRate struct { func (m *FSKDataRate) Reset() { *m = FSKDataRate{} } func (*FSKDataRate) ProtoMessage() {} func (*FSKDataRate) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{11} + return fileDescriptor_lorawan_53bfbc964216b229, []int{11} } func (m *FSKDataRate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1848,7 +1848,7 @@ type DataRate struct { func (m *DataRate) Reset() { *m = DataRate{} } func (*DataRate) ProtoMessage() {} func (*DataRate) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{12} + return fileDescriptor_lorawan_53bfbc964216b229, []int{12} } func (m *DataRate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2026,7 +2026,7 @@ type TxSettings struct { func (m *TxSettings) Reset() { *m = TxSettings{} } func (*TxSettings) ProtoMessage() {} func (*TxSettings) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{13} + return fileDescriptor_lorawan_53bfbc964216b229, []int{13} } func (m *TxSettings) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2142,7 +2142,7 @@ type GatewayAntennaIdentifiers struct { func (m *GatewayAntennaIdentifiers) Reset() { *m = GatewayAntennaIdentifiers{} } func (*GatewayAntennaIdentifiers) ProtoMessage() {} func (*GatewayAntennaIdentifiers) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{14} + return fileDescriptor_lorawan_53bfbc964216b229, []int{14} } func (m *GatewayAntennaIdentifiers) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2188,7 +2188,7 @@ type UplinkToken struct { func (m *UplinkToken) Reset() { *m = UplinkToken{} } func (*UplinkToken) ProtoMessage() {} func (*UplinkToken) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{15} + return fileDescriptor_lorawan_53bfbc964216b229, []int{15} } func (m *UplinkToken) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2239,7 +2239,7 @@ type DownlinkPath struct { func (m *DownlinkPath) Reset() { *m = DownlinkPath{} } func (*DownlinkPath) ProtoMessage() {} func (*DownlinkPath) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{16} + return fileDescriptor_lorawan_53bfbc964216b229, []int{16} } func (m *DownlinkPath) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2416,7 +2416,7 @@ type TxRequest struct { func (m *TxRequest) Reset() { *m = TxRequest{} } func (*TxRequest) ProtoMessage() {} func (*TxRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{17} + return fileDescriptor_lorawan_53bfbc964216b229, []int{17} } func (m *TxRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2557,7 +2557,7 @@ type MACCommand struct { func (m *MACCommand) Reset() { *m = MACCommand{} } func (*MACCommand) ProtoMessage() {} func (*MACCommand) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18} } func (m *MACCommand) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3580,7 +3580,7 @@ type MACCommand_ResetInd struct { func (m *MACCommand_ResetInd) Reset() { *m = MACCommand_ResetInd{} } func (*MACCommand_ResetInd) ProtoMessage() {} func (*MACCommand_ResetInd) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 0} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 0} } func (m *MACCommand_ResetInd) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3625,7 +3625,7 @@ type MACCommand_ResetConf struct { func (m *MACCommand_ResetConf) Reset() { *m = MACCommand_ResetConf{} } func (*MACCommand_ResetConf) ProtoMessage() {} func (*MACCommand_ResetConf) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 1} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 1} } func (m *MACCommand_ResetConf) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3672,7 +3672,7 @@ type MACCommand_LinkCheckAns struct { func (m *MACCommand_LinkCheckAns) Reset() { *m = MACCommand_LinkCheckAns{} } func (*MACCommand_LinkCheckAns) ProtoMessage() {} func (*MACCommand_LinkCheckAns) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 2} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 2} } func (m *MACCommand_LinkCheckAns) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3728,7 +3728,7 @@ type MACCommand_LinkADRReq struct { func (m *MACCommand_LinkADRReq) Reset() { *m = MACCommand_LinkADRReq{} } func (*MACCommand_LinkADRReq) ProtoMessage() {} func (*MACCommand_LinkADRReq) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 3} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 3} } func (m *MACCommand_LinkADRReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3803,7 +3803,7 @@ type MACCommand_LinkADRAns struct { func (m *MACCommand_LinkADRAns) Reset() { *m = MACCommand_LinkADRAns{} } func (*MACCommand_LinkADRAns) ProtoMessage() {} func (*MACCommand_LinkADRAns) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 4} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 4} } func (m *MACCommand_LinkADRAns) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3862,7 +3862,7 @@ type MACCommand_DutyCycleReq struct { func (m *MACCommand_DutyCycleReq) Reset() { *m = MACCommand_DutyCycleReq{} } func (*MACCommand_DutyCycleReq) ProtoMessage() {} func (*MACCommand_DutyCycleReq) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 5} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 5} } func (m *MACCommand_DutyCycleReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3909,7 +3909,7 @@ type MACCommand_RxParamSetupReq struct { func (m *MACCommand_RxParamSetupReq) Reset() { *m = MACCommand_RxParamSetupReq{} } func (*MACCommand_RxParamSetupReq) ProtoMessage() {} func (*MACCommand_RxParamSetupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 6} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 6} } func (m *MACCommand_RxParamSetupReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3970,7 +3970,7 @@ type MACCommand_RxParamSetupAns struct { func (m *MACCommand_RxParamSetupAns) Reset() { *m = MACCommand_RxParamSetupAns{} } func (*MACCommand_RxParamSetupAns) ProtoMessage() {} func (*MACCommand_RxParamSetupAns) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 7} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 7} } func (m *MACCommand_RxParamSetupAns) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4035,7 +4035,7 @@ type MACCommand_DevStatusAns struct { func (m *MACCommand_DevStatusAns) Reset() { *m = MACCommand_DevStatusAns{} } func (*MACCommand_DevStatusAns) ProtoMessage() {} func (*MACCommand_DevStatusAns) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 8} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 8} } func (m *MACCommand_DevStatusAns) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4090,7 +4090,7 @@ type MACCommand_NewChannelReq struct { func (m *MACCommand_NewChannelReq) Reset() { *m = MACCommand_NewChannelReq{} } func (*MACCommand_NewChannelReq) ProtoMessage() {} func (*MACCommand_NewChannelReq) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 9} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 9} } func (m *MACCommand_NewChannelReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4157,7 +4157,7 @@ type MACCommand_NewChannelAns struct { func (m *MACCommand_NewChannelAns) Reset() { *m = MACCommand_NewChannelAns{} } func (*MACCommand_NewChannelAns) ProtoMessage() {} func (*MACCommand_NewChannelAns) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 10} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 10} } func (m *MACCommand_NewChannelAns) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4210,7 +4210,7 @@ type MACCommand_DLChannelReq struct { func (m *MACCommand_DLChannelReq) Reset() { *m = MACCommand_DLChannelReq{} } func (*MACCommand_DLChannelReq) ProtoMessage() {} func (*MACCommand_DLChannelReq) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 11} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 11} } func (m *MACCommand_DLChannelReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4263,7 +4263,7 @@ type MACCommand_DLChannelAns struct { func (m *MACCommand_DLChannelAns) Reset() { *m = MACCommand_DLChannelAns{} } func (*MACCommand_DLChannelAns) ProtoMessage() {} func (*MACCommand_DLChannelAns) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 12} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 12} } func (m *MACCommand_DLChannelAns) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4315,7 +4315,7 @@ type MACCommand_RxTimingSetupReq struct { func (m *MACCommand_RxTimingSetupReq) Reset() { *m = MACCommand_RxTimingSetupReq{} } func (*MACCommand_RxTimingSetupReq) ProtoMessage() {} func (*MACCommand_RxTimingSetupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 13} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 13} } func (m *MACCommand_RxTimingSetupReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4364,7 +4364,7 @@ type MACCommand_TxParamSetupReq struct { func (m *MACCommand_TxParamSetupReq) Reset() { *m = MACCommand_TxParamSetupReq{} } func (*MACCommand_TxParamSetupReq) ProtoMessage() {} func (*MACCommand_TxParamSetupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 14} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 14} } func (m *MACCommand_TxParamSetupReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4423,7 +4423,7 @@ type MACCommand_RekeyInd struct { func (m *MACCommand_RekeyInd) Reset() { *m = MACCommand_RekeyInd{} } func (*MACCommand_RekeyInd) ProtoMessage() {} func (*MACCommand_RekeyInd) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 15} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 15} } func (m *MACCommand_RekeyInd) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4468,7 +4468,7 @@ type MACCommand_RekeyConf struct { func (m *MACCommand_RekeyConf) Reset() { *m = MACCommand_RekeyConf{} } func (*MACCommand_RekeyConf) ProtoMessage() {} func (*MACCommand_RekeyConf) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 16} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 16} } func (m *MACCommand_RekeyConf) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4516,7 +4516,7 @@ type MACCommand_ADRParamSetupReq struct { func (m *MACCommand_ADRParamSetupReq) Reset() { *m = MACCommand_ADRParamSetupReq{} } func (*MACCommand_ADRParamSetupReq) ProtoMessage() {} func (*MACCommand_ADRParamSetupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 17} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 17} } func (m *MACCommand_ADRParamSetupReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4568,7 +4568,7 @@ type MACCommand_DeviceTimeAns struct { func (m *MACCommand_DeviceTimeAns) Reset() { *m = MACCommand_DeviceTimeAns{} } func (*MACCommand_DeviceTimeAns) ProtoMessage() {} func (*MACCommand_DeviceTimeAns) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 18} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 18} } func (m *MACCommand_DeviceTimeAns) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4605,7 +4605,7 @@ func (m *MACCommand_DeviceTimeAns) GetTime() time.Time { } type MACCommand_ForceRejoinReq struct { - RejoinType uint32 `protobuf:"varint,1,opt,name=rejoin_type,json=rejoinType,proto3" json:"rejoin_type,omitempty"` + RejoinType RejoinType `protobuf:"varint,1,opt,name=rejoin_type,json=rejoinType,proto3,enum=ttn.lorawan.v3.RejoinType" json:"rejoin_type,omitempty"` DataRateIndex DataRateIndex `protobuf:"varint,2,opt,name=data_rate_index,json=dataRateIndex,proto3,enum=ttn.lorawan.v3.DataRateIndex" json:"data_rate_index,omitempty"` MaxRetries uint32 `protobuf:"varint,3,opt,name=max_retries,json=maxRetries,proto3" json:"max_retries,omitempty"` // Exponent e that configures the rejoin period = 32 * 2^e + rand(0,32) seconds. @@ -4617,7 +4617,7 @@ type MACCommand_ForceRejoinReq struct { func (m *MACCommand_ForceRejoinReq) Reset() { *m = MACCommand_ForceRejoinReq{} } func (*MACCommand_ForceRejoinReq) ProtoMessage() {} func (*MACCommand_ForceRejoinReq) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 19} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 19} } func (m *MACCommand_ForceRejoinReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4646,11 +4646,11 @@ func (m *MACCommand_ForceRejoinReq) XXX_DiscardUnknown() { var xxx_messageInfo_MACCommand_ForceRejoinReq proto.InternalMessageInfo -func (m *MACCommand_ForceRejoinReq) GetRejoinType() uint32 { +func (m *MACCommand_ForceRejoinReq) GetRejoinType() RejoinType { if m != nil { return m.RejoinType } - return 0 + return RejoinType_CONTEXT } func (m *MACCommand_ForceRejoinReq) GetDataRateIndex() DataRateIndex { @@ -4686,7 +4686,7 @@ type MACCommand_RejoinParamSetupReq struct { func (m *MACCommand_RejoinParamSetupReq) Reset() { *m = MACCommand_RejoinParamSetupReq{} } func (*MACCommand_RejoinParamSetupReq) ProtoMessage() {} func (*MACCommand_RejoinParamSetupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 20} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 20} } func (m *MACCommand_RejoinParamSetupReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4738,7 +4738,7 @@ type MACCommand_RejoinParamSetupAns struct { func (m *MACCommand_RejoinParamSetupAns) Reset() { *m = MACCommand_RejoinParamSetupAns{} } func (*MACCommand_RejoinParamSetupAns) ProtoMessage() {} func (*MACCommand_RejoinParamSetupAns) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 21} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 21} } func (m *MACCommand_RejoinParamSetupAns) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4783,7 +4783,7 @@ type MACCommand_PingSlotInfoReq struct { func (m *MACCommand_PingSlotInfoReq) Reset() { *m = MACCommand_PingSlotInfoReq{} } func (*MACCommand_PingSlotInfoReq) ProtoMessage() {} func (*MACCommand_PingSlotInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 22} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 22} } func (m *MACCommand_PingSlotInfoReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4829,7 +4829,7 @@ type MACCommand_PingSlotChannelReq struct { func (m *MACCommand_PingSlotChannelReq) Reset() { *m = MACCommand_PingSlotChannelReq{} } func (*MACCommand_PingSlotChannelReq) ProtoMessage() {} func (*MACCommand_PingSlotChannelReq) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 23} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 23} } func (m *MACCommand_PingSlotChannelReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4882,7 +4882,7 @@ type MACCommand_PingSlotChannelAns struct { func (m *MACCommand_PingSlotChannelAns) Reset() { *m = MACCommand_PingSlotChannelAns{} } func (*MACCommand_PingSlotChannelAns) ProtoMessage() {} func (*MACCommand_PingSlotChannelAns) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 24} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 24} } func (m *MACCommand_PingSlotChannelAns) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4935,7 +4935,7 @@ type MACCommand_BeaconTimingAns struct { func (m *MACCommand_BeaconTimingAns) Reset() { *m = MACCommand_BeaconTimingAns{} } func (*MACCommand_BeaconTimingAns) ProtoMessage() {} func (*MACCommand_BeaconTimingAns) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 25} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 25} } func (m *MACCommand_BeaconTimingAns) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4987,7 +4987,7 @@ type MACCommand_BeaconFreqReq struct { func (m *MACCommand_BeaconFreqReq) Reset() { *m = MACCommand_BeaconFreqReq{} } func (*MACCommand_BeaconFreqReq) ProtoMessage() {} func (*MACCommand_BeaconFreqReq) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 26} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 26} } func (m *MACCommand_BeaconFreqReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -5032,7 +5032,7 @@ type MACCommand_BeaconFreqAns struct { func (m *MACCommand_BeaconFreqAns) Reset() { *m = MACCommand_BeaconFreqAns{} } func (*MACCommand_BeaconFreqAns) ProtoMessage() {} func (*MACCommand_BeaconFreqAns) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 27} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 27} } func (m *MACCommand_BeaconFreqAns) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -5077,7 +5077,7 @@ type MACCommand_DeviceModeInd struct { func (m *MACCommand_DeviceModeInd) Reset() { *m = MACCommand_DeviceModeInd{} } func (*MACCommand_DeviceModeInd) ProtoMessage() {} func (*MACCommand_DeviceModeInd) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 28} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 28} } func (m *MACCommand_DeviceModeInd) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -5122,7 +5122,7 @@ type MACCommand_DeviceModeConf struct { func (m *MACCommand_DeviceModeConf) Reset() { *m = MACCommand_DeviceModeConf{} } func (*MACCommand_DeviceModeConf) ProtoMessage() {} func (*MACCommand_DeviceModeConf) Descriptor() ([]byte, []int) { - return fileDescriptor_lorawan_58aef822c5219cad, []int{18, 29} + return fileDescriptor_lorawan_53bfbc964216b229, []int{18, 29} } func (m *MACCommand_DeviceModeConf) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -10281,279 +10281,6 @@ func NewPopulatedDownlinkPath_Fixed(r randyLorawan, easy bool) *DownlinkPath_Fix this.Fixed = NewPopulatedGatewayAntennaIdentifiers(r, easy) return this } -func NewPopulatedMACCommand(r randyLorawan, easy bool) *MACCommand { - this := &MACCommand{} - this.CID = MACCommandIdentifier([]int32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 32}[r.Intn(21)]) - oneofNumber_Payload := []int32{2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}[r.Intn(31)] - switch oneofNumber_Payload { - case 2: - this.Payload = NewPopulatedMACCommand_RawPayload(r, easy) - case 3: - this.Payload = NewPopulatedMACCommand_ResetInd_(r, easy) - case 4: - this.Payload = NewPopulatedMACCommand_ResetConf_(r, easy) - case 5: - this.Payload = NewPopulatedMACCommand_LinkCheckAns_(r, easy) - case 6: - this.Payload = NewPopulatedMACCommand_LinkADRReq_(r, easy) - case 7: - this.Payload = NewPopulatedMACCommand_LinkADRAns_(r, easy) - case 8: - this.Payload = NewPopulatedMACCommand_DutyCycleReq_(r, easy) - case 9: - this.Payload = NewPopulatedMACCommand_RxParamSetupReq_(r, easy) - case 10: - this.Payload = NewPopulatedMACCommand_RxParamSetupAns_(r, easy) - case 11: - this.Payload = NewPopulatedMACCommand_DevStatusAns_(r, easy) - case 12: - this.Payload = NewPopulatedMACCommand_NewChannelReq_(r, easy) - case 13: - this.Payload = NewPopulatedMACCommand_NewChannelAns_(r, easy) - case 14: - this.Payload = NewPopulatedMACCommand_DLChannelReq_(r, easy) - case 15: - this.Payload = NewPopulatedMACCommand_DLChannelAns_(r, easy) - case 16: - this.Payload = NewPopulatedMACCommand_RxTimingSetupReq_(r, easy) - case 17: - this.Payload = NewPopulatedMACCommand_TxParamSetupReq_(r, easy) - case 18: - this.Payload = NewPopulatedMACCommand_RekeyInd_(r, easy) - case 19: - this.Payload = NewPopulatedMACCommand_RekeyConf_(r, easy) - case 20: - this.Payload = NewPopulatedMACCommand_ADRParamSetupReq_(r, easy) - case 21: - this.Payload = NewPopulatedMACCommand_DeviceTimeAns_(r, easy) - case 22: - this.Payload = NewPopulatedMACCommand_ForceRejoinReq_(r, easy) - case 23: - this.Payload = NewPopulatedMACCommand_RejoinParamSetupReq_(r, easy) - case 24: - this.Payload = NewPopulatedMACCommand_RejoinParamSetupAns_(r, easy) - case 25: - this.Payload = NewPopulatedMACCommand_PingSlotInfoReq_(r, easy) - case 26: - this.Payload = NewPopulatedMACCommand_PingSlotChannelReq_(r, easy) - case 27: - this.Payload = NewPopulatedMACCommand_PingSlotChannelAns_(r, easy) - case 28: - this.Payload = NewPopulatedMACCommand_BeaconTimingAns_(r, easy) - case 29: - this.Payload = NewPopulatedMACCommand_BeaconFreqReq_(r, easy) - case 30: - this.Payload = NewPopulatedMACCommand_BeaconFreqAns_(r, easy) - case 31: - this.Payload = NewPopulatedMACCommand_DeviceModeInd_(r, easy) - case 32: - this.Payload = NewPopulatedMACCommand_DeviceModeConf_(r, easy) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedMACCommand_RawPayload(r randyLorawan, easy bool) *MACCommand_RawPayload { - this := &MACCommand_RawPayload{} - v4 := r.Intn(100) - this.RawPayload = make([]byte, v4) - for i := 0; i < v4; i++ { - this.RawPayload[i] = byte(r.Intn(256)) - } - return this -} -func NewPopulatedMACCommand_ResetInd_(r randyLorawan, easy bool) *MACCommand_ResetInd_ { - this := &MACCommand_ResetInd_{} - this.ResetInd = NewPopulatedMACCommand_ResetInd(r, easy) - return this -} -func NewPopulatedMACCommand_ResetConf_(r randyLorawan, easy bool) *MACCommand_ResetConf_ { - this := &MACCommand_ResetConf_{} - this.ResetConf = NewPopulatedMACCommand_ResetConf(r, easy) - return this -} -func NewPopulatedMACCommand_LinkCheckAns_(r randyLorawan, easy bool) *MACCommand_LinkCheckAns_ { - this := &MACCommand_LinkCheckAns_{} - this.LinkCheckAns = NewPopulatedMACCommand_LinkCheckAns(r, easy) - return this -} -func NewPopulatedMACCommand_LinkADRReq_(r randyLorawan, easy bool) *MACCommand_LinkADRReq_ { - this := &MACCommand_LinkADRReq_{} - this.LinkADRReq = NewPopulatedMACCommand_LinkADRReq(r, easy) - return this -} -func NewPopulatedMACCommand_LinkADRAns_(r randyLorawan, easy bool) *MACCommand_LinkADRAns_ { - this := &MACCommand_LinkADRAns_{} - this.LinkADRAns = NewPopulatedMACCommand_LinkADRAns(r, easy) - return this -} -func NewPopulatedMACCommand_DutyCycleReq_(r randyLorawan, easy bool) *MACCommand_DutyCycleReq_ { - this := &MACCommand_DutyCycleReq_{} - this.DutyCycleReq = NewPopulatedMACCommand_DutyCycleReq(r, easy) - return this -} -func NewPopulatedMACCommand_RxParamSetupReq_(r randyLorawan, easy bool) *MACCommand_RxParamSetupReq_ { - this := &MACCommand_RxParamSetupReq_{} - this.RxParamSetupReq = NewPopulatedMACCommand_RxParamSetupReq(r, easy) - return this -} -func NewPopulatedMACCommand_RxParamSetupAns_(r randyLorawan, easy bool) *MACCommand_RxParamSetupAns_ { - this := &MACCommand_RxParamSetupAns_{} - this.RxParamSetupAns = NewPopulatedMACCommand_RxParamSetupAns(r, easy) - return this -} -func NewPopulatedMACCommand_DevStatusAns_(r randyLorawan, easy bool) *MACCommand_DevStatusAns_ { - this := &MACCommand_DevStatusAns_{} - this.DevStatusAns = NewPopulatedMACCommand_DevStatusAns(r, easy) - return this -} -func NewPopulatedMACCommand_NewChannelReq_(r randyLorawan, easy bool) *MACCommand_NewChannelReq_ { - this := &MACCommand_NewChannelReq_{} - this.NewChannelReq = NewPopulatedMACCommand_NewChannelReq(r, easy) - return this -} -func NewPopulatedMACCommand_NewChannelAns_(r randyLorawan, easy bool) *MACCommand_NewChannelAns_ { - this := &MACCommand_NewChannelAns_{} - this.NewChannelAns = NewPopulatedMACCommand_NewChannelAns(r, easy) - return this -} -func NewPopulatedMACCommand_DLChannelReq_(r randyLorawan, easy bool) *MACCommand_DLChannelReq_ { - this := &MACCommand_DLChannelReq_{} - this.DLChannelReq = NewPopulatedMACCommand_DLChannelReq(r, easy) - return this -} -func NewPopulatedMACCommand_DLChannelAns_(r randyLorawan, easy bool) *MACCommand_DLChannelAns_ { - this := &MACCommand_DLChannelAns_{} - this.DLChannelAns = NewPopulatedMACCommand_DLChannelAns(r, easy) - return this -} -func NewPopulatedMACCommand_RxTimingSetupReq_(r randyLorawan, easy bool) *MACCommand_RxTimingSetupReq_ { - this := &MACCommand_RxTimingSetupReq_{} - this.RxTimingSetupReq = NewPopulatedMACCommand_RxTimingSetupReq(r, easy) - return this -} -func NewPopulatedMACCommand_TxParamSetupReq_(r randyLorawan, easy bool) *MACCommand_TxParamSetupReq_ { - this := &MACCommand_TxParamSetupReq_{} - this.TxParamSetupReq = NewPopulatedMACCommand_TxParamSetupReq(r, easy) - return this -} -func NewPopulatedMACCommand_RekeyInd_(r randyLorawan, easy bool) *MACCommand_RekeyInd_ { - this := &MACCommand_RekeyInd_{} - this.RekeyInd = NewPopulatedMACCommand_RekeyInd(r, easy) - return this -} -func NewPopulatedMACCommand_RekeyConf_(r randyLorawan, easy bool) *MACCommand_RekeyConf_ { - this := &MACCommand_RekeyConf_{} - this.RekeyConf = NewPopulatedMACCommand_RekeyConf(r, easy) - return this -} -func NewPopulatedMACCommand_ADRParamSetupReq_(r randyLorawan, easy bool) *MACCommand_ADRParamSetupReq_ { - this := &MACCommand_ADRParamSetupReq_{} - this.ADRParamSetupReq = NewPopulatedMACCommand_ADRParamSetupReq(r, easy) - return this -} -func NewPopulatedMACCommand_DeviceTimeAns_(r randyLorawan, easy bool) *MACCommand_DeviceTimeAns_ { - this := &MACCommand_DeviceTimeAns_{} - this.DeviceTimeAns = NewPopulatedMACCommand_DeviceTimeAns(r, easy) - return this -} -func NewPopulatedMACCommand_ForceRejoinReq_(r randyLorawan, easy bool) *MACCommand_ForceRejoinReq_ { - this := &MACCommand_ForceRejoinReq_{} - this.ForceRejoinReq = NewPopulatedMACCommand_ForceRejoinReq(r, easy) - return this -} -func NewPopulatedMACCommand_RejoinParamSetupReq_(r randyLorawan, easy bool) *MACCommand_RejoinParamSetupReq_ { - this := &MACCommand_RejoinParamSetupReq_{} - this.RejoinParamSetupReq = NewPopulatedMACCommand_RejoinParamSetupReq(r, easy) - return this -} -func NewPopulatedMACCommand_RejoinParamSetupAns_(r randyLorawan, easy bool) *MACCommand_RejoinParamSetupAns_ { - this := &MACCommand_RejoinParamSetupAns_{} - this.RejoinParamSetupAns = NewPopulatedMACCommand_RejoinParamSetupAns(r, easy) - return this -} -func NewPopulatedMACCommand_PingSlotInfoReq_(r randyLorawan, easy bool) *MACCommand_PingSlotInfoReq_ { - this := &MACCommand_PingSlotInfoReq_{} - this.PingSlotInfoReq = NewPopulatedMACCommand_PingSlotInfoReq(r, easy) - return this -} -func NewPopulatedMACCommand_PingSlotChannelReq_(r randyLorawan, easy bool) *MACCommand_PingSlotChannelReq_ { - this := &MACCommand_PingSlotChannelReq_{} - this.PingSlotChannelReq = NewPopulatedMACCommand_PingSlotChannelReq(r, easy) - return this -} -func NewPopulatedMACCommand_PingSlotChannelAns_(r randyLorawan, easy bool) *MACCommand_PingSlotChannelAns_ { - this := &MACCommand_PingSlotChannelAns_{} - this.PingSlotChannelAns = NewPopulatedMACCommand_PingSlotChannelAns(r, easy) - return this -} -func NewPopulatedMACCommand_BeaconTimingAns_(r randyLorawan, easy bool) *MACCommand_BeaconTimingAns_ { - this := &MACCommand_BeaconTimingAns_{} - this.BeaconTimingAns = NewPopulatedMACCommand_BeaconTimingAns(r, easy) - return this -} -func NewPopulatedMACCommand_BeaconFreqReq_(r randyLorawan, easy bool) *MACCommand_BeaconFreqReq_ { - this := &MACCommand_BeaconFreqReq_{} - this.BeaconFreqReq = NewPopulatedMACCommand_BeaconFreqReq(r, easy) - return this -} -func NewPopulatedMACCommand_BeaconFreqAns_(r randyLorawan, easy bool) *MACCommand_BeaconFreqAns_ { - this := &MACCommand_BeaconFreqAns_{} - this.BeaconFreqAns = NewPopulatedMACCommand_BeaconFreqAns(r, easy) - return this -} -func NewPopulatedMACCommand_DeviceModeInd_(r randyLorawan, easy bool) *MACCommand_DeviceModeInd_ { - this := &MACCommand_DeviceModeInd_{} - this.DeviceModeInd = NewPopulatedMACCommand_DeviceModeInd(r, easy) - return this -} -func NewPopulatedMACCommand_DeviceModeConf_(r randyLorawan, easy bool) *MACCommand_DeviceModeConf_ { - this := &MACCommand_DeviceModeConf_{} - this.DeviceModeConf = NewPopulatedMACCommand_DeviceModeConf(r, easy) - return this -} -func NewPopulatedMACCommand_ResetInd(r randyLorawan, easy bool) *MACCommand_ResetInd { - this := &MACCommand_ResetInd{} - this.MinorVersion = Minor([]int32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}[r.Intn(16)]) - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedMACCommand_ResetConf(r randyLorawan, easy bool) *MACCommand_ResetConf { - this := &MACCommand_ResetConf{} - this.MinorVersion = Minor([]int32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}[r.Intn(16)]) - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedMACCommand_LinkCheckAns(r randyLorawan, easy bool) *MACCommand_LinkCheckAns { - this := &MACCommand_LinkCheckAns{} - this.Margin = r.Uint32() - this.GatewayCount = r.Uint32() - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedMACCommand_LinkADRReq(r randyLorawan, easy bool) *MACCommand_LinkADRReq { - this := &MACCommand_LinkADRReq{} - this.DataRateIndex = DataRateIndex([]int32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}[r.Intn(16)]) - this.TxPowerIndex = r.Uint32() - v5 := r.Intn(10) - this.ChannelMask = make([]bool, v5) - for i := 0; i < v5; i++ { - this.ChannelMask[i] = bool(r.Intn(2) == 0) - } - this.ChannelMaskControl = r.Uint32() - this.NbTrans = r.Uint32() - if !easy && r.Intn(10) != 0 { - } - return this -} - func NewPopulatedMACCommand_LinkADRAns(r randyLorawan, easy bool) *MACCommand_LinkADRAns { this := &MACCommand_LinkADRAns{} this.ChannelMaskAck = bool(r.Intn(2) == 0) @@ -10572,16 +10299,6 @@ func NewPopulatedMACCommand_DutyCycleReq(r randyLorawan, easy bool) *MACCommand_ return this } -func NewPopulatedMACCommand_RxParamSetupReq(r randyLorawan, easy bool) *MACCommand_RxParamSetupReq { - this := &MACCommand_RxParamSetupReq{} - this.Rx2DataRateIndex = DataRateIndex([]int32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}[r.Intn(16)]) - this.Rx1DataRateOffset = r.Uint32() - this.Rx2Frequency = uint64(r.Uint32()) - if !easy && r.Intn(10) != 0 { - } - return this -} - func NewPopulatedMACCommand_RxParamSetupAns(r randyLorawan, easy bool) *MACCommand_RxParamSetupAns { this := &MACCommand_RxParamSetupAns{} this.Rx2DataRateIndexAck = bool(r.Intn(2) == 0) @@ -10592,29 +10309,6 @@ func NewPopulatedMACCommand_RxParamSetupAns(r randyLorawan, easy bool) *MACComma return this } -func NewPopulatedMACCommand_DevStatusAns(r randyLorawan, easy bool) *MACCommand_DevStatusAns { - this := &MACCommand_DevStatusAns{} - this.Battery = r.Uint32() - this.Margin = r.Int31() - if r.Intn(2) == 0 { - this.Margin *= -1 - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedMACCommand_NewChannelReq(r randyLorawan, easy bool) *MACCommand_NewChannelReq { - this := &MACCommand_NewChannelReq{} - this.ChannelIndex = r.Uint32() - this.Frequency = uint64(r.Uint32()) - this.MinDataRateIndex = DataRateIndex([]int32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}[r.Intn(16)]) - this.MaxDataRateIndex = DataRateIndex([]int32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}[r.Intn(16)]) - if !easy && r.Intn(10) != 0 { - } - return this -} - func NewPopulatedMACCommand_NewChannelAns(r randyLorawan, easy bool) *MACCommand_NewChannelAns { this := &MACCommand_NewChannelAns{} this.FrequencyAck = bool(r.Intn(2) == 0) @@ -10624,15 +10318,6 @@ func NewPopulatedMACCommand_NewChannelAns(r randyLorawan, easy bool) *MACCommand return this } -func NewPopulatedMACCommand_DLChannelReq(r randyLorawan, easy bool) *MACCommand_DLChannelReq { - this := &MACCommand_DLChannelReq{} - this.ChannelIndex = r.Uint32() - this.Frequency = uint64(r.Uint32()) - if !easy && r.Intn(10) != 0 { - } - return this -} - func NewPopulatedMACCommand_DLChannelAns(r randyLorawan, easy bool) *MACCommand_DLChannelAns { this := &MACCommand_DLChannelAns{} this.ChannelIndexAck = bool(r.Intn(2) == 0) @@ -10687,19 +10372,8 @@ func NewPopulatedMACCommand_ADRParamSetupReq(r randyLorawan, easy bool) *MACComm func NewPopulatedMACCommand_DeviceTimeAns(r randyLorawan, easy bool) *MACCommand_DeviceTimeAns { this := &MACCommand_DeviceTimeAns{} - v6 := github_com_gogo_protobuf_types.NewPopulatedStdTime(r, easy) - this.Time = *v6 - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedMACCommand_ForceRejoinReq(r randyLorawan, easy bool) *MACCommand_ForceRejoinReq { - this := &MACCommand_ForceRejoinReq{} - this.RejoinType = r.Uint32() - this.DataRateIndex = DataRateIndex([]int32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}[r.Intn(16)]) - this.MaxRetries = r.Uint32() - this.PeriodExponent = RejoinPeriodExponent([]int32{0, 1, 2, 3, 4, 5, 6, 7}[r.Intn(8)]) + v4 := github_com_gogo_protobuf_types.NewPopulatedStdTime(r, easy) + this.Time = *v4 if !easy && r.Intn(10) != 0 { } return this @@ -10730,15 +10404,6 @@ func NewPopulatedMACCommand_PingSlotInfoReq(r randyLorawan, easy bool) *MACComma return this } -func NewPopulatedMACCommand_PingSlotChannelReq(r randyLorawan, easy bool) *MACCommand_PingSlotChannelReq { - this := &MACCommand_PingSlotChannelReq{} - this.Frequency = uint64(r.Uint32()) - this.DataRateIndex = DataRateIndex([]int32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}[r.Intn(16)]) - if !easy && r.Intn(10) != 0 { - } - return this -} - func NewPopulatedMACCommand_PingSlotChannelAns(r randyLorawan, easy bool) *MACCommand_PingSlotChannelAns { this := &MACCommand_PingSlotChannelAns{} this.FrequencyAck = bool(r.Intn(2) == 0) @@ -10748,23 +10413,6 @@ func NewPopulatedMACCommand_PingSlotChannelAns(r randyLorawan, easy bool) *MACCo return this } -func NewPopulatedMACCommand_BeaconTimingAns(r randyLorawan, easy bool) *MACCommand_BeaconTimingAns { - this := &MACCommand_BeaconTimingAns{} - this.Delay = r.Uint32() - this.ChannelIndex = r.Uint32() - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedMACCommand_BeaconFreqReq(r randyLorawan, easy bool) *MACCommand_BeaconFreqReq { - this := &MACCommand_BeaconFreqReq{} - this.Frequency = uint64(r.Uint32()) - if !easy && r.Intn(10) != 0 { - } - return this -} - func NewPopulatedMACCommand_BeaconFreqAns(r randyLorawan, easy bool) *MACCommand_BeaconFreqAns { this := &MACCommand_BeaconFreqAns{} this.FrequencyAck = bool(r.Intn(2) == 0) @@ -10808,9 +10456,9 @@ func randUTF8RuneLorawan(r randyLorawan) rune { return rune(ru + 61) } func randStringLorawan(r randyLorawan) string { - v7 := r.Intn(100) - tmps := make([]rune, v7) - for i := 0; i < v7; i++ { + v5 := r.Intn(100) + tmps := make([]rune, v5) + for i := 0; i < v5; i++ { tmps[i] = randUTF8RuneLorawan(r) } return string(tmps) @@ -10832,11 +10480,11 @@ func randFieldLorawan(dAtA []byte, r randyLorawan, fieldNumber int, wire int) [] switch wire { case 0: dAtA = encodeVarintPopulateLorawan(dAtA, uint64(key)) - v8 := r.Int63() + v6 := r.Int63() if r.Intn(2) == 0 { - v8 *= -1 + v6 *= -1 } - dAtA = encodeVarintPopulateLorawan(dAtA, uint64(v8)) + dAtA = encodeVarintPopulateLorawan(dAtA, uint64(v6)) case 1: dAtA = encodeVarintPopulateLorawan(dAtA, uint64(key)) dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) @@ -18865,7 +18513,7 @@ func (m *MACCommand_ForceRejoinReq) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.RejoinType |= (uint32(b) & 0x7F) << shift + m.RejoinType |= (RejoinType(b) & 0x7F) << shift if b < 0x80 { break } @@ -19824,337 +19472,350 @@ var ( ) func init() { - proto.RegisterFile("lorawan-stack/api/lorawan.proto", fileDescriptor_lorawan_58aef822c5219cad) + proto.RegisterFile("lorawan-stack/api/lorawan.proto", fileDescriptor_lorawan_53bfbc964216b229) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/lorawan.proto", fileDescriptor_lorawan_58aef822c5219cad) -} - -var fileDescriptor_lorawan_58aef822c5219cad = []byte{ - // 5197 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x7b, 0x4f, 0x6c, 0x23, 0xc9, - 0x75, 0x37, 0x29, 0x92, 0x22, 0xf5, 0x48, 0x8a, 0x3d, 0x25, 0xcd, 0x8c, 0x86, 0xde, 0xa5, 0xd6, - 0x9a, 0xfd, 0xf0, 0x8d, 0xc7, 0x1e, 0x8d, 0x44, 0x69, 0xb4, 0x5a, 0xaf, 0xff, 0xf1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5f, 0xae, 0x06, 0xf3, 0x69, 0x8b, 0xd2, 0x73, 0x6f, 0x30, 0x84, 0x31, 0x51, - 0x21, 0x67, 0x99, 0x27, 0xe3, 0x03, 0x00, 0xea, 0x20, 0x43, 0x39, 0xde, 0x79, 0x09, 0xc7, 0x86, - 0x79, 0xc2, 0x4f, 0x03, 0x4c, 0x03, 0x59, 0x4b, 0x04, 0x82, 0x3c, 0x51, 0xca, 0xec, 0x2b, 0xf0, - 0x64, 0x62, 0x0a, 0x3c, 0x51, 0x4e, 0x1d, 0xa6, 0x8d, 0x9e, 0x24, 0xe6, 0xf4, 0xe5, 0x1b, 0xdf, - 0xf2, 0x85, 0x2a, 0x2b, 0xa3, 0xf3, 0xf9, 0x8c, 0x88, 0x50, 0x55, 0xf4, 0x04, 0xb1, 0xe5, 0x25, - 0x50, 0xea, 0xdc, 0xd5, 0x97, 0x40, 0x0f, 0x96, 0x97, 0xf0, 0xb4, 0xdd, 0x13, 0x76, 0xf1, 0x7d, - 0xcc, 0xff, 0x98, 0x46, 0xf1, 0xf0, 0xe8, 0x7b, 0x9d, 0x42, 0xd7, 0xf9, 0xea, 0x4b, 0x5d, 0x63, - 0x97, 0x4e, 0x12, 0xdc, 0x4e, 0x71, 0x02, 0x18, 0xfa, 0x9d, 0x1b, 0x76, 0xe9, 0x6b, 0x97, 0xfa, - 0xdd, 0x6e, 0xd8, 0xa5, 0xdd, 0x80, 0x4b, 0xd3, 0x84, 0x78, 0x64, 0x9e, 0xd1, 0x84, 0x48, 0xae, - 0x90, 0x10, 0x8f, 0xcc, 0xb3, 0x71, 0x42, 0x64, 0xcf, 0x2c, 0x21, 0x22, 0x0f, 0x9a, 0x10, 0x67, - 0xae, 0x90, 0x10, 0x8f, 0xcc, 0x33, 0x3f, 0x21, 0xf2, 0x01, 0x71, 0x60, 0x06, 0xf3, 0x4b, 0x70, - 0x9b, 0xb3, 0x97, 0xea, 0xb0, 0x54, 0x55, 0xa5, 0x4d, 0x95, 0x67, 0x47, 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0x2d, 0xf7, 0x41, 0x64, 0x3e, 0xfc, 0x7d, 0x3f, - 0x2b, 0x7d, 0xc3, 0xff, 0xe2, 0x3e, 0xfd, 0x60, 0x04, 0x38, 0xa6, 0xeb, 0x74, 0xcd, 0x21, 0xfb, - 0xe1, 0x89, 0x0a, 0x7d, 0xfd, 0x54, 0x65, 0x08, 0xd9, 0x86, 0xdc, 0xc0, 0x74, 0xba, 0xb6, 0xe1, - 0xab, 0x34, 0x7e, 0xf1, 0x4d, 0x25, 0xef, 0x82, 0x28, 0xf1, 0x58, 0x75, 0xd3, 0x03, 0x69, 0x9c, - 0xff, 0x24, 0x0a, 0x33, 0x17, 0x74, 0x65, 0xe4, 0xbb, 0x40, 0x50, 0x0e, 0x7a, 0x14, 0xbb, 0xd4, - 0x5f, 0x18, 0x03, 0x7a, 0x44, 0x1b, 0x2f, 0x84, 0x19, 0x54, 0x42, 0x48, 0x03, 0xae, 0x21, 0x4b, - 0xda, 0xe0, 0x06, 0xdc, 0x61, 0xe1, 0x05, 0x3f, 0x94, 0xe8, 0xf6, 0xcd, 0x31, 0xc3, 0x5c, 0x5f, - 0x3f, 0x15, 0x81, 0xfc, 0x66, 0x58, 0x72, 0x34, 0xfb, 0x32, 0x5c, 0x0f, 0x2d, 0x23, 0xe4, 0x3b, - 0x12, 0x60, 0x83, 0xd9, 0xac, 0x0e, 0xb9, 0x40, 0x3f, 0x47, 0xd6, 0x60, 0x92, 0x69, 0x8a, 0xef, - 0xb9, 0x10, 0x94, 0xd0, 0x9b, 0xc0, 0xf4, 0xab, 0x72, 0xea, 0xfc, 0x19, 0x90, 0x70, 0xf3, 0x26, - 0x67, 0xeb, 0x68, 0xb0, 0xec, 0x7d, 0x31, 0xae, 0x93, 0x3f, 0x0c, 0x2d, 0x7d, 0xe5, 0x32, 0xf5, - 0x6a, 0x87, 0xc5, 0xfc, 0x16, 0xe4, 0x02, 0xdd, 0x1d, 0x99, 0x15, 0x93, 0x7f, 0x96, 0xe7, 0xf8, - 0x70, 0x29, 0x9b, 0x08, 0x97, 0xb2, 0xfc, 0x3d, 0xc8, 0x4a, 0x3d, 0xdd, 0xcb, 0xb5, 0x95, 0x5f, - 0x15, 0xc9, 0xaf, 0xba, 0xc3, 0xfc, 0x37, 0xbc, 0xec, 0xe0, 0xf5, 0x5f, 0xaf, 0xf2, 0x11, 0x29, - 0xff, 0x4d, 0x98, 0x96, 0x3b, 0xaf, 0x57, 0x9a, 0x5e, 0x9e, 0x82, 0x24, 0xff, 0x18, 0x70, 0xf7, - 0xc7, 0x51, 0x48, 0xd0, 0xdf, 0x01, 0x12, 0x05, 0x32, 0xef, 0x35, 0xeb, 0x0d, 0x4d, 0xad, 0x7d, - 0x77, 0xaf, 0xd6, 0xda, 0x55, 0x22, 0x24, 0x07, 0x69, 0x8a, 0x94, 0x2a, 0x95, 0xda, 0xce, 0xae, - 0x12, 0x25, 0x04, 0xa6, 0xf7, 0x1a, 0x95, 0x66, 0x63, 0xa3, 0xae, 0x6e, 0xd7, 0xaa, 0xda, 0xde, - 0x8e, 0x32, 0x41, 0x66, 0x41, 0x11, 0xb1, 0x6a, 0xf3, 0x71, 0x43, 0x89, 0x21, 0x33, 0x89, 0x2e, - 0x8e, 0x73, 0x03, 0x54, 0x09, 0xc4, 0xd4, 0x9a, 0xb4, 0xe8, 0x24, 0x2e, 0xba, 0xa3, 0x36, 0x77, - 0xd4, 0x7a, 0x6d, 0xb7, 0xa4, 0x3e, 0x51, 0x92, 0x77, 0x6f, 0x42, 0x82, 0xfe, 0xf6, 0x90, 0x4c, - 0x03, 0x6c, 0x35, 0xd5, 0xd2, 0xe3, 0x52, 0x43, 0x53, 0x97, 0x95, 0xc8, 0xdd, 0x36, 0xfd, 0x4a, - 0xc2, 0x2b, 0x0d, 0xce, 0xdb, 0x2e, 0x55, 0xb4, 0xbd, 0xc6, 0xc3, 0x06, 0x32, 0x8f, 0x90, 0x0c, - 0xa4, 0x10, 0x78, 0xb4, 0xac, 0x2d, 0x29, 0x51, 0x9c, 0xec, 0x8d, 0xb4, 0x65, 0x65, 0x42, 0x1a, - 0x17, 0x95, 0x98, 0x40, 0xbd, 0xac, 0xc4, 0xf3, 0xa9, 0x8f, 0xff, 0xba, 0x10, 0xf9, 0xd9, 0xdf, - 0x14, 0x22, 0x77, 0x7f, 0x14, 0x05, 0xd8, 0xd9, 0x7c, 0x22, 0xac, 0xb2, 0xb3, 0xf9, 0x44, 0x5e, - 0x05, 0x01, 0x7f, 0x15, 0x6f, 0x44, 0x57, 0x99, 0x05, 0x65, 0x3c, 0x2e, 0x6a, 0x6a, 0xed, 0x91, - 0x56, 0x52, 0x62, 0x17, 0xa0, 0x65, 0xa6, 0x20, 0x8e, 0x2e, 0x73, 0xca, 0x44, 0x08, 0x2b, 0x2b, - 0x93, 0x82, 0x6c, 0x7f, 0x3f, 0x01, 0x59, 0xf9, 0x88, 0x99, 0x83, 0x74, 0xb5, 0xb4, 0x5b, 0xd2, - 0xd4, 0xd2, 0x6e, 0x4d, 0x5b, 0x62, 0x26, 0xf4, 0x81, 0x65, 0x25, 0x2a, 0x03, 0x45, 0x65, 0x42, - 0x06, 0x56, 0x94, 0x98, 0x0c, 0xac, 0x2a, 0x71, 0x19, 0x78, 0xa0, 0x24, 0x64, 0x60, 0x8d, 0xd9, - 0xcc, 0x07, 0xde, 0x52, 0x92, 0x32, 0xb0, 0xae, 0xa4, 0x64, 0xe0, 0x6d, 0x65, 0x0a, 0x1d, 0x44, - 0x10, 0x6c, 0x49, 0x81, 0x00, 0xb2, 0xac, 0xa4, 0x03, 0x48, 0x51, 0xc9, 0x04, 0x90, 0x15, 0x25, - 0x1b, 0x40, 0x56, 0x95, 0xe9, 0x00, 0xf2, 0x40, 0xc9, 0x09, 0x1a, 0x5b, 0x02, 0xf0, 0x7f, 0xf2, - 0x46, 0xd2, 0x90, 0xac, 0x34, 0x1b, 0xbb, 0xb5, 0xf7, 0xd1, 0xd9, 0xd3, 0x90, 0x6c, 0xd5, 0x5a, - 0xad, 0x7a, 0xb3, 0xa1, 0x44, 0x49, 0x0a, 0xe2, 0x0f, 0x6b, 0x4f, 0x5a, 0xca, 0x04, 0xce, 0xf0, - 0x7f, 0xec, 0x82, 0xdb, 0xd8, 0xa0, 0xae, 0xda, 0xa8, 0xd4, 0x6b, 0x2d, 0x25, 0x42, 0xae, 0x41, - 0xb6, 0xb2, 0x59, 0x6a, 0x34, 0x6a, 0x5b, 0xda, 0x76, 0xa9, 0xf5, 0xb0, 0xa5, 0x44, 0xef, 0xae, - 0x42, 0x82, 0x06, 0x1b, 0x65, 0xbf, 0x55, 0x6a, 0xb5, 0xb4, 0x12, 0x63, 0xcf, 0x06, 0x65, 0x25, - 0xea, 0x0f, 0x2a, 0xca, 0x44, 0x3e, 0x8e, 0xd2, 0xdd, 0x1d, 0x00, 0x09, 0x7f, 0x95, 0x24, 0x00, - 0x93, 0x5b, 0xcd, 0xc7, 0x2c, 0x1a, 0x93, 0x10, 0xdb, 0x6a, 0x3e, 0x56, 0xa2, 0xb8, 0xc1, 0x72, - 0x6d, 0xab, 0xf9, 0x58, 0x6b, 0x34, 0xd5, 0xed, 0xd2, 0x96, 0x32, 0x81, 0x64, 0xfc, 0x99, 0x46, - 0x5e, 0xa9, 0xdc, 0x7c, 0x54, 0xf3, 0xde, 0xc6, 0x71, 0x33, 0x9b, 0xf5, 0x77, 0x37, 0x95, 0x04, - 0xae, 0x8b, 0x4f, 0x34, 0xd0, 0xee, 0xfe, 0x67, 0x0c, 0x66, 0x2f, 0xfa, 0x78, 0x48, 0xb2, 0x30, - 0x55, 0xa9, 0x57, 0x35, 0x75, 0x63, 0x8f, 0xba, 0x90, 0x37, 0xac, 0xb5, 0x6a, 0x3c, 0x07, 0xe0, - 0x70, 0xab, 0xde, 0x78, 0xa8, 0x55, 0x36, 0x6b, 0x95, 0x87, 0xca, 0x04, 0x8d, 0x76, 0x0f, 0x2b, - 0x55, 0x55, 0x25, 0xe6, 0x51, 0x55, 0xf7, 0x76, 0x9f, 0x68, 0x95, 0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c, 0x16, 0x6d, 0x59, 0x89, 0x04, 0x90, 0x22, 0x73, 0x31, 0x01, 0x59, 0x65, 0x26, 0x16, - 0x90, 0x75, 0x25, 0x86, 0xae, 0x2f, 0xf2, 0x59, 0x53, 0xe2, 0x01, 0x68, 0xa5, 0xa8, 0x24, 0x02, - 0xd0, 0xda, 0xaa, 0x32, 0x89, 0x56, 0x11, 0x27, 0x16, 0xd7, 0x95, 0x64, 0x00, 0x2b, 0x3e, 0x58, - 0x53, 0x52, 0x01, 0xec, 0xc1, 0x72, 0x51, 0x99, 0xc2, 0xfd, 0x8a, 0x73, 0x97, 0x8a, 0xab, 0x0a, - 0x04, 0xc0, 0xe2, 0xd2, 0xea, 0xba, 0x92, 0x0e, 0x80, 0xab, 0x4b, 0x6f, 0xaf, 0x31, 0xa3, 0x8a, - 0xbb, 0x58, 0x7e, 0xbb, 0xc8, 0x8c, 0x2a, 0x6d, 0x64, 0x65, 0x1d, 0xd3, 0x88, 0x8c, 0xae, 0x14, - 0xdf, 0x5a, 0x5b, 0x57, 0x72, 0x5c, 0xb5, 0xff, 0x10, 0x85, 0x69, 0xf9, 0xbc, 0x85, 0xfb, 0xa4, - 0xb6, 0xac, 0x3d, 0xaa, 0xa9, 0x4f, 0xb4, 0x65, 0x9e, 0x1b, 0x04, 0xa8, 0xd8, 0x52, 0xa2, 0x01, - 0x68, 0xb5, 0xa5, 0x4c, 0x04, 0xa0, 0xf5, 0x16, 0x0b, 0x1e, 0x91, 0xd7, 0x5a, 0x8b, 0x57, 0x07, - 0x1f, 0x5b, 0x29, 0xb6, 0x78, 0x75, 0xf0, 0xb1, 0xb5, 0x55, 0x1e, 0x38, 0xe2, 0xdc, 0xe2, 0x7a, - 0x4b, 0x49, 0x72, 0xa9, 0xff, 0x24, 0xe6, 0x1d, 0x50, 0xe5, 0x73, 0xf0, 0x0c, 0xe4, 0xb8, 0xeb, - 0x56, 0x9a, 0x7b, 0x8d, 0x5d, 0x34, 0x65, 0x24, 0x04, 0xae,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 0x00, 0x13, 0x56, 0x2d, 0x43, 0x38, 0x2f, - 0x98, 0x21, 0x9c, 0xd7, 0xcc, 0x10, 0xce, 0xcb, 0xe6, 0x4d, 0xaa, 0x51, 0x69, 0x9b, 0xac, 0x72, - 0x86, 0x5e, 0xc8, 0xc5, 0xd3, 0x37, 0x85, 0x74, 0x5f, 0x26, 0xea, 0xb2, 0x5a, 0xdb, 0x2a, 0x3d, - 0x09, 0x9a, 0x82, 0x81, 0x01, 0x53, 0x30, 0x30, 0x60, 0x0a, 0x06, 0x06, 0x4c, 0xc1, 0x79, 0x06, - 0x4c, 0xc1, 0xd0, 0xa0, 0x29, 0x18, 0x1a, 0x34, 0x05, 0xe7, 0x10, 0x34, 0x05, 0x97, 0x2b, 0x68, - 0x0a, 0x06, 0x87, 0x4c, 0xc1, 0x99, 0x84, 0x4c, 0xc1, 0xb9, 0x84, 0x4c, 0xc1, 0x37, 0x18, 0x32, - 0x05, 0xdf, 0x63, 0xc8, 0x14, 0xde, 0x36, 0x43, 0xa6, 0xf0, 0x76, 0x2a, 0x9a, 0xe2, 0x47, 0x13, - 0x90, 0xe4, 0xb7, 0xe0, 0xd8, 0xba, 0xaa, 0xef, 0x73, 0x2a, 0x4c, 0x8f, 0xe2, 0x78, 0x99, 0xb5, - 0xb6, 0xe3, 0x71, 0x91, 0x35, 0xd0, 0xe3, 0x31, 0xe6, 0x15, 0x71, 0x8c, 0x39, 0x45, 0x1c, 0x63, - 0x16, 0x14, 0xc7, 0x98, 0x00, 0xc5, 0x31, 0x16, 0x18, 0x71, 0x8c, 0xd5, 0x45, 0x1c, 0x63, 0x69, - 0xc9, 0x41, 0xda, 0x97, 0x07, 0xeb, 0x8a, 0x04, 0x60, 0x51, 0x91, 0x00, 0xac, 0x28, 0x12, 0x80, - 0xe5, 0x44, 0x02, 0x50, 0x3f, 0x12, 0x20, 0xb7, 0x8a, 0x3f, 0x9e, 0x80, 0x04, 0xbd, 0xd1, 0xa6, - 0x37, 0x0b, 0xf5,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0xa2, 0x3f, 0x7f, 0x5e, 0x88, 0x7e, - 0xef, 0x6b, 0x57, 0xfd, 0x8f, 0x22, 0xd7, 0x1a, 0xec, 0xef, 0x4f, 0xd2, 0xeb, 0xf5, 0x95, 0xff, - 0x0d, 0x00, 0x00, 0xff, 0xff, 0xb2, 0x38, 0x26, 0xbd, 0xde, 0x3d, 0x00, 0x00, + golang_proto.RegisterFile("lorawan-stack/api/lorawan.proto", fileDescriptor_lorawan_53bfbc964216b229) +} + +var fileDescriptor_lorawan_53bfbc964216b229 = []byte{ + // 5395 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x5b, 0x4d, 0x6c, 0x23, 0xc9, + 0x75, 0x66, 0xf3, 0x47, 0xa4, 0x1e, 0x49, 0xb1, 0xa7, 0xa4, 0x9d, 0xd1, 0xca, 0x6b, 0x6a, 0x56, + 0xb3, 0x41, 0xc6, 0xb2, 0x47, 0x33, 0xa2, 0x34, 0x1a, 0xad, 0xbd, 0x36, 0x96, 0x7f, 0x5a, 0x71, + 0x47, 0x12, 0xe5, 0xa6, 0x34, 0x3f, 0x1b, 0x1b, 0x9d, 0x16, 0xbb, 0x29, 0x71, 0x45, 0x36, 0xe9, + 0x66, 0x6b, 0x46, 0x72, 0x72, 0x30, 0x0c, 0x04, 0x58, 0xc4, 0x09, 0x60, 0xf8, 0x12, 0xfb, 0x64, + 0xe7, 0x0f, 0x30, 0x10, 0x20, 0x31, 0x90, 0x83, 0x37, 0x39, 0xed, 0x21, 0x07, 0x03, 0xb9, 0x6c, + 0x6e, 0x46, 0x80, 0xcc, 0x7a, 0x34, 0x01, 0x62, 0x23, 0x17, 0x1f, 0x7d, 0xca, 0x06, 0xaf, 0xaa, + 0x9a, 0x5d, 0xd5, 0xcd, 0x19, 0x49, 0xde, 0x9f, 0xcb, 0xb2, 0xbe, 0xaa, 0x7a, 0xef, 0xd5, 0xfb, + 0xad, 0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, 0x3a, 0x9a, 0xfb, 0x53, 0x48, 0xef, 0xf6, 0x3b, 0x6d, + 0xfb, 0x70, 0xa7, 0x77, 0x68, 0xd9, 0xa4, 0x0e, 0x31, 0x5f, 0x88, 0x2f, 0x3c, 0x47, 0x88, 0xf0, + 0x21, 0x46, 0xca, 0x82, 0x94, 0x64, 0xad, 0x46, 0x03, 0x5a, 0x9d, 0xfb, 0x33, 0x05, 0x32, 0x95, + 0xde, 0x63, 0x1b, 0x05, 0xd8, 0x36, 0xdc, 0x03, 0x72, 0x0d, 0x32, 0x47, 0x54, 0x1c, 0xdd, 0x45, + 0x79, 0x58, 0x21, 0x5f, 0x8f, 0x68, 0xe9, 0x23, 0x41, 0xc8, 0x22, 0x24, 0x5a, 0xed, 0x63, 0xcb, + 0xe4, 0xa1, 0x7d, 0x7e, 0x31, 0xd7, 0x23, 0x1a, 0xdb, 0x59, 0xca, 0x42, 0xbc, 0x8f, 0xfc, 0x78, + 0x6c, 0x7f, 0x2f, 0x01, 0xe3, 0x3b, 0xc7, 0xfc, 0xca, 0x47, 0xbe, 0x08, 0x09, 0x7a, 0x91, 0x7e, + 0x5e, 0x93, 0x58, 0xc6, 0x49, 0x8d, 0xad, 0x21, 0x65, 0x98, 0x30, 0xf9, 0x09, 0x74, 0x24, 0x39, + 0xa0, 0x29, 0x77, 0x44, 0xb6, 0x12, 0xcf, 0xa9, 0x65, 0x4d, 0x61, 0x34, 0x20, 0x6f, 0xc2, 0x38, + 0xad, 0x53, 0xb4, 0x74, 0xc6, 0xce, 0x5f, 0x3a, 0x53, 0x58, 0xae, 0x68, 0xed, 0x7c, 0x00, 0x93, + 0x94, 0x42, 0x20, 0x97, 0xc4, 0x2f, 0x9a, 0x4b, 0x54, 0xa4, 0x28, 0xa5, 0x93, 0x6b, 0xac, 0x86, + 0xfa, 0x19, 0x23, 0x41, 0x33, 0x46, 0xc6, 0x39, 0x5e, 0x5c, 0x1b, 0x26, 0x0d, 0xca, 0xbe, 0x10, + 0x62, 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a, 0x49, 0x2f, 0xcb, 0x67, 0xba, 0x27, 0x23, 0x40, 0x2f, 0xce, 0x23, 0x59, 0x63, 0x3d, + 0x90, 0x66, 0xc9, 0x3b, 0x70, 0x09, 0xc9, 0xd3, 0x27, 0x8c, 0x80, 0xff, 0xcd, 0x3d, 0xc7, 0x4a, + 0xed, 0xae, 0x35, 0x92, 0x78, 0xae, 0x6b, 0x1c, 0x8b, 0x93, 0x33, 0xeb, 0xe1, 0x13, 0xa1, 0xa7, + 0x2d, 0xc2, 0x4b, 0x21, 0x96, 0x42, 0x92, 0x26, 0x01, 0x32, 0x98, 0x82, 0x77, 0x21, 0x17, 0xe8, + 0xde, 0x49, 0x09, 0xc6, 0x98, 0x1e, 0xb9, 0x2e, 0xf2, 0x41, 0x69, 0xbd, 0x0d, 0xcc, 0x12, 0x92, + 0xa4, 0x7c, 0xe7, 0xcc, 0x0f, 0x15, 0x20, 0xe1, 0xbe, 0x5d, 0x2e, 0x41, 0xca, 0x0b, 0xaf, 0x00, + 0x9f, 0xbe, 0x57, 0x72, 0x77, 0x38, 0x08, 0x49, 0x76, 0xee, 0x32, 0x7d, 0xb1, 0x1b, 0xfc, 0xcc, + 0x21, 0xe4, 0x02, 0x7d, 0x3f, 0x79, 0x55, 0xac, 0x6e, 0x81, 0x3f, 0x07, 0x64, 0x33, 0xe1, 0xba, + 0x1e, 0x7d, 0x71, 0x5d, 0xe7, 0xc7, 0x7a, 0x13, 0xb2, 0xd2, 0x63, 0xc0, 0x05, 0x74, 0xcd, 0x29, + 0x2c, 0x8b, 0x14, 0xce, 0xab, 0x93, 0x99, 0x75, 0x2f, 0xdd, 0x79, 0xbd, 0xfc, 0x9d, 0xf3, 0x7c, + 0xcc, 0x94, 0xcb, 0x37, 0x5d, 0x3f, 0x53, 0x83, 0x09, 0xb9, 0xa3, 0xff, 0xbd, 0x49, 0xf1, 0x3f, + 0xce, 0x1d, 0x87, 0x24, 0xff, 0xec, 0x34, 0xff, 0x63, 0x05, 0x12, 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 0xce, 0xf5, 0xab, + 0x26, 0xc9, 0x15, 0x98, 0xe4, 0x04, 0x76, 0x6a, 0x9b, 0xb5, 0xad, 0xb7, 0x38, 0x85, 0x94, 0x47, + 0x79, 0x47, 0xa6, 0x3c, 0x3e, 0xa4, 0xbc, 0x31, 0x24, 0x02, 0xfe, 0x71, 0xee, 0x56, 0x1f, 0xaa, + 0x69, 0x8f, 0x66, 0xb1, 0xa2, 0x49, 0x7b, 0x33, 0x9e, 0x04, 0x95, 0xea, 0xbd, 0x5a, 0xb9, 0x8a, + 0x0c, 0xab, 0x6a, 0x16, 0x23, 0x17, 0xc1, 0xb5, 0xba, 0x56, 0xae, 0xea, 0x2c, 0x75, 0xa9, 0x13, + 0x64, 0x06, 0x2e, 0x33, 0x92, 0x34, 0x95, 0x89, 0x64, 0x72, 0x9e, 0x68, 0xdb, 0x54, 0xdc, 0x8d, + 0xfa, 0x8e, 0x5e, 0xdb, 0x5a, 0xab, 0xab, 0x2a, 0x79, 0x19, 0x5e, 0x92, 0x71, 0x4f, 0xc2, 0x4b, + 0xe4, 0x25, 0xb8, 0x84, 0x53, 0xa5, 0x6a, 0xb1, 0x5c, 0xdf, 0xe2, 0x47, 0x55, 0x89, 0x27, 0x10, + 0x87, 0xd1, 0x0d, 0xd5, 0xc9, 0x80, 0x94, 0x9b, 0xf5, 0x4a, 0x55, 0xbd, 0xca, 0x3d, 0xea, 0x97, + 0x51, 0x98, 0x1c, 0xf1, 0x88, 0x45, 0xe3, 0x63, 0x68, 0x16, 0x7d, 0x51, 0x8d, 0x04, 0x90, 0x02, + 0x73, 0x31, 0x01, 0x59, 0x66, 0x26, 0x16, 0x90, 0x55, 0x35, 0x86, 0xae, 0x2f, 0xd2, 0x59, 0x51, + 0xe3, 0x01, 0x68, 0xa9, 0xa0, 0x26, 0x02, 0xd0, 0xca, 0xb2, 0x3a, 0x86, 0x56, 0x11, 0x37, 0x16, + 0x56, 0xd5, 0x64, 0x00, 0x2b, 0xdc, 0x5e, 0x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 0x68, 0x66, 0x14, 0xa0, 0xc5, 0x5b, 0xac, 0x2e, 0x4b, 0x18, + 0x0a, 0x1e, 0xc4, 0x96, 0x58, 0x72, 0x91, 0xb0, 0x65, 0x96, 0x5c, 0x24, 0x6c, 0x85, 0x25, 0x17, + 0x09, 0x5b, 0xe5, 0x99, 0x5b, 0xc0, 0x0a, 0xb7, 0x78, 0xe6, 0x16, 0xb1, 0x45, 0x9e, 0xb9, 0x45, + 0x6c, 0x99, 0xb9, 0x86, 0x84, 0xad, 0x30, 0xd7, 0x90, 0xb0, 0x3b, 0xcc, 0x35, 0x24, 0xec, 0x75, + 0xe6, 0x1a, 0x22, 0xb6, 0x74, 0x8b, 0xb9, 0x86, 0x84, 0x2d, 0x31, 0xd7, 0x90, 0xb0, 0x95, 0xa1, + 0x6b, 0xbc, 0x17, 0x83, 0x51, 0xef, 0x65, 0x68, 0x06, 0x2c, 0xfd, 0xc5, 0xf2, 0x5d, 0x7d, 0xa3, + 0xb6, 0x59, 0xdb, 0xa1, 0xf5, 0x30, 0x04, 0xf2, 0xdc, 0x27, 0x83, 0xcb, 0xcc, 0x33, 0x64, 0x90, + 0xa7, 0xbe, 0x00, 0x4d, 0x9e, 0xfa, 0x64, 0x94, 0x96, 0xc7, 0x10, 0xba, 0xc2, 0x33, 0x5f, 0x80, + 0x42, 0x81, 0x67, 0xbe, 0x80, 0x5c, 0xb7, 0x79, 0xe6, 0x93, 0x61, 0x56, 0x2a, 0x2f, 0x03, 0x09, + 0x10, 0x61, 0xd5, 0x32, 0x84, 0xf3, 0x82, 0x19, 0xc2, 0x79, 0xcd, 0x0c, 0xe1, 0xbc, 0x6c, 0x5e, + 0xa1, 0x1a, 0x95, 0x8e, 0xc9, 0x2a, 0x67, 0x68, 0x42, 0x2e, 0x9e, 0xbe, 0x29, 0xa4, 0xe7, 0x41, + 0x51, 0x97, 0x95, 0xea, 0x46, 0xf1, 0x61, 0xd0, 0x14, 0x0c, 0x0c, 0x98, 0x82, 0x81, 0x01, 0x53, + 0x30, 0x30, 0x60, 0x0a, 0x4e, 0x33, 0x60, 0x0a, 0x86, 0x06, 0x4d, 0xc1, 0xd0, 0xa0, 0x29, 0x38, + 0x85, 0xa0, 0x29, 0xb8, 0x5c, 0x41, 0x53, 0x30, 0x38, 0x64, 0x0a, 0x4e, 0x24, 0x64, 0x0a, 0x4e, + 0x25, 0x64, 0x0a, 0x7e, 0xc0, 0x90, 0x29, 0xf8, 0x19, 0x43, 0xa6, 0xf0, 0x8e, 0x19, 0x32, 0x85, + 0x77, 0x52, 0xd1, 0x14, 0x3f, 0x8a, 0x42, 0x92, 0x7f, 0x36, 0xc0, 0xd6, 0x55, 0x7b, 0xc0, 0x57, + 0x61, 0x7a, 0x14, 0xc7, 0x8b, 0xac, 0xb5, 0x1d, 0x8e, 0x0b, 0xac, 0x81, 0x1e, 0x8e, 0x31, 0xaf, + 0x88, 0x63, 0xcc, 0x29, 0xe2, 0x18, 0xb3, 0xa0, 0x38, 0xc6, 0x04, 0x28, 0x8e, 0xb1, 0xc0, 0x88, + 0x63, 0xac, 0x2e, 0xe2, 0x18, 0x4b, 0x4b, 0x0e, 0xd2, 0xbe, 0x3c, 0x58, 0x57, 0x24, 0x00, 0x8b, + 0x8a, 0x04, 0x60, 0x45, 0x91, 0x00, 0x2c, 0x27, 0x12, 0x80, 0xfa, 0x91, 0x00, 0xb9, 0x55, 0xfc, + 0x71, 0x14, 0x12, 0xf4, 0x81, 0x9f, 0xbe, 0x2c, 0xd4, 0xb6, 0xea, 0xda, 0xb0, 0x23, 0x4a, 0x43, + 0x92, 0x01, 0xbc, 0xa1, 0xf6, 0x67, 0x79, 0x43, 0xed, 0x03, 0xbc, 0xa1, 0xf6, 0x01, 0xde, 0x50, + 0xfb, 0x00, 0x6f, 0xa8, 0x7d, 0x80, 0x37, 0xd4, 0x3e, 0xc0, 0x1b, 0x6a, 0x1f, 0xe0, 0x0d, 0xb5, + 0x0f, 0xf0, 0x86, 0xda, 0x07, 0xbc, 0x86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ttnpb/lorawan.pb.paths.fm.go new file mode 100644 index 0000000000..080a4f9c82 --- /dev/null +++ b/pkg/ttnpb/lorawan.pb.paths.fm.go @@ -0,0 +1,679 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var MessageFieldPathsNested = []string{ + "Payload", + "Payload.join_accept_payload", + "Payload.join_accept_payload.cf_list", + "Payload.join_accept_payload.cf_list.ch_masks", + "Payload.join_accept_payload.cf_list.freq", + "Payload.join_accept_payload.cf_list.type", + "Payload.join_accept_payload.dev_addr", + "Payload.join_accept_payload.dl_settings", + "Payload.join_accept_payload.dl_settings.opt_neg", + "Payload.join_accept_payload.dl_settings.rx1_dr_offset", + "Payload.join_accept_payload.dl_settings.rx2_dr", + "Payload.join_accept_payload.encrypted", + "Payload.join_accept_payload.join_nonce", + "Payload.join_accept_payload.net_id", + "Payload.join_accept_payload.rx_delay", + "Payload.join_request_payload", + "Payload.join_request_payload.dev_eui", + "Payload.join_request_payload.dev_nonce", + "Payload.join_request_payload.join_eui", + "Payload.mac_payload", + "Payload.mac_payload.decoded_payload", + "Payload.mac_payload.f_hdr", + "Payload.mac_payload.f_hdr.dev_addr", + "Payload.mac_payload.f_hdr.f_cnt", + "Payload.mac_payload.f_hdr.f_ctrl", + "Payload.mac_payload.f_hdr.f_ctrl.ack", + "Payload.mac_payload.f_hdr.f_ctrl.adr", + "Payload.mac_payload.f_hdr.f_ctrl.adr_ack_req", + "Payload.mac_payload.f_hdr.f_ctrl.class_b", + "Payload.mac_payload.f_hdr.f_ctrl.f_pending", + "Payload.mac_payload.f_hdr.f_opts", + "Payload.mac_payload.f_port", + "Payload.mac_payload.frm_payload", + "Payload.rejoin_request_payload", + "Payload.rejoin_request_payload.dev_eui", + "Payload.rejoin_request_payload.join_eui", + "Payload.rejoin_request_payload.net_id", + "Payload.rejoin_request_payload.rejoin_cnt", + "Payload.rejoin_request_payload.rejoin_type", + "m_hdr", + "m_hdr.m_type", + "m_hdr.major", + "mic", +} + +var MessageFieldPathsTopLevel = []string{ + "Payload", + "m_hdr", + "mic", +} +var MHDRFieldPathsNested = []string{ + "m_type", + "major", +} + +var MHDRFieldPathsTopLevel = []string{ + "m_type", + "major", +} +var MACPayloadFieldPathsNested = []string{ + "decoded_payload", + "f_hdr", + "f_hdr.dev_addr", + "f_hdr.f_cnt", + "f_hdr.f_ctrl", + "f_hdr.f_ctrl.ack", + "f_hdr.f_ctrl.adr", + "f_hdr.f_ctrl.adr_ack_req", + "f_hdr.f_ctrl.class_b", + "f_hdr.f_ctrl.f_pending", + "f_hdr.f_opts", + "f_port", + "frm_payload", +} + +var MACPayloadFieldPathsTopLevel = []string{ + "decoded_payload", + "f_hdr", + "f_port", + "frm_payload", +} +var FHDRFieldPathsNested = []string{ + "dev_addr", + "f_cnt", + "f_ctrl", + "f_ctrl.ack", + "f_ctrl.adr", + "f_ctrl.adr_ack_req", + "f_ctrl.class_b", + "f_ctrl.f_pending", + "f_opts", +} + +var FHDRFieldPathsTopLevel = []string{ + "dev_addr", + "f_cnt", + "f_ctrl", + "f_opts", +} +var FCtrlFieldPathsNested = []string{ + "ack", + "adr", + "adr_ack_req", + "class_b", + "f_pending", +} + +var FCtrlFieldPathsTopLevel = []string{ + "ack", + "adr", + "adr_ack_req", + "class_b", + "f_pending", +} +var JoinRequestPayloadFieldPathsNested = []string{ + "dev_eui", + "dev_nonce", + "join_eui", +} + +var JoinRequestPayloadFieldPathsTopLevel = []string{ + "dev_eui", + "dev_nonce", + "join_eui", +} +var RejoinRequestPayloadFieldPathsNested = []string{ + "dev_eui", + "join_eui", + "net_id", + "rejoin_cnt", + "rejoin_type", +} + +var RejoinRequestPayloadFieldPathsTopLevel = []string{ + "dev_eui", + "join_eui", + "net_id", + "rejoin_cnt", + "rejoin_type", +} +var JoinAcceptPayloadFieldPathsNested = []string{ + "cf_list", + "cf_list.ch_masks", + "cf_list.freq", + "cf_list.type", + "dev_addr", + "dl_settings", + "dl_settings.opt_neg", + "dl_settings.rx1_dr_offset", + "dl_settings.rx2_dr", + "encrypted", + "join_nonce", + "net_id", + "rx_delay", +} + +var JoinAcceptPayloadFieldPathsTopLevel = []string{ + "cf_list", + "dev_addr", + "dl_settings", + "encrypted", + "join_nonce", + "net_id", + "rx_delay", +} +var DLSettingsFieldPathsNested = []string{ + "opt_neg", + "rx1_dr_offset", + "rx2_dr", +} + +var DLSettingsFieldPathsTopLevel = []string{ + "opt_neg", + "rx1_dr_offset", + "rx2_dr", +} +var CFListFieldPathsNested = []string{ + "ch_masks", + "freq", + "type", +} + +var CFListFieldPathsTopLevel = []string{ + "ch_masks", + "freq", + "type", +} +var LoRaDataRateFieldPathsNested = []string{ + "bandwidth", + "spreading_factor", +} + +var LoRaDataRateFieldPathsTopLevel = []string{ + "bandwidth", + "spreading_factor", +} +var FSKDataRateFieldPathsNested = []string{ + "bit_rate", +} + +var FSKDataRateFieldPathsTopLevel = []string{ + "bit_rate", +} +var DataRateFieldPathsNested = []string{ + "modulation", + "modulation.fsk", + "modulation.fsk.bit_rate", + "modulation.lora", + "modulation.lora.bandwidth", + "modulation.lora.spreading_factor", +} + +var DataRateFieldPathsTopLevel = []string{ + "modulation", +} +var TxSettingsFieldPathsNested = []string{ + "coding_rate", + "data_rate", + "data_rate.modulation", + "data_rate.modulation.fsk", + "data_rate.modulation.fsk.bit_rate", + "data_rate.modulation.lora", + "data_rate.modulation.lora.bandwidth", + "data_rate.modulation.lora.spreading_factor", + "data_rate_index", + "device_channel_index", + "enable_crc", + "frequency", + "gateway_channel_index", + "invert_polarization", + "time", + "timestamp", + "tx_power", +} + +var TxSettingsFieldPathsTopLevel = []string{ + "coding_rate", + "data_rate", + "data_rate_index", + "device_channel_index", + "enable_crc", + "frequency", + "gateway_channel_index", + "invert_polarization", + "time", + "timestamp", + "tx_power", +} +var GatewayAntennaIdentifiersFieldPathsNested = []string{ + "antenna_index", + "gateway_ids", + "gateway_ids.eui", + "gateway_ids.gateway_id", +} + +var GatewayAntennaIdentifiersFieldPathsTopLevel = []string{ + "antenna_index", + "gateway_ids", +} +var UplinkTokenFieldPathsNested = []string{ + "ids", + "ids.antenna_index", + "ids.gateway_ids", + "ids.gateway_ids.eui", + "ids.gateway_ids.gateway_id", + "timestamp", +} + +var UplinkTokenFieldPathsTopLevel = []string{ + "ids", + "timestamp", +} +var DownlinkPathFieldPathsNested = []string{ + "path", + "path.fixed", + "path.fixed.antenna_index", + "path.fixed.gateway_ids", + "path.fixed.gateway_ids.eui", + "path.fixed.gateway_ids.gateway_id", + "path.uplink_token", +} + +var DownlinkPathFieldPathsTopLevel = []string{ + "path", +} +var TxRequestFieldPathsNested = []string{ + "absolute_time", + "advanced", + "class", + "downlink_paths", + "priority", + "rx1_data_rate_index", + "rx1_delay", + "rx1_frequency", + "rx2_data_rate_index", + "rx2_frequency", +} + +var TxRequestFieldPathsTopLevel = []string{ + "absolute_time", + "advanced", + "class", + "downlink_paths", + "priority", + "rx1_data_rate_index", + "rx1_delay", + "rx1_frequency", + "rx2_data_rate_index", + "rx2_frequency", +} +var MACCommandFieldPathsNested = []string{ + "cid", + "payload", + "payload.adr_param_setup_req", + "payload.adr_param_setup_req.adr_ack_delay_exponent", + "payload.adr_param_setup_req.adr_ack_limit_exponent", + "payload.beacon_freq_ans", + "payload.beacon_freq_ans.frequency_ack", + "payload.beacon_freq_req", + "payload.beacon_freq_req.frequency", + "payload.beacon_timing_ans", + "payload.beacon_timing_ans.channel_index", + "payload.beacon_timing_ans.delay", + "payload.dev_status_ans", + "payload.dev_status_ans.battery", + "payload.dev_status_ans.margin", + "payload.device_mode_conf", + "payload.device_mode_conf.class", + "payload.device_mode_ind", + "payload.device_mode_ind.class", + "payload.device_time_ans", + "payload.device_time_ans.time", + "payload.dl_channel_ans", + "payload.dl_channel_ans.channel_index_ack", + "payload.dl_channel_ans.frequency_ack", + "payload.dl_channel_req", + "payload.dl_channel_req.channel_index", + "payload.dl_channel_req.frequency", + "payload.duty_cycle_req", + "payload.duty_cycle_req.max_duty_cycle", + "payload.force_rejoin_req", + "payload.force_rejoin_req.data_rate_index", + "payload.force_rejoin_req.max_retries", + "payload.force_rejoin_req.period_exponent", + "payload.force_rejoin_req.rejoin_type", + "payload.link_adr_ans", + "payload.link_adr_ans.channel_mask_ack", + "payload.link_adr_ans.data_rate_index_ack", + "payload.link_adr_ans.tx_power_index_ack", + "payload.link_adr_req", + "payload.link_adr_req.channel_mask", + "payload.link_adr_req.channel_mask_control", + "payload.link_adr_req.data_rate_index", + "payload.link_adr_req.nb_trans", + "payload.link_adr_req.tx_power_index", + "payload.link_check_ans", + "payload.link_check_ans.gateway_count", + "payload.link_check_ans.margin", + "payload.new_channel_ans", + "payload.new_channel_ans.data_rate_ack", + "payload.new_channel_ans.frequency_ack", + "payload.new_channel_req", + "payload.new_channel_req.channel_index", + "payload.new_channel_req.frequency", + "payload.new_channel_req.max_data_rate_index", + "payload.new_channel_req.min_data_rate_index", + "payload.ping_slot_channel_ans", + "payload.ping_slot_channel_ans.data_rate_index_ack", + "payload.ping_slot_channel_ans.frequency_ack", + "payload.ping_slot_channel_req", + "payload.ping_slot_channel_req.data_rate_index", + "payload.ping_slot_channel_req.frequency", + "payload.ping_slot_info_req", + "payload.ping_slot_info_req.period", + "payload.raw_payload", + "payload.rejoin_param_setup_ans", + "payload.rejoin_param_setup_ans.max_time_exponent_ack", + "payload.rejoin_param_setup_req", + "payload.rejoin_param_setup_req.max_count_exponent", + "payload.rejoin_param_setup_req.max_time_exponent", + "payload.rekey_conf", + "payload.rekey_conf.minor_version", + "payload.rekey_ind", + "payload.rekey_ind.minor_version", + "payload.reset_conf", + "payload.reset_conf.minor_version", + "payload.reset_ind", + "payload.reset_ind.minor_version", + "payload.rx_param_setup_ans", + "payload.rx_param_setup_ans.rx1_data_rate_offset_ack", + "payload.rx_param_setup_ans.rx2_data_rate_index_ack", + "payload.rx_param_setup_ans.rx2_frequency_ack", + "payload.rx_param_setup_req", + "payload.rx_param_setup_req.rx1_data_rate_offset", + "payload.rx_param_setup_req.rx2_data_rate_index", + "payload.rx_param_setup_req.rx2_frequency", + "payload.rx_timing_setup_req", + "payload.rx_timing_setup_req.delay", + "payload.tx_param_setup_req", + "payload.tx_param_setup_req.downlink_dwell_time", + "payload.tx_param_setup_req.max_eirp_index", + "payload.tx_param_setup_req.uplink_dwell_time", +} + +var MACCommandFieldPathsTopLevel = []string{ + "cid", + "payload", +} +var MACCommand_ResetIndFieldPathsNested = []string{ + "minor_version", +} + +var MACCommand_ResetIndFieldPathsTopLevel = []string{ + "minor_version", +} +var MACCommand_ResetConfFieldPathsNested = []string{ + "minor_version", +} + +var MACCommand_ResetConfFieldPathsTopLevel = []string{ + "minor_version", +} +var MACCommand_LinkCheckAnsFieldPathsNested = []string{ + "gateway_count", + "margin", +} + +var MACCommand_LinkCheckAnsFieldPathsTopLevel = []string{ + "gateway_count", + "margin", +} +var MACCommand_LinkADRReqFieldPathsNested = []string{ + "channel_mask", + "channel_mask_control", + "data_rate_index", + "nb_trans", + "tx_power_index", +} + +var MACCommand_LinkADRReqFieldPathsTopLevel = []string{ + "channel_mask", + "channel_mask_control", + "data_rate_index", + "nb_trans", + "tx_power_index", +} +var MACCommand_LinkADRAnsFieldPathsNested = []string{ + "channel_mask_ack", + "data_rate_index_ack", + "tx_power_index_ack", +} + +var MACCommand_LinkADRAnsFieldPathsTopLevel = []string{ + "channel_mask_ack", + "data_rate_index_ack", + "tx_power_index_ack", +} +var MACCommand_DutyCycleReqFieldPathsNested = []string{ + "max_duty_cycle", +} + +var MACCommand_DutyCycleReqFieldPathsTopLevel = []string{ + "max_duty_cycle", +} +var MACCommand_RxParamSetupReqFieldPathsNested = []string{ + "rx1_data_rate_offset", + "rx2_data_rate_index", + "rx2_frequency", +} + +var MACCommand_RxParamSetupReqFieldPathsTopLevel = []string{ + "rx1_data_rate_offset", + "rx2_data_rate_index", + "rx2_frequency", +} +var MACCommand_RxParamSetupAnsFieldPathsNested = []string{ + "rx1_data_rate_offset_ack", + "rx2_data_rate_index_ack", + "rx2_frequency_ack", +} + +var MACCommand_RxParamSetupAnsFieldPathsTopLevel = []string{ + "rx1_data_rate_offset_ack", + "rx2_data_rate_index_ack", + "rx2_frequency_ack", +} +var MACCommand_DevStatusAnsFieldPathsNested = []string{ + "battery", + "margin", +} + +var MACCommand_DevStatusAnsFieldPathsTopLevel = []string{ + "battery", + "margin", +} +var MACCommand_NewChannelReqFieldPathsNested = []string{ + "channel_index", + "frequency", + "max_data_rate_index", + "min_data_rate_index", +} + +var MACCommand_NewChannelReqFieldPathsTopLevel = []string{ + "channel_index", + "frequency", + "max_data_rate_index", + "min_data_rate_index", +} +var MACCommand_NewChannelAnsFieldPathsNested = []string{ + "data_rate_ack", + "frequency_ack", +} + +var MACCommand_NewChannelAnsFieldPathsTopLevel = []string{ + "data_rate_ack", + "frequency_ack", +} +var MACCommand_DLChannelReqFieldPathsNested = []string{ + "channel_index", + "frequency", +} + +var MACCommand_DLChannelReqFieldPathsTopLevel = []string{ + "channel_index", + "frequency", +} +var MACCommand_DLChannelAnsFieldPathsNested = []string{ + "channel_index_ack", + "frequency_ack", +} + +var MACCommand_DLChannelAnsFieldPathsTopLevel = []string{ + "channel_index_ack", + "frequency_ack", +} +var MACCommand_RxTimingSetupReqFieldPathsNested = []string{ + "delay", +} + +var MACCommand_RxTimingSetupReqFieldPathsTopLevel = []string{ + "delay", +} +var MACCommand_TxParamSetupReqFieldPathsNested = []string{ + "downlink_dwell_time", + "max_eirp_index", + "uplink_dwell_time", +} + +var MACCommand_TxParamSetupReqFieldPathsTopLevel = []string{ + "downlink_dwell_time", + "max_eirp_index", + "uplink_dwell_time", +} +var MACCommand_RekeyIndFieldPathsNested = []string{ + "minor_version", +} + +var MACCommand_RekeyIndFieldPathsTopLevel = []string{ + "minor_version", +} +var MACCommand_RekeyConfFieldPathsNested = []string{ + "minor_version", +} + +var MACCommand_RekeyConfFieldPathsTopLevel = []string{ + "minor_version", +} +var MACCommand_ADRParamSetupReqFieldPathsNested = []string{ + "adr_ack_delay_exponent", + "adr_ack_limit_exponent", +} + +var MACCommand_ADRParamSetupReqFieldPathsTopLevel = []string{ + "adr_ack_delay_exponent", + "adr_ack_limit_exponent", +} +var MACCommand_DeviceTimeAnsFieldPathsNested = []string{ + "time", +} + +var MACCommand_DeviceTimeAnsFieldPathsTopLevel = []string{ + "time", +} +var MACCommand_ForceRejoinReqFieldPathsNested = []string{ + "data_rate_index", + "max_retries", + "period_exponent", + "rejoin_type", +} + +var MACCommand_ForceRejoinReqFieldPathsTopLevel = []string{ + "data_rate_index", + "max_retries", + "period_exponent", + "rejoin_type", +} +var MACCommand_RejoinParamSetupReqFieldPathsNested = []string{ + "max_count_exponent", + "max_time_exponent", +} + +var MACCommand_RejoinParamSetupReqFieldPathsTopLevel = []string{ + "max_count_exponent", + "max_time_exponent", +} +var MACCommand_RejoinParamSetupAnsFieldPathsNested = []string{ + "max_time_exponent_ack", +} + +var MACCommand_RejoinParamSetupAnsFieldPathsTopLevel = []string{ + "max_time_exponent_ack", +} +var MACCommand_PingSlotInfoReqFieldPathsNested = []string{ + "period", +} + +var MACCommand_PingSlotInfoReqFieldPathsTopLevel = []string{ + "period", +} +var MACCommand_PingSlotChannelReqFieldPathsNested = []string{ + "data_rate_index", + "frequency", +} + +var MACCommand_PingSlotChannelReqFieldPathsTopLevel = []string{ + "data_rate_index", + "frequency", +} +var MACCommand_PingSlotChannelAnsFieldPathsNested = []string{ + "data_rate_index_ack", + "frequency_ack", +} + +var MACCommand_PingSlotChannelAnsFieldPathsTopLevel = []string{ + "data_rate_index_ack", + "frequency_ack", +} +var MACCommand_BeaconTimingAnsFieldPathsNested = []string{ + "channel_index", + "delay", +} + +var MACCommand_BeaconTimingAnsFieldPathsTopLevel = []string{ + "channel_index", + "delay", +} +var MACCommand_BeaconFreqReqFieldPathsNested = []string{ + "frequency", +} + +var MACCommand_BeaconFreqReqFieldPathsTopLevel = []string{ + "frequency", +} +var MACCommand_BeaconFreqAnsFieldPathsNested = []string{ + "frequency_ack", +} + +var MACCommand_BeaconFreqAnsFieldPathsTopLevel = []string{ + "frequency_ack", +} +var MACCommand_DeviceModeIndFieldPathsNested = []string{ + "class", +} + +var MACCommand_DeviceModeIndFieldPathsTopLevel = []string{ + "class", +} +var MACCommand_DeviceModeConfFieldPathsNested = []string{ + "class", +} + +var MACCommand_DeviceModeConfFieldPathsTopLevel = []string{ + "class", +} diff --git a/pkg/ttnpb/lorawan.pb.fm.go b/pkg/ttnpb/lorawan.pb.setters.fm.go similarity index 83% rename from pkg/ttnpb/lorawan.pb.fm.go rename to pkg/ttnpb/lorawan.pb.setters.fm.go index 5d18b01f89..964ce7c928 100644 --- a/pkg/ttnpb/lorawan.pb.fm.go +++ b/pkg/ttnpb/lorawan.pb.setters.fm.go @@ -9,58 +9,6 @@ import ( go_thethings_network_lorawan_stack_pkg_types "go.thethings.network/lorawan-stack/pkg/types" ) -var MessageFieldPathsNested = []string{ - "Payload", - "Payload.join_accept_payload", - "Payload.join_accept_payload.cf_list", - "Payload.join_accept_payload.cf_list.ch_masks", - "Payload.join_accept_payload.cf_list.freq", - "Payload.join_accept_payload.cf_list.type", - "Payload.join_accept_payload.dev_addr", - "Payload.join_accept_payload.dl_settings", - "Payload.join_accept_payload.dl_settings.opt_neg", - "Payload.join_accept_payload.dl_settings.rx1_dr_offset", - "Payload.join_accept_payload.dl_settings.rx2_dr", - "Payload.join_accept_payload.encrypted", - "Payload.join_accept_payload.join_nonce", - "Payload.join_accept_payload.net_id", - "Payload.join_accept_payload.rx_delay", - "Payload.join_request_payload", - "Payload.join_request_payload.dev_eui", - "Payload.join_request_payload.dev_nonce", - "Payload.join_request_payload.join_eui", - "Payload.mac_payload", - "Payload.mac_payload.decoded_payload", - "Payload.mac_payload.f_hdr", - "Payload.mac_payload.f_hdr.dev_addr", - "Payload.mac_payload.f_hdr.f_cnt", - "Payload.mac_payload.f_hdr.f_ctrl", - "Payload.mac_payload.f_hdr.f_ctrl.ack", - "Payload.mac_payload.f_hdr.f_ctrl.adr", - "Payload.mac_payload.f_hdr.f_ctrl.adr_ack_req", - "Payload.mac_payload.f_hdr.f_ctrl.class_b", - "Payload.mac_payload.f_hdr.f_ctrl.f_pending", - "Payload.mac_payload.f_hdr.f_opts", - "Payload.mac_payload.f_port", - "Payload.mac_payload.frm_payload", - "Payload.rejoin_request_payload", - "Payload.rejoin_request_payload.dev_eui", - "Payload.rejoin_request_payload.join_eui", - "Payload.rejoin_request_payload.net_id", - "Payload.rejoin_request_payload.rejoin_cnt", - "Payload.rejoin_request_payload.rejoin_type", - "m_hdr", - "m_hdr.m_type", - "m_hdr.major", - "mic", -} - -var MessageFieldPathsTopLevel = []string{ - "Payload", - "m_hdr", - "mic", -} - func (dst *Message) SetFields(src *Message, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -89,8 +37,7 @@ func (dst *Message) SetFields(src *Message, paths ...string) error { if src != nil { dst.MIC = src.MIC } else { - var zero []byte - dst.MIC = zero + dst.MIC = nil } case "Payload": @@ -217,16 +164,6 @@ func (dst *Message) SetFields(src *Message, paths ...string) error { return nil } -var MHDRFieldPathsNested = []string{ - "m_type", - "major", -} - -var MHDRFieldPathsTopLevel = []string{ - "m_type", - "major", -} - func (dst *MHDR) SetFields(src *MHDR, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -258,29 +195,6 @@ func (dst *MHDR) SetFields(src *MHDR, paths ...string) error { return nil } -var MACPayloadFieldPathsNested = []string{ - "decoded_payload", - "f_hdr", - "f_hdr.dev_addr", - "f_hdr.f_cnt", - "f_hdr.f_ctrl", - "f_hdr.f_ctrl.ack", - "f_hdr.f_ctrl.adr", - "f_hdr.f_ctrl.adr_ack_req", - "f_hdr.f_ctrl.class_b", - "f_hdr.f_ctrl.f_pending", - "f_hdr.f_opts", - "f_port", - "frm_payload", -} - -var MACPayloadFieldPathsTopLevel = []string{ - "decoded_payload", - "f_hdr", - "f_port", - "frm_payload", -} - func (dst *MACPayload) SetFields(src *MACPayload, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -319,8 +233,7 @@ func (dst *MACPayload) SetFields(src *MACPayload, paths ...string) error { if src != nil { dst.FRMPayload = src.FRMPayload } else { - var zero []byte - dst.FRMPayload = zero + dst.FRMPayload = nil } case "decoded_payload": if len(subs) > 0 { @@ -339,25 +252,6 @@ func (dst *MACPayload) SetFields(src *MACPayload, paths ...string) error { return nil } -var FHDRFieldPathsNested = []string{ - "dev_addr", - "f_cnt", - "f_ctrl", - "f_ctrl.ack", - "f_ctrl.adr", - "f_ctrl.adr_ack_req", - "f_ctrl.class_b", - "f_ctrl.f_pending", - "f_opts", -} - -var FHDRFieldPathsTopLevel = []string{ - "dev_addr", - "f_cnt", - "f_ctrl", - "f_opts", -} - func (dst *FHDR) SetFields(src *FHDR, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -406,8 +300,7 @@ func (dst *FHDR) SetFields(src *FHDR, paths ...string) error { if src != nil { dst.FOpts = src.FOpts } else { - var zero []byte - dst.FOpts = zero + dst.FOpts = nil } default: @@ -417,22 +310,6 @@ func (dst *FHDR) SetFields(src *FHDR, paths ...string) error { return nil } -var FCtrlFieldPathsNested = []string{ - "ack", - "adr", - "adr_ack_req", - "class_b", - "f_pending", -} - -var FCtrlFieldPathsTopLevel = []string{ - "ack", - "adr", - "adr_ack_req", - "class_b", - "f_pending", -} - func (dst *FCtrl) SetFields(src *FCtrl, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -494,18 +371,6 @@ func (dst *FCtrl) SetFields(src *FCtrl, paths ...string) error { return nil } -var JoinRequestPayloadFieldPathsNested = []string{ - "dev_eui", - "dev_nonce", - "join_eui", -} - -var JoinRequestPayloadFieldPathsTopLevel = []string{ - "dev_eui", - "dev_nonce", - "join_eui", -} - func (dst *JoinRequestPayload) SetFields(src *JoinRequestPayload, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -547,22 +412,6 @@ func (dst *JoinRequestPayload) SetFields(src *JoinRequestPayload, paths ...strin return nil } -var RejoinRequestPayloadFieldPathsNested = []string{ - "dev_eui", - "join_eui", - "net_id", - "rejoin_cnt", - "rejoin_type", -} - -var RejoinRequestPayloadFieldPathsTopLevel = []string{ - "dev_eui", - "join_eui", - "net_id", - "rejoin_cnt", - "rejoin_type", -} - func (dst *RejoinRequestPayload) SetFields(src *RejoinRequestPayload, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -624,32 +473,6 @@ func (dst *RejoinRequestPayload) SetFields(src *RejoinRequestPayload, paths ...s return nil } -var JoinAcceptPayloadFieldPathsNested = []string{ - "cf_list", - "cf_list.ch_masks", - "cf_list.freq", - "cf_list.type", - "dev_addr", - "dl_settings", - "dl_settings.opt_neg", - "dl_settings.rx1_dr_offset", - "dl_settings.rx2_dr", - "encrypted", - "join_nonce", - "net_id", - "rx_delay", -} - -var JoinAcceptPayloadFieldPathsTopLevel = []string{ - "cf_list", - "dev_addr", - "dl_settings", - "encrypted", - "join_nonce", - "net_id", - "rx_delay", -} - func (dst *JoinAcceptPayload) SetFields(src *JoinAcceptPayload, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -660,8 +483,7 @@ func (dst *JoinAcceptPayload) SetFields(src *JoinAcceptPayload, paths ...string) if src != nil { dst.Encrypted = src.Encrypted } else { - var zero []byte - dst.Encrypted = zero + dst.Encrypted = nil } case "join_nonce": if len(subs) > 0 { @@ -750,18 +572,6 @@ func (dst *JoinAcceptPayload) SetFields(src *JoinAcceptPayload, paths ...string) return nil } -var DLSettingsFieldPathsNested = []string{ - "opt_neg", - "rx1_dr_offset", - "rx2_dr", -} - -var DLSettingsFieldPathsTopLevel = []string{ - "opt_neg", - "rx1_dr_offset", - "rx2_dr", -} - func (dst *DLSettings) SetFields(src *DLSettings, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -803,18 +613,6 @@ func (dst *DLSettings) SetFields(src *DLSettings, paths ...string) error { return nil } -var CFListFieldPathsNested = []string{ - "ch_masks", - "freq", - "type", -} - -var CFListFieldPathsTopLevel = []string{ - "ch_masks", - "freq", - "type", -} - func (dst *CFList) SetFields(src *CFList, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -854,16 +652,6 @@ func (dst *CFList) SetFields(src *CFList, paths ...string) error { return nil } -var LoRaDataRateFieldPathsNested = []string{ - "bandwidth", - "spreading_factor", -} - -var LoRaDataRateFieldPathsTopLevel = []string{ - "bandwidth", - "spreading_factor", -} - func (dst *LoRaDataRate) SetFields(src *LoRaDataRate, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -895,14 +683,6 @@ func (dst *LoRaDataRate) SetFields(src *LoRaDataRate, paths ...string) error { return nil } -var FSKDataRateFieldPathsNested = []string{ - "bit_rate", -} - -var FSKDataRateFieldPathsTopLevel = []string{ - "bit_rate", -} - func (dst *FSKDataRate) SetFields(src *FSKDataRate, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -924,19 +704,6 @@ func (dst *FSKDataRate) SetFields(src *FSKDataRate, paths ...string) error { return nil } -var DataRateFieldPathsNested = []string{ - "modulation", - "modulation.fsk", - "modulation.fsk.bit_rate", - "modulation.lora", - "modulation.lora.bandwidth", - "modulation.lora.spreading_factor", -} - -var DataRateFieldPathsTopLevel = []string{ - "modulation", -} - func (dst *DataRate) SetFields(src *DataRate, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1017,40 +784,6 @@ func (dst *DataRate) SetFields(src *DataRate, paths ...string) error { return nil } -var TxSettingsFieldPathsNested = []string{ - "coding_rate", - "data_rate", - "data_rate.modulation", - "data_rate.modulation.fsk", - "data_rate.modulation.fsk.bit_rate", - "data_rate.modulation.lora", - "data_rate.modulation.lora.bandwidth", - "data_rate.modulation.lora.spreading_factor", - "data_rate_index", - "device_channel_index", - "enable_crc", - "frequency", - "gateway_channel_index", - "invert_polarization", - "time", - "timestamp", - "tx_power", -} - -var TxSettingsFieldPathsTopLevel = []string{ - "coding_rate", - "data_rate", - "data_rate_index", - "device_channel_index", - "enable_crc", - "frequency", - "gateway_channel_index", - "invert_polarization", - "time", - "timestamp", - "tx_power", -} - func (dst *TxSettings) SetFields(src *TxSettings, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1179,18 +912,6 @@ func (dst *TxSettings) SetFields(src *TxSettings, paths ...string) error { return nil } -var GatewayAntennaIdentifiersFieldPathsNested = []string{ - "antenna_index", - "gateway_ids", - "gateway_ids.eui", - "gateway_ids.gateway_id", -} - -var GatewayAntennaIdentifiersFieldPathsTopLevel = []string{ - "antenna_index", - "gateway_ids", -} - func (dst *GatewayAntennaIdentifiers) SetFields(src *GatewayAntennaIdentifiers, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1230,20 +951,6 @@ func (dst *GatewayAntennaIdentifiers) SetFields(src *GatewayAntennaIdentifiers, return nil } -var UplinkTokenFieldPathsNested = []string{ - "ids", - "ids.antenna_index", - "ids.gateway_ids", - "ids.gateway_ids.eui", - "ids.gateway_ids.gateway_id", - "timestamp", -} - -var UplinkTokenFieldPathsTopLevel = []string{ - "ids", - "timestamp", -} - func (dst *UplinkToken) SetFields(src *UplinkToken, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1283,20 +990,6 @@ func (dst *UplinkToken) SetFields(src *UplinkToken, paths ...string) error { return nil } -var DownlinkPathFieldPathsNested = []string{ - "path", - "path.fixed", - "path.fixed.antenna_index", - "path.fixed.gateway_ids", - "path.fixed.gateway_ids.eui", - "path.fixed.gateway_ids.gateway_id", - "path.uplink_token", -} - -var DownlinkPathFieldPathsTopLevel = []string{ - "path", -} - func (dst *DownlinkPath) SetFields(src *DownlinkPath, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1326,8 +1019,7 @@ func (dst *DownlinkPath) SetFields(src *DownlinkPath, paths ...string) error { if src != nil { dst.Path.(*DownlinkPath_UplinkToken).UplinkToken = src.GetUplinkToken() } else { - var zero []byte - dst.Path.(*DownlinkPath_UplinkToken).UplinkToken = zero + dst.Path.(*DownlinkPath_UplinkToken).UplinkToken = nil } case "fixed": if _, ok := dst.Path.(*DownlinkPath_Fixed); !ok { @@ -1366,32 +1058,6 @@ func (dst *DownlinkPath) SetFields(src *DownlinkPath, paths ...string) error { return nil } -var TxRequestFieldPathsNested = []string{ - "absolute_time", - "advanced", - "class", - "downlink_paths", - "priority", - "rx1_data_rate_index", - "rx1_delay", - "rx1_frequency", - "rx2_data_rate_index", - "rx2_frequency", -} - -var TxRequestFieldPathsTopLevel = []string{ - "absolute_time", - "advanced", - "class", - "downlink_paths", - "priority", - "rx1_data_rate_index", - "rx1_delay", - "rx1_frequency", - "rx2_data_rate_index", - "rx2_frequency", -} - func (dst *TxRequest) SetFields(src *TxRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1500,105 +1166,6 @@ func (dst *TxRequest) SetFields(src *TxRequest, paths ...string) error { return nil } -var MACCommandFieldPathsNested = []string{ - "cid", - "payload", - "payload.adr_param_setup_req", - "payload.adr_param_setup_req.adr_ack_delay_exponent", - "payload.adr_param_setup_req.adr_ack_limit_exponent", - "payload.beacon_freq_ans", - "payload.beacon_freq_ans.frequency_ack", - "payload.beacon_freq_req", - "payload.beacon_freq_req.frequency", - "payload.beacon_timing_ans", - "payload.beacon_timing_ans.channel_index", - "payload.beacon_timing_ans.delay", - "payload.dev_status_ans", - "payload.dev_status_ans.battery", - "payload.dev_status_ans.margin", - "payload.device_mode_conf", - "payload.device_mode_conf.class", - "payload.device_mode_ind", - "payload.device_mode_ind.class", - "payload.device_time_ans", - "payload.device_time_ans.time", - "payload.dl_channel_ans", - "payload.dl_channel_ans.channel_index_ack", - "payload.dl_channel_ans.frequency_ack", - "payload.dl_channel_req", - "payload.dl_channel_req.channel_index", - "payload.dl_channel_req.frequency", - "payload.duty_cycle_req", - "payload.duty_cycle_req.max_duty_cycle", - "payload.force_rejoin_req", - "payload.force_rejoin_req.data_rate_index", - "payload.force_rejoin_req.max_retries", - "payload.force_rejoin_req.period_exponent", - "payload.force_rejoin_req.rejoin_type", - "payload.link_adr_ans", - "payload.link_adr_ans.channel_mask_ack", - "payload.link_adr_ans.data_rate_index_ack", - "payload.link_adr_ans.tx_power_index_ack", - "payload.link_adr_req", - "payload.link_adr_req.channel_mask", - "payload.link_adr_req.channel_mask_control", - "payload.link_adr_req.data_rate_index", - "payload.link_adr_req.nb_trans", - "payload.link_adr_req.tx_power_index", - "payload.link_check_ans", - "payload.link_check_ans.gateway_count", - "payload.link_check_ans.margin", - "payload.new_channel_ans", - "payload.new_channel_ans.data_rate_ack", - "payload.new_channel_ans.frequency_ack", - "payload.new_channel_req", - "payload.new_channel_req.channel_index", - "payload.new_channel_req.frequency", - "payload.new_channel_req.max_data_rate_index", - "payload.new_channel_req.min_data_rate_index", - "payload.ping_slot_channel_ans", - "payload.ping_slot_channel_ans.data_rate_index_ack", - "payload.ping_slot_channel_ans.frequency_ack", - "payload.ping_slot_channel_req", - "payload.ping_slot_channel_req.data_rate_index", - "payload.ping_slot_channel_req.frequency", - "payload.ping_slot_info_req", - "payload.ping_slot_info_req.period", - "payload.raw_payload", - "payload.rejoin_param_setup_ans", - "payload.rejoin_param_setup_ans.max_time_exponent_ack", - "payload.rejoin_param_setup_req", - "payload.rejoin_param_setup_req.max_count_exponent", - "payload.rejoin_param_setup_req.max_time_exponent", - "payload.rekey_conf", - "payload.rekey_conf.minor_version", - "payload.rekey_ind", - "payload.rekey_ind.minor_version", - "payload.reset_conf", - "payload.reset_conf.minor_version", - "payload.reset_ind", - "payload.reset_ind.minor_version", - "payload.rx_param_setup_ans", - "payload.rx_param_setup_ans.rx1_data_rate_offset_ack", - "payload.rx_param_setup_ans.rx2_data_rate_index_ack", - "payload.rx_param_setup_ans.rx2_frequency_ack", - "payload.rx_param_setup_req", - "payload.rx_param_setup_req.rx1_data_rate_offset", - "payload.rx_param_setup_req.rx2_data_rate_index", - "payload.rx_param_setup_req.rx2_frequency", - "payload.rx_timing_setup_req", - "payload.rx_timing_setup_req.delay", - "payload.tx_param_setup_req", - "payload.tx_param_setup_req.downlink_dwell_time", - "payload.tx_param_setup_req.max_eirp_index", - "payload.tx_param_setup_req.uplink_dwell_time", -} - -var MACCommandFieldPathsTopLevel = []string{ - "cid", - "payload", -} - func (dst *MACCommand) SetFields(src *MACCommand, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1638,8 +1205,7 @@ func (dst *MACCommand) SetFields(src *MACCommand, paths ...string) error { if src != nil { dst.Payload.(*MACCommand_RawPayload).RawPayload = src.GetRawPayload() } else { - var zero []byte - dst.Payload.(*MACCommand_RawPayload).RawPayload = zero + dst.Payload.(*MACCommand_RawPayload).RawPayload = nil } case "reset_ind": if _, ok := dst.Payload.(*MACCommand_ResetInd_); !ok { @@ -2374,14 +1940,6 @@ func (dst *MACCommand) SetFields(src *MACCommand, paths ...string) error { return nil } -var MACCommand_ResetIndFieldPathsNested = []string{ - "minor_version", -} - -var MACCommand_ResetIndFieldPathsTopLevel = []string{ - "minor_version", -} - func (dst *MACCommand_ResetInd) SetFields(src *MACCommand_ResetInd, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -2403,14 +1961,6 @@ func (dst *MACCommand_ResetInd) SetFields(src *MACCommand_ResetInd, paths ...str return nil } -var MACCommand_ResetConfFieldPathsNested = []string{ - "minor_version", -} - -var MACCommand_ResetConfFieldPathsTopLevel = []string{ - "minor_version", -} - func (dst *MACCommand_ResetConf) SetFields(src *MACCommand_ResetConf, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -2432,16 +1982,6 @@ func (dst *MACCommand_ResetConf) SetFields(src *MACCommand_ResetConf, paths ...s return nil } -var MACCommand_LinkCheckAnsFieldPathsNested = []string{ - "gateway_count", - "margin", -} - -var MACCommand_LinkCheckAnsFieldPathsTopLevel = []string{ - "gateway_count", - "margin", -} - func (dst *MACCommand_LinkCheckAns) SetFields(src *MACCommand_LinkCheckAns, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -2473,22 +2013,6 @@ func (dst *MACCommand_LinkCheckAns) SetFields(src *MACCommand_LinkCheckAns, path return nil } -var MACCommand_LinkADRReqFieldPathsNested = []string{ - "channel_mask", - "channel_mask_control", - "data_rate_index", - "nb_trans", - "tx_power_index", -} - -var MACCommand_LinkADRReqFieldPathsTopLevel = []string{ - "channel_mask", - "channel_mask_control", - "data_rate_index", - "nb_trans", - "tx_power_index", -} - func (dst *MACCommand_LinkADRReq) SetFields(src *MACCommand_LinkADRReq, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -2549,18 +2073,6 @@ func (dst *MACCommand_LinkADRReq) SetFields(src *MACCommand_LinkADRReq, paths .. return nil } -var MACCommand_LinkADRAnsFieldPathsNested = []string{ - "channel_mask_ack", - "data_rate_index_ack", - "tx_power_index_ack", -} - -var MACCommand_LinkADRAnsFieldPathsTopLevel = []string{ - "channel_mask_ack", - "data_rate_index_ack", - "tx_power_index_ack", -} - func (dst *MACCommand_LinkADRAns) SetFields(src *MACCommand_LinkADRAns, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -2602,14 +2114,6 @@ func (dst *MACCommand_LinkADRAns) SetFields(src *MACCommand_LinkADRAns, paths .. return nil } -var MACCommand_DutyCycleReqFieldPathsNested = []string{ - "max_duty_cycle", -} - -var MACCommand_DutyCycleReqFieldPathsTopLevel = []string{ - "max_duty_cycle", -} - func (dst *MACCommand_DutyCycleReq) SetFields(src *MACCommand_DutyCycleReq, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -2631,18 +2135,6 @@ func (dst *MACCommand_DutyCycleReq) SetFields(src *MACCommand_DutyCycleReq, path return nil } -var MACCommand_RxParamSetupReqFieldPathsNested = []string{ - "rx1_data_rate_offset", - "rx2_data_rate_index", - "rx2_frequency", -} - -var MACCommand_RxParamSetupReqFieldPathsTopLevel = []string{ - "rx1_data_rate_offset", - "rx2_data_rate_index", - "rx2_frequency", -} - func (dst *MACCommand_RxParamSetupReq) SetFields(src *MACCommand_RxParamSetupReq, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -2684,18 +2176,6 @@ func (dst *MACCommand_RxParamSetupReq) SetFields(src *MACCommand_RxParamSetupReq return nil } -var MACCommand_RxParamSetupAnsFieldPathsNested = []string{ - "rx1_data_rate_offset_ack", - "rx2_data_rate_index_ack", - "rx2_frequency_ack", -} - -var MACCommand_RxParamSetupAnsFieldPathsTopLevel = []string{ - "rx1_data_rate_offset_ack", - "rx2_data_rate_index_ack", - "rx2_frequency_ack", -} - func (dst *MACCommand_RxParamSetupAns) SetFields(src *MACCommand_RxParamSetupAns, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -2737,16 +2217,6 @@ func (dst *MACCommand_RxParamSetupAns) SetFields(src *MACCommand_RxParamSetupAns return nil } -var MACCommand_DevStatusAnsFieldPathsNested = []string{ - "battery", - "margin", -} - -var MACCommand_DevStatusAnsFieldPathsTopLevel = []string{ - "battery", - "margin", -} - func (dst *MACCommand_DevStatusAns) SetFields(src *MACCommand_DevStatusAns, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -2778,20 +2248,6 @@ func (dst *MACCommand_DevStatusAns) SetFields(src *MACCommand_DevStatusAns, path return nil } -var MACCommand_NewChannelReqFieldPathsNested = []string{ - "channel_index", - "frequency", - "max_data_rate_index", - "min_data_rate_index", -} - -var MACCommand_NewChannelReqFieldPathsTopLevel = []string{ - "channel_index", - "frequency", - "max_data_rate_index", - "min_data_rate_index", -} - func (dst *MACCommand_NewChannelReq) SetFields(src *MACCommand_NewChannelReq, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -2843,16 +2299,6 @@ func (dst *MACCommand_NewChannelReq) SetFields(src *MACCommand_NewChannelReq, pa return nil } -var MACCommand_NewChannelAnsFieldPathsNested = []string{ - "data_rate_ack", - "frequency_ack", -} - -var MACCommand_NewChannelAnsFieldPathsTopLevel = []string{ - "data_rate_ack", - "frequency_ack", -} - func (dst *MACCommand_NewChannelAns) SetFields(src *MACCommand_NewChannelAns, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -2884,16 +2330,6 @@ func (dst *MACCommand_NewChannelAns) SetFields(src *MACCommand_NewChannelAns, pa return nil } -var MACCommand_DLChannelReqFieldPathsNested = []string{ - "channel_index", - "frequency", -} - -var MACCommand_DLChannelReqFieldPathsTopLevel = []string{ - "channel_index", - "frequency", -} - func (dst *MACCommand_DLChannelReq) SetFields(src *MACCommand_DLChannelReq, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -2925,16 +2361,6 @@ func (dst *MACCommand_DLChannelReq) SetFields(src *MACCommand_DLChannelReq, path return nil } -var MACCommand_DLChannelAnsFieldPathsNested = []string{ - "channel_index_ack", - "frequency_ack", -} - -var MACCommand_DLChannelAnsFieldPathsTopLevel = []string{ - "channel_index_ack", - "frequency_ack", -} - func (dst *MACCommand_DLChannelAns) SetFields(src *MACCommand_DLChannelAns, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -2966,14 +2392,6 @@ func (dst *MACCommand_DLChannelAns) SetFields(src *MACCommand_DLChannelAns, path return nil } -var MACCommand_RxTimingSetupReqFieldPathsNested = []string{ - "delay", -} - -var MACCommand_RxTimingSetupReqFieldPathsTopLevel = []string{ - "delay", -} - func (dst *MACCommand_RxTimingSetupReq) SetFields(src *MACCommand_RxTimingSetupReq, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -2995,18 +2413,6 @@ func (dst *MACCommand_RxTimingSetupReq) SetFields(src *MACCommand_RxTimingSetupR return nil } -var MACCommand_TxParamSetupReqFieldPathsNested = []string{ - "downlink_dwell_time", - "max_eirp_index", - "uplink_dwell_time", -} - -var MACCommand_TxParamSetupReqFieldPathsTopLevel = []string{ - "downlink_dwell_time", - "max_eirp_index", - "uplink_dwell_time", -} - func (dst *MACCommand_TxParamSetupReq) SetFields(src *MACCommand_TxParamSetupReq, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -3048,14 +2454,6 @@ func (dst *MACCommand_TxParamSetupReq) SetFields(src *MACCommand_TxParamSetupReq return nil } -var MACCommand_RekeyIndFieldPathsNested = []string{ - "minor_version", -} - -var MACCommand_RekeyIndFieldPathsTopLevel = []string{ - "minor_version", -} - func (dst *MACCommand_RekeyInd) SetFields(src *MACCommand_RekeyInd, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -3077,14 +2475,6 @@ func (dst *MACCommand_RekeyInd) SetFields(src *MACCommand_RekeyInd, paths ...str return nil } -var MACCommand_RekeyConfFieldPathsNested = []string{ - "minor_version", -} - -var MACCommand_RekeyConfFieldPathsTopLevel = []string{ - "minor_version", -} - func (dst *MACCommand_RekeyConf) SetFields(src *MACCommand_RekeyConf, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -3106,16 +2496,6 @@ func (dst *MACCommand_RekeyConf) SetFields(src *MACCommand_RekeyConf, paths ...s return nil } -var MACCommand_ADRParamSetupReqFieldPathsNested = []string{ - "adr_ack_delay_exponent", - "adr_ack_limit_exponent", -} - -var MACCommand_ADRParamSetupReqFieldPathsTopLevel = []string{ - "adr_ack_delay_exponent", - "adr_ack_limit_exponent", -} - func (dst *MACCommand_ADRParamSetupReq) SetFields(src *MACCommand_ADRParamSetupReq, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -3147,14 +2527,6 @@ func (dst *MACCommand_ADRParamSetupReq) SetFields(src *MACCommand_ADRParamSetupR return nil } -var MACCommand_DeviceTimeAnsFieldPathsNested = []string{ - "time", -} - -var MACCommand_DeviceTimeAnsFieldPathsTopLevel = []string{ - "time", -} - func (dst *MACCommand_DeviceTimeAns) SetFields(src *MACCommand_DeviceTimeAns, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -3176,20 +2548,6 @@ func (dst *MACCommand_DeviceTimeAns) SetFields(src *MACCommand_DeviceTimeAns, pa return nil } -var MACCommand_ForceRejoinReqFieldPathsNested = []string{ - "data_rate_index", - "max_retries", - "period_exponent", - "rejoin_type", -} - -var MACCommand_ForceRejoinReqFieldPathsTopLevel = []string{ - "data_rate_index", - "max_retries", - "period_exponent", - "rejoin_type", -} - func (dst *MACCommand_ForceRejoinReq) SetFields(src *MACCommand_ForceRejoinReq, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -3200,7 +2558,7 @@ func (dst *MACCommand_ForceRejoinReq) SetFields(src *MACCommand_ForceRejoinReq, if src != nil { dst.RejoinType = src.RejoinType } else { - var zero uint32 + var zero RejoinType dst.RejoinType = zero } case "data_rate_index": @@ -3241,16 +2599,6 @@ func (dst *MACCommand_ForceRejoinReq) SetFields(src *MACCommand_ForceRejoinReq, return nil } -var MACCommand_RejoinParamSetupReqFieldPathsNested = []string{ - "max_count_exponent", - "max_time_exponent", -} - -var MACCommand_RejoinParamSetupReqFieldPathsTopLevel = []string{ - "max_count_exponent", - "max_time_exponent", -} - func (dst *MACCommand_RejoinParamSetupReq) SetFields(src *MACCommand_RejoinParamSetupReq, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -3282,14 +2630,6 @@ func (dst *MACCommand_RejoinParamSetupReq) SetFields(src *MACCommand_RejoinParam return nil } -var MACCommand_RejoinParamSetupAnsFieldPathsNested = []string{ - "max_time_exponent_ack", -} - -var MACCommand_RejoinParamSetupAnsFieldPathsTopLevel = []string{ - "max_time_exponent_ack", -} - func (dst *MACCommand_RejoinParamSetupAns) SetFields(src *MACCommand_RejoinParamSetupAns, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -3311,14 +2651,6 @@ func (dst *MACCommand_RejoinParamSetupAns) SetFields(src *MACCommand_RejoinParam return nil } -var MACCommand_PingSlotInfoReqFieldPathsNested = []string{ - "period", -} - -var MACCommand_PingSlotInfoReqFieldPathsTopLevel = []string{ - "period", -} - func (dst *MACCommand_PingSlotInfoReq) SetFields(src *MACCommand_PingSlotInfoReq, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -3340,16 +2672,6 @@ func (dst *MACCommand_PingSlotInfoReq) SetFields(src *MACCommand_PingSlotInfoReq return nil } -var MACCommand_PingSlotChannelReqFieldPathsNested = []string{ - "data_rate_index", - "frequency", -} - -var MACCommand_PingSlotChannelReqFieldPathsTopLevel = []string{ - "data_rate_index", - "frequency", -} - func (dst *MACCommand_PingSlotChannelReq) SetFields(src *MACCommand_PingSlotChannelReq, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -3381,16 +2703,6 @@ func (dst *MACCommand_PingSlotChannelReq) SetFields(src *MACCommand_PingSlotChan return nil } -var MACCommand_PingSlotChannelAnsFieldPathsNested = []string{ - "data_rate_index_ack", - "frequency_ack", -} - -var MACCommand_PingSlotChannelAnsFieldPathsTopLevel = []string{ - "data_rate_index_ack", - "frequency_ack", -} - func (dst *MACCommand_PingSlotChannelAns) SetFields(src *MACCommand_PingSlotChannelAns, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -3422,16 +2734,6 @@ func (dst *MACCommand_PingSlotChannelAns) SetFields(src *MACCommand_PingSlotChan return nil } -var MACCommand_BeaconTimingAnsFieldPathsNested = []string{ - "channel_index", - "delay", -} - -var MACCommand_BeaconTimingAnsFieldPathsTopLevel = []string{ - "channel_index", - "delay", -} - func (dst *MACCommand_BeaconTimingAns) SetFields(src *MACCommand_BeaconTimingAns, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -3463,14 +2765,6 @@ func (dst *MACCommand_BeaconTimingAns) SetFields(src *MACCommand_BeaconTimingAns return nil } -var MACCommand_BeaconFreqReqFieldPathsNested = []string{ - "frequency", -} - -var MACCommand_BeaconFreqReqFieldPathsTopLevel = []string{ - "frequency", -} - func (dst *MACCommand_BeaconFreqReq) SetFields(src *MACCommand_BeaconFreqReq, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -3492,14 +2786,6 @@ func (dst *MACCommand_BeaconFreqReq) SetFields(src *MACCommand_BeaconFreqReq, pa return nil } -var MACCommand_BeaconFreqAnsFieldPathsNested = []string{ - "frequency_ack", -} - -var MACCommand_BeaconFreqAnsFieldPathsTopLevel = []string{ - "frequency_ack", -} - func (dst *MACCommand_BeaconFreqAns) SetFields(src *MACCommand_BeaconFreqAns, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -3521,14 +2807,6 @@ func (dst *MACCommand_BeaconFreqAns) SetFields(src *MACCommand_BeaconFreqAns, pa return nil } -var MACCommand_DeviceModeIndFieldPathsNested = []string{ - "class", -} - -var MACCommand_DeviceModeIndFieldPathsTopLevel = []string{ - "class", -} - func (dst *MACCommand_DeviceModeInd) SetFields(src *MACCommand_DeviceModeInd, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -3550,14 +2828,6 @@ func (dst *MACCommand_DeviceModeInd) SetFields(src *MACCommand_DeviceModeInd, pa return nil } -var MACCommand_DeviceModeConfFieldPathsNested = []string{ - "class", -} - -var MACCommand_DeviceModeConfFieldPathsTopLevel = []string{ - "class", -} - func (dst *MACCommand_DeviceModeConf) SetFields(src *MACCommand_DeviceModeConf, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { diff --git a/pkg/ttnpb/lorawan.pb.validate.go b/pkg/ttnpb/lorawan.pb.validate.go new file mode 100644 index 0000000000..7954a18c25 --- /dev/null +++ b/pkg/ttnpb/lorawan.pb.validate.go @@ -0,0 +1,5345 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on Message with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *Message) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MessageFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "m_hdr": + + if v, ok := interface{}(&m.MHDR).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MessageValidationError{ + field: "m_hdr", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "mic": + + if len(m.GetMIC()) != 4 { + return MessageValidationError{ + field: "mic", + reason: "value length must be 4 bytes", + } + } + + case "Payload": + if len(subs) == 0 { + subs = []string{ + "mac_payload", "join_request_payload", "join_accept_payload", "rejoin_request_payload", + } + } + for name, subs := range _processPaths(subs) { + _ = subs + switch name { + case "mac_payload": + + if v, ok := interface{}(m.GetMACPayload()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MessageValidationError{ + field: "mac_payload", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "join_request_payload": + + if v, ok := interface{}(m.GetJoinRequestPayload()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MessageValidationError{ + field: "join_request_payload", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "join_accept_payload": + + if v, ok := interface{}(m.GetJoinAcceptPayload()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MessageValidationError{ + field: "join_accept_payload", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "rejoin_request_payload": + + if v, ok := interface{}(m.GetRejoinRequestPayload()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MessageValidationError{ + field: "rejoin_request_payload", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return MessageValidationError{ + field: "Payload", + reason: "value is required", + } + } + } + default: + return MessageValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MessageValidationError is the validation error returned by +// Message.ValidateFields if the designated constraints aren't met. +type MessageValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MessageValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MessageValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MessageValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MessageValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MessageValidationError) ErrorName() string { return "MessageValidationError" } + +// Error satisfies the builtin error interface +func (e MessageValidationError) 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 %sMessage.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MessageValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MessageValidationError{} + +// ValidateFields checks the field values on MHDR with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *MHDR) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MHDRFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "m_type": + + if _, ok := MType_name[int32(m.GetMType())]; !ok { + return MHDRValidationError{ + field: "m_type", + reason: "value must be one of the defined enum values", + } + } + + case "major": + + if _, ok := Major_name[int32(m.GetMajor())]; !ok { + return MHDRValidationError{ + field: "major", + reason: "value must be one of the defined enum values", + } + } + + default: + return MHDRValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MHDRValidationError is the validation error returned by MHDR.ValidateFields +// if the designated constraints aren't met. +type MHDRValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MHDRValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MHDRValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MHDRValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MHDRValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MHDRValidationError) ErrorName() string { return "MHDRValidationError" } + +// Error satisfies the builtin error interface +func (e MHDRValidationError) 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 %sMHDR.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MHDRValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MHDRValidationError{} + +// ValidateFields checks the field values on MACPayload with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *MACPayload) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACPayloadFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "f_hdr": + + if v, ok := interface{}(&m.FHDR).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACPayloadValidationError{ + field: "f_hdr", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "f_port": + + if m.GetFPort() > 255 { + return MACPayloadValidationError{ + field: "f_port", + reason: "value must be less than or equal to 255", + } + } + + case "frm_payload": + // no validation rules for FRMPayload + case "decoded_payload": + + if v, ok := interface{}(m.GetDecodedPayload()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACPayloadValidationError{ + field: "decoded_payload", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return MACPayloadValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACPayloadValidationError is the validation error returned by +// MACPayload.ValidateFields if the designated constraints aren't met. +type MACPayloadValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACPayloadValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACPayloadValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACPayloadValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACPayloadValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACPayloadValidationError) ErrorName() string { return "MACPayloadValidationError" } + +// Error satisfies the builtin error interface +func (e MACPayloadValidationError) 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 %sMACPayload.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACPayloadValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACPayloadValidationError{} + +// ValidateFields checks the field values on FHDR with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *FHDR) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = FHDRFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "dev_addr": + // no validation rules for DevAddr + case "f_ctrl": + + if v, ok := interface{}(&m.FCtrl).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return FHDRValidationError{ + field: "f_ctrl", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "f_cnt": + + if m.GetFCnt() > 65535 { + return FHDRValidationError{ + field: "f_cnt", + reason: "value must be less than or equal to 65535", + } + } + + case "f_opts": + + if len(m.GetFOpts()) > 15 { + return FHDRValidationError{ + field: "f_opts", + reason: "value length must be at most 15 bytes", + } + } + + default: + return FHDRValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// FHDRValidationError is the validation error returned by FHDR.ValidateFields +// if the designated constraints aren't met. +type FHDRValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e FHDRValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e FHDRValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e FHDRValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e FHDRValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e FHDRValidationError) ErrorName() string { return "FHDRValidationError" } + +// Error satisfies the builtin error interface +func (e FHDRValidationError) 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 %sFHDR.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = FHDRValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = FHDRValidationError{} + +// ValidateFields checks the field values on FCtrl with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *FCtrl) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = FCtrlFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "adr": + // no validation rules for ADR + case "adr_ack_req": + // no validation rules for ADRAckReq + case "ack": + // no validation rules for Ack + case "f_pending": + // no validation rules for FPending + case "class_b": + // no validation rules for ClassB + default: + return FCtrlValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// FCtrlValidationError is the validation error returned by +// FCtrl.ValidateFields if the designated constraints aren't met. +type FCtrlValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e FCtrlValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e FCtrlValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e FCtrlValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e FCtrlValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e FCtrlValidationError) ErrorName() string { return "FCtrlValidationError" } + +// Error satisfies the builtin error interface +func (e FCtrlValidationError) 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 %sFCtrl.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = FCtrlValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = FCtrlValidationError{} + +// ValidateFields checks the field values on JoinRequestPayload with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *JoinRequestPayload) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = JoinRequestPayloadFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "join_eui": + // no validation rules for JoinEUI + case "dev_eui": + // no validation rules for DevEUI + case "dev_nonce": + // no validation rules for DevNonce + default: + return JoinRequestPayloadValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// JoinRequestPayloadValidationError is the validation error returned by +// JoinRequestPayload.ValidateFields if the designated constraints aren't met. +type JoinRequestPayloadValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e JoinRequestPayloadValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e JoinRequestPayloadValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e JoinRequestPayloadValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e JoinRequestPayloadValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e JoinRequestPayloadValidationError) ErrorName() string { + return "JoinRequestPayloadValidationError" +} + +// Error satisfies the builtin error interface +func (e JoinRequestPayloadValidationError) 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 %sJoinRequestPayload.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = JoinRequestPayloadValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = JoinRequestPayloadValidationError{} + +// ValidateFields checks the field values on RejoinRequestPayload with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *RejoinRequestPayload) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = RejoinRequestPayloadFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "rejoin_type": + + if _, ok := RejoinType_name[int32(m.GetRejoinType())]; !ok { + return RejoinRequestPayloadValidationError{ + field: "rejoin_type", + reason: "value must be one of the defined enum values", + } + } + + case "net_id": + // no validation rules for NetID + case "join_eui": + // no validation rules for JoinEUI + case "dev_eui": + // no validation rules for DevEUI + case "rejoin_cnt": + // no validation rules for RejoinCnt + default: + return RejoinRequestPayloadValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// RejoinRequestPayloadValidationError is the validation error returned by +// RejoinRequestPayload.ValidateFields if the designated constraints aren't met. +type RejoinRequestPayloadValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e RejoinRequestPayloadValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e RejoinRequestPayloadValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e RejoinRequestPayloadValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e RejoinRequestPayloadValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e RejoinRequestPayloadValidationError) ErrorName() string { + return "RejoinRequestPayloadValidationError" +} + +// Error satisfies the builtin error interface +func (e RejoinRequestPayloadValidationError) 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 %sRejoinRequestPayload.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = RejoinRequestPayloadValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = RejoinRequestPayloadValidationError{} + +// ValidateFields checks the field values on JoinAcceptPayload with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *JoinAcceptPayload) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = JoinAcceptPayloadFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "encrypted": + // no validation rules for Encrypted + case "join_nonce": + // no validation rules for JoinNonce + case "net_id": + // no validation rules for NetID + case "dev_addr": + // no validation rules for DevAddr + case "dl_settings": + + if v, ok := interface{}(&m.DLSettings).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return JoinAcceptPayloadValidationError{ + field: "dl_settings", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "rx_delay": + + if _, ok := RxDelay_name[int32(m.GetRxDelay())]; !ok { + return JoinAcceptPayloadValidationError{ + field: "rx_delay", + reason: "value must be one of the defined enum values", + } + } + + case "cf_list": + + if v, ok := interface{}(m.GetCFList()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return JoinAcceptPayloadValidationError{ + field: "cf_list", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return JoinAcceptPayloadValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// JoinAcceptPayloadValidationError is the validation error returned by +// JoinAcceptPayload.ValidateFields if the designated constraints aren't met. +type JoinAcceptPayloadValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e JoinAcceptPayloadValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e JoinAcceptPayloadValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e JoinAcceptPayloadValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e JoinAcceptPayloadValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e JoinAcceptPayloadValidationError) ErrorName() string { + return "JoinAcceptPayloadValidationError" +} + +// Error satisfies the builtin error interface +func (e JoinAcceptPayloadValidationError) 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 %sJoinAcceptPayload.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = JoinAcceptPayloadValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = JoinAcceptPayloadValidationError{} + +// ValidateFields checks the field values on DLSettings with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *DLSettings) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = DLSettingsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "rx1_dr_offset": + + if m.GetRx1DROffset() > 7 { + return DLSettingsValidationError{ + field: "rx1_dr_offset", + reason: "value must be less than or equal to 7", + } + } + + case "rx2_dr": + + if _, ok := DataRateIndex_name[int32(m.GetRx2DR())]; !ok { + return DLSettingsValidationError{ + field: "rx2_dr", + reason: "value must be one of the defined enum values", + } + } + + case "opt_neg": + // no validation rules for OptNeg + default: + return DLSettingsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// DLSettingsValidationError is the validation error returned by +// DLSettings.ValidateFields if the designated constraints aren't met. +type DLSettingsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e DLSettingsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e DLSettingsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e DLSettingsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e DLSettingsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e DLSettingsValidationError) ErrorName() string { return "DLSettingsValidationError" } + +// Error satisfies the builtin error interface +func (e DLSettingsValidationError) 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 %sDLSettings.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = DLSettingsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = DLSettingsValidationError{} + +// ValidateFields checks the field values on CFList with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *CFList) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = CFListFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "type": + + if _, ok := CFListType_name[int32(m.GetType())]; !ok { + return CFListValidationError{ + field: "type", + reason: "value must be one of the defined enum values", + } + } + + case "freq": + + case "ch_masks": + + default: + return CFListValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// CFListValidationError is the validation error returned by +// CFList.ValidateFields if the designated constraints aren't met. +type CFListValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CFListValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CFListValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CFListValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CFListValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CFListValidationError) ErrorName() string { return "CFListValidationError" } + +// Error satisfies the builtin error interface +func (e CFListValidationError) 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 %sCFList.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CFListValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CFListValidationError{} + +// ValidateFields checks the field values on LoRaDataRate with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *LoRaDataRate) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = LoRaDataRateFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "bandwidth": + // no validation rules for Bandwidth + case "spreading_factor": + // no validation rules for SpreadingFactor + default: + return LoRaDataRateValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// LoRaDataRateValidationError is the validation error returned by +// LoRaDataRate.ValidateFields if the designated constraints aren't met. +type LoRaDataRateValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e LoRaDataRateValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e LoRaDataRateValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e LoRaDataRateValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e LoRaDataRateValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e LoRaDataRateValidationError) ErrorName() string { return "LoRaDataRateValidationError" } + +// Error satisfies the builtin error interface +func (e LoRaDataRateValidationError) 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 %sLoRaDataRate.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = LoRaDataRateValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = LoRaDataRateValidationError{} + +// ValidateFields checks the field values on FSKDataRate with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *FSKDataRate) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = FSKDataRateFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "bit_rate": + // no validation rules for BitRate + default: + return FSKDataRateValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// FSKDataRateValidationError is the validation error returned by +// FSKDataRate.ValidateFields if the designated constraints aren't met. +type FSKDataRateValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e FSKDataRateValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e FSKDataRateValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e FSKDataRateValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e FSKDataRateValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e FSKDataRateValidationError) ErrorName() string { return "FSKDataRateValidationError" } + +// Error satisfies the builtin error interface +func (e FSKDataRateValidationError) 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 %sFSKDataRate.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = FSKDataRateValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = FSKDataRateValidationError{} + +// ValidateFields checks the field values on DataRate with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *DataRate) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = DataRateFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "modulation": + if len(subs) == 0 { + subs = []string{ + "lora", "fsk", + } + } + for name, subs := range _processPaths(subs) { + _ = subs + switch name { + case "lora": + + if v, ok := interface{}(m.GetLoRa()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return DataRateValidationError{ + field: "lora", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "fsk": + + if v, ok := interface{}(m.GetFSK()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return DataRateValidationError{ + field: "fsk", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return DataRateValidationError{ + field: "modulation", + reason: "value is required", + } + } + } + default: + return DataRateValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// DataRateValidationError is the validation error returned by +// DataRate.ValidateFields if the designated constraints aren't met. +type DataRateValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e DataRateValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e DataRateValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e DataRateValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e DataRateValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e DataRateValidationError) ErrorName() string { return "DataRateValidationError" } + +// Error satisfies the builtin error interface +func (e DataRateValidationError) 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 %sDataRate.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = DataRateValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = DataRateValidationError{} + +// ValidateFields checks the field values on TxSettings with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *TxSettings) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = TxSettingsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "data_rate": + + if v, ok := interface{}(&m.DataRate).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return TxSettingsValidationError{ + field: "data_rate", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "data_rate_index": + + if _, ok := DataRateIndex_name[int32(m.GetDataRateIndex())]; !ok { + return TxSettingsValidationError{ + field: "data_rate_index", + reason: "value must be one of the defined enum values", + } + } + + case "coding_rate": + // no validation rules for CodingRate + case "frequency": + // no validation rules for Frequency + case "tx_power": + // no validation rules for TxPower + case "invert_polarization": + // no validation rules for InvertPolarization + case "gateway_channel_index": + + if m.GetGatewayChannelIndex() > 255 { + return TxSettingsValidationError{ + field: "gateway_channel_index", + reason: "value must be less than or equal to 255", + } + } + + case "device_channel_index": + + if m.GetDeviceChannelIndex() > 255 { + return TxSettingsValidationError{ + field: "device_channel_index", + reason: "value must be less than or equal to 255", + } + } + + case "enable_crc": + // no validation rules for EnableCRC + case "timestamp": + // no validation rules for Timestamp + case "time": + + if v, ok := interface{}(m.GetTime()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return TxSettingsValidationError{ + field: "time", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return TxSettingsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// TxSettingsValidationError is the validation error returned by +// TxSettings.ValidateFields if the designated constraints aren't met. +type TxSettingsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e TxSettingsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e TxSettingsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e TxSettingsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e TxSettingsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e TxSettingsValidationError) ErrorName() string { return "TxSettingsValidationError" } + +// Error satisfies the builtin error interface +func (e TxSettingsValidationError) 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 %sTxSettings.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = TxSettingsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = TxSettingsValidationError{} + +// ValidateFields checks the field values on GatewayAntennaIdentifiers with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GatewayAntennaIdentifiers) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GatewayAntennaIdentifiersFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "gateway_ids": + + if v, ok := interface{}(&m.GatewayIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GatewayAntennaIdentifiersValidationError{ + field: "gateway_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "antenna_index": + // no validation rules for AntennaIndex + default: + return GatewayAntennaIdentifiersValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GatewayAntennaIdentifiersValidationError is the validation error returned by +// GatewayAntennaIdentifiers.ValidateFields if the designated constraints +// aren't met. +type GatewayAntennaIdentifiersValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GatewayAntennaIdentifiersValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GatewayAntennaIdentifiersValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GatewayAntennaIdentifiersValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GatewayAntennaIdentifiersValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GatewayAntennaIdentifiersValidationError) ErrorName() string { + return "GatewayAntennaIdentifiersValidationError" +} + +// Error satisfies the builtin error interface +func (e GatewayAntennaIdentifiersValidationError) 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 %sGatewayAntennaIdentifiers.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GatewayAntennaIdentifiersValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GatewayAntennaIdentifiersValidationError{} + +// ValidateFields checks the field values on UplinkToken with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *UplinkToken) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = UplinkTokenFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "ids": + + if v, ok := interface{}(&m.GatewayAntennaIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UplinkTokenValidationError{ + field: "ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "timestamp": + // no validation rules for Timestamp + default: + return UplinkTokenValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// UplinkTokenValidationError is the validation error returned by +// UplinkToken.ValidateFields if the designated constraints aren't met. +type UplinkTokenValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UplinkTokenValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UplinkTokenValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UplinkTokenValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UplinkTokenValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UplinkTokenValidationError) ErrorName() string { return "UplinkTokenValidationError" } + +// Error satisfies the builtin error interface +func (e UplinkTokenValidationError) 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 %sUplinkToken.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UplinkTokenValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UplinkTokenValidationError{} + +// ValidateFields checks the field values on DownlinkPath with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *DownlinkPath) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = DownlinkPathFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "path": + if len(subs) == 0 { + subs = []string{ + "uplink_token", "fixed", + } + } + for name, subs := range _processPaths(subs) { + _ = subs + switch name { + case "uplink_token": + // no validation rules for UplinkToken + case "fixed": + + if v, ok := interface{}(m.GetFixed()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return DownlinkPathValidationError{ + field: "fixed", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return DownlinkPathValidationError{ + field: "path", + reason: "value is required", + } + } + } + default: + return DownlinkPathValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// DownlinkPathValidationError is the validation error returned by +// DownlinkPath.ValidateFields if the designated constraints aren't met. +type DownlinkPathValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e DownlinkPathValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e DownlinkPathValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e DownlinkPathValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e DownlinkPathValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e DownlinkPathValidationError) ErrorName() string { return "DownlinkPathValidationError" } + +// Error satisfies the builtin error interface +func (e DownlinkPathValidationError) 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 %sDownlinkPath.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = DownlinkPathValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = DownlinkPathValidationError{} + +// ValidateFields checks the field values on TxRequest with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *TxRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = TxRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "class": + // no validation rules for Class + case "downlink_paths": + + for idx, item := range m.GetDownlinkPaths() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return TxRequestValidationError{ + field: fmt.Sprintf("downlink_paths[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "rx1_delay": + + if _, ok := RxDelay_name[int32(m.GetRx1Delay())]; !ok { + return TxRequestValidationError{ + field: "rx1_delay", + reason: "value must be one of the defined enum values", + } + } + + case "rx1_data_rate_index": + + if _, ok := DataRateIndex_name[int32(m.GetRx1DataRateIndex())]; !ok { + return TxRequestValidationError{ + field: "rx1_data_rate_index", + reason: "value must be one of the defined enum values", + } + } + + case "rx1_frequency": + // no validation rules for Rx1Frequency + case "rx2_data_rate_index": + + if _, ok := DataRateIndex_name[int32(m.GetRx2DataRateIndex())]; !ok { + return TxRequestValidationError{ + field: "rx2_data_rate_index", + reason: "value must be one of the defined enum values", + } + } + + case "rx2_frequency": + // no validation rules for Rx2Frequency + case "priority": + + if _, ok := TxSchedulePriority_name[int32(m.GetPriority())]; !ok { + return TxRequestValidationError{ + field: "priority", + reason: "value must be one of the defined enum values", + } + } + + case "absolute_time": + + if v, ok := interface{}(m.GetAbsoluteTime()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return TxRequestValidationError{ + field: "absolute_time", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "advanced": + + if v, ok := interface{}(m.GetAdvanced()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return TxRequestValidationError{ + field: "advanced", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return TxRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// TxRequestValidationError is the validation error returned by +// TxRequest.ValidateFields if the designated constraints aren't met. +type TxRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e TxRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e TxRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e TxRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e TxRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e TxRequestValidationError) ErrorName() string { return "TxRequestValidationError" } + +// Error satisfies the builtin error interface +func (e TxRequestValidationError) 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 %sTxRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = TxRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = TxRequestValidationError{} + +// ValidateFields checks the field values on MACCommand with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *MACCommand) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommandFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "cid": + + if _, ok := _MACCommand_CID_NotInLookup[m.GetCID()]; ok { + return MACCommandValidationError{ + field: "cid", + reason: "value must not be in list [0]", + } + } + + if _, ok := MACCommandIdentifier_name[int32(m.GetCID())]; !ok { + return MACCommandValidationError{ + field: "cid", + reason: "value must be one of the defined enum values", + } + } + + case "payload": + if len(subs) == 0 { + subs = []string{ + "raw_payload", "reset_ind", "reset_conf", "link_check_ans", "link_adr_req", "link_adr_ans", "duty_cycle_req", "rx_param_setup_req", "rx_param_setup_ans", "dev_status_ans", "new_channel_req", "new_channel_ans", "dl_channel_req", "dl_channel_ans", "rx_timing_setup_req", "tx_param_setup_req", "rekey_ind", "rekey_conf", "adr_param_setup_req", "device_time_ans", "force_rejoin_req", "rejoin_param_setup_req", "rejoin_param_setup_ans", "ping_slot_info_req", "ping_slot_channel_req", "ping_slot_channel_ans", "beacon_timing_ans", "beacon_freq_req", "beacon_freq_ans", "device_mode_ind", "device_mode_conf", + } + } + for name, subs := range _processPaths(subs) { + _ = subs + switch name { + case "raw_payload": + // no validation rules for RawPayload + case "reset_ind": + + if v, ok := interface{}(m.GetResetInd()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "reset_ind", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "reset_conf": + + if v, ok := interface{}(m.GetResetConf()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "reset_conf", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "link_check_ans": + + if v, ok := interface{}(m.GetLinkCheckAns()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "link_check_ans", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "link_adr_req": + + if v, ok := interface{}(m.GetLinkADRReq()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "link_adr_req", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "link_adr_ans": + + if v, ok := interface{}(m.GetLinkADRAns()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "link_adr_ans", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "duty_cycle_req": + + if v, ok := interface{}(m.GetDutyCycleReq()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "duty_cycle_req", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "rx_param_setup_req": + + if v, ok := interface{}(m.GetRxParamSetupReq()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "rx_param_setup_req", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "rx_param_setup_ans": + + if v, ok := interface{}(m.GetRxParamSetupAns()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "rx_param_setup_ans", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "dev_status_ans": + + if v, ok := interface{}(m.GetDevStatusAns()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "dev_status_ans", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "new_channel_req": + + if v, ok := interface{}(m.GetNewChannelReq()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "new_channel_req", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "new_channel_ans": + + if v, ok := interface{}(m.GetNewChannelAns()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "new_channel_ans", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "dl_channel_req": + + if v, ok := interface{}(m.GetDLChannelReq()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "dl_channel_req", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "dl_channel_ans": + + if v, ok := interface{}(m.GetDLChannelAns()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "dl_channel_ans", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "rx_timing_setup_req": + + if v, ok := interface{}(m.GetRxTimingSetupReq()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "rx_timing_setup_req", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "tx_param_setup_req": + + if v, ok := interface{}(m.GetTxParamSetupReq()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "tx_param_setup_req", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "rekey_ind": + + if v, ok := interface{}(m.GetRekeyInd()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "rekey_ind", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "rekey_conf": + + if v, ok := interface{}(m.GetRekeyConf()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "rekey_conf", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "adr_param_setup_req": + + if v, ok := interface{}(m.GetADRParamSetupReq()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "adr_param_setup_req", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "device_time_ans": + + if v, ok := interface{}(m.GetDeviceTimeAns()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "device_time_ans", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "force_rejoin_req": + + if v, ok := interface{}(m.GetForceRejoinReq()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "force_rejoin_req", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "rejoin_param_setup_req": + + if v, ok := interface{}(m.GetRejoinParamSetupReq()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "rejoin_param_setup_req", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "rejoin_param_setup_ans": + + if v, ok := interface{}(m.GetRejoinParamSetupAns()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "rejoin_param_setup_ans", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "ping_slot_info_req": + + if v, ok := interface{}(m.GetPingSlotInfoReq()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "ping_slot_info_req", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "ping_slot_channel_req": + + if v, ok := interface{}(m.GetPingSlotChannelReq()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "ping_slot_channel_req", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "ping_slot_channel_ans": + + if v, ok := interface{}(m.GetPingSlotChannelAns()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "ping_slot_channel_ans", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "beacon_timing_ans": + + if v, ok := interface{}(m.GetBeaconTimingAns()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "beacon_timing_ans", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "beacon_freq_req": + + if v, ok := interface{}(m.GetBeaconFreqReq()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "beacon_freq_req", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "beacon_freq_ans": + + if v, ok := interface{}(m.GetBeaconFreqAns()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "beacon_freq_ans", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "device_mode_ind": + + if v, ok := interface{}(m.GetDeviceModeInd()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "device_mode_ind", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "device_mode_conf": + + if v, ok := interface{}(m.GetDeviceModeConf()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommandValidationError{ + field: "device_mode_conf", + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + } + default: + return MACCommandValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommandValidationError is the validation error returned by +// MACCommand.ValidateFields if the designated constraints aren't met. +type MACCommandValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommandValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommandValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommandValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommandValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommandValidationError) ErrorName() string { return "MACCommandValidationError" } + +// Error satisfies the builtin error interface +func (e MACCommandValidationError) 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 %sMACCommand.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommandValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommandValidationError{} + +var _MACCommand_CID_NotInLookup = map[MACCommandIdentifier]struct{}{ + 0: {}, +} + +// ValidateFields checks the field values on MACCommand_ResetInd with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACCommand_ResetInd) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_ResetIndFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "minor_version": + + if _, ok := _MACCommand_ResetInd_MinorVersion_InLookup[m.GetMinorVersion()]; !ok { + return MACCommand_ResetIndValidationError{ + field: "minor_version", + reason: "value must be in list [1]", + } + } + + if _, ok := Minor_name[int32(m.GetMinorVersion())]; !ok { + return MACCommand_ResetIndValidationError{ + field: "minor_version", + reason: "value must be one of the defined enum values", + } + } + + default: + return MACCommand_ResetIndValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_ResetIndValidationError is the validation error returned by +// MACCommand_ResetInd.ValidateFields if the designated constraints aren't met. +type MACCommand_ResetIndValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_ResetIndValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_ResetIndValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_ResetIndValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_ResetIndValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_ResetIndValidationError) ErrorName() string { + return "MACCommand_ResetIndValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_ResetIndValidationError) 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 %sMACCommand_ResetInd.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_ResetIndValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_ResetIndValidationError{} + +var _MACCommand_ResetInd_MinorVersion_InLookup = map[Minor]struct{}{ + 1: {}, +} + +// ValidateFields checks the field values on MACCommand_ResetConf with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACCommand_ResetConf) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_ResetConfFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "minor_version": + + if _, ok := _MACCommand_ResetConf_MinorVersion_InLookup[m.GetMinorVersion()]; !ok { + return MACCommand_ResetConfValidationError{ + field: "minor_version", + reason: "value must be in list [1]", + } + } + + if _, ok := Minor_name[int32(m.GetMinorVersion())]; !ok { + return MACCommand_ResetConfValidationError{ + field: "minor_version", + reason: "value must be one of the defined enum values", + } + } + + default: + return MACCommand_ResetConfValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_ResetConfValidationError is the validation error returned by +// MACCommand_ResetConf.ValidateFields if the designated constraints aren't met. +type MACCommand_ResetConfValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_ResetConfValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_ResetConfValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_ResetConfValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_ResetConfValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_ResetConfValidationError) ErrorName() string { + return "MACCommand_ResetConfValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_ResetConfValidationError) 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 %sMACCommand_ResetConf.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_ResetConfValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_ResetConfValidationError{} + +var _MACCommand_ResetConf_MinorVersion_InLookup = map[Minor]struct{}{ + 1: {}, +} + +// ValidateFields checks the field values on MACCommand_LinkCheckAns with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACCommand_LinkCheckAns) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_LinkCheckAnsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "margin": + + if m.GetMargin() > 254 { + return MACCommand_LinkCheckAnsValidationError{ + field: "margin", + reason: "value must be less than or equal to 254", + } + } + + case "gateway_count": + + if m.GetGatewayCount() > 255 { + return MACCommand_LinkCheckAnsValidationError{ + field: "gateway_count", + reason: "value must be less than or equal to 255", + } + } + + default: + return MACCommand_LinkCheckAnsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_LinkCheckAnsValidationError is the validation error returned by +// MACCommand_LinkCheckAns.ValidateFields if the designated constraints aren't met. +type MACCommand_LinkCheckAnsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_LinkCheckAnsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_LinkCheckAnsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_LinkCheckAnsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_LinkCheckAnsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_LinkCheckAnsValidationError) ErrorName() string { + return "MACCommand_LinkCheckAnsValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_LinkCheckAnsValidationError) 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 %sMACCommand_LinkCheckAns.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_LinkCheckAnsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_LinkCheckAnsValidationError{} + +// ValidateFields checks the field values on MACCommand_LinkADRReq with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACCommand_LinkADRReq) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_LinkADRReqFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "data_rate_index": + + if _, ok := DataRateIndex_name[int32(m.GetDataRateIndex())]; !ok { + return MACCommand_LinkADRReqValidationError{ + field: "data_rate_index", + reason: "value must be one of the defined enum values", + } + } + + case "tx_power_index": + + if m.GetTxPowerIndex() > 15 { + return MACCommand_LinkADRReqValidationError{ + field: "tx_power_index", + reason: "value must be less than or equal to 15", + } + } + + case "channel_mask": + + if len(m.GetChannelMask()) > 16 { + return MACCommand_LinkADRReqValidationError{ + field: "channel_mask", + reason: "value must contain no more than 16 item(s)", + } + } + + case "channel_mask_control": + + if m.GetChannelMaskControl() > 7 { + return MACCommand_LinkADRReqValidationError{ + field: "channel_mask_control", + reason: "value must be less than or equal to 7", + } + } + + case "nb_trans": + + if m.GetNbTrans() > 15 { + return MACCommand_LinkADRReqValidationError{ + field: "nb_trans", + reason: "value must be less than or equal to 15", + } + } + + default: + return MACCommand_LinkADRReqValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_LinkADRReqValidationError is the validation error returned by +// MACCommand_LinkADRReq.ValidateFields if the designated constraints aren't met. +type MACCommand_LinkADRReqValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_LinkADRReqValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_LinkADRReqValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_LinkADRReqValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_LinkADRReqValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_LinkADRReqValidationError) ErrorName() string { + return "MACCommand_LinkADRReqValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_LinkADRReqValidationError) 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 %sMACCommand_LinkADRReq.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_LinkADRReqValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_LinkADRReqValidationError{} + +// ValidateFields checks the field values on MACCommand_LinkADRAns with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACCommand_LinkADRAns) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_LinkADRAnsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "channel_mask_ack": + // no validation rules for ChannelMaskAck + case "data_rate_index_ack": + // no validation rules for DataRateIndexAck + case "tx_power_index_ack": + // no validation rules for TxPowerIndexAck + default: + return MACCommand_LinkADRAnsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_LinkADRAnsValidationError is the validation error returned by +// MACCommand_LinkADRAns.ValidateFields if the designated constraints aren't met. +type MACCommand_LinkADRAnsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_LinkADRAnsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_LinkADRAnsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_LinkADRAnsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_LinkADRAnsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_LinkADRAnsValidationError) ErrorName() string { + return "MACCommand_LinkADRAnsValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_LinkADRAnsValidationError) 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 %sMACCommand_LinkADRAns.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_LinkADRAnsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_LinkADRAnsValidationError{} + +// ValidateFields checks the field values on MACCommand_DutyCycleReq with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACCommand_DutyCycleReq) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_DutyCycleReqFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "max_duty_cycle": + + if _, ok := AggregatedDutyCycle_name[int32(m.GetMaxDutyCycle())]; !ok { + return MACCommand_DutyCycleReqValidationError{ + field: "max_duty_cycle", + reason: "value must be one of the defined enum values", + } + } + + default: + return MACCommand_DutyCycleReqValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_DutyCycleReqValidationError is the validation error returned by +// MACCommand_DutyCycleReq.ValidateFields if the designated constraints aren't met. +type MACCommand_DutyCycleReqValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_DutyCycleReqValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_DutyCycleReqValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_DutyCycleReqValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_DutyCycleReqValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_DutyCycleReqValidationError) ErrorName() string { + return "MACCommand_DutyCycleReqValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_DutyCycleReqValidationError) 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 %sMACCommand_DutyCycleReq.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_DutyCycleReqValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_DutyCycleReqValidationError{} + +// ValidateFields checks the field values on MACCommand_RxParamSetupReq with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *MACCommand_RxParamSetupReq) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_RxParamSetupReqFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "rx2_data_rate_index": + + if _, ok := DataRateIndex_name[int32(m.GetRx2DataRateIndex())]; !ok { + return MACCommand_RxParamSetupReqValidationError{ + field: "rx2_data_rate_index", + reason: "value must be one of the defined enum values", + } + } + + case "rx1_data_rate_offset": + + if m.GetRx1DataRateOffset() > 7 { + return MACCommand_RxParamSetupReqValidationError{ + field: "rx1_data_rate_offset", + reason: "value must be less than or equal to 7", + } + } + + case "rx2_frequency": + + if m.GetRx2Frequency() < 100000 { + return MACCommand_RxParamSetupReqValidationError{ + field: "rx2_frequency", + reason: "value must be greater than or equal to 100000", + } + } + + default: + return MACCommand_RxParamSetupReqValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_RxParamSetupReqValidationError is the validation error returned +// by MACCommand_RxParamSetupReq.ValidateFields if the designated constraints +// aren't met. +type MACCommand_RxParamSetupReqValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_RxParamSetupReqValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_RxParamSetupReqValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_RxParamSetupReqValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_RxParamSetupReqValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_RxParamSetupReqValidationError) ErrorName() string { + return "MACCommand_RxParamSetupReqValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_RxParamSetupReqValidationError) 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 %sMACCommand_RxParamSetupReq.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_RxParamSetupReqValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_RxParamSetupReqValidationError{} + +// ValidateFields checks the field values on MACCommand_RxParamSetupAns with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *MACCommand_RxParamSetupAns) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_RxParamSetupAnsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "rx2_data_rate_index_ack": + // no validation rules for Rx2DataRateIndexAck + case "rx1_data_rate_offset_ack": + // no validation rules for Rx1DataRateOffsetAck + case "rx2_frequency_ack": + // no validation rules for Rx2FrequencyAck + default: + return MACCommand_RxParamSetupAnsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_RxParamSetupAnsValidationError is the validation error returned +// by MACCommand_RxParamSetupAns.ValidateFields if the designated constraints +// aren't met. +type MACCommand_RxParamSetupAnsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_RxParamSetupAnsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_RxParamSetupAnsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_RxParamSetupAnsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_RxParamSetupAnsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_RxParamSetupAnsValidationError) ErrorName() string { + return "MACCommand_RxParamSetupAnsValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_RxParamSetupAnsValidationError) 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 %sMACCommand_RxParamSetupAns.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_RxParamSetupAnsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_RxParamSetupAnsValidationError{} + +// ValidateFields checks the field values on MACCommand_DevStatusAns with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACCommand_DevStatusAns) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_DevStatusAnsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "battery": + + if m.GetBattery() > 255 { + return MACCommand_DevStatusAnsValidationError{ + field: "battery", + reason: "value must be less than or equal to 255", + } + } + + case "margin": + + if val := m.GetMargin(); val < -32 || val > 31 { + return MACCommand_DevStatusAnsValidationError{ + field: "margin", + reason: "value must be inside range [-32, 31]", + } + } + + default: + return MACCommand_DevStatusAnsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_DevStatusAnsValidationError is the validation error returned by +// MACCommand_DevStatusAns.ValidateFields if the designated constraints aren't met. +type MACCommand_DevStatusAnsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_DevStatusAnsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_DevStatusAnsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_DevStatusAnsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_DevStatusAnsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_DevStatusAnsValidationError) ErrorName() string { + return "MACCommand_DevStatusAnsValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_DevStatusAnsValidationError) 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 %sMACCommand_DevStatusAns.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_DevStatusAnsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_DevStatusAnsValidationError{} + +// ValidateFields checks the field values on MACCommand_NewChannelReq with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACCommand_NewChannelReq) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_NewChannelReqFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "channel_index": + + if m.GetChannelIndex() > 255 { + return MACCommand_NewChannelReqValidationError{ + field: "channel_index", + reason: "value must be less than or equal to 255", + } + } + + case "frequency": + + if m.GetFrequency() < 100000 { + return MACCommand_NewChannelReqValidationError{ + field: "frequency", + reason: "value must be greater than or equal to 100000", + } + } + + case "min_data_rate_index": + + if _, ok := DataRateIndex_name[int32(m.GetMinDataRateIndex())]; !ok { + return MACCommand_NewChannelReqValidationError{ + field: "min_data_rate_index", + reason: "value must be one of the defined enum values", + } + } + + case "max_data_rate_index": + + if _, ok := DataRateIndex_name[int32(m.GetMaxDataRateIndex())]; !ok { + return MACCommand_NewChannelReqValidationError{ + field: "max_data_rate_index", + reason: "value must be one of the defined enum values", + } + } + + default: + return MACCommand_NewChannelReqValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_NewChannelReqValidationError is the validation error returned by +// MACCommand_NewChannelReq.ValidateFields if the designated constraints +// aren't met. +type MACCommand_NewChannelReqValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_NewChannelReqValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_NewChannelReqValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_NewChannelReqValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_NewChannelReqValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_NewChannelReqValidationError) ErrorName() string { + return "MACCommand_NewChannelReqValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_NewChannelReqValidationError) 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 %sMACCommand_NewChannelReq.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_NewChannelReqValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_NewChannelReqValidationError{} + +// ValidateFields checks the field values on MACCommand_NewChannelAns with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACCommand_NewChannelAns) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_NewChannelAnsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "frequency_ack": + // no validation rules for FrequencyAck + case "data_rate_ack": + // no validation rules for DataRateAck + default: + return MACCommand_NewChannelAnsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_NewChannelAnsValidationError is the validation error returned by +// MACCommand_NewChannelAns.ValidateFields if the designated constraints +// aren't met. +type MACCommand_NewChannelAnsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_NewChannelAnsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_NewChannelAnsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_NewChannelAnsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_NewChannelAnsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_NewChannelAnsValidationError) ErrorName() string { + return "MACCommand_NewChannelAnsValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_NewChannelAnsValidationError) 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 %sMACCommand_NewChannelAns.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_NewChannelAnsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_NewChannelAnsValidationError{} + +// ValidateFields checks the field values on MACCommand_DLChannelReq with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACCommand_DLChannelReq) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_DLChannelReqFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "channel_index": + + if m.GetChannelIndex() > 255 { + return MACCommand_DLChannelReqValidationError{ + field: "channel_index", + reason: "value must be less than or equal to 255", + } + } + + case "frequency": + + if m.GetFrequency() < 100000 { + return MACCommand_DLChannelReqValidationError{ + field: "frequency", + reason: "value must be greater than or equal to 100000", + } + } + + default: + return MACCommand_DLChannelReqValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_DLChannelReqValidationError is the validation error returned by +// MACCommand_DLChannelReq.ValidateFields if the designated constraints aren't met. +type MACCommand_DLChannelReqValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_DLChannelReqValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_DLChannelReqValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_DLChannelReqValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_DLChannelReqValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_DLChannelReqValidationError) ErrorName() string { + return "MACCommand_DLChannelReqValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_DLChannelReqValidationError) 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 %sMACCommand_DLChannelReq.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_DLChannelReqValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_DLChannelReqValidationError{} + +// ValidateFields checks the field values on MACCommand_DLChannelAns with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACCommand_DLChannelAns) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_DLChannelAnsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "channel_index_ack": + // no validation rules for ChannelIndexAck + case "frequency_ack": + // no validation rules for FrequencyAck + default: + return MACCommand_DLChannelAnsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_DLChannelAnsValidationError is the validation error returned by +// MACCommand_DLChannelAns.ValidateFields if the designated constraints aren't met. +type MACCommand_DLChannelAnsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_DLChannelAnsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_DLChannelAnsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_DLChannelAnsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_DLChannelAnsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_DLChannelAnsValidationError) ErrorName() string { + return "MACCommand_DLChannelAnsValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_DLChannelAnsValidationError) 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 %sMACCommand_DLChannelAns.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_DLChannelAnsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_DLChannelAnsValidationError{} + +// ValidateFields checks the field values on MACCommand_RxTimingSetupReq with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *MACCommand_RxTimingSetupReq) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_RxTimingSetupReqFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "delay": + + if _, ok := RxDelay_name[int32(m.GetDelay())]; !ok { + return MACCommand_RxTimingSetupReqValidationError{ + field: "delay", + reason: "value must be one of the defined enum values", + } + } + + default: + return MACCommand_RxTimingSetupReqValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_RxTimingSetupReqValidationError is the validation error returned +// by MACCommand_RxTimingSetupReq.ValidateFields if the designated constraints +// aren't met. +type MACCommand_RxTimingSetupReqValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_RxTimingSetupReqValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_RxTimingSetupReqValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_RxTimingSetupReqValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_RxTimingSetupReqValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_RxTimingSetupReqValidationError) ErrorName() string { + return "MACCommand_RxTimingSetupReqValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_RxTimingSetupReqValidationError) 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 %sMACCommand_RxTimingSetupReq.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_RxTimingSetupReqValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_RxTimingSetupReqValidationError{} + +// ValidateFields checks the field values on MACCommand_TxParamSetupReq with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *MACCommand_TxParamSetupReq) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_TxParamSetupReqFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "max_eirp_index": + + if _, ok := DeviceEIRP_name[int32(m.GetMaxEIRPIndex())]; !ok { + return MACCommand_TxParamSetupReqValidationError{ + field: "max_eirp_index", + reason: "value must be one of the defined enum values", + } + } + + case "uplink_dwell_time": + // no validation rules for UplinkDwellTime + case "downlink_dwell_time": + // no validation rules for DownlinkDwellTime + default: + return MACCommand_TxParamSetupReqValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_TxParamSetupReqValidationError is the validation error returned +// by MACCommand_TxParamSetupReq.ValidateFields if the designated constraints +// aren't met. +type MACCommand_TxParamSetupReqValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_TxParamSetupReqValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_TxParamSetupReqValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_TxParamSetupReqValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_TxParamSetupReqValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_TxParamSetupReqValidationError) ErrorName() string { + return "MACCommand_TxParamSetupReqValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_TxParamSetupReqValidationError) 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 %sMACCommand_TxParamSetupReq.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_TxParamSetupReqValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_TxParamSetupReqValidationError{} + +// ValidateFields checks the field values on MACCommand_RekeyInd with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACCommand_RekeyInd) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_RekeyIndFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "minor_version": + + if _, ok := Minor_name[int32(m.GetMinorVersion())]; !ok { + return MACCommand_RekeyIndValidationError{ + field: "minor_version", + reason: "value must be one of the defined enum values", + } + } + + default: + return MACCommand_RekeyIndValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_RekeyIndValidationError is the validation error returned by +// MACCommand_RekeyInd.ValidateFields if the designated constraints aren't met. +type MACCommand_RekeyIndValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_RekeyIndValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_RekeyIndValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_RekeyIndValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_RekeyIndValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_RekeyIndValidationError) ErrorName() string { + return "MACCommand_RekeyIndValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_RekeyIndValidationError) 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 %sMACCommand_RekeyInd.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_RekeyIndValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_RekeyIndValidationError{} + +// ValidateFields checks the field values on MACCommand_RekeyConf with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACCommand_RekeyConf) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_RekeyConfFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "minor_version": + + if _, ok := Minor_name[int32(m.GetMinorVersion())]; !ok { + return MACCommand_RekeyConfValidationError{ + field: "minor_version", + reason: "value must be one of the defined enum values", + } + } + + default: + return MACCommand_RekeyConfValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_RekeyConfValidationError is the validation error returned by +// MACCommand_RekeyConf.ValidateFields if the designated constraints aren't met. +type MACCommand_RekeyConfValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_RekeyConfValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_RekeyConfValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_RekeyConfValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_RekeyConfValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_RekeyConfValidationError) ErrorName() string { + return "MACCommand_RekeyConfValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_RekeyConfValidationError) 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 %sMACCommand_RekeyConf.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_RekeyConfValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_RekeyConfValidationError{} + +// ValidateFields checks the field values on MACCommand_ADRParamSetupReq with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *MACCommand_ADRParamSetupReq) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_ADRParamSetupReqFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "adr_ack_limit_exponent": + + if _, ok := ADRAckLimitExponent_name[int32(m.GetADRAckLimitExponent())]; !ok { + return MACCommand_ADRParamSetupReqValidationError{ + field: "adr_ack_limit_exponent", + reason: "value must be one of the defined enum values", + } + } + + case "adr_ack_delay_exponent": + + if _, ok := ADRAckDelayExponent_name[int32(m.GetADRAckDelayExponent())]; !ok { + return MACCommand_ADRParamSetupReqValidationError{ + field: "adr_ack_delay_exponent", + reason: "value must be one of the defined enum values", + } + } + + default: + return MACCommand_ADRParamSetupReqValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_ADRParamSetupReqValidationError is the validation error returned +// by MACCommand_ADRParamSetupReq.ValidateFields if the designated constraints +// aren't met. +type MACCommand_ADRParamSetupReqValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_ADRParamSetupReqValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_ADRParamSetupReqValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_ADRParamSetupReqValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_ADRParamSetupReqValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_ADRParamSetupReqValidationError) ErrorName() string { + return "MACCommand_ADRParamSetupReqValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_ADRParamSetupReqValidationError) 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 %sMACCommand_ADRParamSetupReq.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_ADRParamSetupReqValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_ADRParamSetupReqValidationError{} + +// ValidateFields checks the field values on MACCommand_DeviceTimeAns with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACCommand_DeviceTimeAns) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_DeviceTimeAnsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "time": + + if v, ok := interface{}(&m.Time).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return MACCommand_DeviceTimeAnsValidationError{ + field: "time", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return MACCommand_DeviceTimeAnsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_DeviceTimeAnsValidationError is the validation error returned by +// MACCommand_DeviceTimeAns.ValidateFields if the designated constraints +// aren't met. +type MACCommand_DeviceTimeAnsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_DeviceTimeAnsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_DeviceTimeAnsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_DeviceTimeAnsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_DeviceTimeAnsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_DeviceTimeAnsValidationError) ErrorName() string { + return "MACCommand_DeviceTimeAnsValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_DeviceTimeAnsValidationError) 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 %sMACCommand_DeviceTimeAns.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_DeviceTimeAnsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_DeviceTimeAnsValidationError{} + +// ValidateFields checks the field values on MACCommand_ForceRejoinReq with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACCommand_ForceRejoinReq) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_ForceRejoinReqFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "rejoin_type": + + if _, ok := RejoinType_name[int32(m.GetRejoinType())]; !ok { + return MACCommand_ForceRejoinReqValidationError{ + field: "rejoin_type", + reason: "value must be one of the defined enum values", + } + } + + case "data_rate_index": + + if _, ok := DataRateIndex_name[int32(m.GetDataRateIndex())]; !ok { + return MACCommand_ForceRejoinReqValidationError{ + field: "data_rate_index", + reason: "value must be one of the defined enum values", + } + } + + case "max_retries": + + if m.GetMaxRetries() > 7 { + return MACCommand_ForceRejoinReqValidationError{ + field: "max_retries", + reason: "value must be less than or equal to 7", + } + } + + case "period_exponent": + + if _, ok := RejoinPeriodExponent_name[int32(m.GetPeriodExponent())]; !ok { + return MACCommand_ForceRejoinReqValidationError{ + field: "period_exponent", + reason: "value must be one of the defined enum values", + } + } + + default: + return MACCommand_ForceRejoinReqValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_ForceRejoinReqValidationError is the validation error returned by +// MACCommand_ForceRejoinReq.ValidateFields if the designated constraints +// aren't met. +type MACCommand_ForceRejoinReqValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_ForceRejoinReqValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_ForceRejoinReqValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_ForceRejoinReqValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_ForceRejoinReqValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_ForceRejoinReqValidationError) ErrorName() string { + return "MACCommand_ForceRejoinReqValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_ForceRejoinReqValidationError) 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 %sMACCommand_ForceRejoinReq.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_ForceRejoinReqValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_ForceRejoinReqValidationError{} + +// ValidateFields checks the field values on MACCommand_RejoinParamSetupReq +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *MACCommand_RejoinParamSetupReq) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_RejoinParamSetupReqFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "max_count_exponent": + + if _, ok := RejoinCountExponent_name[int32(m.GetMaxCountExponent())]; !ok { + return MACCommand_RejoinParamSetupReqValidationError{ + field: "max_count_exponent", + reason: "value must be one of the defined enum values", + } + } + + case "max_time_exponent": + + if _, ok := RejoinTimeExponent_name[int32(m.GetMaxTimeExponent())]; !ok { + return MACCommand_RejoinParamSetupReqValidationError{ + field: "max_time_exponent", + reason: "value must be one of the defined enum values", + } + } + + default: + return MACCommand_RejoinParamSetupReqValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_RejoinParamSetupReqValidationError is the validation error +// returned by MACCommand_RejoinParamSetupReq.ValidateFields if the designated +// constraints aren't met. +type MACCommand_RejoinParamSetupReqValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_RejoinParamSetupReqValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_RejoinParamSetupReqValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_RejoinParamSetupReqValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_RejoinParamSetupReqValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_RejoinParamSetupReqValidationError) ErrorName() string { + return "MACCommand_RejoinParamSetupReqValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_RejoinParamSetupReqValidationError) 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 %sMACCommand_RejoinParamSetupReq.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_RejoinParamSetupReqValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_RejoinParamSetupReqValidationError{} + +// ValidateFields checks the field values on MACCommand_RejoinParamSetupAns +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *MACCommand_RejoinParamSetupAns) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_RejoinParamSetupAnsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "max_time_exponent_ack": + // no validation rules for MaxTimeExponentAck + default: + return MACCommand_RejoinParamSetupAnsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_RejoinParamSetupAnsValidationError is the validation error +// returned by MACCommand_RejoinParamSetupAns.ValidateFields if the designated +// constraints aren't met. +type MACCommand_RejoinParamSetupAnsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_RejoinParamSetupAnsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_RejoinParamSetupAnsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_RejoinParamSetupAnsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_RejoinParamSetupAnsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_RejoinParamSetupAnsValidationError) ErrorName() string { + return "MACCommand_RejoinParamSetupAnsValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_RejoinParamSetupAnsValidationError) 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 %sMACCommand_RejoinParamSetupAns.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_RejoinParamSetupAnsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_RejoinParamSetupAnsValidationError{} + +// ValidateFields checks the field values on MACCommand_PingSlotInfoReq with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *MACCommand_PingSlotInfoReq) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_PingSlotInfoReqFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "period": + + if _, ok := PingSlotPeriod_name[int32(m.GetPeriod())]; !ok { + return MACCommand_PingSlotInfoReqValidationError{ + field: "period", + reason: "value must be one of the defined enum values", + } + } + + default: + return MACCommand_PingSlotInfoReqValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_PingSlotInfoReqValidationError is the validation error returned +// by MACCommand_PingSlotInfoReq.ValidateFields if the designated constraints +// aren't met. +type MACCommand_PingSlotInfoReqValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_PingSlotInfoReqValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_PingSlotInfoReqValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_PingSlotInfoReqValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_PingSlotInfoReqValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_PingSlotInfoReqValidationError) ErrorName() string { + return "MACCommand_PingSlotInfoReqValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_PingSlotInfoReqValidationError) 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 %sMACCommand_PingSlotInfoReq.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_PingSlotInfoReqValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_PingSlotInfoReqValidationError{} + +// ValidateFields checks the field values on MACCommand_PingSlotChannelReq with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *MACCommand_PingSlotChannelReq) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_PingSlotChannelReqFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "frequency": + + if m.GetFrequency() < 100000 { + return MACCommand_PingSlotChannelReqValidationError{ + field: "frequency", + reason: "value must be greater than or equal to 100000", + } + } + + case "data_rate_index": + + if _, ok := DataRateIndex_name[int32(m.GetDataRateIndex())]; !ok { + return MACCommand_PingSlotChannelReqValidationError{ + field: "data_rate_index", + reason: "value must be one of the defined enum values", + } + } + + default: + return MACCommand_PingSlotChannelReqValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_PingSlotChannelReqValidationError is the validation error +// returned by MACCommand_PingSlotChannelReq.ValidateFields if the designated +// constraints aren't met. +type MACCommand_PingSlotChannelReqValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_PingSlotChannelReqValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_PingSlotChannelReqValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_PingSlotChannelReqValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_PingSlotChannelReqValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_PingSlotChannelReqValidationError) ErrorName() string { + return "MACCommand_PingSlotChannelReqValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_PingSlotChannelReqValidationError) 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 %sMACCommand_PingSlotChannelReq.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_PingSlotChannelReqValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_PingSlotChannelReqValidationError{} + +// ValidateFields checks the field values on MACCommand_PingSlotChannelAns with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *MACCommand_PingSlotChannelAns) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_PingSlotChannelAnsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "frequency_ack": + // no validation rules for FrequencyAck + case "data_rate_index_ack": + // no validation rules for DataRateIndexAck + default: + return MACCommand_PingSlotChannelAnsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_PingSlotChannelAnsValidationError is the validation error +// returned by MACCommand_PingSlotChannelAns.ValidateFields if the designated +// constraints aren't met. +type MACCommand_PingSlotChannelAnsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_PingSlotChannelAnsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_PingSlotChannelAnsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_PingSlotChannelAnsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_PingSlotChannelAnsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_PingSlotChannelAnsValidationError) ErrorName() string { + return "MACCommand_PingSlotChannelAnsValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_PingSlotChannelAnsValidationError) 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 %sMACCommand_PingSlotChannelAns.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_PingSlotChannelAnsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_PingSlotChannelAnsValidationError{} + +// ValidateFields checks the field values on MACCommand_BeaconTimingAns with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *MACCommand_BeaconTimingAns) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_BeaconTimingAnsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "delay": + + if m.GetDelay() > 65535 { + return MACCommand_BeaconTimingAnsValidationError{ + field: "delay", + reason: "value must be less than or equal to 65535", + } + } + + case "channel_index": + + if m.GetChannelIndex() > 255 { + return MACCommand_BeaconTimingAnsValidationError{ + field: "channel_index", + reason: "value must be less than or equal to 255", + } + } + + default: + return MACCommand_BeaconTimingAnsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_BeaconTimingAnsValidationError is the validation error returned +// by MACCommand_BeaconTimingAns.ValidateFields if the designated constraints +// aren't met. +type MACCommand_BeaconTimingAnsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_BeaconTimingAnsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_BeaconTimingAnsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_BeaconTimingAnsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_BeaconTimingAnsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_BeaconTimingAnsValidationError) ErrorName() string { + return "MACCommand_BeaconTimingAnsValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_BeaconTimingAnsValidationError) 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 %sMACCommand_BeaconTimingAns.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_BeaconTimingAnsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_BeaconTimingAnsValidationError{} + +// ValidateFields checks the field values on MACCommand_BeaconFreqReq with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACCommand_BeaconFreqReq) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_BeaconFreqReqFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "frequency": + + if m.GetFrequency() < 100000 { + return MACCommand_BeaconFreqReqValidationError{ + field: "frequency", + reason: "value must be greater than or equal to 100000", + } + } + + default: + return MACCommand_BeaconFreqReqValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_BeaconFreqReqValidationError is the validation error returned by +// MACCommand_BeaconFreqReq.ValidateFields if the designated constraints +// aren't met. +type MACCommand_BeaconFreqReqValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_BeaconFreqReqValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_BeaconFreqReqValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_BeaconFreqReqValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_BeaconFreqReqValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_BeaconFreqReqValidationError) ErrorName() string { + return "MACCommand_BeaconFreqReqValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_BeaconFreqReqValidationError) 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 %sMACCommand_BeaconFreqReq.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_BeaconFreqReqValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_BeaconFreqReqValidationError{} + +// ValidateFields checks the field values on MACCommand_BeaconFreqAns with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACCommand_BeaconFreqAns) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_BeaconFreqAnsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "frequency_ack": + // no validation rules for FrequencyAck + default: + return MACCommand_BeaconFreqAnsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_BeaconFreqAnsValidationError is the validation error returned by +// MACCommand_BeaconFreqAns.ValidateFields if the designated constraints +// aren't met. +type MACCommand_BeaconFreqAnsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_BeaconFreqAnsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_BeaconFreqAnsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_BeaconFreqAnsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_BeaconFreqAnsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_BeaconFreqAnsValidationError) ErrorName() string { + return "MACCommand_BeaconFreqAnsValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_BeaconFreqAnsValidationError) 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 %sMACCommand_BeaconFreqAns.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_BeaconFreqAnsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_BeaconFreqAnsValidationError{} + +// ValidateFields checks the field values on MACCommand_DeviceModeInd with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACCommand_DeviceModeInd) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_DeviceModeIndFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "class": + + if _, ok := Class_name[int32(m.GetClass())]; !ok { + return MACCommand_DeviceModeIndValidationError{ + field: "class", + reason: "value must be one of the defined enum values", + } + } + + default: + return MACCommand_DeviceModeIndValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_DeviceModeIndValidationError is the validation error returned by +// MACCommand_DeviceModeInd.ValidateFields if the designated constraints +// aren't met. +type MACCommand_DeviceModeIndValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_DeviceModeIndValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_DeviceModeIndValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_DeviceModeIndValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_DeviceModeIndValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_DeviceModeIndValidationError) ErrorName() string { + return "MACCommand_DeviceModeIndValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_DeviceModeIndValidationError) 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 %sMACCommand_DeviceModeInd.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_DeviceModeIndValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_DeviceModeIndValidationError{} + +// ValidateFields checks the field values on MACCommand_DeviceModeConf with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MACCommand_DeviceModeConf) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MACCommand_DeviceModeConfFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "class": + + if _, ok := Class_name[int32(m.GetClass())]; !ok { + return MACCommand_DeviceModeConfValidationError{ + field: "class", + reason: "value must be one of the defined enum values", + } + } + + default: + return MACCommand_DeviceModeConfValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MACCommand_DeviceModeConfValidationError is the validation error returned by +// MACCommand_DeviceModeConf.ValidateFields if the designated constraints +// aren't met. +type MACCommand_DeviceModeConfValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MACCommand_DeviceModeConfValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MACCommand_DeviceModeConfValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MACCommand_DeviceModeConfValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MACCommand_DeviceModeConfValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MACCommand_DeviceModeConfValidationError) ErrorName() string { + return "MACCommand_DeviceModeConfValidationError" +} + +// Error satisfies the builtin error interface +func (e MACCommand_DeviceModeConfValidationError) 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 %sMACCommand_DeviceModeConf.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MACCommand_DeviceModeConfValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MACCommand_DeviceModeConfValidationError{} diff --git a/pkg/ttnpb/lorawan.validator.pb.go b/pkg/ttnpb/lorawan.validator.pb.go deleted file mode 100644 index f37608c3b5..0000000000 --- a/pkg/ttnpb/lorawan.validator.pb.go +++ /dev/null @@ -1,496 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/lorawan.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import fmt "fmt" -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/struct" -import _ "github.com/golang/protobuf/ptypes/timestamp" -import _ "github.com/mwitkow/go-proto-validators" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *Message) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.MHDR)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("MHDR", err) - } - if oneOfNester, ok := this.GetPayload().(*Message_MACPayload); ok { - if oneOfNester.MACPayload != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.MACPayload); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("MACPayload", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*Message_JoinRequestPayload); ok { - if oneOfNester.JoinRequestPayload != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.JoinRequestPayload); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("JoinRequestPayload", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*Message_JoinAcceptPayload); ok { - if oneOfNester.JoinAcceptPayload != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.JoinAcceptPayload); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("JoinAcceptPayload", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*Message_RejoinRequestPayload); ok { - if oneOfNester.RejoinRequestPayload != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.RejoinRequestPayload); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("RejoinRequestPayload", err) - } - } - } - return nil -} -func (this *MHDR) Validate() error { - return nil -} -func (this *MACPayload) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FHDR)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FHDR", err) - } - if !(this.FPort < 256) { - return github_com_mwitkow_go_proto_validators.FieldError("FPort", fmt.Errorf(`value '%v' must be less than '256'`, this.FPort)) - } - if this.DecodedPayload != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.DecodedPayload); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DecodedPayload", err) - } - } - return nil -} -func (this *FHDR) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FCtrl)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FCtrl", err) - } - if !(this.FCnt < 65536) { - return github_com_mwitkow_go_proto_validators.FieldError("FCnt", fmt.Errorf(`value '%v' must be less than '65536'`, this.FCnt)) - } - return nil -} -func (this *FCtrl) Validate() error { - return nil -} -func (this *JoinRequestPayload) Validate() error { - return nil -} -func (this *RejoinRequestPayload) Validate() error { - return nil -} -func (this *JoinAcceptPayload) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.DLSettings)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DLSettings", err) - } - if this.CFList != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.CFList); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("CFList", err) - } - } - return nil -} -func (this *DLSettings) Validate() error { - return nil -} -func (this *CFList) Validate() error { - return nil -} -func (this *LoRaDataRate) Validate() error { - return nil -} -func (this *FSKDataRate) Validate() error { - return nil -} -func (this *DataRate) Validate() error { - if oneOfNester, ok := this.GetModulation().(*DataRate_LoRa); ok { - if oneOfNester.LoRa != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.LoRa); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("LoRa", err) - } - } - } - if oneOfNester, ok := this.GetModulation().(*DataRate_FSK); ok { - if oneOfNester.FSK != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.FSK); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FSK", err) - } - } - } - return nil -} -func (this *TxSettings) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.DataRate)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DataRate", err) - } - if !(this.GatewayChannelIndex < 256) { - return github_com_mwitkow_go_proto_validators.FieldError("GatewayChannelIndex", fmt.Errorf(`value '%v' must be less than '256'`, this.GatewayChannelIndex)) - } - if !(this.DeviceChannelIndex < 256) { - return github_com_mwitkow_go_proto_validators.FieldError("DeviceChannelIndex", fmt.Errorf(`value '%v' must be less than '256'`, this.DeviceChannelIndex)) - } - if this.Time != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Time); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Time", err) - } - } - return nil -} -func (this *GatewayAntennaIdentifiers) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.GatewayIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("GatewayIdentifiers", err) - } - return nil -} -func (this *UplinkToken) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.GatewayAntennaIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("GatewayAntennaIdentifiers", err) - } - return nil -} -func (this *DownlinkPath) Validate() error { - if oneOfNester, ok := this.GetPath().(*DownlinkPath_Fixed); ok { - if oneOfNester.Fixed != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.Fixed); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Fixed", err) - } - } - } - return nil -} -func (this *TxRequest) Validate() error { - for _, item := range this.DownlinkPaths { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DownlinkPaths", err) - } - } - } - if this.AbsoluteTime != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.AbsoluteTime); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("AbsoluteTime", err) - } - } - if this.Advanced != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Advanced); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Advanced", err) - } - } - return nil -} -func (this *MACCommand) Validate() error { - if oneOfNester, ok := this.GetPayload().(*MACCommand_ResetInd_); ok { - if oneOfNester.ResetInd != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.ResetInd); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ResetInd", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_ResetConf_); ok { - if oneOfNester.ResetConf != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.ResetConf); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ResetConf", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_LinkCheckAns_); ok { - if oneOfNester.LinkCheckAns != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.LinkCheckAns); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("LinkCheckAns", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_LinkADRReq_); ok { - if oneOfNester.LinkADRReq != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.LinkADRReq); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("LinkADRReq", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_LinkADRAns_); ok { - if oneOfNester.LinkADRAns != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.LinkADRAns); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("LinkADRAns", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_DutyCycleReq_); ok { - if oneOfNester.DutyCycleReq != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.DutyCycleReq); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DutyCycleReq", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_RxParamSetupReq_); ok { - if oneOfNester.RxParamSetupReq != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.RxParamSetupReq); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("RxParamSetupReq", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_RxParamSetupAns_); ok { - if oneOfNester.RxParamSetupAns != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.RxParamSetupAns); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("RxParamSetupAns", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_DevStatusAns_); ok { - if oneOfNester.DevStatusAns != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.DevStatusAns); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DevStatusAns", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_NewChannelReq_); ok { - if oneOfNester.NewChannelReq != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.NewChannelReq); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("NewChannelReq", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_NewChannelAns_); ok { - if oneOfNester.NewChannelAns != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.NewChannelAns); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("NewChannelAns", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_DLChannelReq_); ok { - if oneOfNester.DLChannelReq != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.DLChannelReq); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DLChannelReq", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_DLChannelAns_); ok { - if oneOfNester.DLChannelAns != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.DLChannelAns); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DLChannelAns", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_RxTimingSetupReq_); ok { - if oneOfNester.RxTimingSetupReq != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.RxTimingSetupReq); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("RxTimingSetupReq", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_TxParamSetupReq_); ok { - if oneOfNester.TxParamSetupReq != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.TxParamSetupReq); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("TxParamSetupReq", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_RekeyInd_); ok { - if oneOfNester.RekeyInd != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.RekeyInd); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("RekeyInd", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_RekeyConf_); ok { - if oneOfNester.RekeyConf != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.RekeyConf); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("RekeyConf", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_ADRParamSetupReq_); ok { - if oneOfNester.ADRParamSetupReq != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.ADRParamSetupReq); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ADRParamSetupReq", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_DeviceTimeAns_); ok { - if oneOfNester.DeviceTimeAns != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.DeviceTimeAns); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DeviceTimeAns", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_ForceRejoinReq_); ok { - if oneOfNester.ForceRejoinReq != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.ForceRejoinReq); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ForceRejoinReq", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_RejoinParamSetupReq_); ok { - if oneOfNester.RejoinParamSetupReq != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.RejoinParamSetupReq); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("RejoinParamSetupReq", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_RejoinParamSetupAns_); ok { - if oneOfNester.RejoinParamSetupAns != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.RejoinParamSetupAns); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("RejoinParamSetupAns", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_PingSlotInfoReq_); ok { - if oneOfNester.PingSlotInfoReq != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.PingSlotInfoReq); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("PingSlotInfoReq", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_PingSlotChannelReq_); ok { - if oneOfNester.PingSlotChannelReq != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.PingSlotChannelReq); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("PingSlotChannelReq", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_PingSlotChannelAns_); ok { - if oneOfNester.PingSlotChannelAns != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.PingSlotChannelAns); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("PingSlotChannelAns", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_BeaconTimingAns_); ok { - if oneOfNester.BeaconTimingAns != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.BeaconTimingAns); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("BeaconTimingAns", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_BeaconFreqReq_); ok { - if oneOfNester.BeaconFreqReq != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.BeaconFreqReq); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("BeaconFreqReq", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_BeaconFreqAns_); ok { - if oneOfNester.BeaconFreqAns != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.BeaconFreqAns); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("BeaconFreqAns", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_DeviceModeInd_); ok { - if oneOfNester.DeviceModeInd != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.DeviceModeInd); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DeviceModeInd", err) - } - } - } - if oneOfNester, ok := this.GetPayload().(*MACCommand_DeviceModeConf_); ok { - if oneOfNester.DeviceModeConf != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.DeviceModeConf); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DeviceModeConf", err) - } - } - } - return nil -} -func (this *MACCommand_ResetInd) Validate() error { - return nil -} -func (this *MACCommand_ResetConf) Validate() error { - return nil -} -func (this *MACCommand_LinkCheckAns) Validate() error { - return nil -} -func (this *MACCommand_LinkADRReq) Validate() error { - return nil -} -func (this *MACCommand_LinkADRAns) Validate() error { - return nil -} -func (this *MACCommand_DutyCycleReq) Validate() error { - return nil -} -func (this *MACCommand_RxParamSetupReq) Validate() error { - return nil -} -func (this *MACCommand_RxParamSetupAns) Validate() error { - return nil -} -func (this *MACCommand_DevStatusAns) Validate() error { - return nil -} -func (this *MACCommand_NewChannelReq) Validate() error { - return nil -} -func (this *MACCommand_NewChannelAns) Validate() error { - return nil -} -func (this *MACCommand_DLChannelReq) Validate() error { - return nil -} -func (this *MACCommand_DLChannelAns) Validate() error { - return nil -} -func (this *MACCommand_RxTimingSetupReq) Validate() error { - return nil -} -func (this *MACCommand_TxParamSetupReq) Validate() error { - return nil -} -func (this *MACCommand_RekeyInd) Validate() error { - return nil -} -func (this *MACCommand_RekeyConf) Validate() error { - return nil -} -func (this *MACCommand_ADRParamSetupReq) Validate() error { - return nil -} -func (this *MACCommand_DeviceTimeAns) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Time)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Time", err) - } - return nil -} -func (this *MACCommand_ForceRejoinReq) Validate() error { - return nil -} -func (this *MACCommand_RejoinParamSetupReq) Validate() error { - return nil -} -func (this *MACCommand_RejoinParamSetupAns) Validate() error { - return nil -} -func (this *MACCommand_PingSlotInfoReq) Validate() error { - return nil -} -func (this *MACCommand_PingSlotChannelReq) Validate() error { - return nil -} -func (this *MACCommand_PingSlotChannelAns) Validate() error { - return nil -} -func (this *MACCommand_BeaconTimingAns) Validate() error { - return nil -} -func (this *MACCommand_BeaconFreqReq) Validate() error { - return nil -} -func (this *MACCommand_BeaconFreqAns) Validate() error { - return nil -} -func (this *MACCommand_DeviceModeInd) Validate() error { - return nil -} -func (this *MACCommand_DeviceModeConf) Validate() error { - return nil -} diff --git a/pkg/ttnpb/lorawan_populate.go b/pkg/ttnpb/lorawan_populate.go index 204747f77c..6d49af27d7 100644 --- a/pkg/ttnpb/lorawan_populate.go +++ b/pkg/ttnpb/lorawan_populate.go @@ -22,11 +22,231 @@ import ( "go.thethings.network/lorawan-stack/pkg/types" ) +// NewPopulatedFrequency returns a uint64 in range [100000, 1677721600]. +func NewPopulatedFrequency(r randyEndDevice, _ bool) uint64 { + return 100000 + uint64(r.Int63()%(1677721600-100000)) +} + func NewPopulatedDataRateIndex(r randyEndDevice, _ bool) DataRateIndex { return DataRateIndex(r.Intn(16)) } -func NewPopulatedFHDR(r randyLorawan, easy bool) *FHDR { +func NewPopulatedChannelIndex(r randyEndDevice, _ bool) uint32 { + return r.Uint32() % 256 +} + +func NewPopulatedMACCommand_ResetInd(r randyLorawan, _ bool) *MACCommand_ResetInd { + out := &MACCommand_ResetInd{} + out.MinorVersion = MINOR_1 + return out +} + +func NewPopulatedMACCommand_ResetConf(r randyLorawan, _ bool) *MACCommand_ResetConf { + out := &MACCommand_ResetConf{} + out.MinorVersion = MINOR_1 + return out +} + +func NewPopulatedMACCommand_LinkCheckAns(r randyLorawan, _ bool) *MACCommand_LinkCheckAns { + out := &MACCommand_LinkCheckAns{} + out.Margin = r.Uint32() % 255 + out.GatewayCount = r.Uint32() % 256 + return out +} + +func NewPopulatedMACCommand_LinkADRReq(r randyLorawan, easy bool) *MACCommand_LinkADRReq { + out := &MACCommand_LinkADRReq{} + out.DataRateIndex = NewPopulatedDataRateIndex(r, easy) + out.TxPowerIndex = r.Uint32() % 16 + out.ChannelMask = make([]bool, r.Intn(17)) + for i := 0; i < len(out.ChannelMask); i++ { + out.ChannelMask[i] = r.Intn(2) == 0 + } + out.ChannelMaskControl = r.Uint32() % 8 + out.NbTrans = r.Uint32() % 16 + return out +} + +func NewPopulatedMACCommand_RxParamSetupReq(r randyLorawan, easy bool) *MACCommand_RxParamSetupReq { + out := &MACCommand_RxParamSetupReq{} + out.Rx2DataRateIndex = NewPopulatedDataRateIndex(r, easy) + out.Rx1DataRateOffset = r.Uint32() % 8 + out.Rx2Frequency = NewPopulatedFrequency(r, easy) + return out +} + +func NewPopulatedMACCommand_DevStatusAns(r randyLorawan, _ bool) *MACCommand_DevStatusAns { + out := &MACCommand_DevStatusAns{} + out.Battery = r.Uint32() % 256 + out.Margin = r.Int31() % 32 + if r.Intn(2) == 0 { + out.Margin *= -1 + } + return out +} + +func NewPopulatedMACCommand_NewChannelReq(r randyLorawan, easy bool) *MACCommand_NewChannelReq { + out := &MACCommand_NewChannelReq{} + out.ChannelIndex = NewPopulatedChannelIndex(r, easy) + out.Frequency = NewPopulatedFrequency(r, easy) + out.MinDataRateIndex = NewPopulatedDataRateIndex(r, easy) + out.MaxDataRateIndex = NewPopulatedDataRateIndex(r, easy) + return out +} + +func NewPopulatedMACCommand_DLChannelReq(r randyLorawan, easy bool) *MACCommand_DLChannelReq { + out := &MACCommand_DLChannelReq{} + out.ChannelIndex = NewPopulatedChannelIndex(r, easy) + out.Frequency = NewPopulatedFrequency(r, easy) + return out +} + +func NewPopulatedMACCommand_ForceRejoinReq(r randyLorawan, easy bool) *MACCommand_ForceRejoinReq { + out := &MACCommand_ForceRejoinReq{} + out.RejoinType = RejoinType(r.Intn(3)) + out.DataRateIndex = NewPopulatedDataRateIndex(r, easy) + out.MaxRetries = r.Uint32() % 8 + out.PeriodExponent = RejoinPeriodExponent(r.Intn(8)) + return out +} + +func NewPopulatedMACCommand_PingSlotChannelReq(r randyLorawan, easy bool) *MACCommand_PingSlotChannelReq { + out := &MACCommand_PingSlotChannelReq{} + out.Frequency = NewPopulatedFrequency(r, easy) + out.DataRateIndex = NewPopulatedDataRateIndex(r, easy) + return out +} + +func NewPopulatedMACCommand_BeaconTimingAns(r randyLorawan, easy bool) *MACCommand_BeaconTimingAns { + out := &MACCommand_BeaconTimingAns{} + out.Delay = r.Uint32() % 65536 + out.ChannelIndex = r.Uint32() % 256 + return out +} + +func NewPopulatedMACCommand_BeaconFreqReq(r randyLorawan, easy bool) *MACCommand_BeaconFreqReq { + out := &MACCommand_BeaconFreqReq{} + out.Frequency = NewPopulatedFrequency(r, easy) + return out +} + +func NewPopulatedMACCommand(r randyLorawan, easy bool) *MACCommand { + out := &MACCommand{} + out.CID = MACCommandIdentifier([]int32{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 32}[r.Intn(20)]) + switch out.CID { + case CID_RESET: + if r.Intn(2) == 1 { + out.Payload = &MACCommand_ResetInd_{ResetInd: NewPopulatedMACCommand_ResetInd(r, easy)} + } else { + out.Payload = &MACCommand_ResetConf_{ResetConf: NewPopulatedMACCommand_ResetConf(r, easy)} + } + case CID_LINK_CHECK: + if r.Intn(2) == 1 { + out.Payload = &MACCommand_LinkCheckAns_{LinkCheckAns: NewPopulatedMACCommand_LinkCheckAns(r, easy)} + } + case CID_LINK_ADR: + if r.Intn(2) == 1 { + out.Payload = &MACCommand_LinkADRReq_{LinkADRReq: NewPopulatedMACCommand_LinkADRReq(r, easy)} + } else { + out.Payload = &MACCommand_LinkADRAns_{LinkADRAns: NewPopulatedMACCommand_LinkADRAns(r, easy)} + } + case CID_DUTY_CYCLE: + if r.Intn(2) == 1 { + out.Payload = &MACCommand_DutyCycleReq_{DutyCycleReq: NewPopulatedMACCommand_DutyCycleReq(r, easy)} + } + case CID_RX_PARAM_SETUP: + if r.Intn(2) == 1 { + out.Payload = &MACCommand_RxParamSetupReq_{RxParamSetupReq: NewPopulatedMACCommand_RxParamSetupReq(r, easy)} + } else { + out.Payload = &MACCommand_RxParamSetupAns_{RxParamSetupAns: NewPopulatedMACCommand_RxParamSetupAns(r, easy)} + } + case CID_DEV_STATUS: + if r.Intn(2) == 1 { + out.Payload = &MACCommand_DevStatusAns_{DevStatusAns: NewPopulatedMACCommand_DevStatusAns(r, easy)} + } + case CID_NEW_CHANNEL: + if r.Intn(2) == 1 { + out.Payload = &MACCommand_NewChannelReq_{NewChannelReq: NewPopulatedMACCommand_NewChannelReq(r, easy)} + } else { + out.Payload = &MACCommand_NewChannelAns_{NewChannelAns: NewPopulatedMACCommand_NewChannelAns(r, easy)} + } + case CID_DL_CHANNEL: + if r.Intn(2) == 1 { + out.Payload = &MACCommand_DLChannelReq_{DLChannelReq: NewPopulatedMACCommand_DLChannelReq(r, easy)} + } else { + out.Payload = &MACCommand_DLChannelAns_{DLChannelAns: NewPopulatedMACCommand_DLChannelAns(r, easy)} + } + case CID_RX_TIMING_SETUP: + if r.Intn(2) == 1 { + out.Payload = &MACCommand_RxTimingSetupReq_{RxTimingSetupReq: NewPopulatedMACCommand_RxTimingSetupReq(r, easy)} + } + case CID_TX_PARAM_SETUP: + if r.Intn(2) == 1 { + out.Payload = &MACCommand_TxParamSetupReq_{TxParamSetupReq: NewPopulatedMACCommand_TxParamSetupReq(r, easy)} + } + case CID_REKEY: + if r.Intn(2) == 1 { + out.Payload = &MACCommand_RekeyInd_{RekeyInd: NewPopulatedMACCommand_RekeyInd(r, easy)} + } else { + out.Payload = &MACCommand_RekeyConf_{RekeyConf: NewPopulatedMACCommand_RekeyConf(r, easy)} + } + case CID_ADR_PARAM_SETUP: + if r.Intn(2) == 1 { + out.Payload = &MACCommand_ADRParamSetupReq_{ADRParamSetupReq: NewPopulatedMACCommand_ADRParamSetupReq(r, easy)} + } + case CID_DEVICE_TIME: + if r.Intn(2) == 1 { + out.Payload = &MACCommand_DeviceTimeAns_{DeviceTimeAns: NewPopulatedMACCommand_DeviceTimeAns(r, easy)} + } + case CID_FORCE_REJOIN: + if r.Intn(2) == 1 { + out.Payload = &MACCommand_ForceRejoinReq_{ForceRejoinReq: NewPopulatedMACCommand_ForceRejoinReq(r, easy)} + } + case CID_REJOIN_PARAM_SETUP: + if r.Intn(2) == 1 { + out.Payload = &MACCommand_RejoinParamSetupReq_{RejoinParamSetupReq: NewPopulatedMACCommand_RejoinParamSetupReq(r, easy)} + } else { + out.Payload = &MACCommand_RejoinParamSetupAns_{RejoinParamSetupAns: NewPopulatedMACCommand_RejoinParamSetupAns(r, easy)} + } + case CID_PING_SLOT_INFO: + if r.Intn(2) == 1 { + out.Payload = &MACCommand_PingSlotInfoReq_{PingSlotInfoReq: NewPopulatedMACCommand_PingSlotInfoReq(r, easy)} + } + case CID_PING_SLOT_CHANNEL: + if r.Intn(2) == 1 { + out.Payload = &MACCommand_PingSlotChannelReq_{PingSlotChannelReq: NewPopulatedMACCommand_PingSlotChannelReq(r, easy)} + } else { + out.Payload = &MACCommand_PingSlotChannelAns_{PingSlotChannelAns: NewPopulatedMACCommand_PingSlotChannelAns(r, easy)} + } + case CID_BEACON_TIMING: + if r.Intn(2) == 1 { + out.Payload = &MACCommand_BeaconTimingAns_{BeaconTimingAns: NewPopulatedMACCommand_BeaconTimingAns(r, easy)} + } + case CID_BEACON_FREQ: + if r.Intn(2) == 1 { + out.Payload = &MACCommand_BeaconFreqReq_{BeaconFreqReq: NewPopulatedMACCommand_BeaconFreqReq(r, easy)} + } else { + out.Payload = &MACCommand_BeaconFreqAns_{BeaconFreqAns: NewPopulatedMACCommand_BeaconFreqAns(r, easy)} + } + case CID_DEVICE_MODE: + if r.Intn(2) == 1 { + out.Payload = &MACCommand_DeviceModeInd_{DeviceModeInd: NewPopulatedMACCommand_DeviceModeInd(r, easy)} + } else { + out.Payload = &MACCommand_DeviceModeConf_{DeviceModeConf: NewPopulatedMACCommand_DeviceModeConf(r, easy)} + } + default: + if r.Intn(2) == 1 { + b := make([]byte, r.Intn(100)) + for i := 0; i < len(b); i++ { + b[i] = byte(r.Int63()) + } + out.Payload = &MACCommand_RawPayload{RawPayload: b} + } + } + return out +} + +func NewPopulatedFHDR(r randyLorawan, _ bool) *FHDR { out := &FHDR{} out.DevAddr = *types.NewPopulatedDevAddr(r) out.FCtrl = *NewPopulatedFCtrl(r, false) diff --git a/pkg/ttnpb/message_services.pb.go b/pkg/ttnpb/message_services.pb.go index db0a660fc8..17b0c935f7 100644 --- a/pkg/ttnpb/message_services.pb.go +++ b/pkg/ttnpb/message_services.pb.go @@ -8,6 +8,7 @@ import golang_proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" +import _ "github.com/lyft/protoc-gen-validate/validate" import ( context "context" @@ -44,7 +45,7 @@ type ProcessUplinkMessageRequest struct { func (m *ProcessUplinkMessageRequest) Reset() { *m = ProcessUplinkMessageRequest{} } func (*ProcessUplinkMessageRequest) ProtoMessage() {} func (*ProcessUplinkMessageRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_message_services_60896bf540219283, []int{0} + return fileDescriptor_message_services_3b702a4f872eaf5e, []int{0} } func (m *ProcessUplinkMessageRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -106,7 +107,7 @@ type ProcessDownlinkMessageRequest struct { func (m *ProcessDownlinkMessageRequest) Reset() { *m = ProcessDownlinkMessageRequest{} } func (*ProcessDownlinkMessageRequest) ProtoMessage() {} func (*ProcessDownlinkMessageRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_message_services_60896bf540219283, []int{1} + return fileDescriptor_message_services_3b702a4f872eaf5e, []int{1} } func (m *ProcessDownlinkMessageRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1099,46 +1100,48 @@ var ( ) func init() { - proto.RegisterFile("lorawan-stack/api/message_services.proto", fileDescriptor_message_services_60896bf540219283) + proto.RegisterFile("lorawan-stack/api/message_services.proto", fileDescriptor_message_services_3b702a4f872eaf5e) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/message_services.proto", fileDescriptor_message_services_60896bf540219283) + golang_proto.RegisterFile("lorawan-stack/api/message_services.proto", fileDescriptor_message_services_3b702a4f872eaf5e) } -var fileDescriptor_message_services_60896bf540219283 = []byte{ - // 533 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x94, 0xb1, 0x6f, 0xd3, 0x40, - 0x14, 0xc6, 0xef, 0xd2, 0x8a, 0xd2, 0x43, 0x62, 0x70, 0xa5, 0x2a, 0x4a, 0xe1, 0x25, 0xa4, 0x0c, - 0x91, 0x20, 0xb6, 0x94, 0xfe, 0x03, 0xb4, 0x84, 0x81, 0x01, 0x09, 0x45, 0x02, 0x09, 0x24, 0x14, - 0x39, 0xc9, 0xd5, 0x39, 0x25, 0xb9, 0x33, 0x77, 0x97, 0x44, 0x0c, 0x48, 0x1d, 0x3b, 0x32, 0x32, - 0x22, 0xa6, 0x8e, 0x1d, 0xbb, 0x51, 0x89, 0x25, 0x63, 0xc6, 0x4e, 0x51, 0x7d, 0x5e, 0x3a, 0x76, - 0xec, 0x88, 0xe2, 0xb8, 0x32, 0x89, 0x49, 0x81, 0xb5, 0x9b, 0x9f, 0xef, 0x7b, 0xef, 0x7b, 0xef, - 0xf7, 0x4e, 0x47, 0x4a, 0x5d, 0x21, 0xdd, 0xa1, 0xcb, 0xcb, 0x4a, 0xbb, 0xcd, 0x8e, 0xe3, 0xfa, - 0xcc, 0xe9, 0x51, 0xa5, 0x5c, 0x8f, 0xd6, 0x15, 0x95, 0x03, 0xd6, 0xa4, 0xca, 0xf6, 0xa5, 0xd0, - 0xc2, 0xba, 0xaf, 0x35, 0xb7, 0x63, 0xb5, 0x3d, 0xd8, 0xc9, 0x95, 0x3d, 0xa6, 0xdb, 0xfd, 0x86, - 0xdd, 0x14, 0x3d, 0xc7, 0x13, 0x9e, 0x70, 0x22, 0x59, 0xa3, 0xbf, 0x1f, 0x45, 0x51, 0x10, 0x7d, - 0xcd, 0xd2, 0x73, 0xc5, 0xb4, 0x11, 0xe5, 0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x46, 0x86, 0xcf, 0x17, 0x19, - 0x6e, 0xdf, 0xc0, 0xf0, 0x1a, 0xc2, 0x7f, 0x51, 0xac, 0x28, 0xb2, 0x39, 0x77, 0xff, 0x62, 0xa2, - 0x42, 0x5a, 0xef, 0xc8, 0x5a, 0x1c, 0x58, 0xa9, 0x31, 0x6f, 0xb8, 0xb9, 0xb9, 0xbf, 0xef, 0xb9, - 0xf2, 0x89, 0x64, 0x17, 0x56, 0x96, 0xd8, 0x7e, 0x48, 0x6c, 0xcb, 0x4b, 0x6c, 0xff, 0xbc, 0xee, - 0xdc, 0x3f, 0xc1, 0xf9, 0x8e, 0x47, 0x01, 0xe0, 0x71, 0x00, 0xf8, 0x2c, 0x00, 0x74, 0x1e, 0x00, - 0xba, 0x08, 0x00, 0x5d, 0x06, 0x80, 0xae, 0x02, 0xc0, 0x07, 0x06, 0xf0, 0xa1, 0x01, 0x74, 0x64, - 0x00, 0x1f, 0x1b, 0x40, 0x27, 0x06, 0xd0, 0xa9, 0x01, 0x34, 0x32, 0x80, 0xc7, 0x06, 0xf0, 0x99, - 0x01, 0x74, 0x6e, 0x00, 0x5f, 0x18, 0x40, 0x97, 0x06, 0xf0, 0x95, 0x01, 0x74, 0x10, 0x02, 0x3a, - 0x0c, 0x01, 0x7f, 0x09, 0x01, 0x7d, 0x0d, 0x01, 0x7f, 0x0b, 0x01, 0x1d, 0x85, 0x80, 0x8e, 0x43, - 0xc0, 0x27, 0x21, 0xe0, 0xd3, 0x10, 0xf0, 0xfb, 0xa7, 0x9e, 0xb0, 0x75, 0x9b, 0xea, 0x36, 0xe3, - 0x9e, 0xb2, 0x39, 0xd5, 0x43, 0x21, 0x3b, 0xce, 0xfc, 0x2b, 0xe1, 0x77, 0x3c, 0x47, 0x6b, 0xee, - 0x37, 0x1a, 0x77, 0xa2, 0x37, 0x62, 0xe7, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x31, 0x96, 0x69, - 0xc6, 0xf9, 0x04, 0x00, 0x00, +var fileDescriptor_message_services_3b702a4f872eaf5e = []byte{ + // 568 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x94, 0x3f, 0x88, 0x13, 0x41, + 0x14, 0xc6, 0x67, 0x12, 0xf5, 0xb8, 0x15, 0x0e, 0xd9, 0x83, 0x23, 0x44, 0x7d, 0x89, 0x39, 0x85, + 0x80, 0x66, 0x17, 0x72, 0xa5, 0x95, 0x47, 0x2c, 0x54, 0x0e, 0x24, 0xa0, 0xa0, 0x20, 0x61, 0xb3, + 0x3b, 0xd9, 0x0c, 0x49, 0x66, 0xd6, 0x9d, 0x49, 0xc2, 0x75, 0xd7, 0x79, 0x58, 0x59, 0x5a, 0x8a, + 0xd5, 0x95, 0x57, 0x1e, 0x56, 0x29, 0x53, 0xa6, 0xbc, 0x2a, 0xdc, 0xce, 0x36, 0x67, 0x77, 0xe5, + 0x95, 0x92, 0xcd, 0x1e, 0xf9, 0xb3, 0xe6, 0x14, 0x5b, 0xbb, 0x79, 0xc9, 0x37, 0xdf, 0xf7, 0xde, + 0x6f, 0x1f, 0xa3, 0x15, 0xdb, 0xdc, 0xb7, 0xfa, 0x16, 0x2b, 0x09, 0x69, 0xd9, 0x2d, 0xd3, 0xf2, + 0xa8, 0xd9, 0x21, 0x42, 0x58, 0x2e, 0xa9, 0x09, 0xe2, 0xf7, 0xa8, 0x4d, 0x84, 0xe1, 0xf9, 0x5c, + 0x72, 0x7d, 0x43, 0x4a, 0x66, 0xc4, 0x6a, 0xa3, 0xb7, 0x93, 0x2d, 0xb9, 0x54, 0x36, 0xbb, 0x75, + 0xc3, 0xe6, 0x1d, 0xd3, 0xe5, 0x2e, 0x37, 0x23, 0x59, 0xbd, 0xdb, 0x88, 0xaa, 0xa8, 0x88, 0x4e, + 0xd3, 0xeb, 0xd9, 0xa7, 0x73, 0xf2, 0xf6, 0x7e, 0x43, 0x4e, 0xe5, 0x76, 0xc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 0x2e, 0xbe, 0x31, 0x5e, 0xcb, + 0x35, 0xa5, 0x64, 0x5e, 0xbd, 0x7e, 0x2b, 0x7a, 0x61, 0x76, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, + 0xbc, 0x66, 0xf6, 0x73, 0x74, 0x05, 0x00, 0x00, } diff --git a/pkg/ttnpb/message_services.pb.paths.fm.go b/pkg/ttnpb/message_services.pb.paths.fm.go new file mode 100644 index 0000000000..9153a5db8e --- /dev/null +++ b/pkg/ttnpb/message_services.pb.paths.fm.go @@ -0,0 +1,85 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var ProcessUplinkMessageRequestFieldPathsNested = []string{ + "end_device_version_ids", + "end_device_version_ids.brand_id", + "end_device_version_ids.firmware_version", + "end_device_version_ids.hardware_version", + "end_device_version_ids.model_id", + "ids", + "ids.application_ids", + "ids.application_ids.application_id", + "ids.dev_addr", + "ids.dev_eui", + "ids.device_id", + "ids.join_eui", + "message", + "message.decoded_payload", + "message.f_cnt", + "message.f_port", + "message.frm_payload", + "message.rx_metadata", + "message.session_key_id", + "message.settings", + "message.settings.coding_rate", + "message.settings.data_rate", + "message.settings.data_rate.modulation", + "message.settings.data_rate.modulation.fsk", + "message.settings.data_rate.modulation.fsk.bit_rate", + "message.settings.data_rate.modulation.lora", + "message.settings.data_rate.modulation.lora.bandwidth", + "message.settings.data_rate.modulation.lora.spreading_factor", + "message.settings.data_rate_index", + "message.settings.device_channel_index", + "message.settings.enable_crc", + "message.settings.frequency", + "message.settings.gateway_channel_index", + "message.settings.invert_polarization", + "message.settings.time", + "message.settings.timestamp", + "message.settings.tx_power", + "parameter", +} + +var ProcessUplinkMessageRequestFieldPathsTopLevel = []string{ + "end_device_version_ids", + "ids", + "message", + "parameter", +} +var ProcessDownlinkMessageRequestFieldPathsNested = []string{ + "end_device_version_ids", + "end_device_version_ids.brand_id", + "end_device_version_ids.firmware_version", + "end_device_version_ids.hardware_version", + "end_device_version_ids.model_id", + "ids", + "ids.application_ids", + "ids.application_ids.application_id", + "ids.dev_addr", + "ids.dev_eui", + "ids.device_id", + "ids.join_eui", + "message", + "message.class_b_c", + "message.class_b_c.absolute_time", + "message.class_b_c.gateways", + "message.confirmed", + "message.correlation_ids", + "message.decoded_payload", + "message.f_cnt", + "message.f_port", + "message.frm_payload", + "message.priority", + "message.session_key_id", + "parameter", +} + +var ProcessDownlinkMessageRequestFieldPathsTopLevel = []string{ + "end_device_version_ids", + "ids", + "message", + "parameter", +} diff --git a/pkg/ttnpb/message_services.pb.fm.go b/pkg/ttnpb/message_services.pb.setters.fm.go similarity index 62% rename from pkg/ttnpb/message_services.pb.fm.go rename to pkg/ttnpb/message_services.pb.setters.fm.go index 5106cc4e61..32baacf669 100644 --- a/pkg/ttnpb/message_services.pb.fm.go +++ b/pkg/ttnpb/message_services.pb.setters.fm.go @@ -4,54 +4,6 @@ package ttnpb import fmt "fmt" -var ProcessUplinkMessageRequestFieldPathsNested = []string{ - "end_device_version_ids", - "end_device_version_ids.brand_id", - "end_device_version_ids.firmware_version", - "end_device_version_ids.hardware_version", - "end_device_version_ids.model_id", - "ids", - "ids.application_ids", - "ids.application_ids.application_id", - "ids.dev_addr", - "ids.dev_eui", - "ids.device_id", - "ids.join_eui", - "message", - "message.decoded_payload", - "message.f_cnt", - "message.f_port", - "message.frm_payload", - "message.rx_metadata", - "message.session_key_id", - "message.settings", - "message.settings.coding_rate", - "message.settings.data_rate", - "message.settings.data_rate.modulation", - "message.settings.data_rate.modulation.fsk", - "message.settings.data_rate.modulation.fsk.bit_rate", - "message.settings.data_rate.modulation.lora", - "message.settings.data_rate.modulation.lora.bandwidth", - "message.settings.data_rate.modulation.lora.spreading_factor", - "message.settings.data_rate_index", - "message.settings.device_channel_index", - "message.settings.enable_crc", - "message.settings.frequency", - "message.settings.gateway_channel_index", - "message.settings.invert_polarization", - "message.settings.time", - "message.settings.timestamp", - "message.settings.tx_power", - "parameter", -} - -var ProcessUplinkMessageRequestFieldPathsTopLevel = []string{ - "end_device_version_ids", - "ids", - "message", - "parameter", -} - func (dst *ProcessUplinkMessageRequest) SetFields(src *ProcessUplinkMessageRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -127,41 +79,6 @@ func (dst *ProcessUplinkMessageRequest) SetFields(src *ProcessUplinkMessageReque return nil } -var ProcessDownlinkMessageRequestFieldPathsNested = []string{ - "end_device_version_ids", - "end_device_version_ids.brand_id", - "end_device_version_ids.firmware_version", - "end_device_version_ids.hardware_version", - "end_device_version_ids.model_id", - "ids", - "ids.application_ids", - "ids.application_ids.application_id", - "ids.dev_addr", - "ids.dev_eui", - "ids.device_id", - "ids.join_eui", - "message", - "message.class_b_c", - "message.class_b_c.absolute_time", - "message.class_b_c.gateways", - "message.confirmed", - "message.correlation_ids", - "message.decoded_payload", - "message.f_cnt", - "message.f_port", - "message.frm_payload", - "message.priority", - "message.session_key_id", - "parameter", -} - -var ProcessDownlinkMessageRequestFieldPathsTopLevel = []string{ - "end_device_version_ids", - "ids", - "message", - "parameter", -} - func (dst *ProcessDownlinkMessageRequest) SetFields(src *ProcessDownlinkMessageRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { diff --git a/pkg/ttnpb/message_services.pb.validate.go b/pkg/ttnpb/message_services.pb.validate.go new file mode 100644 index 0000000000..57cc207110 --- /dev/null +++ b/pkg/ttnpb/message_services.pb.validate.go @@ -0,0 +1,273 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on ProcessUplinkMessageRequest with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *ProcessUplinkMessageRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ProcessUplinkMessageRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "ids": + + if v, ok := interface{}(&m.EndDeviceIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ProcessUplinkMessageRequestValidationError{ + field: "ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "end_device_version_ids": + + if v, ok := interface{}(&m.EndDeviceVersionIDs).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ProcessUplinkMessageRequestValidationError{ + field: "end_device_version_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "message": + + if v, ok := interface{}(&m.Message).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ProcessUplinkMessageRequestValidationError{ + field: "message", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "parameter": + // no validation rules for Parameter + default: + return ProcessUplinkMessageRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ProcessUplinkMessageRequestValidationError is the validation error returned +// by ProcessUplinkMessageRequest.ValidateFields if the designated constraints +// aren't met. +type ProcessUplinkMessageRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ProcessUplinkMessageRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ProcessUplinkMessageRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ProcessUplinkMessageRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ProcessUplinkMessageRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ProcessUplinkMessageRequestValidationError) ErrorName() string { + return "ProcessUplinkMessageRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e ProcessUplinkMessageRequestValidationError) 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 %sProcessUplinkMessageRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ProcessUplinkMessageRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ProcessUplinkMessageRequestValidationError{} + +// ValidateFields checks the field values on ProcessDownlinkMessageRequest with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *ProcessDownlinkMessageRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ProcessDownlinkMessageRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "ids": + + if v, ok := interface{}(&m.EndDeviceIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ProcessDownlinkMessageRequestValidationError{ + field: "ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "end_device_version_ids": + + if v, ok := interface{}(&m.EndDeviceVersionIDs).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ProcessDownlinkMessageRequestValidationError{ + field: "end_device_version_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "message": + + if v, ok := interface{}(&m.Message).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ProcessDownlinkMessageRequestValidationError{ + field: "message", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "parameter": + // no validation rules for Parameter + default: + return ProcessDownlinkMessageRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ProcessDownlinkMessageRequestValidationError is the validation error +// returned by ProcessDownlinkMessageRequest.ValidateFields if the designated +// constraints aren't met. +type ProcessDownlinkMessageRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ProcessDownlinkMessageRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ProcessDownlinkMessageRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ProcessDownlinkMessageRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ProcessDownlinkMessageRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ProcessDownlinkMessageRequestValidationError) ErrorName() string { + return "ProcessDownlinkMessageRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e ProcessDownlinkMessageRequestValidationError) 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 %sProcessDownlinkMessageRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ProcessDownlinkMessageRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ProcessDownlinkMessageRequestValidationError{} diff --git a/pkg/ttnpb/message_services.validator.pb.go b/pkg/ttnpb/message_services.validator.pb.go deleted file mode 100644 index b06bb2fbaf..0000000000 --- a/pkg/ttnpb/message_services.validator.pb.go +++ /dev/null @@ -1,43 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/message_services.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *ProcessUplinkMessageRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.EndDeviceIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("EndDeviceIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.EndDeviceVersionIDs)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("EndDeviceVersionIDs", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Message)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Message", err) - } - return nil -} -func (this *ProcessDownlinkMessageRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.EndDeviceIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("EndDeviceIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.EndDeviceVersionIDs)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("EndDeviceVersionIDs", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Message)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Message", err) - } - return nil -} diff --git a/pkg/ttnpb/message_validators.go b/pkg/ttnpb/message_validators.go index 6b4d37740f..961968e07f 100644 --- a/pkg/ttnpb/message_validators.go +++ b/pkg/ttnpb/message_validators.go @@ -14,28 +14,14 @@ package ttnpb -import ( - "context" - "fmt" - "math" - - "go.thethings.network/lorawan-stack/pkg/errors" -) - -// ValidateContext wraps the generated validator with (optionally context-based) custom checks. -func (s TxSettings) ValidateContext(ctx context.Context) error { - if s.GetDataRateIndex() > math.MaxUint8 { - return errExpectedLowerOrEqual("TxDRIdx", math.MaxUint8)(s.GetDataRateIndex()) - } - return s.Validate() -} +import "context" // ValidateContext wraps the generated validator with (optionally context-based) custom checks. func (p MACPayload) ValidateContext(context.Context) error { if p.DevAddr.IsZero() { return errMissing("DevAddr") } - return p.Validate() + return p.ValidateFields() } // ValidateContext wraps the generated validator with (optionally context-based) custom checks. @@ -46,56 +32,5 @@ func (p JoinRequestPayload) ValidateContext(context.Context) error { if p.JoinEUI.IsZero() { return errMissing("JoinEUI") } - return p.Validate() -} - -var ( - errExpectedUplinkMType = errors.DefineInvalidArgument("expected_uplink_mtype", "MType `{result}` is not an uplink MType") - errMissingRawPayload = errors.DefineInvalidArgument("raw_payload", "missing raw payload") -) - -// ValidateContext wraps the generated validator with (optionally context-based) custom checks. -func (m *UplinkMessage) ValidateContext(context.Context) error { - if p := m.GetPayload(); p.Payload == nil { - if len(m.GetRawPayload()) == 0 { - return errMissingRawPayload - } - } else { - switch p.GetMType() { - case MType_CONFIRMED_UP, MType_UNCONFIRMED_UP: - mp := p.GetMACPayload() - if mp == nil { - return errMissing("MACPayload") - } - return mp.Validate() - case MType_JOIN_REQUEST: - jp := p.GetJoinRequestPayload() - if jp == nil { - return errMissing("JoinRequestPayload") - } - return jp.Validate() - case MType_REJOIN_REQUEST: - rp := p.GetRejoinRequestPayload() - if rp == nil { - return errMissing("RejoinRequestPayload") - } - return rp.Validate() - default: - return errExpectedUplinkMType.WithAttributes("result", p.GetMType().String()) - } - } - return m.Validate() -} - -// ValidateContext wraps the generated validator with (optionally context-based) custom checks. -func (cmd *MACCommand) ValidateContext(context.Context) error { - return cmd.CID.Validate() -} - -// ValidateContext wraps the generated validator with (optionally context-based) custom checks. -func (cid MACCommandIdentifier) Validate() error { - if cid < 0x00 || cid > 0xff { - return errExpectedBetween("CID", "0x00", "0xFF")(fmt.Sprintf("0x%X", int32(cid))) - } - return nil + return p.ValidateFields() } diff --git a/pkg/ttnpb/messages.pb.go b/pkg/ttnpb/messages.pb.go index ccaa4ee588..1e5c951868 100644 --- a/pkg/ttnpb/messages.pb.go +++ b/pkg/ttnpb/messages.pb.go @@ -9,7 +9,7 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import types "github.com/gogo/protobuf/types" -import _ "github.com/mwitkow/go-proto-validators" +import _ "github.com/lyft/protoc-gen-validate/validate" import time "time" @@ -69,7 +69,7 @@ var PayloadFormatter_value = map[string]int32{ } func (PayloadFormatter) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_messages_e6e0b619399f62ae, []int{0} + return fileDescriptor_messages_c9a9a0efe28b775b, []int{0} } type TxAcknowledgment_Result int32 @@ -110,7 +110,7 @@ var TxAcknowledgment_Result_value = map[string]int32{ } func (TxAcknowledgment_Result) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_messages_e6e0b619399f62ae, []int{2, 0} + return fileDescriptor_messages_c9a9a0efe28b775b, []int{2, 0} } // Uplink message from the end device to the network @@ -130,7 +130,7 @@ type UplinkMessage struct { func (m *UplinkMessage) Reset() { *m = UplinkMessage{} } func (*UplinkMessage) ProtoMessage() {} func (*UplinkMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e6e0b619399f62ae, []int{0} + return fileDescriptor_messages_c9a9a0efe28b775b, []int{0} } func (m *UplinkMessage) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -218,7 +218,7 @@ type DownlinkMessage struct { func (m *DownlinkMessage) Reset() { *m = DownlinkMessage{} } func (*DownlinkMessage) ProtoMessage() {} func (*DownlinkMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e6e0b619399f62ae, []int{1} + return fileDescriptor_messages_c9a9a0efe28b775b, []int{1} } func (m *DownlinkMessage) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -397,7 +397,7 @@ type TxAcknowledgment struct { func (m *TxAcknowledgment) Reset() { *m = TxAcknowledgment{} } func (*TxAcknowledgment) ProtoMessage() {} func (*TxAcknowledgment) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e6e0b619399f62ae, []int{2} + return fileDescriptor_messages_c9a9a0efe28b775b, []int{2} } func (m *TxAcknowledgment) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -456,7 +456,7 @@ type ApplicationUplink struct { func (m *ApplicationUplink) Reset() { *m = ApplicationUplink{} } func (*ApplicationUplink) ProtoMessage() {} func (*ApplicationUplink) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e6e0b619399f62ae, []int{3} + return fileDescriptor_messages_c9a9a0efe28b775b, []int{3} } func (m *ApplicationUplink) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -545,7 +545,7 @@ type ApplicationLocation struct { func (m *ApplicationLocation) Reset() { *m = ApplicationLocation{} } func (*ApplicationLocation) ProtoMessage() {} func (*ApplicationLocation) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e6e0b619399f62ae, []int{4} + return fileDescriptor_messages_c9a9a0efe28b775b, []int{4} } func (m *ApplicationLocation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -605,7 +605,7 @@ type ApplicationJoinAccept struct { func (m *ApplicationJoinAccept) Reset() { *m = ApplicationJoinAccept{} } func (*ApplicationJoinAccept) ProtoMessage() {} func (*ApplicationJoinAccept) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e6e0b619399f62ae, []int{5} + return fileDescriptor_messages_c9a9a0efe28b775b, []int{5} } func (m *ApplicationJoinAccept) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -684,7 +684,7 @@ type ApplicationDownlink struct { func (m *ApplicationDownlink) Reset() { *m = ApplicationDownlink{} } func (*ApplicationDownlink) ProtoMessage() {} func (*ApplicationDownlink) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e6e0b619399f62ae, []int{6} + return fileDescriptor_messages_c9a9a0efe28b775b, []int{6} } func (m *ApplicationDownlink) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -794,7 +794,7 @@ type ApplicationDownlink_ClassBC struct { func (m *ApplicationDownlink_ClassBC) Reset() { *m = ApplicationDownlink_ClassBC{} } func (*ApplicationDownlink_ClassBC) ProtoMessage() {} func (*ApplicationDownlink_ClassBC) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e6e0b619399f62ae, []int{6, 0} + return fileDescriptor_messages_c9a9a0efe28b775b, []int{6, 0} } func (m *ApplicationDownlink_ClassBC) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -846,7 +846,7 @@ type ApplicationDownlinks struct { func (m *ApplicationDownlinks) Reset() { *m = ApplicationDownlinks{} } func (*ApplicationDownlinks) ProtoMessage() {} func (*ApplicationDownlinks) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e6e0b619399f62ae, []int{7} + return fileDescriptor_messages_c9a9a0efe28b775b, []int{7} } func (m *ApplicationDownlinks) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -892,7 +892,7 @@ type ApplicationDownlinkFailed struct { func (m *ApplicationDownlinkFailed) Reset() { *m = ApplicationDownlinkFailed{} } func (*ApplicationDownlinkFailed) ProtoMessage() {} func (*ApplicationDownlinkFailed) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e6e0b619399f62ae, []int{8} + return fileDescriptor_messages_c9a9a0efe28b775b, []int{8} } func (m *ApplicationDownlinkFailed) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -938,7 +938,7 @@ type ApplicationInvalidatedDownlinks struct { func (m *ApplicationInvalidatedDownlinks) Reset() { *m = ApplicationInvalidatedDownlinks{} } func (*ApplicationInvalidatedDownlinks) ProtoMessage() {} func (*ApplicationInvalidatedDownlinks) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e6e0b619399f62ae, []int{9} + return fileDescriptor_messages_c9a9a0efe28b775b, []int{9} } func (m *ApplicationInvalidatedDownlinks) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1002,7 +1002,7 @@ type ApplicationUp struct { func (m *ApplicationUp) Reset() { *m = ApplicationUp{} } func (*ApplicationUp) ProtoMessage() {} func (*ApplicationUp) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e6e0b619399f62ae, []int{10} + return fileDescriptor_messages_c9a9a0efe28b775b, []int{10} } func (m *ApplicationUp) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1376,7 +1376,7 @@ type MessagePayloadFormatters struct { func (m *MessagePayloadFormatters) Reset() { *m = MessagePayloadFormatters{} } func (*MessagePayloadFormatters) ProtoMessage() {} func (*MessagePayloadFormatters) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e6e0b619399f62ae, []int{11} + return fileDescriptor_messages_c9a9a0efe28b775b, []int{11} } func (m *MessagePayloadFormatters) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1443,7 +1443,7 @@ type DownlinkQueueRequest struct { func (m *DownlinkQueueRequest) Reset() { *m = DownlinkQueueRequest{} } func (*DownlinkQueueRequest) ProtoMessage() {} func (*DownlinkQueueRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e6e0b619399f62ae, []int{12} + return fileDescriptor_messages_c9a9a0efe28b775b, []int{12} } func (m *DownlinkQueueRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -6959,129 +6959,132 @@ var ( ) func init() { - proto.RegisterFile("lorawan-stack/api/messages.proto", fileDescriptor_messages_e6e0b619399f62ae) + proto.RegisterFile("lorawan-stack/api/messages.proto", fileDescriptor_messages_c9a9a0efe28b775b) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/messages.proto", fileDescriptor_messages_e6e0b619399f62ae) -} - -var fileDescriptor_messages_e6e0b619399f62ae = []byte{ - // 1857 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0x4d, 0x6c, 0x1b, 0xc7, - 0x15, 0xde, 0xa5, 0x28, 0x91, 0x7c, 0xa4, 0xa8, 0xcd, 0x44, 0x71, 0x19, 0xd5, 0x5d, 0xaa, 0x4c, - 0x83, 0x38, 0x6d, 0x4d, 0xa2, 0x76, 0x9b, 0x1a, 0x4e, 0xff, 0x28, 0x6a, 0x25, 0xd1, 0x92, 0x49, - 0x66, 0x48, 0x27, 0x76, 0x51, 0x60, 0xb1, 0xda, 0x1d, 0xd2, 0x1b, 0x92, 0xbb, 0x9b, 0xdd, 0xa1, - 0x64, 0xde, 0x02, 0x14, 0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2, 0xf3, 0x53, 0x59, 0xfc, 0xea, 0x54, - 0x16, 0xbe, 0x3e, 0x95, 0x85, 0x17, 0xa7, 0xb2, 0xf0, 0xf2, 0x54, 0x16, 0xbe, 0x39, 0x95, 0xc5, - 0x8f, 0x47, 0xb2, 0xf8, 0xc9, 0x48, 0x16, 0x3e, 0x1f, 0xc9, 0xe2, 0x17, 0x23, 0x59, 0x78, 0x3a, - 0x92, 0x85, 0x2f, 0x47, 0xb2, 0xf0, 0x6c, 0x24, 0x8b, 0xcf, 0x47, 0xb2, 0xf8, 0xd5, 0x48, 0x16, - 0xbe, 0x1e, 0xc9, 0xe2, 0x8b, 0x91, 0x2c, 0xbc, 0x1c, 0xc9, 0xe2, 0x37, 0x23, 0x59, 0xf8, 0xf8, - 0x4c, 0x16, 0x3e, 0x39, 0x93, 0xc5, 0xc7, 0x67, 0xb2, 0xf0, 0xd9, 0x99, 0x2c, 0x3e, 0x39, 0x93, - 0x85, 0xcf, 0xcf, 0x64, 0xe1, 0x8b, 0x33, 0x59, 0x7c, 0x7a, 0x26, 0x8b, 0x5f, 0x9e, 0xc9, 0xe2, - 0x1f, 0x7f, 0xde, 0xb1, 0x8b, 0xf4, 0x21, 0xa1, 0x0f, 0xfd, 0x2f, 0x90, 0xa2, 0x45, 0xe8, 0xb1, - 0xed, 0x76, 0x4b, 0xd3, 0xff, 0x39, 0x72, 0xba, 0x9d, 0x12, 0xa5, 0x96, 0x73, 0x78, 0xb8, 0xc2, - 0x06, 0x89, 0x9b, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x02, 0xcf, 0xed, 0xb1, 0xb6, 0x13, 0x00, - 0x00, + golang_proto.RegisterFile("lorawan-stack/api/messages.proto", fileDescriptor_messages_c9a9a0efe28b775b) +} + +var fileDescriptor_messages_c9a9a0efe28b775b = []byte{ + // 1917 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x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, 0xa9, 0xdb, 0x56, 0xdb, 0x74, 0xfb, 0xc4, 0x60, 0x93, 0x3f, 0x81, 0x27, 0x07, 0xe8, + 0x06, 0x24, 0xf5, 0x9e, 0xe6, 0x79, 0xea, 0x81, 0xaa, 0xf3, 0xfa, 0xfb, 0xc1, 0x29, 0xe2, 0x51, + 0x28, 0xfb, 0x42, 0xa5, 0x32, 0x8e, 0xeb, 0xc1, 0x0f, 0x74, 0x13, 0x12, 0x8e, 0x6b, 0xda, 0xae, + 0x49, 0x87, 0xd9, 0x04, 0xeb, 0xfc, 0xf9, 0x25, 0x75, 0xcc, 0xc7, 0x59, 0x83, 0x73, 0xce, 0x34, + 0xfd, 0xb1, 0xfc, 0xb2, 0x01, 0x94, 0x3c, 0xed, 0x00, 0xda, 0xfc, 0x58, 0x84, 0x38, 0xb7, 0x0e, + 0x29, 0x90, 0xe8, 0x68, 0x94, 0x1c, 0x69, 0xc3, 0x60, 0x53, 0x49, 0x5d, 0x7d, 0x73, 0xde, 0xa8, + 0x1b, 0x01, 0xbd, 0x68, 0x51, 0x62, 0x59, 0xda, 0xd4, 0x12, 0x80, 0xc7, 0xa2, 0x48, 0x81, 0x35, + 0xed, 0xc0, 0xb3, 0x7b, 0x03, 0x4a, 0x54, 0x7f, 0xed, 0x65, 0x17, 0x7c, 0xf1, 0x02, 0xb5, 0xc2, + 0x96, 0xa7, 0x74, 0x28, 0xe6, 0x13, 0xf8, 0x06, 0x74, 0x17, 0x36, 0x96, 0x38, 0xd4, 0x43, 0x45, + 0x48, 0x4e, 0x2a, 0x43, 0x3c, 0x7d, 0x65, 0x4c, 0xa4, 0xf2, 0x7f, 0x13, 0xe1, 0x95, 0x25, 0x2c, + 0xbb, 0x9a, 0xe9, 0x6f, 0x10, 0x4d, 0x48, 0x84, 0xac, 0x2c, 0xcb, 0x4f, 0x87, 0xbf, 0xbc, 0xf5, + 0x85, 0x40, 0xa8, 0x04, 0x31, 0xb6, 0xe5, 0xf3, 0x86, 0x70, 0x69,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 0x36, 0x2b, 0x36, 0xde, 0x21, 0xde, 0x3c, 0x05, 0x5a, 0x50, 0x9d, 0x15, 0x01, 0x67, 0x8c, + 0xd9, 0x7a, 0xad, 0x4d, 0xa1, 0x7e, 0x38, 0x20, 0x03, 0x62, 0x64, 0x93, 0x67, 0xb1, 0x71, 0x8c, + 0xf7, 0x2e, 0x13, 0x46, 0x36, 0x6c, 0xce, 0xe2, 0xa9, 0x53, 0x33, 0x35, 0x0b, 0x0c, 0x7a, 0xfb, + 0x05, 0xd0, 0xcb, 0xea, 0xb2, 0x22, 0xe0, 0xec, 0x8c, 0x9a, 0x29, 0x26, 0xff, 0x02, 0xe1, 0x8a, + 0xa4, 0x7a, 0x76, 0xef, 0x90, 0x18, 0xd9, 0xd4, 0xb7, 0x5e, 0x20, 0xdc, 0x8d, 0xfc, 0x0b, 0x84, + 0xd2, 0x4d, 0x26, 0x5c, 0x4a, 0x41, 0x64, 0xe0, 0x84, 0x2f, 0x97, 0x47, 0x11, 0xc8, 0xf2, 0x5c, + 0xe5, 0x93, 0x6e, 0xd7, 0x76, 0xfb, 0x1a, 0xa5, 0xc4, 0xf5, 0x50, 0x1d, 0xd2, 0x03, 0x47, 0x6d, + 0x87, 0x07, 0xac, 0x46, 0x33, 0x57, 0xb7, 0xe6, 0xd5, 0xce, 0x0b, 0xce, 0x8c, 0xa3, 0xd4, 0xc0, + 0x19, 0x13, 0xd0, 0x8f, 0xe1, 0xe2, 0x34, 0xa0, 0xea, 0x68, 0xae, 0xd6, 0x27, 0x3e, 0x74, 0xb0, + 0x78, 0x6d, 0x4c, 0x31, 0x37, 0x42, 0x1a, 0x6a, 0x02, 0x8b, 0xc1, 0x94, 0x21, 0xd1, 0x73, 0x18, + 0xc2, 0xf2, 0x74, 0x62, 0xca, 0xdb, 0x90, 0x9d, 0x05, 0x9d, 0x32, 0x66, 0x85, 0x19, 0x73, 0x71, + 0x46, 0x60, 0x6c, 0x4e, 0xfe, 0xaf, 0x22, 0x6c, 0xec, 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+ 0x91, 0xc5, 0x87, 0x27, 0xb2, 0xf0, 0xc9, 0x89, 0x2c, 0x7e, 0x7a, 0x22, 0x0b, 0x9f, 0x9d, 0xc8, + 0xc2, 0xa3, 0x13, 0x59, 0x7c, 0x7c, 0x22, 0x8b, 0x4f, 0x4e, 0x64, 0xf1, 0x97, 0x3f, 0xec, 0xd8, + 0x05, 0x7a, 0x8f, 0xd0, 0x7b, 0xfe, 0x63, 0xa7, 0x60, 0x11, 0x7a, 0x64, 0xbb, 0xdd, 0xed, 0xd9, + 0xff, 0x77, 0x39, 0xdd, 0xce, 0x36, 0xa5, 0x96, 0x73, 0x70, 0xb0, 0xca, 0x36, 0x92, 0x6b, 0xff, + 0x09, 0x00, 0x00, 0xff, 0xff, 0xaf, 0xf9, 0xde, 0x52, 0x71, 0x14, 0x00, 0x00, } diff --git a/pkg/ttnpb/messages.pb.paths.fm.go b/pkg/ttnpb/messages.pb.paths.fm.go new file mode 100644 index 0000000000..2e5e0d208c --- /dev/null +++ b/pkg/ttnpb/messages.pb.paths.fm.go @@ -0,0 +1,493 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var UplinkMessageFieldPathsNested = []string{ + "correlation_ids", + "payload", + "payload.Payload", + "payload.Payload.join_accept_payload", + "payload.Payload.join_accept_payload.cf_list", + "payload.Payload.join_accept_payload.cf_list.ch_masks", + "payload.Payload.join_accept_payload.cf_list.freq", + "payload.Payload.join_accept_payload.cf_list.type", + "payload.Payload.join_accept_payload.dev_addr", + "payload.Payload.join_accept_payload.dl_settings", + "payload.Payload.join_accept_payload.dl_settings.opt_neg", + "payload.Payload.join_accept_payload.dl_settings.rx1_dr_offset", + "payload.Payload.join_accept_payload.dl_settings.rx2_dr", + "payload.Payload.join_accept_payload.encrypted", + "payload.Payload.join_accept_payload.join_nonce", + "payload.Payload.join_accept_payload.net_id", + "payload.Payload.join_accept_payload.rx_delay", + "payload.Payload.join_request_payload", + "payload.Payload.join_request_payload.dev_eui", + "payload.Payload.join_request_payload.dev_nonce", + "payload.Payload.join_request_payload.join_eui", + "payload.Payload.mac_payload", + "payload.Payload.mac_payload.decoded_payload", + "payload.Payload.mac_payload.f_hdr", + "payload.Payload.mac_payload.f_hdr.dev_addr", + "payload.Payload.mac_payload.f_hdr.f_cnt", + "payload.Payload.mac_payload.f_hdr.f_ctrl", + "payload.Payload.mac_payload.f_hdr.f_ctrl.ack", + "payload.Payload.mac_payload.f_hdr.f_ctrl.adr", + "payload.Payload.mac_payload.f_hdr.f_ctrl.adr_ack_req", + "payload.Payload.mac_payload.f_hdr.f_ctrl.class_b", + "payload.Payload.mac_payload.f_hdr.f_ctrl.f_pending", + "payload.Payload.mac_payload.f_hdr.f_opts", + "payload.Payload.mac_payload.f_port", + "payload.Payload.mac_payload.frm_payload", + "payload.Payload.rejoin_request_payload", + "payload.Payload.rejoin_request_payload.dev_eui", + "payload.Payload.rejoin_request_payload.join_eui", + "payload.Payload.rejoin_request_payload.net_id", + "payload.Payload.rejoin_request_payload.rejoin_cnt", + "payload.Payload.rejoin_request_payload.rejoin_type", + "payload.m_hdr", + "payload.m_hdr.m_type", + "payload.m_hdr.major", + "payload.mic", + "raw_payload", + "received_at", + "rx_metadata", + "settings", + "settings.coding_rate", + "settings.data_rate", + "settings.data_rate.modulation", + "settings.data_rate.modulation.fsk", + "settings.data_rate.modulation.fsk.bit_rate", + "settings.data_rate.modulation.lora", + "settings.data_rate.modulation.lora.bandwidth", + "settings.data_rate.modulation.lora.spreading_factor", + "settings.data_rate_index", + "settings.device_channel_index", + "settings.enable_crc", + "settings.frequency", + "settings.gateway_channel_index", + "settings.invert_polarization", + "settings.time", + "settings.timestamp", + "settings.tx_power", +} + +var UplinkMessageFieldPathsTopLevel = []string{ + "correlation_ids", + "payload", + "raw_payload", + "received_at", + "rx_metadata", + "settings", +} +var DownlinkMessageFieldPathsNested = []string{ + "correlation_ids", + "end_device_ids", + "end_device_ids.application_ids", + "end_device_ids.application_ids.application_id", + "end_device_ids.dev_addr", + "end_device_ids.dev_eui", + "end_device_ids.device_id", + "end_device_ids.join_eui", + "payload", + "payload.Payload", + "payload.Payload.join_accept_payload", + "payload.Payload.join_accept_payload.cf_list", + "payload.Payload.join_accept_payload.cf_list.ch_masks", + "payload.Payload.join_accept_payload.cf_list.freq", + "payload.Payload.join_accept_payload.cf_list.type", + "payload.Payload.join_accept_payload.dev_addr", + "payload.Payload.join_accept_payload.dl_settings", + "payload.Payload.join_accept_payload.dl_settings.opt_neg", + "payload.Payload.join_accept_payload.dl_settings.rx1_dr_offset", + "payload.Payload.join_accept_payload.dl_settings.rx2_dr", + "payload.Payload.join_accept_payload.encrypted", + "payload.Payload.join_accept_payload.join_nonce", + "payload.Payload.join_accept_payload.net_id", + "payload.Payload.join_accept_payload.rx_delay", + "payload.Payload.join_request_payload", + "payload.Payload.join_request_payload.dev_eui", + "payload.Payload.join_request_payload.dev_nonce", + "payload.Payload.join_request_payload.join_eui", + "payload.Payload.mac_payload", + "payload.Payload.mac_payload.decoded_payload", + "payload.Payload.mac_payload.f_hdr", + "payload.Payload.mac_payload.f_hdr.dev_addr", + "payload.Payload.mac_payload.f_hdr.f_cnt", + "payload.Payload.mac_payload.f_hdr.f_ctrl", + "payload.Payload.mac_payload.f_hdr.f_ctrl.ack", + "payload.Payload.mac_payload.f_hdr.f_ctrl.adr", + "payload.Payload.mac_payload.f_hdr.f_ctrl.adr_ack_req", + "payload.Payload.mac_payload.f_hdr.f_ctrl.class_b", + "payload.Payload.mac_payload.f_hdr.f_ctrl.f_pending", + "payload.Payload.mac_payload.f_hdr.f_opts", + "payload.Payload.mac_payload.f_port", + "payload.Payload.mac_payload.frm_payload", + "payload.Payload.rejoin_request_payload", + "payload.Payload.rejoin_request_payload.dev_eui", + "payload.Payload.rejoin_request_payload.join_eui", + "payload.Payload.rejoin_request_payload.net_id", + "payload.Payload.rejoin_request_payload.rejoin_cnt", + "payload.Payload.rejoin_request_payload.rejoin_type", + "payload.m_hdr", + "payload.m_hdr.m_type", + "payload.m_hdr.major", + "payload.mic", + "raw_payload", + "settings", + "settings.request", + "settings.request.absolute_time", + "settings.request.advanced", + "settings.request.class", + "settings.request.downlink_paths", + "settings.request.priority", + "settings.request.rx1_data_rate_index", + "settings.request.rx1_delay", + "settings.request.rx1_frequency", + "settings.request.rx2_data_rate_index", + "settings.request.rx2_frequency", + "settings.scheduled", + "settings.scheduled.coding_rate", + "settings.scheduled.data_rate", + "settings.scheduled.data_rate.modulation", + "settings.scheduled.data_rate.modulation.fsk", + "settings.scheduled.data_rate.modulation.fsk.bit_rate", + "settings.scheduled.data_rate.modulation.lora", + "settings.scheduled.data_rate.modulation.lora.bandwidth", + "settings.scheduled.data_rate.modulation.lora.spreading_factor", + "settings.scheduled.data_rate_index", + "settings.scheduled.device_channel_index", + "settings.scheduled.enable_crc", + "settings.scheduled.frequency", + "settings.scheduled.gateway_channel_index", + "settings.scheduled.invert_polarization", + "settings.scheduled.time", + "settings.scheduled.timestamp", + "settings.scheduled.tx_power", +} + +var DownlinkMessageFieldPathsTopLevel = []string{ + "correlation_ids", + "end_device_ids", + "payload", + "raw_payload", + "settings", +} +var TxAcknowledgmentFieldPathsNested = []string{ + "correlation_ids", + "result", +} + +var TxAcknowledgmentFieldPathsTopLevel = []string{ + "correlation_ids", + "result", +} +var ApplicationUplinkFieldPathsNested = []string{ + "decoded_payload", + "f_cnt", + "f_port", + "frm_payload", + "rx_metadata", + "session_key_id", + "settings", + "settings.coding_rate", + "settings.data_rate", + "settings.data_rate.modulation", + "settings.data_rate.modulation.fsk", + "settings.data_rate.modulation.fsk.bit_rate", + "settings.data_rate.modulation.lora", + "settings.data_rate.modulation.lora.bandwidth", + "settings.data_rate.modulation.lora.spreading_factor", + "settings.data_rate_index", + "settings.device_channel_index", + "settings.enable_crc", + "settings.frequency", + "settings.gateway_channel_index", + "settings.invert_polarization", + "settings.time", + "settings.timestamp", + "settings.tx_power", +} + +var ApplicationUplinkFieldPathsTopLevel = []string{ + "decoded_payload", + "f_cnt", + "f_port", + "frm_payload", + "rx_metadata", + "session_key_id", + "settings", +} +var ApplicationLocationFieldPathsNested = []string{ + "attributes", + "location", + "location.accuracy", + "location.altitude", + "location.latitude", + "location.longitude", + "location.source", + "service", +} + +var ApplicationLocationFieldPathsTopLevel = []string{ + "attributes", + "location", + "service", +} +var ApplicationJoinAcceptFieldPathsNested = []string{ + "app_s_key", + "app_s_key.kek_label", + "app_s_key.key", + "invalidated_downlinks", + "pending_session", + "session_key_id", +} + +var ApplicationJoinAcceptFieldPathsTopLevel = []string{ + "app_s_key", + "invalidated_downlinks", + "pending_session", + "session_key_id", +} +var ApplicationDownlinkFieldPathsNested = []string{ + "class_b_c", + "class_b_c.absolute_time", + "class_b_c.gateways", + "confirmed", + "correlation_ids", + "decoded_payload", + "f_cnt", + "f_port", + "frm_payload", + "priority", + "session_key_id", +} + +var ApplicationDownlinkFieldPathsTopLevel = []string{ + "class_b_c", + "confirmed", + "correlation_ids", + "decoded_payload", + "f_cnt", + "f_port", + "frm_payload", + "priority", + "session_key_id", +} +var ApplicationDownlinksFieldPathsNested = []string{ + "downlinks", +} + +var ApplicationDownlinksFieldPathsTopLevel = []string{ + "downlinks", +} +var ApplicationDownlinkFailedFieldPathsNested = []string{ + "downlink", + "downlink.class_b_c", + "downlink.class_b_c.absolute_time", + "downlink.class_b_c.gateways", + "downlink.confirmed", + "downlink.correlation_ids", + "downlink.decoded_payload", + "downlink.f_cnt", + "downlink.f_port", + "downlink.frm_payload", + "downlink.priority", + "downlink.session_key_id", + "error", + "error.attributes", + "error.cause", + "error.cause.attributes", + "error.cause.correlation_id", + "error.cause.message_format", + "error.cause.name", + "error.cause.namespace", + "error.correlation_id", + "error.message_format", + "error.name", + "error.namespace", +} + +var ApplicationDownlinkFailedFieldPathsTopLevel = []string{ + "downlink", + "error", +} +var ApplicationInvalidatedDownlinksFieldPathsNested = []string{ + "downlinks", + "last_f_cnt_down", +} + +var ApplicationInvalidatedDownlinksFieldPathsTopLevel = []string{ + "downlinks", + "last_f_cnt_down", +} +var ApplicationUpFieldPathsNested = []string{ + "correlation_ids", + "end_device_ids", + "end_device_ids.application_ids", + "end_device_ids.application_ids.application_id", + "end_device_ids.dev_addr", + "end_device_ids.dev_eui", + "end_device_ids.device_id", + "end_device_ids.join_eui", + "up", + "up.downlink_ack", + "up.downlink_ack.class_b_c", + "up.downlink_ack.class_b_c.absolute_time", + "up.downlink_ack.class_b_c.gateways", + "up.downlink_ack.confirmed", + "up.downlink_ack.correlation_ids", + "up.downlink_ack.decoded_payload", + "up.downlink_ack.f_cnt", + "up.downlink_ack.f_port", + "up.downlink_ack.frm_payload", + "up.downlink_ack.priority", + "up.downlink_ack.session_key_id", + "up.downlink_failed", + "up.downlink_failed.downlink", + "up.downlink_failed.downlink.class_b_c", + "up.downlink_failed.downlink.class_b_c.absolute_time", + "up.downlink_failed.downlink.class_b_c.gateways", + "up.downlink_failed.downlink.confirmed", + "up.downlink_failed.downlink.correlation_ids", + "up.downlink_failed.downlink.decoded_payload", + "up.downlink_failed.downlink.f_cnt", + "up.downlink_failed.downlink.f_port", + "up.downlink_failed.downlink.frm_payload", + "up.downlink_failed.downlink.priority", + "up.downlink_failed.downlink.session_key_id", + "up.downlink_failed.error", + "up.downlink_failed.error.attributes", + "up.downlink_failed.error.cause", + "up.downlink_failed.error.cause.attributes", + "up.downlink_failed.error.cause.correlation_id", + "up.downlink_failed.error.cause.message_format", + "up.downlink_failed.error.cause.name", + "up.downlink_failed.error.cause.namespace", + "up.downlink_failed.error.correlation_id", + "up.downlink_failed.error.message_format", + "up.downlink_failed.error.name", + "up.downlink_failed.error.namespace", + "up.downlink_nack", + "up.downlink_nack.class_b_c", + "up.downlink_nack.class_b_c.absolute_time", + "up.downlink_nack.class_b_c.gateways", + "up.downlink_nack.confirmed", + "up.downlink_nack.correlation_ids", + "up.downlink_nack.decoded_payload", + "up.downlink_nack.f_cnt", + "up.downlink_nack.f_port", + "up.downlink_nack.frm_payload", + "up.downlink_nack.priority", + "up.downlink_nack.session_key_id", + "up.downlink_queue_invalidated", + "up.downlink_queue_invalidated.downlinks", + "up.downlink_queue_invalidated.last_f_cnt_down", + "up.downlink_queued", + "up.downlink_queued.class_b_c", + "up.downlink_queued.class_b_c.absolute_time", + "up.downlink_queued.class_b_c.gateways", + "up.downlink_queued.confirmed", + "up.downlink_queued.correlation_ids", + "up.downlink_queued.decoded_payload", + "up.downlink_queued.f_cnt", + "up.downlink_queued.f_port", + "up.downlink_queued.frm_payload", + "up.downlink_queued.priority", + "up.downlink_queued.session_key_id", + "up.downlink_sent", + "up.downlink_sent.class_b_c", + "up.downlink_sent.class_b_c.absolute_time", + "up.downlink_sent.class_b_c.gateways", + "up.downlink_sent.confirmed", + "up.downlink_sent.correlation_ids", + "up.downlink_sent.decoded_payload", + "up.downlink_sent.f_cnt", + "up.downlink_sent.f_port", + "up.downlink_sent.frm_payload", + "up.downlink_sent.priority", + "up.downlink_sent.session_key_id", + "up.join_accept", + "up.join_accept.app_s_key", + "up.join_accept.app_s_key.kek_label", + "up.join_accept.app_s_key.key", + "up.join_accept.invalidated_downlinks", + "up.join_accept.pending_session", + "up.join_accept.session_key_id", + "up.location_solved", + "up.location_solved.attributes", + "up.location_solved.location", + "up.location_solved.location.accuracy", + "up.location_solved.location.altitude", + "up.location_solved.location.latitude", + "up.location_solved.location.longitude", + "up.location_solved.location.source", + "up.location_solved.service", + "up.uplink_message", + "up.uplink_message.decoded_payload", + "up.uplink_message.f_cnt", + "up.uplink_message.f_port", + "up.uplink_message.frm_payload", + "up.uplink_message.rx_metadata", + "up.uplink_message.session_key_id", + "up.uplink_message.settings", + "up.uplink_message.settings.coding_rate", + "up.uplink_message.settings.data_rate", + "up.uplink_message.settings.data_rate.modulation", + "up.uplink_message.settings.data_rate.modulation.fsk", + "up.uplink_message.settings.data_rate.modulation.fsk.bit_rate", + "up.uplink_message.settings.data_rate.modulation.lora", + "up.uplink_message.settings.data_rate.modulation.lora.bandwidth", + "up.uplink_message.settings.data_rate.modulation.lora.spreading_factor", + "up.uplink_message.settings.data_rate_index", + "up.uplink_message.settings.device_channel_index", + "up.uplink_message.settings.enable_crc", + "up.uplink_message.settings.frequency", + "up.uplink_message.settings.gateway_channel_index", + "up.uplink_message.settings.invert_polarization", + "up.uplink_message.settings.time", + "up.uplink_message.settings.timestamp", + "up.uplink_message.settings.tx_power", +} + +var ApplicationUpFieldPathsTopLevel = []string{ + "correlation_ids", + "end_device_ids", + "up", +} +var MessagePayloadFormattersFieldPathsNested = []string{ + "down_formatter", + "down_formatter_parameter", + "up_formatter", + "up_formatter_parameter", +} + +var MessagePayloadFormattersFieldPathsTopLevel = []string{ + "down_formatter", + "down_formatter_parameter", + "up_formatter", + "up_formatter_parameter", +} +var DownlinkQueueRequestFieldPathsNested = []string{ + "downlinks", + "end_device_ids", + "end_device_ids.application_ids", + "end_device_ids.application_ids.application_id", + "end_device_ids.dev_addr", + "end_device_ids.dev_eui", + "end_device_ids.device_id", + "end_device_ids.join_eui", +} + +var DownlinkQueueRequestFieldPathsTopLevel = []string{ + "downlinks", + "end_device_ids", +} +var ApplicationDownlink_ClassBCFieldPathsNested = []string{ + "absolute_time", + "gateways", +} + +var ApplicationDownlink_ClassBCFieldPathsTopLevel = []string{ + "absolute_time", + "gateways", +} diff --git a/pkg/ttnpb/messages.pb.fm.go b/pkg/ttnpb/messages.pb.setters.fm.go similarity index 64% rename from pkg/ttnpb/messages.pb.fm.go rename to pkg/ttnpb/messages.pb.setters.fm.go index 12d25f69c2..2ba5662b9e 100644 --- a/pkg/ttnpb/messages.pb.fm.go +++ b/pkg/ttnpb/messages.pb.setters.fm.go @@ -7,84 +7,6 @@ import ( time "time" ) -var UplinkMessageFieldPathsNested = []string{ - "correlation_ids", - "payload", - "payload.Payload", - "payload.Payload.join_accept_payload", - "payload.Payload.join_accept_payload.cf_list", - "payload.Payload.join_accept_payload.cf_list.ch_masks", - "payload.Payload.join_accept_payload.cf_list.freq", - "payload.Payload.join_accept_payload.cf_list.type", - "payload.Payload.join_accept_payload.dev_addr", - "payload.Payload.join_accept_payload.dl_settings", - "payload.Payload.join_accept_payload.dl_settings.opt_neg", - "payload.Payload.join_accept_payload.dl_settings.rx1_dr_offset", - "payload.Payload.join_accept_payload.dl_settings.rx2_dr", - "payload.Payload.join_accept_payload.encrypted", - "payload.Payload.join_accept_payload.join_nonce", - "payload.Payload.join_accept_payload.net_id", - "payload.Payload.join_accept_payload.rx_delay", - "payload.Payload.join_request_payload", - "payload.Payload.join_request_payload.dev_eui", - "payload.Payload.join_request_payload.dev_nonce", - "payload.Payload.join_request_payload.join_eui", - "payload.Payload.mac_payload", - "payload.Payload.mac_payload.decoded_payload", - "payload.Payload.mac_payload.f_hdr", - "payload.Payload.mac_payload.f_hdr.dev_addr", - "payload.Payload.mac_payload.f_hdr.f_cnt", - "payload.Payload.mac_payload.f_hdr.f_ctrl", - "payload.Payload.mac_payload.f_hdr.f_ctrl.ack", - "payload.Payload.mac_payload.f_hdr.f_ctrl.adr", - "payload.Payload.mac_payload.f_hdr.f_ctrl.adr_ack_req", - "payload.Payload.mac_payload.f_hdr.f_ctrl.class_b", - "payload.Payload.mac_payload.f_hdr.f_ctrl.f_pending", - "payload.Payload.mac_payload.f_hdr.f_opts", - "payload.Payload.mac_payload.f_port", - "payload.Payload.mac_payload.frm_payload", - "payload.Payload.rejoin_request_payload", - "payload.Payload.rejoin_request_payload.dev_eui", - "payload.Payload.rejoin_request_payload.join_eui", - "payload.Payload.rejoin_request_payload.net_id", - "payload.Payload.rejoin_request_payload.rejoin_cnt", - "payload.Payload.rejoin_request_payload.rejoin_type", - "payload.m_hdr", - "payload.m_hdr.m_type", - "payload.m_hdr.major", - "payload.mic", - "raw_payload", - "received_at", - "rx_metadata", - "settings", - "settings.coding_rate", - "settings.data_rate", - "settings.data_rate.modulation", - "settings.data_rate.modulation.fsk", - "settings.data_rate.modulation.fsk.bit_rate", - "settings.data_rate.modulation.lora", - "settings.data_rate.modulation.lora.bandwidth", - "settings.data_rate.modulation.lora.spreading_factor", - "settings.data_rate_index", - "settings.device_channel_index", - "settings.enable_crc", - "settings.frequency", - "settings.gateway_channel_index", - "settings.invert_polarization", - "settings.time", - "settings.timestamp", - "settings.tx_power", -} - -var UplinkMessageFieldPathsTopLevel = []string{ - "correlation_ids", - "payload", - "raw_payload", - "received_at", - "rx_metadata", - "settings", -} - func (dst *UplinkMessage) SetFields(src *UplinkMessage, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -95,8 +17,7 @@ func (dst *UplinkMessage) SetFields(src *UplinkMessage, paths ...string) error { if src != nil { dst.RawPayload = src.RawPayload } else { - var zero []byte - dst.RawPayload = zero + dst.RawPayload = nil } case "payload": if len(subs) > 0 { @@ -173,100 +94,6 @@ func (dst *UplinkMessage) SetFields(src *UplinkMessage, paths ...string) error { return nil } -var DownlinkMessageFieldPathsNested = []string{ - "correlation_ids", - "end_device_ids", - "end_device_ids.application_ids", - "end_device_ids.application_ids.application_id", - "end_device_ids.dev_addr", - "end_device_ids.dev_eui", - "end_device_ids.device_id", - "end_device_ids.join_eui", - "payload", - "payload.Payload", - "payload.Payload.join_accept_payload", - "payload.Payload.join_accept_payload.cf_list", - "payload.Payload.join_accept_payload.cf_list.ch_masks", - "payload.Payload.join_accept_payload.cf_list.freq", - "payload.Payload.join_accept_payload.cf_list.type", - "payload.Payload.join_accept_payload.dev_addr", - "payload.Payload.join_accept_payload.dl_settings", - "payload.Payload.join_accept_payload.dl_settings.opt_neg", - "payload.Payload.join_accept_payload.dl_settings.rx1_dr_offset", - "payload.Payload.join_accept_payload.dl_settings.rx2_dr", - "payload.Payload.join_accept_payload.encrypted", - "payload.Payload.join_accept_payload.join_nonce", - "payload.Payload.join_accept_payload.net_id", - "payload.Payload.join_accept_payload.rx_delay", - "payload.Payload.join_request_payload", - "payload.Payload.join_request_payload.dev_eui", - "payload.Payload.join_request_payload.dev_nonce", - "payload.Payload.join_request_payload.join_eui", - "payload.Payload.mac_payload", - "payload.Payload.mac_payload.decoded_payload", - "payload.Payload.mac_payload.f_hdr", - "payload.Payload.mac_payload.f_hdr.dev_addr", - "payload.Payload.mac_payload.f_hdr.f_cnt", - "payload.Payload.mac_payload.f_hdr.f_ctrl", - "payload.Payload.mac_payload.f_hdr.f_ctrl.ack", - "payload.Payload.mac_payload.f_hdr.f_ctrl.adr", - "payload.Payload.mac_payload.f_hdr.f_ctrl.adr_ack_req", - "payload.Payload.mac_payload.f_hdr.f_ctrl.class_b", - "payload.Payload.mac_payload.f_hdr.f_ctrl.f_pending", - "payload.Payload.mac_payload.f_hdr.f_opts", - "payload.Payload.mac_payload.f_port", - "payload.Payload.mac_payload.frm_payload", - "payload.Payload.rejoin_request_payload", - "payload.Payload.rejoin_request_payload.dev_eui", - "payload.Payload.rejoin_request_payload.join_eui", - "payload.Payload.rejoin_request_payload.net_id", - "payload.Payload.rejoin_request_payload.rejoin_cnt", - "payload.Payload.rejoin_request_payload.rejoin_type", - "payload.m_hdr", - "payload.m_hdr.m_type", - "payload.m_hdr.major", - "payload.mic", - "raw_payload", - "settings", - "settings.request", - "settings.request.absolute_time", - "settings.request.advanced", - "settings.request.class", - "settings.request.downlink_paths", - "settings.request.priority", - "settings.request.rx1_data_rate_index", - "settings.request.rx1_delay", - "settings.request.rx1_frequency", - "settings.request.rx2_data_rate_index", - "settings.request.rx2_frequency", - "settings.scheduled", - "settings.scheduled.coding_rate", - "settings.scheduled.data_rate", - "settings.scheduled.data_rate.modulation", - "settings.scheduled.data_rate.modulation.fsk", - "settings.scheduled.data_rate.modulation.fsk.bit_rate", - "settings.scheduled.data_rate.modulation.lora", - "settings.scheduled.data_rate.modulation.lora.bandwidth", - "settings.scheduled.data_rate.modulation.lora.spreading_factor", - "settings.scheduled.data_rate_index", - "settings.scheduled.device_channel_index", - "settings.scheduled.enable_crc", - "settings.scheduled.frequency", - "settings.scheduled.gateway_channel_index", - "settings.scheduled.invert_polarization", - "settings.scheduled.time", - "settings.scheduled.timestamp", - "settings.scheduled.tx_power", -} - -var DownlinkMessageFieldPathsTopLevel = []string{ - "correlation_ids", - "end_device_ids", - "payload", - "raw_payload", - "settings", -} - func (dst *DownlinkMessage) SetFields(src *DownlinkMessage, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -277,8 +104,7 @@ func (dst *DownlinkMessage) SetFields(src *DownlinkMessage, paths ...string) err if src != nil { dst.RawPayload = src.RawPayload } else { - var zero []byte - dst.RawPayload = zero + dst.RawPayload = nil } case "payload": if len(subs) > 0 { @@ -408,16 +234,6 @@ func (dst *DownlinkMessage) SetFields(src *DownlinkMessage, paths ...string) err return nil } -var TxAcknowledgmentFieldPathsNested = []string{ - "correlation_ids", - "result", -} - -var TxAcknowledgmentFieldPathsTopLevel = []string{ - "correlation_ids", - "result", -} - func (dst *TxAcknowledgment) SetFields(src *TxAcknowledgment, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -448,43 +264,6 @@ func (dst *TxAcknowledgment) SetFields(src *TxAcknowledgment, paths ...string) e return nil } -var ApplicationUplinkFieldPathsNested = []string{ - "decoded_payload", - "f_cnt", - "f_port", - "frm_payload", - "rx_metadata", - "session_key_id", - "settings", - "settings.coding_rate", - "settings.data_rate", - "settings.data_rate.modulation", - "settings.data_rate.modulation.fsk", - "settings.data_rate.modulation.fsk.bit_rate", - "settings.data_rate.modulation.lora", - "settings.data_rate.modulation.lora.bandwidth", - "settings.data_rate.modulation.lora.spreading_factor", - "settings.data_rate_index", - "settings.device_channel_index", - "settings.enable_crc", - "settings.frequency", - "settings.gateway_channel_index", - "settings.invert_polarization", - "settings.time", - "settings.timestamp", - "settings.tx_power", -} - -var ApplicationUplinkFieldPathsTopLevel = []string{ - "decoded_payload", - "f_cnt", - "f_port", - "frm_payload", - "rx_metadata", - "session_key_id", - "settings", -} - func (dst *ApplicationUplink) SetFields(src *ApplicationUplink, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -495,8 +274,7 @@ func (dst *ApplicationUplink) SetFields(src *ApplicationUplink, paths ...string) if src != nil { dst.SessionKeyID = src.SessionKeyID } else { - var zero []byte - dst.SessionKeyID = zero + dst.SessionKeyID = nil } case "f_port": if len(subs) > 0 { @@ -525,8 +303,7 @@ func (dst *ApplicationUplink) SetFields(src *ApplicationUplink, paths ...string) if src != nil { dst.FRMPayload = src.FRMPayload } else { - var zero []byte - dst.FRMPayload = zero + dst.FRMPayload = nil } case "decoded_payload": if len(subs) > 0 { @@ -572,23 +349,6 @@ func (dst *ApplicationUplink) SetFields(src *ApplicationUplink, paths ...string) return nil } -var ApplicationLocationFieldPathsNested = []string{ - "attributes", - "location", - "location.accuracy", - "location.altitude", - "location.latitude", - "location.longitude", - "location.source", - "service", -} - -var ApplicationLocationFieldPathsTopLevel = []string{ - "attributes", - "location", - "service", -} - func (dst *ApplicationLocation) SetFields(src *ApplicationLocation, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -637,22 +397,6 @@ func (dst *ApplicationLocation) SetFields(src *ApplicationLocation, paths ...str return nil } -var ApplicationJoinAcceptFieldPathsNested = []string{ - "app_s_key", - "app_s_key.kek_label", - "app_s_key.key", - "invalidated_downlinks", - "pending_session", - "session_key_id", -} - -var ApplicationJoinAcceptFieldPathsTopLevel = []string{ - "app_s_key", - "invalidated_downlinks", - "pending_session", - "session_key_id", -} - func (dst *ApplicationJoinAccept) SetFields(src *ApplicationJoinAccept, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -663,8 +407,7 @@ func (dst *ApplicationJoinAccept) SetFields(src *ApplicationJoinAccept, paths .. if src != nil { dst.SessionKeyID = src.SessionKeyID } else { - var zero []byte - dst.SessionKeyID = zero + dst.SessionKeyID = nil } case "app_s_key": if len(subs) > 0 { @@ -714,32 +457,6 @@ func (dst *ApplicationJoinAccept) SetFields(src *ApplicationJoinAccept, paths .. return nil } -var ApplicationDownlinkFieldPathsNested = []string{ - "class_b_c", - "class_b_c.absolute_time", - "class_b_c.gateways", - "confirmed", - "correlation_ids", - "decoded_payload", - "f_cnt", - "f_port", - "frm_payload", - "priority", - "session_key_id", -} - -var ApplicationDownlinkFieldPathsTopLevel = []string{ - "class_b_c", - "confirmed", - "correlation_ids", - "decoded_payload", - "f_cnt", - "f_port", - "frm_payload", - "priority", - "session_key_id", -} - func (dst *ApplicationDownlink) SetFields(src *ApplicationDownlink, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -750,8 +467,7 @@ func (dst *ApplicationDownlink) SetFields(src *ApplicationDownlink, paths ...str if src != nil { dst.SessionKeyID = src.SessionKeyID } else { - var zero []byte - dst.SessionKeyID = zero + dst.SessionKeyID = nil } case "f_port": if len(subs) > 0 { @@ -780,8 +496,7 @@ func (dst *ApplicationDownlink) SetFields(src *ApplicationDownlink, paths ...str if src != nil { dst.FRMPayload = src.FRMPayload } else { - var zero []byte - dst.FRMPayload = zero + dst.FRMPayload = nil } case "decoded_payload": if len(subs) > 0 { @@ -850,53 +565,6 @@ func (dst *ApplicationDownlink) SetFields(src *ApplicationDownlink, paths ...str return nil } -var ApplicationDownlink_ClassBCFieldPathsNested = []string{ - "absolute_time", - "gateways", -} - -var ApplicationDownlink_ClassBCFieldPathsTopLevel = []string{ - "absolute_time", - "gateways", -} - -func (dst *ApplicationDownlink_ClassBC) SetFields(src *ApplicationDownlink_ClassBC, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "gateways": - if len(subs) > 0 { - return fmt.Errorf("'gateways' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Gateways = src.Gateways - } else { - dst.Gateways = nil - } - case "absolute_time": - if len(subs) > 0 { - return fmt.Errorf("'absolute_time' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.AbsoluteTime = src.AbsoluteTime - } else { - dst.AbsoluteTime = nil - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - -var ApplicationDownlinksFieldPathsNested = []string{ - "downlinks", -} - -var ApplicationDownlinksFieldPathsTopLevel = []string{ - "downlinks", -} - func (dst *ApplicationDownlinks) SetFields(src *ApplicationDownlinks, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -917,38 +585,6 @@ func (dst *ApplicationDownlinks) SetFields(src *ApplicationDownlinks, paths ...s return nil } -var ApplicationDownlinkFailedFieldPathsNested = []string{ - "downlink", - "downlink.class_b_c", - "downlink.class_b_c.absolute_time", - "downlink.class_b_c.gateways", - "downlink.confirmed", - "downlink.correlation_ids", - "downlink.decoded_payload", - "downlink.f_cnt", - "downlink.f_port", - "downlink.frm_payload", - "downlink.priority", - "downlink.session_key_id", - "error", - "error.attributes", - "error.cause", - "error.cause.attributes", - "error.cause.correlation_id", - "error.cause.message_format", - "error.cause.name", - "error.cause.namespace", - "error.correlation_id", - "error.message_format", - "error.name", - "error.namespace", -} - -var ApplicationDownlinkFailedFieldPathsTopLevel = []string{ - "downlink", - "error", -} - func (dst *ApplicationDownlinkFailed) SetFields(src *ApplicationDownlinkFailed, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -996,16 +632,6 @@ func (dst *ApplicationDownlinkFailed) SetFields(src *ApplicationDownlinkFailed, return nil } -var ApplicationInvalidatedDownlinksFieldPathsNested = []string{ - "downlinks", - "last_f_cnt_down", -} - -var ApplicationInvalidatedDownlinksFieldPathsTopLevel = []string{ - "downlinks", - "last_f_cnt_down", -} - func (dst *ApplicationInvalidatedDownlinks) SetFields(src *ApplicationInvalidatedDownlinks, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1036,141 +662,6 @@ func (dst *ApplicationInvalidatedDownlinks) SetFields(src *ApplicationInvalidate return nil } -var ApplicationUpFieldPathsNested = []string{ - "correlation_ids", - "end_device_ids", - "end_device_ids.application_ids", - "end_device_ids.application_ids.application_id", - "end_device_ids.dev_addr", - "end_device_ids.dev_eui", - "end_device_ids.device_id", - "end_device_ids.join_eui", - "up", - "up.downlink_ack", - "up.downlink_ack.class_b_c", - "up.downlink_ack.class_b_c.absolute_time", - "up.downlink_ack.class_b_c.gateways", - "up.downlink_ack.confirmed", - "up.downlink_ack.correlation_ids", - "up.downlink_ack.decoded_payload", - "up.downlink_ack.f_cnt", - "up.downlink_ack.f_port", - "up.downlink_ack.frm_payload", - "up.downlink_ack.priority", - "up.downlink_ack.session_key_id", - "up.downlink_failed", - "up.downlink_failed.downlink", - "up.downlink_failed.downlink.class_b_c", - "up.downlink_failed.downlink.class_b_c.absolute_time", - "up.downlink_failed.downlink.class_b_c.gateways", - "up.downlink_failed.downlink.confirmed", - "up.downlink_failed.downlink.correlation_ids", - "up.downlink_failed.downlink.decoded_payload", - "up.downlink_failed.downlink.f_cnt", - "up.downlink_failed.downlink.f_port", - "up.downlink_failed.downlink.frm_payload", - "up.downlink_failed.downlink.priority", - "up.downlink_failed.downlink.session_key_id", - "up.downlink_failed.error", - "up.downlink_failed.error.attributes", - "up.downlink_failed.error.cause", - "up.downlink_failed.error.cause.attributes", - "up.downlink_failed.error.cause.correlation_id", - "up.downlink_failed.error.cause.message_format", - "up.downlink_failed.error.cause.name", - "up.downlink_failed.error.cause.namespace", - "up.downlink_failed.error.correlation_id", - "up.downlink_failed.error.message_format", - "up.downlink_failed.error.name", - "up.downlink_failed.error.namespace", - "up.downlink_nack", - "up.downlink_nack.class_b_c", - "up.downlink_nack.class_b_c.absolute_time", - "up.downlink_nack.class_b_c.gateways", - "up.downlink_nack.confirmed", - "up.downlink_nack.correlation_ids", - "up.downlink_nack.decoded_payload", - "up.downlink_nack.f_cnt", - "up.downlink_nack.f_port", - "up.downlink_nack.frm_payload", - "up.downlink_nack.priority", - "up.downlink_nack.session_key_id", - "up.downlink_queue_invalidated", - "up.downlink_queue_invalidated.downlinks", - "up.downlink_queue_invalidated.last_f_cnt_down", - "up.downlink_queued", - "up.downlink_queued.class_b_c", - "up.downlink_queued.class_b_c.absolute_time", - "up.downlink_queued.class_b_c.gateways", - "up.downlink_queued.confirmed", - "up.downlink_queued.correlation_ids", - "up.downlink_queued.decoded_payload", - "up.downlink_queued.f_cnt", - "up.downlink_queued.f_port", - "up.downlink_queued.frm_payload", - "up.downlink_queued.priority", - "up.downlink_queued.session_key_id", - "up.downlink_sent", - "up.downlink_sent.class_b_c", - "up.downlink_sent.class_b_c.absolute_time", - "up.downlink_sent.class_b_c.gateways", - "up.downlink_sent.confirmed", - "up.downlink_sent.correlation_ids", - "up.downlink_sent.decoded_payload", - "up.downlink_sent.f_cnt", - "up.downlink_sent.f_port", - "up.downlink_sent.frm_payload", - "up.downlink_sent.priority", - "up.downlink_sent.session_key_id", - "up.join_accept", - "up.join_accept.app_s_key", - "up.join_accept.app_s_key.kek_label", - "up.join_accept.app_s_key.key", - "up.join_accept.invalidated_downlinks", - "up.join_accept.pending_session", - "up.join_accept.session_key_id", - "up.location_solved", - "up.location_solved.attributes", - "up.location_solved.location", - "up.location_solved.location.accuracy", - "up.location_solved.location.altitude", - "up.location_solved.location.latitude", - "up.location_solved.location.longitude", - "up.location_solved.location.source", - "up.location_solved.service", - "up.uplink_message", - "up.uplink_message.decoded_payload", - "up.uplink_message.f_cnt", - "up.uplink_message.f_port", - "up.uplink_message.frm_payload", - "up.uplink_message.rx_metadata", - "up.uplink_message.session_key_id", - "up.uplink_message.settings", - "up.uplink_message.settings.coding_rate", - "up.uplink_message.settings.data_rate", - "up.uplink_message.settings.data_rate.modulation", - "up.uplink_message.settings.data_rate.modulation.fsk", - "up.uplink_message.settings.data_rate.modulation.fsk.bit_rate", - "up.uplink_message.settings.data_rate.modulation.lora", - "up.uplink_message.settings.data_rate.modulation.lora.bandwidth", - "up.uplink_message.settings.data_rate.modulation.lora.spreading_factor", - "up.uplink_message.settings.data_rate_index", - "up.uplink_message.settings.device_channel_index", - "up.uplink_message.settings.enable_crc", - "up.uplink_message.settings.frequency", - "up.uplink_message.settings.gateway_channel_index", - "up.uplink_message.settings.invert_polarization", - "up.uplink_message.settings.time", - "up.uplink_message.settings.timestamp", - "up.uplink_message.settings.tx_power", -} - -var ApplicationUpFieldPathsTopLevel = []string{ - "correlation_ids", - "end_device_ids", - "up", -} - func (dst *ApplicationUp) SetFields(src *ApplicationUp, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1446,20 +937,6 @@ func (dst *ApplicationUp) SetFields(src *ApplicationUp, paths ...string) error { return nil } -var MessagePayloadFormattersFieldPathsNested = []string{ - "down_formatter", - "down_formatter_parameter", - "up_formatter", - "up_formatter_parameter", -} - -var MessagePayloadFormattersFieldPathsTopLevel = []string{ - "down_formatter", - "down_formatter_parameter", - "up_formatter", - "up_formatter_parameter", -} - func (dst *MessagePayloadFormatters) SetFields(src *MessagePayloadFormatters, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1511,22 +988,6 @@ func (dst *MessagePayloadFormatters) SetFields(src *MessagePayloadFormatters, pa return nil } -var DownlinkQueueRequestFieldPathsNested = []string{ - "downlinks", - "end_device_ids", - "end_device_ids.application_ids", - "end_device_ids.application_ids.application_id", - "end_device_ids.dev_addr", - "end_device_ids.dev_eui", - "end_device_ids.device_id", - "end_device_ids.join_eui", -} - -var DownlinkQueueRequestFieldPathsTopLevel = []string{ - "downlinks", - "end_device_ids", -} - func (dst *DownlinkQueueRequest) SetFields(src *DownlinkQueueRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1564,3 +1025,32 @@ func (dst *DownlinkQueueRequest) SetFields(src *DownlinkQueueRequest, paths ...s } return nil } + +func (dst *ApplicationDownlink_ClassBC) SetFields(src *ApplicationDownlink_ClassBC, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "gateways": + if len(subs) > 0 { + return fmt.Errorf("'gateways' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Gateways = src.Gateways + } else { + dst.Gateways = nil + } + case "absolute_time": + if len(subs) > 0 { + return fmt.Errorf("'absolute_time' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.AbsoluteTime = src.AbsoluteTime + } else { + dst.AbsoluteTime = nil + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} diff --git a/pkg/ttnpb/messages.pb.validate.go b/pkg/ttnpb/messages.pb.validate.go new file mode 100644 index 0000000000..211db93fcb --- /dev/null +++ b/pkg/ttnpb/messages.pb.validate.go @@ -0,0 +1,1755 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on UplinkMessage with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *UplinkMessage) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = UplinkMessageFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "raw_payload": + // no validation rules for RawPayload + case "payload": + + if v, ok := interface{}(m.GetPayload()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UplinkMessageValidationError{ + field: "payload", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "settings": + + if v, ok := interface{}(&m.Settings).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UplinkMessageValidationError{ + field: "settings", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "rx_metadata": + + if len(m.GetRxMetadata()) < 1 { + return UplinkMessageValidationError{ + field: "rx_metadata", + reason: "value must contain at least 1 item(s)", + } + } + + for idx, item := range m.GetRxMetadata() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UplinkMessageValidationError{ + field: fmt.Sprintf("rx_metadata[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "received_at": + + if v, ok := interface{}(&m.ReceivedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UplinkMessageValidationError{ + field: "received_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "correlation_ids": + + default: + return UplinkMessageValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// UplinkMessageValidationError is the validation error returned by +// UplinkMessage.ValidateFields if the designated constraints aren't met. +type UplinkMessageValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UplinkMessageValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UplinkMessageValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UplinkMessageValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UplinkMessageValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UplinkMessageValidationError) ErrorName() string { return "UplinkMessageValidationError" } + +// Error satisfies the builtin error interface +func (e UplinkMessageValidationError) 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 %sUplinkMessage.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UplinkMessageValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UplinkMessageValidationError{} + +// ValidateFields checks the field values on DownlinkMessage with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *DownlinkMessage) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = DownlinkMessageFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "raw_payload": + // no validation rules for RawPayload + case "payload": + + if v, ok := interface{}(m.GetPayload()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return DownlinkMessageValidationError{ + field: "payload", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "end_device_ids": + + if v, ok := interface{}(m.GetEndDeviceIDs()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return DownlinkMessageValidationError{ + field: "end_device_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "correlation_ids": + + case "settings": + if len(subs) == 0 { + subs = []string{ + "request", "scheduled", + } + } + for name, subs := range _processPaths(subs) { + _ = subs + switch name { + case "request": + + if v, ok := interface{}(m.GetRequest()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return DownlinkMessageValidationError{ + field: "request", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "scheduled": + + if v, ok := interface{}(m.GetScheduled()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return DownlinkMessageValidationError{ + field: "scheduled", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return DownlinkMessageValidationError{ + field: "settings", + reason: "value is required", + } + } + } + default: + return DownlinkMessageValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// DownlinkMessageValidationError is the validation error returned by +// DownlinkMessage.ValidateFields if the designated constraints aren't met. +type DownlinkMessageValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e DownlinkMessageValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e DownlinkMessageValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e DownlinkMessageValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e DownlinkMessageValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e DownlinkMessageValidationError) ErrorName() string { return "DownlinkMessageValidationError" } + +// Error satisfies the builtin error interface +func (e DownlinkMessageValidationError) 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 %sDownlinkMessage.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = DownlinkMessageValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = DownlinkMessageValidationError{} + +// ValidateFields checks the field values on TxAcknowledgment with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *TxAcknowledgment) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = TxAcknowledgmentFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "correlation_ids": + + case "result": + + if _, ok := TxAcknowledgment_Result_name[int32(m.GetResult())]; !ok { + return TxAcknowledgmentValidationError{ + field: "result", + reason: "value must be one of the defined enum values", + } + } + + default: + return TxAcknowledgmentValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// TxAcknowledgmentValidationError is the validation error returned by +// TxAcknowledgment.ValidateFields if the designated constraints aren't met. +type TxAcknowledgmentValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e TxAcknowledgmentValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e TxAcknowledgmentValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e TxAcknowledgmentValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e TxAcknowledgmentValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e TxAcknowledgmentValidationError) ErrorName() string { return "TxAcknowledgmentValidationError" } + +// Error satisfies the builtin error interface +func (e TxAcknowledgmentValidationError) 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 %sTxAcknowledgment.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = TxAcknowledgmentValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = TxAcknowledgmentValidationError{} + +// ValidateFields checks the field values on ApplicationUplink with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ApplicationUplink) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ApplicationUplinkFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "session_key_id": + // no validation rules for SessionKeyID + case "f_port": + + if m.GetFPort() > 255 { + return ApplicationUplinkValidationError{ + field: "f_port", + reason: "value must be less than or equal to 255", + } + } + + case "f_cnt": + // no validation rules for FCnt + case "frm_payload": + // no validation rules for FRMPayload + case "decoded_payload": + + if v, ok := interface{}(m.GetDecodedPayload()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationUplinkValidationError{ + field: "decoded_payload", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "rx_metadata": + + if len(m.GetRxMetadata()) < 1 { + return ApplicationUplinkValidationError{ + field: "rx_metadata", + reason: "value must contain at least 1 item(s)", + } + } + + for idx, item := range m.GetRxMetadata() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationUplinkValidationError{ + field: fmt.Sprintf("rx_metadata[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "settings": + + if v, ok := interface{}(&m.Settings).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationUplinkValidationError{ + field: "settings", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return ApplicationUplinkValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ApplicationUplinkValidationError is the validation error returned by +// ApplicationUplink.ValidateFields if the designated constraints aren't met. +type ApplicationUplinkValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ApplicationUplinkValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ApplicationUplinkValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ApplicationUplinkValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ApplicationUplinkValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ApplicationUplinkValidationError) ErrorName() string { + return "ApplicationUplinkValidationError" +} + +// Error satisfies the builtin error interface +func (e ApplicationUplinkValidationError) 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 %sApplicationUplink.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ApplicationUplinkValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ApplicationUplinkValidationError{} + +// ValidateFields checks the field values on ApplicationLocation with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ApplicationLocation) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ApplicationLocationFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "service": + // no validation rules for Service + case "location": + + if v, ok := interface{}(&m.Location).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationLocationValidationError{ + field: "location", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "attributes": + // no validation rules for Attributes + default: + return ApplicationLocationValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ApplicationLocationValidationError is the validation error returned by +// ApplicationLocation.ValidateFields if the designated constraints aren't met. +type ApplicationLocationValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ApplicationLocationValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ApplicationLocationValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ApplicationLocationValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ApplicationLocationValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ApplicationLocationValidationError) ErrorName() string { + return "ApplicationLocationValidationError" +} + +// Error satisfies the builtin error interface +func (e ApplicationLocationValidationError) 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 %sApplicationLocation.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ApplicationLocationValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ApplicationLocationValidationError{} + +// ValidateFields checks the field values on ApplicationJoinAccept with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ApplicationJoinAccept) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ApplicationJoinAcceptFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "session_key_id": + // no validation rules for SessionKeyID + case "app_s_key": + + if v, ok := interface{}(m.GetAppSKey()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationJoinAcceptValidationError{ + field: "app_s_key", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "invalidated_downlinks": + + for idx, item := range m.GetInvalidatedDownlinks() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationJoinAcceptValidationError{ + field: fmt.Sprintf("invalidated_downlinks[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "pending_session": + // no validation rules for PendingSession + default: + return ApplicationJoinAcceptValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ApplicationJoinAcceptValidationError is the validation error returned by +// ApplicationJoinAccept.ValidateFields if the designated constraints aren't met. +type ApplicationJoinAcceptValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ApplicationJoinAcceptValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ApplicationJoinAcceptValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ApplicationJoinAcceptValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ApplicationJoinAcceptValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ApplicationJoinAcceptValidationError) ErrorName() string { + return "ApplicationJoinAcceptValidationError" +} + +// Error satisfies the builtin error interface +func (e ApplicationJoinAcceptValidationError) 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 %sApplicationJoinAccept.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ApplicationJoinAcceptValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ApplicationJoinAcceptValidationError{} + +// ValidateFields checks the field values on ApplicationDownlink with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ApplicationDownlink) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ApplicationDownlinkFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "session_key_id": + // no validation rules for SessionKeyID + case "f_port": + + if m.GetFPort() > 255 { + return ApplicationDownlinkValidationError{ + field: "f_port", + reason: "value must be less than or equal to 255", + } + } + + case "f_cnt": + // no validation rules for FCnt + case "frm_payload": + // no validation rules for FRMPayload + case "decoded_payload": + + if v, ok := interface{}(m.GetDecodedPayload()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationDownlinkValidationError{ + field: "decoded_payload", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "confirmed": + // no validation rules for Confirmed + case "class_b_c": + + if v, ok := interface{}(m.GetClassBC()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationDownlinkValidationError{ + field: "class_b_c", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "priority": + + if _, ok := TxSchedulePriority_name[int32(m.GetPriority())]; !ok { + return ApplicationDownlinkValidationError{ + field: "priority", + reason: "value must be one of the defined enum values", + } + } + + case "correlation_ids": + + default: + return ApplicationDownlinkValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ApplicationDownlinkValidationError is the validation error returned by +// ApplicationDownlink.ValidateFields if the designated constraints aren't met. +type ApplicationDownlinkValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ApplicationDownlinkValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ApplicationDownlinkValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ApplicationDownlinkValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ApplicationDownlinkValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ApplicationDownlinkValidationError) ErrorName() string { + return "ApplicationDownlinkValidationError" +} + +// Error satisfies the builtin error interface +func (e ApplicationDownlinkValidationError) 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 %sApplicationDownlink.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ApplicationDownlinkValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ApplicationDownlinkValidationError{} + +// ValidateFields checks the field values on ApplicationDownlinks with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ApplicationDownlinks) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ApplicationDownlinksFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "downlinks": + + for idx, item := range m.GetDownlinks() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationDownlinksValidationError{ + field: fmt.Sprintf("downlinks[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + default: + return ApplicationDownlinksValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ApplicationDownlinksValidationError is the validation error returned by +// ApplicationDownlinks.ValidateFields if the designated constraints aren't met. +type ApplicationDownlinksValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ApplicationDownlinksValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ApplicationDownlinksValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ApplicationDownlinksValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ApplicationDownlinksValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ApplicationDownlinksValidationError) ErrorName() string { + return "ApplicationDownlinksValidationError" +} + +// Error satisfies the builtin error interface +func (e ApplicationDownlinksValidationError) 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 %sApplicationDownlinks.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ApplicationDownlinksValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ApplicationDownlinksValidationError{} + +// ValidateFields checks the field values on ApplicationDownlinkFailed with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ApplicationDownlinkFailed) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ApplicationDownlinkFailedFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "downlink": + + if v, ok := interface{}(&m.ApplicationDownlink).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationDownlinkFailedValidationError{ + field: "downlink", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "error": + + if v, ok := interface{}(&m.Error).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationDownlinkFailedValidationError{ + field: "error", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return ApplicationDownlinkFailedValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ApplicationDownlinkFailedValidationError is the validation error returned by +// ApplicationDownlinkFailed.ValidateFields if the designated constraints +// aren't met. +type ApplicationDownlinkFailedValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ApplicationDownlinkFailedValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ApplicationDownlinkFailedValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ApplicationDownlinkFailedValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ApplicationDownlinkFailedValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ApplicationDownlinkFailedValidationError) ErrorName() string { + return "ApplicationDownlinkFailedValidationError" +} + +// Error satisfies the builtin error interface +func (e ApplicationDownlinkFailedValidationError) 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 %sApplicationDownlinkFailed.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ApplicationDownlinkFailedValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ApplicationDownlinkFailedValidationError{} + +// ValidateFields checks the field values on ApplicationInvalidatedDownlinks +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *ApplicationInvalidatedDownlinks) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ApplicationInvalidatedDownlinksFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "downlinks": + + if len(m.GetDownlinks()) < 1 { + return ApplicationInvalidatedDownlinksValidationError{ + field: "downlinks", + reason: "value must contain at least 1 item(s)", + } + } + + for idx, item := range m.GetDownlinks() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationInvalidatedDownlinksValidationError{ + field: fmt.Sprintf("downlinks[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "last_f_cnt_down": + // no validation rules for LastFCntDown + default: + return ApplicationInvalidatedDownlinksValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ApplicationInvalidatedDownlinksValidationError is the validation error +// returned by ApplicationInvalidatedDownlinks.ValidateFields if the +// designated constraints aren't met. +type ApplicationInvalidatedDownlinksValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ApplicationInvalidatedDownlinksValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ApplicationInvalidatedDownlinksValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ApplicationInvalidatedDownlinksValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ApplicationInvalidatedDownlinksValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ApplicationInvalidatedDownlinksValidationError) ErrorName() string { + return "ApplicationInvalidatedDownlinksValidationError" +} + +// Error satisfies the builtin error interface +func (e ApplicationInvalidatedDownlinksValidationError) 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 %sApplicationInvalidatedDownlinks.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ApplicationInvalidatedDownlinksValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ApplicationInvalidatedDownlinksValidationError{} + +// ValidateFields checks the field values on ApplicationUp with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ApplicationUp) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ApplicationUpFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "end_device_ids": + + if v, ok := interface{}(&m.EndDeviceIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationUpValidationError{ + field: "end_device_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "correlation_ids": + + case "up": + if len(subs) == 0 { + subs = []string{ + "uplink_message", "join_accept", "downlink_ack", "downlink_nack", "downlink_sent", "downlink_failed", "downlink_queued", "downlink_queue_invalidated", "location_solved", + } + } + for name, subs := range _processPaths(subs) { + _ = subs + switch name { + case "uplink_message": + + if v, ok := interface{}(m.GetUplinkMessage()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationUpValidationError{ + field: "uplink_message", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "join_accept": + + if v, ok := interface{}(m.GetJoinAccept()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationUpValidationError{ + field: "join_accept", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "downlink_ack": + + if v, ok := interface{}(m.GetDownlinkAck()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationUpValidationError{ + field: "downlink_ack", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "downlink_nack": + + if v, ok := interface{}(m.GetDownlinkNack()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationUpValidationError{ + field: "downlink_nack", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "downlink_sent": + + if v, ok := interface{}(m.GetDownlinkSent()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationUpValidationError{ + field: "downlink_sent", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "downlink_failed": + + if v, ok := interface{}(m.GetDownlinkFailed()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationUpValidationError{ + field: "downlink_failed", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "downlink_queued": + + if v, ok := interface{}(m.GetDownlinkQueued()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationUpValidationError{ + field: "downlink_queued", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "downlink_queue_invalidated": + + if v, ok := interface{}(m.GetDownlinkQueueInvalidated()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationUpValidationError{ + field: "downlink_queue_invalidated", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "location_solved": + + if v, ok := interface{}(m.GetLocationSolved()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationUpValidationError{ + field: "location_solved", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return ApplicationUpValidationError{ + field: "up", + reason: "value is required", + } + } + } + default: + return ApplicationUpValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ApplicationUpValidationError is the validation error returned by +// ApplicationUp.ValidateFields if the designated constraints aren't met. +type ApplicationUpValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ApplicationUpValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ApplicationUpValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ApplicationUpValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ApplicationUpValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ApplicationUpValidationError) ErrorName() string { return "ApplicationUpValidationError" } + +// Error satisfies the builtin error interface +func (e ApplicationUpValidationError) 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 %sApplicationUp.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ApplicationUpValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ApplicationUpValidationError{} + +// ValidateFields checks the field values on MessagePayloadFormatters with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *MessagePayloadFormatters) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = MessagePayloadFormattersFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "up_formatter": + + if _, ok := PayloadFormatter_name[int32(m.GetUpFormatter())]; !ok { + return MessagePayloadFormattersValidationError{ + field: "up_formatter", + reason: "value must be one of the defined enum values", + } + } + + case "up_formatter_parameter": + // no validation rules for UpFormatterParameter + case "down_formatter": + + if _, ok := PayloadFormatter_name[int32(m.GetDownFormatter())]; !ok { + return MessagePayloadFormattersValidationError{ + field: "down_formatter", + reason: "value must be one of the defined enum values", + } + } + + case "down_formatter_parameter": + // no validation rules for DownFormatterParameter + default: + return MessagePayloadFormattersValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// MessagePayloadFormattersValidationError is the validation error returned by +// MessagePayloadFormatters.ValidateFields if the designated constraints +// aren't met. +type MessagePayloadFormattersValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e MessagePayloadFormattersValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e MessagePayloadFormattersValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e MessagePayloadFormattersValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e MessagePayloadFormattersValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e MessagePayloadFormattersValidationError) ErrorName() string { + return "MessagePayloadFormattersValidationError" +} + +// Error satisfies the builtin error interface +func (e MessagePayloadFormattersValidationError) 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 %sMessagePayloadFormatters.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = MessagePayloadFormattersValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = MessagePayloadFormattersValidationError{} + +// ValidateFields checks the field values on DownlinkQueueRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *DownlinkQueueRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = DownlinkQueueRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "end_device_ids": + + if v, ok := interface{}(&m.EndDeviceIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return DownlinkQueueRequestValidationError{ + field: "end_device_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "downlinks": + + for idx, item := range m.GetDownlinks() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return DownlinkQueueRequestValidationError{ + field: fmt.Sprintf("downlinks[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + default: + return DownlinkQueueRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// DownlinkQueueRequestValidationError is the validation error returned by +// DownlinkQueueRequest.ValidateFields if the designated constraints aren't met. +type DownlinkQueueRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e DownlinkQueueRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e DownlinkQueueRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e DownlinkQueueRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e DownlinkQueueRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e DownlinkQueueRequestValidationError) ErrorName() string { + return "DownlinkQueueRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e DownlinkQueueRequestValidationError) 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 %sDownlinkQueueRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = DownlinkQueueRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = DownlinkQueueRequestValidationError{} + +// ValidateFields checks the field values on ApplicationDownlink_ClassBC with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *ApplicationDownlink_ClassBC) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ApplicationDownlink_ClassBCFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "gateways": + + for idx, item := range m.GetGateways() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationDownlink_ClassBCValidationError{ + field: fmt.Sprintf("gateways[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "absolute_time": + + if v, ok := interface{}(m.GetAbsoluteTime()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ApplicationDownlink_ClassBCValidationError{ + field: "absolute_time", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return ApplicationDownlink_ClassBCValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ApplicationDownlink_ClassBCValidationError is the validation error returned +// by ApplicationDownlink_ClassBC.ValidateFields if the designated constraints +// aren't met. +type ApplicationDownlink_ClassBCValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ApplicationDownlink_ClassBCValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ApplicationDownlink_ClassBCValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ApplicationDownlink_ClassBCValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ApplicationDownlink_ClassBCValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ApplicationDownlink_ClassBCValidationError) ErrorName() string { + return "ApplicationDownlink_ClassBCValidationError" +} + +// Error satisfies the builtin error interface +func (e ApplicationDownlink_ClassBCValidationError) 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 %sApplicationDownlink_ClassBC.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ApplicationDownlink_ClassBCValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ApplicationDownlink_ClassBCValidationError{} diff --git a/pkg/ttnpb/messages.validator.pb.go b/pkg/ttnpb/messages.validator.pb.go deleted file mode 100644 index 834143222e..0000000000 --- a/pkg/ttnpb/messages.validator.pb.go +++ /dev/null @@ -1,255 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/messages.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/struct" -import _ "github.com/golang/protobuf/ptypes/timestamp" -import _ "github.com/mwitkow/go-proto-validators" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *UplinkMessage) Validate() error { - if this.Payload != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Payload); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Payload", err) - } - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Settings)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Settings", err) - } - for _, item := range this.RxMetadata { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("RxMetadata", err) - } - } - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ReceivedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ReceivedAt", err) - } - return nil -} -func (this *DownlinkMessage) Validate() error { - if this.Payload != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Payload); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Payload", err) - } - } - if this.EndDeviceIDs != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.EndDeviceIDs); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("EndDeviceIDs", err) - } - } - if oneOfNester, ok := this.GetSettings().(*DownlinkMessage_Request); ok { - if oneOfNester.Request != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.Request); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Request", err) - } - } - } - if oneOfNester, ok := this.GetSettings().(*DownlinkMessage_Scheduled); ok { - if oneOfNester.Scheduled != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.Scheduled); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Scheduled", err) - } - } - } - return nil -} -func (this *TxAcknowledgment) Validate() error { - return nil -} -func (this *ApplicationUplink) Validate() error { - if this.DecodedPayload != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.DecodedPayload); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DecodedPayload", err) - } - } - for _, item := range this.RxMetadata { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("RxMetadata", err) - } - } - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Settings)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Settings", err) - } - return nil -} -func (this *ApplicationLocation) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Location)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Location", err) - } - // Validation of proto3 map<> fields is unsupported. - return nil -} -func (this *ApplicationJoinAccept) Validate() error { - if this.AppSKey != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.AppSKey); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("AppSKey", err) - } - } - for _, item := range this.InvalidatedDownlinks { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("InvalidatedDownlinks", err) - } - } - } - return nil -} -func (this *ApplicationDownlink) Validate() error { - if this.DecodedPayload != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.DecodedPayload); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DecodedPayload", err) - } - } - if this.ClassBC != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ClassBC); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ClassBC", err) - } - } - return nil -} -func (this *ApplicationDownlink_ClassBC) Validate() error { - for _, item := range this.Gateways { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Gateways", err) - } - } - } - if this.AbsoluteTime != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.AbsoluteTime); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("AbsoluteTime", err) - } - } - return nil -} -func (this *ApplicationDownlinks) Validate() error { - for _, item := range this.Downlinks { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Downlinks", err) - } - } - } - return nil -} -func (this *ApplicationDownlinkFailed) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ApplicationDownlink)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationDownlink", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Error)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Error", err) - } - return nil -} -func (this *ApplicationInvalidatedDownlinks) Validate() error { - for _, item := range this.Downlinks { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Downlinks", err) - } - } - } - return nil -} -func (this *ApplicationUp) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.EndDeviceIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("EndDeviceIdentifiers", err) - } - if oneOfNester, ok := this.GetUp().(*ApplicationUp_UplinkMessage); ok { - if oneOfNester.UplinkMessage != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.UplinkMessage); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UplinkMessage", err) - } - } - } - if oneOfNester, ok := this.GetUp().(*ApplicationUp_JoinAccept); ok { - if oneOfNester.JoinAccept != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.JoinAccept); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("JoinAccept", err) - } - } - } - if oneOfNester, ok := this.GetUp().(*ApplicationUp_DownlinkAck); ok { - if oneOfNester.DownlinkAck != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.DownlinkAck); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DownlinkAck", err) - } - } - } - if oneOfNester, ok := this.GetUp().(*ApplicationUp_DownlinkNack); ok { - if oneOfNester.DownlinkNack != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.DownlinkNack); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DownlinkNack", err) - } - } - } - if oneOfNester, ok := this.GetUp().(*ApplicationUp_DownlinkSent); ok { - if oneOfNester.DownlinkSent != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.DownlinkSent); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DownlinkSent", err) - } - } - } - if oneOfNester, ok := this.GetUp().(*ApplicationUp_DownlinkFailed); ok { - if oneOfNester.DownlinkFailed != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.DownlinkFailed); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DownlinkFailed", err) - } - } - } - if oneOfNester, ok := this.GetUp().(*ApplicationUp_DownlinkQueued); ok { - if oneOfNester.DownlinkQueued != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.DownlinkQueued); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DownlinkQueued", err) - } - } - } - if oneOfNester, ok := this.GetUp().(*ApplicationUp_DownlinkQueueInvalidated); ok { - if oneOfNester.DownlinkQueueInvalidated != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.DownlinkQueueInvalidated); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("DownlinkQueueInvalidated", err) - } - } - } - if oneOfNester, ok := this.GetUp().(*ApplicationUp_LocationSolved); ok { - if oneOfNester.LocationSolved != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(oneOfNester.LocationSolved); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("LocationSolved", err) - } - } - } - return nil -} -func (this *MessagePayloadFormatters) Validate() error { - return nil -} -func (this *DownlinkQueueRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.EndDeviceIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("EndDeviceIdentifiers", err) - } - for _, item := range this.Downlinks { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Downlinks", err) - } - } - } - return nil -} diff --git a/pkg/ttnpb/metadata.pb.go b/pkg/ttnpb/metadata.pb.go index b92dcbf47a..784e970985 100644 --- a/pkg/ttnpb/metadata.pb.go +++ b/pkg/ttnpb/metadata.pb.go @@ -9,6 +9,7 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" import time "time" @@ -84,7 +85,7 @@ var LocationSource_value = map[string]int32{ } func (LocationSource) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_metadata_8f259ff0d4005ede, []int{0} + return fileDescriptor_metadata_a3e7a08775c8e38d, []int{0} } // Contains metadata for a received message. Each antenna that receives @@ -127,7 +128,7 @@ type RxMetadata struct { func (m *RxMetadata) Reset() { *m = RxMetadata{} } func (*RxMetadata) ProtoMessage() {} func (*RxMetadata) Descriptor() ([]byte, []int) { - return fileDescriptor_metadata_8f259ff0d4005ede, []int{0} + return fileDescriptor_metadata_a3e7a08775c8e38d, []int{0} } func (m *RxMetadata) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -279,7 +280,7 @@ type Location struct { func (m *Location) Reset() { *m = Location{} } func (*Location) ProtoMessage() {} func (*Location) Descriptor() ([]byte, []int) { - return fileDescriptor_metadata_8f259ff0d4005ede, []int{1} + return fileDescriptor_metadata_a3e7a08775c8e38d, []int{1} } func (m *Location) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1585,73 +1586,77 @@ var ( ) func init() { - proto.RegisterFile("lorawan-stack/api/metadata.proto", fileDescriptor_metadata_8f259ff0d4005ede) + proto.RegisterFile("lorawan-stack/api/metadata.proto", fileDescriptor_metadata_a3e7a08775c8e38d) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/metadata.proto", fileDescriptor_metadata_8f259ff0d4005ede) + golang_proto.RegisterFile("lorawan-stack/api/metadata.proto", fileDescriptor_metadata_a3e7a08775c8e38d) } -var fileDescriptor_metadata_8f259ff0d4005ede = []byte{ - // 961 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x94, 0x31, 0x50, 0x1b, 0xc7, - 0x17, 0xc6, 0x6f, 0x41, 0x80, 0x58, 0x81, 0x60, 0xf6, 0x3f, 0xd8, 0x87, 0xe0, 0xbf, 0x77, 0xc1, - 0x93, 0x8c, 0x92, 0x89, 0x4f, 0x33, 0xe0, 0xc9, 0xa4, 0x45, 0x80, 0x99, 0x1b, 0x83, 0x44, 0x56, - 0xf2, 0x78, 0x92, 0xe6, 0xb2, 0xdc, 0xad, 0x4e, 0x37, 0x12, 0x7b, 0xca, 0xdd, 0x0a, 0x4c, 0xe7, - 0x92, 0xd2, 0xe9, 0x52, 0x66, 0x92, 0xc6, 0xa5, 0x8b, 0x14, 0x2e, 0x5d, 0x52, 0x52, 0xba, 0x52, - 0xac, 0x53, 0xe3, 0xd2, 0x5d, 0x5c, 0x66, 0x6e, 0xb5, 0x88, 0x08, 0x99, 0x4e, 0xef, 0xfb, 0x7e, - 0xdf, 0xd3, 0xbe, 0x9d, 0xb7, 0x07, 0xcd, 0x76, 0x18, 0xd1, 0x33, 0xca, 0x1f, 0xc6, 0x82, 0xba, - 0xad, 0x12, 0xed, 0x04, 0xa5, 0x13, 0x26, 0xa8, 0x47, 0x05, 0xb5, 0x3a, 0x51, 0x28, 0x42, 0x94, - 0x17, 0x82, 0x5b, 0x8a, 0xb2, 0x4e, 0xb7, 0x0a, 0x0f, 0xfd, 0x40, 0x34, 0xbb, 0xc7, 0x96, 0x1b, - 0x9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, 0x12, 0xac, 0xbd, 0x4f, 0x30, 0xf8, 0x90, 0x60, 0xed, 0x63, 0x82, - 0xc1, 0xa7, 0x04, 0x6b, 0x2f, 0x06, 0x58, 0xbb, 0x18, 0x60, 0xf0, 0x72, 0x80, 0xb5, 0xdf, 0x06, - 0x18, 0xfc, 0x3e, 0xc0, 0xda, 0xab, 0x01, 0xd6, 0x5e, 0x0f, 0x30, 0x78, 0x33, 0xc0, 0xe0, 0xed, - 0x00, 0x83, 0x9f, 0xbe, 0xf5, 0x43, 0x4b, 0x34, 0x99, 0x68, 0x06, 0xdc, 0x8f, 0x2d, 0xce, 0xc4, - 0x59, 0x18, 0xb5, 0x4a, 0xe3, 0x5f, 0xfd, 0x4e, 0xcb, 0x2f, 0x09, 0xc1, 0x3b, 0xc7, 0xc7, 0xb3, - 0x72, 0x15, 0xb7, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x96, 0xb9, 0xab, 0xd4, 0xd6, 0x06, 0x00, - 0x00, +var fileDescriptor_metadata_a3e7a08775c8e38d = []byte{ + // 1037 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x95, 0x41, 0x4c, 0x1b, 0xc7, + 0x17, 0xc6, 0x77, 0xb0, 0x01, 0x33, 0x06, 0x63, 0xcd, 0xff, 0x9f, 0x64, 0x31, 0x74, 0xd6, 0x25, + 0x6a, 0xe5, 0x54, 0xc5, 0x96, 0x20, 0x55, 0x2b, 0xf5, 0x52, 0x0c, 0x04, 0x59, 0x21, 0x36, 0x1d, + 0x3b, 0x45, 0xed, 0x65, 0x35, 0xec, 0x8e, 0xd7, 0x2b, 0x2f, 0xb3, 0xee, 0xee, 0x18, 0xe2, 0x1b, + 0xea, 0x09, 0x55, 0xaa, 0x94, 0xde, 0x7a, 0xac, 0xda, 0x4b, 0x8e, 0x39, 0x46, 0x3d, 0x71, 0xe4, + 0xc8, 0x31, 0x27, 0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x72, 0xf3, 0xa2, 0xc1, 0x44, 0xc3, 0xe6, 0x96, 0x9f, 0xe7, 0x4c, 0x9c, 0xb8, 0x5e, 0xb3, 0x30, + 0xfe, 0x6b, 0xd2, 0x6a, 0x5a, 0x05, 0x21, 0x78, 0xeb, 0xf0, 0x70, 0x46, 0x0e, 0xf3, 0xc6, 0x7f, + 0x01, 0x00, 0x00, 0xff, 0xff, 0x22, 0x03, 0xc7, 0xdf, 0x6b, 0x07, 0x00, 0x00, } diff --git a/pkg/ttnpb/metadata.pb.paths.fm.go b/pkg/ttnpb/metadata.pb.paths.fm.go new file mode 100644 index 0000000000..f07c88a475 --- /dev/null +++ b/pkg/ttnpb/metadata.pb.paths.fm.go @@ -0,0 +1,63 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var RxMetadataFieldPathsNested = []string{ + "advanced", + "antenna_index", + "channel_rssi", + "downlink_path_constraint", + "encrypted_fine_timestamp", + "encrypted_fine_timestamp_key_id", + "fine_timestamp", + "frequency_offset", + "gateway_ids", + "gateway_ids.eui", + "gateway_ids.gateway_id", + "location", + "location.accuracy", + "location.altitude", + "location.latitude", + "location.longitude", + "location.source", + "rssi", + "rssi_standard_deviation", + "snr", + "time", + "timestamp", + "uplink_token", +} + +var RxMetadataFieldPathsTopLevel = []string{ + "advanced", + "antenna_index", + "channel_rssi", + "downlink_path_constraint", + "encrypted_fine_timestamp", + "encrypted_fine_timestamp_key_id", + "fine_timestamp", + "frequency_offset", + "gateway_ids", + "location", + "rssi", + "rssi_standard_deviation", + "snr", + "time", + "timestamp", + "uplink_token", +} +var LocationFieldPathsNested = []string{ + "accuracy", + "altitude", + "latitude", + "longitude", + "source", +} + +var LocationFieldPathsTopLevel = []string{ + "accuracy", + "altitude", + "latitude", + "longitude", + "source", +} diff --git a/pkg/ttnpb/metadata.pb.fm.go b/pkg/ttnpb/metadata.pb.setters.fm.go similarity index 84% rename from pkg/ttnpb/metadata.pb.fm.go rename to pkg/ttnpb/metadata.pb.setters.fm.go index 7d7d1a8b2c..11363cdbaa 100644 --- a/pkg/ttnpb/metadata.pb.fm.go +++ b/pkg/ttnpb/metadata.pb.setters.fm.go @@ -4,51 +4,6 @@ package ttnpb import fmt "fmt" -var RxMetadataFieldPathsNested = []string{ - "advanced", - "antenna_index", - "channel_rssi", - "downlink_path_constraint", - "encrypted_fine_timestamp", - "encrypted_fine_timestamp_key_id", - "fine_timestamp", - "frequency_offset", - "gateway_ids", - "gateway_ids.eui", - "gateway_ids.gateway_id", - "location", - "location.accuracy", - "location.altitude", - "location.latitude", - "location.longitude", - "location.source", - "rssi", - "rssi_standard_deviation", - "snr", - "time", - "timestamp", - "uplink_token", -} - -var RxMetadataFieldPathsTopLevel = []string{ - "advanced", - "antenna_index", - "channel_rssi", - "downlink_path_constraint", - "encrypted_fine_timestamp", - "encrypted_fine_timestamp_key_id", - "fine_timestamp", - "frequency_offset", - "gateway_ids", - "location", - "rssi", - "rssi_standard_deviation", - "snr", - "time", - "timestamp", - "uplink_token", -} - func (dst *RxMetadata) SetFields(src *RxMetadata, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -116,8 +71,7 @@ func (dst *RxMetadata) SetFields(src *RxMetadata, paths ...string) error { if src != nil { dst.EncryptedFineTimestamp = src.EncryptedFineTimestamp } else { - var zero []byte - dst.EncryptedFineTimestamp = zero + dst.EncryptedFineTimestamp = nil } case "encrypted_fine_timestamp_key_id": if len(subs) > 0 { @@ -217,8 +171,7 @@ func (dst *RxMetadata) SetFields(src *RxMetadata, paths ...string) error { if src != nil { dst.UplinkToken = src.UplinkToken } else { - var zero []byte - dst.UplinkToken = zero + dst.UplinkToken = nil } case "advanced": if len(subs) > 0 { @@ -237,22 +190,6 @@ func (dst *RxMetadata) SetFields(src *RxMetadata, paths ...string) error { return nil } -var LocationFieldPathsNested = []string{ - "accuracy", - "altitude", - "latitude", - "longitude", - "source", -} - -var LocationFieldPathsTopLevel = []string{ - "accuracy", - "altitude", - "latitude", - "longitude", - "source", -} - func (dst *Location) SetFields(src *Location, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { diff --git a/pkg/ttnpb/metadata.pb.validate.go b/pkg/ttnpb/metadata.pb.validate.go new file mode 100644 index 0000000000..fc0123c7b2 --- /dev/null +++ b/pkg/ttnpb/metadata.pb.validate.go @@ -0,0 +1,301 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on RxMetadata with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *RxMetadata) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = RxMetadataFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "gateway_ids": + + if v, ok := interface{}(&m.GatewayIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return RxMetadataValidationError{ + field: "gateway_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "antenna_index": + // no validation rules for AntennaIndex + case "time": + + if v, ok := interface{}(m.GetTime()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return RxMetadataValidationError{ + field: "time", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "timestamp": + // no validation rules for Timestamp + case "fine_timestamp": + // no validation rules for FineTimestamp + case "encrypted_fine_timestamp": + // no validation rules for EncryptedFineTimestamp + case "encrypted_fine_timestamp_key_id": + // no validation rules for EncryptedFineTimestampKeyID + case "rssi": + // no validation rules for RSSI + case "channel_rssi": + // no validation rules for ChannelRSSI + case "rssi_standard_deviation": + // no validation rules for RSSIStandardDeviation + case "snr": + // no validation rules for SNR + case "frequency_offset": + // no validation rules for FrequencyOffset + case "location": + + if v, ok := interface{}(m.GetLocation()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return RxMetadataValidationError{ + field: "location", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "downlink_path_constraint": + + if _, ok := DownlinkPathConstraint_name[int32(m.GetDownlinkPathConstraint())]; !ok { + return RxMetadataValidationError{ + field: "downlink_path_constraint", + reason: "value must be one of the defined enum values", + } + } + + case "uplink_token": + // no validation rules for UplinkToken + case "advanced": + + if v, ok := interface{}(m.GetAdvanced()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return RxMetadataValidationError{ + field: "advanced", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return RxMetadataValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// RxMetadataValidationError is the validation error returned by +// RxMetadata.ValidateFields if the designated constraints aren't met. +type RxMetadataValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e RxMetadataValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e RxMetadataValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e RxMetadataValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e RxMetadataValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e RxMetadataValidationError) ErrorName() string { return "RxMetadataValidationError" } + +// Error satisfies the builtin error interface +func (e RxMetadataValidationError) 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 %sRxMetadata.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = RxMetadataValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = RxMetadataValidationError{} + +// ValidateFields checks the field values on Location with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *Location) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = LocationFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "latitude": + + if val := m.GetLatitude(); val < -90 || val > 90 { + return LocationValidationError{ + field: "latitude", + reason: "value must be inside range [-90, 90]", + } + } + + case "longitude": + + if val := m.GetLongitude(); val < -180 || val > 180 { + return LocationValidationError{ + field: "longitude", + reason: "value must be inside range [-180, 180]", + } + } + + case "altitude": + // no validation rules for Altitude + case "accuracy": + // no validation rules for Accuracy + case "source": + + if _, ok := LocationSource_name[int32(m.GetSource())]; !ok { + return LocationValidationError{ + field: "source", + reason: "value must be one of the defined enum values", + } + } + + default: + return LocationValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// LocationValidationError is the validation error returned by +// Location.ValidateFields if the designated constraints aren't met. +type LocationValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e LocationValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e LocationValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e LocationValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e LocationValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e LocationValidationError) ErrorName() string { return "LocationValidationError" } + +// Error satisfies the builtin error interface +func (e LocationValidationError) 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 %sLocation.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = LocationValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = LocationValidationError{} diff --git a/pkg/ttnpb/metadata.validator.pb.go b/pkg/ttnpb/metadata.validator.pb.go deleted file mode 100644 index fe5085b4b5..0000000000 --- a/pkg/ttnpb/metadata.validator.pb.go +++ /dev/null @@ -1,45 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/metadata.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/struct" -import _ "github.com/golang/protobuf/ptypes/timestamp" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *RxMetadata) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.GatewayIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("GatewayIdentifiers", err) - } - if this.Time != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Time); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Time", err) - } - } - if this.Location != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Location); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Location", err) - } - } - if this.Advanced != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Advanced); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Advanced", err) - } - } - return nil -} -func (this *Location) Validate() error { - return nil -} diff --git a/pkg/ttnpb/networkserver.pb.gw.go b/pkg/ttnpb/networkserver.pb.gw.go index 184b0b0ddd..27fd6788cb 100644 --- a/pkg/ttnpb/networkserver.pb.gw.go +++ b/pkg/ttnpb/networkserver.pb.gw.go @@ -9,11 +9,10 @@ It translates gRPC into RESTful JSON APIs. package ttnpb import ( + "context" "io" "net/http" - "context" - "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" diff --git a/pkg/ttnpb/networkserver.pb.validate.go b/pkg/ttnpb/networkserver.pb.validate.go new file mode 100644 index 0000000000..fb43d9d432 --- /dev/null +++ b/pkg/ttnpb/networkserver.pb.validate.go @@ -0,0 +1,33 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) diff --git a/pkg/ttnpb/networkserver.validator.pb.go b/pkg/ttnpb/networkserver.validator.pb.go deleted file mode 100644 index db3ac89b11..0000000000 --- a/pkg/ttnpb/networkserver.validator.pb.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/networkserver.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/empty" -import _ "google.golang.org/genproto/googleapis/api/annotations" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen diff --git a/pkg/ttnpb/oauth.pb.go b/pkg/ttnpb/oauth.pb.go index bd838b69a8..36df01bc1d 100644 --- a/pkg/ttnpb/oauth.pb.go +++ b/pkg/ttnpb/oauth.pb.go @@ -9,6 +9,7 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import _ "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" import time "time" @@ -42,7 +43,7 @@ type OAuthClientAuthorizationIdentifiers struct { func (m *OAuthClientAuthorizationIdentifiers) Reset() { *m = OAuthClientAuthorizationIdentifiers{} } func (*OAuthClientAuthorizationIdentifiers) ProtoMessage() {} func (*OAuthClientAuthorizationIdentifiers) Descriptor() ([]byte, []int) { - return fileDescriptor_oauth_c8a6878985e94c8c, []int{0} + return fileDescriptor_oauth_1a455a7cc681461a, []int{0} } func (m *OAuthClientAuthorizationIdentifiers) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -98,7 +99,7 @@ type OAuthClientAuthorization struct { func (m *OAuthClientAuthorization) Reset() { *m = OAuthClientAuthorization{} } func (*OAuthClientAuthorization) ProtoMessage() {} func (*OAuthClientAuthorization) Descriptor() ([]byte, []int) { - return fileDescriptor_oauth_c8a6878985e94c8c, []int{1} + return fileDescriptor_oauth_1a455a7cc681461a, []int{1} } func (m *OAuthClientAuthorization) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -171,7 +172,7 @@ type OAuthClientAuthorizations struct { func (m *OAuthClientAuthorizations) Reset() { *m = OAuthClientAuthorizations{} } func (*OAuthClientAuthorizations) ProtoMessage() {} func (*OAuthClientAuthorizations) Descriptor() ([]byte, []int) { - return fileDescriptor_oauth_c8a6878985e94c8c, []int{2} + return fileDescriptor_oauth_1a455a7cc681461a, []int{2} } func (m *OAuthClientAuthorizations) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -223,7 +224,7 @@ type ListOAuthClientAuthorizationsRequest struct { func (m *ListOAuthClientAuthorizationsRequest) Reset() { *m = ListOAuthClientAuthorizationsRequest{} } func (*ListOAuthClientAuthorizationsRequest) ProtoMessage() {} func (*ListOAuthClientAuthorizationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_oauth_c8a6878985e94c8c, []int{3} + return fileDescriptor_oauth_1a455a7cc681461a, []int{3} } func (m *ListOAuthClientAuthorizationsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -289,7 +290,7 @@ type OAuthAuthorizationCode struct { func (m *OAuthAuthorizationCode) Reset() { *m = OAuthAuthorizationCode{} } func (*OAuthAuthorizationCode) ProtoMessage() {} func (*OAuthAuthorizationCode) Descriptor() ([]byte, []int) { - return fileDescriptor_oauth_c8a6878985e94c8c, []int{4} + return fileDescriptor_oauth_1a455a7cc681461a, []int{4} } func (m *OAuthAuthorizationCode) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -385,7 +386,7 @@ type OAuthAccessTokenIdentifiers struct { func (m *OAuthAccessTokenIdentifiers) Reset() { *m = OAuthAccessTokenIdentifiers{} } func (*OAuthAccessTokenIdentifiers) ProtoMessage() {} func (*OAuthAccessTokenIdentifiers) Descriptor() ([]byte, []int) { - return fileDescriptor_oauth_c8a6878985e94c8c, []int{5} + return fileDescriptor_oauth_1a455a7cc681461a, []int{5} } func (m *OAuthAccessTokenIdentifiers) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -451,7 +452,7 @@ type OAuthAccessToken struct { func (m *OAuthAccessToken) Reset() { *m = OAuthAccessToken{} } func (*OAuthAccessToken) ProtoMessage() {} func (*OAuthAccessToken) Descriptor() ([]byte, []int) { - return fileDescriptor_oauth_c8a6878985e94c8c, []int{6} + return fileDescriptor_oauth_1a455a7cc681461a, []int{6} } func (m *OAuthAccessToken) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -545,7 +546,7 @@ type OAuthAccessTokens struct { func (m *OAuthAccessTokens) Reset() { *m = OAuthAccessTokens{} } func (*OAuthAccessTokens) ProtoMessage() {} func (*OAuthAccessTokens) Descriptor() ([]byte, []int) { - return fileDescriptor_oauth_c8a6878985e94c8c, []int{7} + return fileDescriptor_oauth_1a455a7cc681461a, []int{7} } func (m *OAuthAccessTokens) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -598,7 +599,7 @@ type ListOAuthAccessTokensRequest struct { func (m *ListOAuthAccessTokensRequest) Reset() { *m = ListOAuthAccessTokensRequest{} } func (*ListOAuthAccessTokensRequest) ProtoMessage() {} func (*ListOAuthAccessTokensRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_oauth_c8a6878985e94c8c, []int{8} + return fileDescriptor_oauth_1a455a7cc681461a, []int{8} } func (m *ListOAuthAccessTokensRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3756,63 +3757,66 @@ var ( ) func init() { - proto.RegisterFile("lorawan-stack/api/oauth.proto", fileDescriptor_oauth_c8a6878985e94c8c) + proto.RegisterFile("lorawan-stack/api/oauth.proto", fileDescriptor_oauth_1a455a7cc681461a) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/oauth.proto", fileDescriptor_oauth_c8a6878985e94c8c) -} - -var fileDescriptor_oauth_c8a6878985e94c8c = []byte{ - // 816 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0x3d, 0x70, 0x1b, 0x45, - 0x18, 0xdd, 0x95, 0x6c, 0xd9, 0x5a, 0xd9, 0x0e, 0xb9, 0x81, 0x8c, 0x30, 0xb0, 0xa7, 0x9c, 0x29, - 0x54, 0xe0, 0xd3, 0x8c, 0xd3, 0xd0, 0x5a, 0x76, 0xe3, 0x01, 0x06, 0x66, 0x89, 0x1b, 0x1a, 0xcf, - 0xf9, 0x6e, 0x7d, 0xda, 0xb1, 0x74, 0x7b, 0xec, 0xee, 0x11, 0x86, 0xca, 0x65, 0xca, 0x94, 0x94, - 0x0c, 0x55, 0x0a, 0x8a, 0x94, 0x29, 0xd3, 0xe1, 0x86, 0x19, 0x53, 0x91, 0x4a, 0x44, 0x7b, 0x4d, - 0xca, 0x34, 0xcc, 0xa4, 0x64, 0x6e, 0x6f, 0x15, 0xfd, 0xc4, 0x2a, 0x44, 0x43, 0x92, 0x6e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x71, - 0x16, 0xb7, 0xae, 0xcd, 0xe2, 0xa9, 0x12, 0x62, 0xf1, 0xde, 0x45, 0x05, 0x7d, 0xfc, 0x2a, 0x7b, - 0xa7, 0x39, 0xc7, 0x99, 0xfb, 0xe6, 0x5b, 0xe5, 0x55, 0x9e, 0x57, 0xaf, 0xcd, 0xf3, 0x95, 0xeb, - 0xf2, 0x7c, 0x75, 0x92, 0xe7, 0xdd, 0x5f, 0xe1, 0xe5, 0x08, 0xc3, 0xab, 0x11, 0x86, 0x4f, 0x47, - 0x18, 0x3c, 0x1b, 0x61, 0xf0, 0x7c, 0x84, 0xc1, 0x8b, 0x11, 0x06, 0x2f, 0x47, 0x18, 0x5e, 0x68, - 0x0c, 0xef, 0x6b, 0x0c, 0x1e, 0x6a, 0x0c, 0x1f, 0x69, 0x0c, 0x1e, 0x6b, 0x0c, 0x9e, 0x68, 0x0c, - 0x2e, 0x35, 0x86, 0x57, 0x1a, 0xc3, 0xa7, 0x1a, 0x83, 0x67, 0x1a, 0xc3, 0xe7, 0x1a, 0x83, 0x17, - 0x1a, 0xc3, 0x97, 0x1a, 0x83, 0x8b, 0x1c, 0x83, 0xfb, 0x39, 0x86, 0x0f, 0x72, 0x0c, 0x7e, 0xce, - 0x31, 0xfc, 0x25, 0xc7, 0xe0, 0x61, 0x8e, 0xc1, 0xa3, 0x1c, 0xc3, 0xc7, 0x39, 0x86, 0x4f, 0x72, - 0x0c, 0xbf, 0xfb, 0x2c, 0xe6, 0xbe, 0xea, 0x51, 0xd5, 0x63, 0x49, 0x2c, 0xfd, 0x84, 0xaa, 0x7b, - 0x5c, 0x9c, 0x77, 0x66, 0xff, 0xdb, 0xa5, 0xe7, 0x71, 0x47, 0xa9, 0x24, 0x3d, 0x3d, 0xad, 0x19, - 0x7f, 0xdc, 0xf9, 0x37, 0x00, 0x00, 0xff, 0xff, 0xb2, 0xf7, 0xe9, 0x80, 0xa1, 0x0a, 0x00, 0x00, + golang_proto.RegisterFile("lorawan-stack/api/oauth.proto", fileDescriptor_oauth_1a455a7cc681461a) +} + +var fileDescriptor_oauth_1a455a7cc681461a = []byte{ + // 858 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x56, 0x3d, 0x6c, 0x1b, 0x37, + 0x14, 0x3e, 0xea, 0x6c, 0xd9, 0xa2, 0x6c, 0x37, 0x3d, 0xb4, 0x81, 0xe2, 0xb4, 0x94, 0x22, 0x77, + 0xd0, 0x50, 0x9d, 0x00, 0x67, 0x29, 0xd0, 0xc9, 0x72, 0x16, 0x03, 0xfd, 0xc3, 0x21, 0x5e, 0x0a, + 0x14, 0x06, 0x7d, 0x47, 0x9f, 0x08, 0x4b, 0x47, 0x95, 0x7c, 0x97, 0xb4, 0x9d, 0x32, 0xa6, 0x9d, + 0x32, 0x74, 0xe8, 0x58, 0x74, 0xca, 0x98, 0xa9, 0x08, 0x3a, 0x79, 0xf4, 0xe8, 0x31, 0x40, 0x01, + 0x35, 0xe2, 0xa1, 0x40, 0x8a, 0x2e, 0x19, 0x33, 0x16, 0xc7, 0xa3, 0x62, 0x49, 0xb6, 0x07, 0x77, + 0x29, 0xdc, 0x6c, 0xfc, 0xf9, 0xde, 0xc7, 0xf7, 0xdd, 0xfb, 0xf8, 0x78, 0xf8, 0xfd, 0xbe, 0x90, + 0xf4, 0x3e, 0x4d, 0xda, 0x0a, 0x68, 0x78, 0xd8, 0xa1, 0x43, 0xde, 0x11, 0x34, 0x85, 0x9e, 0x3f, + 0x94, 0x02, 0x84, 0xb7, 0x06, 0x90, 0xf8, 0x16, 0xe2, 0xdf, 0xbb, 0xbd, 0xde, 0x8e, 0x39, 0xf4, + 0xd2, 0x7d, 0x3f, 0x14, 0x83, 0x4e, 0x2c, 0x62, 0xd1, 0x31, 0xb0, 0xfd, 0xf4, 0xc0, 0xcc, 0xcc, + 0xc4, 0x8c, 0x8a, 0xf0, 0xf5, 0x8f, 0xa7, 0x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 0xf1, 0xf4, 0x7d, 0xe8, 0xfe, 0x82, + 0x8e, 0xc7, 0x04, 0x9d, 0x8c, 0x09, 0x7a, 0x36, 0x26, 0xce, 0xf3, 0x31, 0x71, 0x5e, 0x8c, 0x89, + 0xf3, 0x72, 0x4c, 0x9c, 0x57, 0x63, 0x82, 0x1e, 0x68, 0x82, 0x1e, 0x6a, 0xe2, 0x3c, 0xd6, 0x04, + 0x3d, 0xd1, 0xc4, 0x79, 0xaa, 0x89, 0x73, 0xa4, 0x89, 0x73, 0xac, 0x09, 0x3a, 0xd1, 0x04, 0x3d, + 0xd3, 0xc4, 0x79, 0xae, 0x09, 0x7a, 0xa1, 0x89, 0xf3, 0x52, 0x13, 0xf4, 0x4a, 0x13, 0xe7, 0x41, + 0x46, 0x9c, 0x87, 0x19, 0x41, 0x8f, 0x32, 0xe2, 0xfc, 0x94, 0x11, 0xf4, 0x73, 0x46, 0x9c, 0xc7, + 0x19, 0x71, 0x9e, 0x64, 0x04, 0x3d, 0xcd, 0x08, 0x3a, 0xca, 0x08, 0xfa, 0xf2, 0xc3, 0x58, 0xf8, + 0xd0, 0x63, 0xd0, 0xe3, 0x49, 0xac, 0xfc, 0x84, 0xc1, 0x7d, 0x21, 0x0f, 0x3b, 0xb3, 0x7f, 0x97, + 0xc3, 0xc3, 0xb8, 0x03, 0x90, 0x0c, 0xf7, 0xf7, 0xcb, 0xc6, 0x33, 0xb7, 0xff, 0x09, 0x00, 0x00, + 0xff, 0xff, 0x1c, 0x9e, 0xbd, 0xbe, 0x60, 0x0b, 0x00, 0x00, } diff --git a/pkg/ttnpb/oauth.pb.paths.fm.go b/pkg/ttnpb/oauth.pb.paths.fm.go new file mode 100644 index 0000000000..f329a92642 --- /dev/null +++ b/pkg/ttnpb/oauth.pb.paths.fm.go @@ -0,0 +1,143 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var OAuthClientAuthorizationIdentifiersFieldPathsNested = []string{ + "client_ids", + "client_ids.client_id", + "user_ids", + "user_ids.email", + "user_ids.user_id", +} + +var OAuthClientAuthorizationIdentifiersFieldPathsTopLevel = []string{ + "client_ids", + "user_ids", +} +var OAuthClientAuthorizationFieldPathsNested = []string{ + "client_ids", + "client_ids.client_id", + "created_at", + "rights", + "updated_at", + "user_ids", + "user_ids.email", + "user_ids.user_id", +} + +var OAuthClientAuthorizationFieldPathsTopLevel = []string{ + "client_ids", + "created_at", + "rights", + "updated_at", + "user_ids", +} +var OAuthClientAuthorizationsFieldPathsNested = []string{ + "authorizations", +} + +var OAuthClientAuthorizationsFieldPathsTopLevel = []string{ + "authorizations", +} +var ListOAuthClientAuthorizationsRequestFieldPathsNested = []string{ + "limit", + "order", + "page", + "user_ids", + "user_ids.email", + "user_ids.user_id", +} + +var ListOAuthClientAuthorizationsRequestFieldPathsTopLevel = []string{ + "limit", + "order", + "page", + "user_ids", +} +var OAuthAuthorizationCodeFieldPathsNested = []string{ + "client_ids", + "client_ids.client_id", + "code", + "created_at", + "expires_at", + "redirect_uri", + "rights", + "state", + "user_ids", + "user_ids.email", + "user_ids.user_id", +} + +var OAuthAuthorizationCodeFieldPathsTopLevel = []string{ + "client_ids", + "code", + "created_at", + "expires_at", + "redirect_uri", + "rights", + "state", + "user_ids", +} +var OAuthAccessTokenIdentifiersFieldPathsNested = []string{ + "client_ids", + "client_ids.client_id", + "id", + "user_ids", + "user_ids.email", + "user_ids.user_id", +} + +var OAuthAccessTokenIdentifiersFieldPathsTopLevel = []string{ + "client_ids", + "id", + "user_ids", +} +var OAuthAccessTokenFieldPathsNested = []string{ + "access_token", + "client_ids", + "client_ids.client_id", + "created_at", + "expires_at", + "id", + "refresh_token", + "rights", + "user_ids", + "user_ids.email", + "user_ids.user_id", +} + +var OAuthAccessTokenFieldPathsTopLevel = []string{ + "access_token", + "client_ids", + "created_at", + "expires_at", + "id", + "refresh_token", + "rights", + "user_ids", +} +var OAuthAccessTokensFieldPathsNested = []string{ + "tokens", +} + +var OAuthAccessTokensFieldPathsTopLevel = []string{ + "tokens", +} +var ListOAuthAccessTokensRequestFieldPathsNested = []string{ + "client_ids", + "client_ids.client_id", + "limit", + "order", + "page", + "user_ids", + "user_ids.email", + "user_ids.user_id", +} + +var ListOAuthAccessTokensRequestFieldPathsTopLevel = []string{ + "client_ids", + "limit", + "order", + "page", + "user_ids", +} diff --git a/pkg/ttnpb/oauth.pb.fm.go b/pkg/ttnpb/oauth.pb.setters.fm.go similarity index 84% rename from pkg/ttnpb/oauth.pb.fm.go rename to pkg/ttnpb/oauth.pb.setters.fm.go index 5c02ef3b81..b010699400 100644 --- a/pkg/ttnpb/oauth.pb.fm.go +++ b/pkg/ttnpb/oauth.pb.setters.fm.go @@ -7,19 +7,6 @@ import ( time "time" ) -var OAuthClientAuthorizationIdentifiersFieldPathsNested = []string{ - "client_ids", - "client_ids.client_id", - "user_ids", - "user_ids.email", - "user_ids.user_id", -} - -var OAuthClientAuthorizationIdentifiersFieldPathsTopLevel = []string{ - "client_ids", - "user_ids", -} - func (dst *OAuthClientAuthorizationIdentifiers) SetFields(src *OAuthClientAuthorizationIdentifiers, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -67,25 +54,6 @@ func (dst *OAuthClientAuthorizationIdentifiers) SetFields(src *OAuthClientAuthor return nil } -var OAuthClientAuthorizationFieldPathsNested = []string{ - "client_ids", - "client_ids.client_id", - "created_at", - "rights", - "updated_at", - "user_ids", - "user_ids.email", - "user_ids.user_id", -} - -var OAuthClientAuthorizationFieldPathsTopLevel = []string{ - "client_ids", - "created_at", - "rights", - "updated_at", - "user_ids", -} - func (dst *OAuthClientAuthorization) SetFields(src *OAuthClientAuthorization, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -162,14 +130,6 @@ func (dst *OAuthClientAuthorization) SetFields(src *OAuthClientAuthorization, pa return nil } -var OAuthClientAuthorizationsFieldPathsNested = []string{ - "authorizations", -} - -var OAuthClientAuthorizationsFieldPathsTopLevel = []string{ - "authorizations", -} - func (dst *OAuthClientAuthorizations) SetFields(src *OAuthClientAuthorizations, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -190,22 +150,6 @@ func (dst *OAuthClientAuthorizations) SetFields(src *OAuthClientAuthorizations, return nil } -var ListOAuthClientAuthorizationsRequestFieldPathsNested = []string{ - "limit", - "order", - "page", - "user_ids", - "user_ids.email", - "user_ids.user_id", -} - -var ListOAuthClientAuthorizationsRequestFieldPathsTopLevel = []string{ - "limit", - "order", - "page", - "user_ids", -} - func (dst *ListOAuthClientAuthorizationsRequest) SetFields(src *ListOAuthClientAuthorizationsRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -265,31 +209,6 @@ func (dst *ListOAuthClientAuthorizationsRequest) SetFields(src *ListOAuthClientA return nil } -var OAuthAuthorizationCodeFieldPathsNested = []string{ - "client_ids", - "client_ids.client_id", - "code", - "created_at", - "expires_at", - "redirect_uri", - "rights", - "state", - "user_ids", - "user_ids.email", - "user_ids.user_id", -} - -var OAuthAuthorizationCodeFieldPathsTopLevel = []string{ - "client_ids", - "code", - "created_at", - "expires_at", - "redirect_uri", - "rights", - "state", - "user_ids", -} - func (dst *OAuthAuthorizationCode) SetFields(src *OAuthAuthorizationCode, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -396,21 +315,6 @@ func (dst *OAuthAuthorizationCode) SetFields(src *OAuthAuthorizationCode, paths return nil } -var OAuthAccessTokenIdentifiersFieldPathsNested = []string{ - "client_ids", - "client_ids.client_id", - "id", - "user_ids", - "user_ids.email", - "user_ids.user_id", -} - -var OAuthAccessTokenIdentifiersFieldPathsTopLevel = []string{ - "client_ids", - "id", - "user_ids", -} - func (dst *OAuthAccessTokenIdentifiers) SetFields(src *OAuthAccessTokenIdentifiers, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -468,31 +372,6 @@ func (dst *OAuthAccessTokenIdentifiers) SetFields(src *OAuthAccessTokenIdentifie return nil } -var OAuthAccessTokenFieldPathsNested = []string{ - "access_token", - "client_ids", - "client_ids.client_id", - "created_at", - "expires_at", - "id", - "refresh_token", - "rights", - "user_ids", - "user_ids.email", - "user_ids.user_id", -} - -var OAuthAccessTokenFieldPathsTopLevel = []string{ - "access_token", - "client_ids", - "created_at", - "expires_at", - "id", - "refresh_token", - "rights", - "user_ids", -} - func (dst *OAuthAccessToken) SetFields(src *OAuthAccessToken, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -599,14 +478,6 @@ func (dst *OAuthAccessToken) SetFields(src *OAuthAccessToken, paths ...string) e return nil } -var OAuthAccessTokensFieldPathsNested = []string{ - "tokens", -} - -var OAuthAccessTokensFieldPathsTopLevel = []string{ - "tokens", -} - func (dst *OAuthAccessTokens) SetFields(src *OAuthAccessTokens, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -627,25 +498,6 @@ func (dst *OAuthAccessTokens) SetFields(src *OAuthAccessTokens, paths ...string) return nil } -var ListOAuthAccessTokensRequestFieldPathsNested = []string{ - "client_ids", - "client_ids.client_id", - "limit", - "order", - "page", - "user_ids", - "user_ids.email", - "user_ids.user_id", -} - -var ListOAuthAccessTokensRequestFieldPathsTopLevel = []string{ - "client_ids", - "limit", - "order", - "page", - "user_ids", -} - func (dst *ListOAuthAccessTokensRequest) SetFields(src *ListOAuthAccessTokensRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { diff --git a/pkg/ttnpb/oauth.pb.validate.go b/pkg/ttnpb/oauth.pb.validate.go new file mode 100644 index 0000000000..b615da792f --- /dev/null +++ b/pkg/ttnpb/oauth.pb.validate.go @@ -0,0 +1,1060 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on +// OAuthClientAuthorizationIdentifiers with the rules defined in the proto +// definition for this message. If any rules are violated, an error is returned. +func (m *OAuthClientAuthorizationIdentifiers) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = OAuthClientAuthorizationIdentifiersFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "user_ids": + + if v, ok := interface{}(&m.UserIDs).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OAuthClientAuthorizationIdentifiersValidationError{ + field: "user_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "client_ids": + + if v, ok := interface{}(&m.ClientIDs).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OAuthClientAuthorizationIdentifiersValidationError{ + field: "client_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return OAuthClientAuthorizationIdentifiersValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// OAuthClientAuthorizationIdentifiersValidationError is the validation error +// returned by OAuthClientAuthorizationIdentifiers.ValidateFields if the +// designated constraints aren't met. +type OAuthClientAuthorizationIdentifiersValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e OAuthClientAuthorizationIdentifiersValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e OAuthClientAuthorizationIdentifiersValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e OAuthClientAuthorizationIdentifiersValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e OAuthClientAuthorizationIdentifiersValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e OAuthClientAuthorizationIdentifiersValidationError) ErrorName() string { + return "OAuthClientAuthorizationIdentifiersValidationError" +} + +// Error satisfies the builtin error interface +func (e OAuthClientAuthorizationIdentifiersValidationError) 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 %sOAuthClientAuthorizationIdentifiers.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = OAuthClientAuthorizationIdentifiersValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = OAuthClientAuthorizationIdentifiersValidationError{} + +// ValidateFields checks the field values on OAuthClientAuthorization with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *OAuthClientAuthorization) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = OAuthClientAuthorizationFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "user_ids": + + if v, ok := interface{}(&m.UserIDs).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OAuthClientAuthorizationValidationError{ + field: "user_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "client_ids": + + if v, ok := interface{}(&m.ClientIDs).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OAuthClientAuthorizationValidationError{ + field: "client_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "rights": + + case "created_at": + + if v, ok := interface{}(&m.CreatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OAuthClientAuthorizationValidationError{ + field: "created_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "updated_at": + + if v, ok := interface{}(&m.UpdatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OAuthClientAuthorizationValidationError{ + field: "updated_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return OAuthClientAuthorizationValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// OAuthClientAuthorizationValidationError is the validation error returned by +// OAuthClientAuthorization.ValidateFields if the designated constraints +// aren't met. +type OAuthClientAuthorizationValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e OAuthClientAuthorizationValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e OAuthClientAuthorizationValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e OAuthClientAuthorizationValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e OAuthClientAuthorizationValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e OAuthClientAuthorizationValidationError) ErrorName() string { + return "OAuthClientAuthorizationValidationError" +} + +// Error satisfies the builtin error interface +func (e OAuthClientAuthorizationValidationError) 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 %sOAuthClientAuthorization.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = OAuthClientAuthorizationValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = OAuthClientAuthorizationValidationError{} + +// ValidateFields checks the field values on OAuthClientAuthorizations with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *OAuthClientAuthorizations) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = OAuthClientAuthorizationsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "authorizations": + + for idx, item := range m.GetAuthorizations() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OAuthClientAuthorizationsValidationError{ + field: fmt.Sprintf("authorizations[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + default: + return OAuthClientAuthorizationsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// OAuthClientAuthorizationsValidationError is the validation error returned by +// OAuthClientAuthorizations.ValidateFields if the designated constraints +// aren't met. +type OAuthClientAuthorizationsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e OAuthClientAuthorizationsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e OAuthClientAuthorizationsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e OAuthClientAuthorizationsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e OAuthClientAuthorizationsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e OAuthClientAuthorizationsValidationError) ErrorName() string { + return "OAuthClientAuthorizationsValidationError" +} + +// Error satisfies the builtin error interface +func (e OAuthClientAuthorizationsValidationError) 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 %sOAuthClientAuthorizations.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = OAuthClientAuthorizationsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = OAuthClientAuthorizationsValidationError{} + +// ValidateFields checks the field values on +// ListOAuthClientAuthorizationsRequest with the rules defined in the proto +// definition for this message. If any rules are violated, an error is returned. +func (m *ListOAuthClientAuthorizationsRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ListOAuthClientAuthorizationsRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "user_ids": + + if v, ok := interface{}(&m.UserIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ListOAuthClientAuthorizationsRequestValidationError{ + field: "user_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "order": + // no validation rules for Order + case "limit": + // no validation rules for Limit + case "page": + // no validation rules for Page + default: + return ListOAuthClientAuthorizationsRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ListOAuthClientAuthorizationsRequestValidationError is the validation error +// returned by ListOAuthClientAuthorizationsRequest.ValidateFields if the +// designated constraints aren't met. +type ListOAuthClientAuthorizationsRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListOAuthClientAuthorizationsRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListOAuthClientAuthorizationsRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListOAuthClientAuthorizationsRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListOAuthClientAuthorizationsRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListOAuthClientAuthorizationsRequestValidationError) ErrorName() string { + return "ListOAuthClientAuthorizationsRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e ListOAuthClientAuthorizationsRequestValidationError) 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 %sListOAuthClientAuthorizationsRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListOAuthClientAuthorizationsRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListOAuthClientAuthorizationsRequestValidationError{} + +// ValidateFields checks the field values on OAuthAuthorizationCode with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *OAuthAuthorizationCode) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = OAuthAuthorizationCodeFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "user_ids": + + if v, ok := interface{}(&m.UserIDs).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OAuthAuthorizationCodeValidationError{ + field: "user_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "client_ids": + + if v, ok := interface{}(&m.ClientIDs).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OAuthAuthorizationCodeValidationError{ + field: "client_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "rights": + + case "code": + // no validation rules for Code + case "redirect_uri": + // no validation rules for RedirectURI + case "state": + // no validation rules for State + case "created_at": + + if v, ok := interface{}(&m.CreatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OAuthAuthorizationCodeValidationError{ + field: "created_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "expires_at": + + if v, ok := interface{}(&m.ExpiresAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OAuthAuthorizationCodeValidationError{ + field: "expires_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return OAuthAuthorizationCodeValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// OAuthAuthorizationCodeValidationError is the validation error returned by +// OAuthAuthorizationCode.ValidateFields if the designated constraints aren't met. +type OAuthAuthorizationCodeValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e OAuthAuthorizationCodeValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e OAuthAuthorizationCodeValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e OAuthAuthorizationCodeValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e OAuthAuthorizationCodeValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e OAuthAuthorizationCodeValidationError) ErrorName() string { + return "OAuthAuthorizationCodeValidationError" +} + +// Error satisfies the builtin error interface +func (e OAuthAuthorizationCodeValidationError) 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 %sOAuthAuthorizationCode.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = OAuthAuthorizationCodeValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = OAuthAuthorizationCodeValidationError{} + +// ValidateFields checks the field values on OAuthAccessTokenIdentifiers with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *OAuthAccessTokenIdentifiers) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = OAuthAccessTokenIdentifiersFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "user_ids": + + if v, ok := interface{}(&m.UserIDs).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OAuthAccessTokenIdentifiersValidationError{ + field: "user_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "client_ids": + + if v, ok := interface{}(&m.ClientIDs).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OAuthAccessTokenIdentifiersValidationError{ + field: "client_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "id": + // no validation rules for ID + default: + return OAuthAccessTokenIdentifiersValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// OAuthAccessTokenIdentifiersValidationError is the validation error returned +// by OAuthAccessTokenIdentifiers.ValidateFields if the designated constraints +// aren't met. +type OAuthAccessTokenIdentifiersValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e OAuthAccessTokenIdentifiersValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e OAuthAccessTokenIdentifiersValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e OAuthAccessTokenIdentifiersValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e OAuthAccessTokenIdentifiersValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e OAuthAccessTokenIdentifiersValidationError) ErrorName() string { + return "OAuthAccessTokenIdentifiersValidationError" +} + +// Error satisfies the builtin error interface +func (e OAuthAccessTokenIdentifiersValidationError) 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 %sOAuthAccessTokenIdentifiers.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = OAuthAccessTokenIdentifiersValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = OAuthAccessTokenIdentifiersValidationError{} + +// ValidateFields checks the field values on OAuthAccessToken with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *OAuthAccessToken) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = OAuthAccessTokenFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "user_ids": + + if v, ok := interface{}(&m.UserIDs).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OAuthAccessTokenValidationError{ + field: "user_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "client_ids": + + if v, ok := interface{}(&m.ClientIDs).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OAuthAccessTokenValidationError{ + field: "client_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "id": + // no validation rules for ID + case "access_token": + // no validation rules for AccessToken + case "refresh_token": + // no validation rules for RefreshToken + case "rights": + + case "created_at": + + if v, ok := interface{}(&m.CreatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OAuthAccessTokenValidationError{ + field: "created_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "expires_at": + + if v, ok := interface{}(&m.ExpiresAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OAuthAccessTokenValidationError{ + field: "expires_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return OAuthAccessTokenValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// OAuthAccessTokenValidationError is the validation error returned by +// OAuthAccessToken.ValidateFields if the designated constraints aren't met. +type OAuthAccessTokenValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e OAuthAccessTokenValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e OAuthAccessTokenValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e OAuthAccessTokenValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e OAuthAccessTokenValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e OAuthAccessTokenValidationError) ErrorName() string { return "OAuthAccessTokenValidationError" } + +// Error satisfies the builtin error interface +func (e OAuthAccessTokenValidationError) 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 %sOAuthAccessToken.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = OAuthAccessTokenValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = OAuthAccessTokenValidationError{} + +// ValidateFields checks the field values on OAuthAccessTokens with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *OAuthAccessTokens) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = OAuthAccessTokensFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "tokens": + + for idx, item := range m.GetTokens() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OAuthAccessTokensValidationError{ + field: fmt.Sprintf("tokens[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + default: + return OAuthAccessTokensValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// OAuthAccessTokensValidationError is the validation error returned by +// OAuthAccessTokens.ValidateFields if the designated constraints aren't met. +type OAuthAccessTokensValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e OAuthAccessTokensValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e OAuthAccessTokensValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e OAuthAccessTokensValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e OAuthAccessTokensValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e OAuthAccessTokensValidationError) ErrorName() string { + return "OAuthAccessTokensValidationError" +} + +// Error satisfies the builtin error interface +func (e OAuthAccessTokensValidationError) 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 %sOAuthAccessTokens.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = OAuthAccessTokensValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = OAuthAccessTokensValidationError{} + +// ValidateFields checks the field values on ListOAuthAccessTokensRequest with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *ListOAuthAccessTokensRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ListOAuthAccessTokensRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "user_ids": + + if v, ok := interface{}(&m.UserIDs).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ListOAuthAccessTokensRequestValidationError{ + field: "user_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "client_ids": + + if v, ok := interface{}(&m.ClientIDs).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ListOAuthAccessTokensRequestValidationError{ + field: "client_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "order": + // no validation rules for Order + case "limit": + // no validation rules for Limit + case "page": + // no validation rules for Page + default: + return ListOAuthAccessTokensRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ListOAuthAccessTokensRequestValidationError is the validation error returned +// by ListOAuthAccessTokensRequest.ValidateFields if the designated +// constraints aren't met. +type ListOAuthAccessTokensRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListOAuthAccessTokensRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListOAuthAccessTokensRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListOAuthAccessTokensRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListOAuthAccessTokensRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListOAuthAccessTokensRequestValidationError) ErrorName() string { + return "ListOAuthAccessTokensRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e ListOAuthAccessTokensRequestValidationError) 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 %sListOAuthAccessTokensRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListOAuthAccessTokensRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListOAuthAccessTokensRequestValidationError{} diff --git a/pkg/ttnpb/oauth.validator.pb.go b/pkg/ttnpb/oauth.validator.pb.go deleted file mode 100644 index ed99291da4..0000000000 --- a/pkg/ttnpb/oauth.validator.pb.go +++ /dev/null @@ -1,118 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/oauth.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/timestamp" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *OAuthClientAuthorizationIdentifiers) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UserIDs)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UserIDs", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ClientIDs)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ClientIDs", err) - } - return nil -} -func (this *OAuthClientAuthorization) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UserIDs)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UserIDs", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ClientIDs)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ClientIDs", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.CreatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("CreatedAt", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UpdatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UpdatedAt", err) - } - return nil -} -func (this *OAuthClientAuthorizations) Validate() error { - for _, item := range this.Authorizations { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Authorizations", err) - } - } - } - return nil -} -func (this *ListOAuthClientAuthorizationsRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UserIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UserIdentifiers", err) - } - return nil -} -func (this *OAuthAuthorizationCode) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UserIDs)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UserIDs", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ClientIDs)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ClientIDs", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.CreatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("CreatedAt", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ExpiresAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ExpiresAt", err) - } - return nil -} -func (this *OAuthAccessTokenIdentifiers) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UserIDs)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UserIDs", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ClientIDs)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ClientIDs", err) - } - return nil -} -func (this *OAuthAccessToken) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UserIDs)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UserIDs", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ClientIDs)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ClientIDs", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.CreatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("CreatedAt", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ExpiresAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ExpiresAt", err) - } - return nil -} -func (this *OAuthAccessTokens) Validate() error { - for _, item := range this.Tokens { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Tokens", err) - } - } - } - return nil -} -func (this *ListOAuthAccessTokensRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UserIDs)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UserIDs", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ClientIDs)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ClientIDs", err) - } - return nil -} diff --git a/pkg/ttnpb/oauth_services.pb.gw.go b/pkg/ttnpb/oauth_services.pb.gw.go index e826098741..fc1e0d280e 100644 --- a/pkg/ttnpb/oauth_services.pb.gw.go +++ b/pkg/ttnpb/oauth_services.pb.gw.go @@ -9,11 +9,10 @@ It translates gRPC into RESTful JSON APIs. package ttnpb import ( + "context" "io" "net/http" - "context" - "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" diff --git a/pkg/ttnpb/oauth_services.pb.validate.go b/pkg/ttnpb/oauth_services.pb.validate.go new file mode 100644 index 0000000000..fb43d9d432 --- /dev/null +++ b/pkg/ttnpb/oauth_services.pb.validate.go @@ -0,0 +1,33 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) diff --git a/pkg/ttnpb/oauth_services.validator.pb.go b/pkg/ttnpb/oauth_services.validator.pb.go deleted file mode 100644 index 11096d7c7b..0000000000 --- a/pkg/ttnpb/oauth_services.validator.pb.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/oauth_services.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/empty" -import _ "google.golang.org/genproto/googleapis/api/annotations" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen diff --git a/pkg/ttnpb/organization.go b/pkg/ttnpb/organization.go new file mode 100644 index 0000000000..154313d54b --- /dev/null +++ b/pkg/ttnpb/organization.go @@ -0,0 +1,29 @@ +// Copyright © 2019 The Things Network Foundation, The Things Industries B.V. +// +// 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. + +package ttnpb + +import ( + "context" +) + +// ValidateContext wraps the generated validator with (optionally context-based) custom checks. +func (m *UpdateOrganizationRequest) ValidateContext(context.Context) error { + if len(m.FieldMask.Paths) == 0 { + return m.ValidateFields() + } + return m.ValidateFields(append(fieldsWithPrefix("organization", m.FieldMask.Paths...), + "organization.ids", + )...) +} diff --git a/pkg/ttnpb/organization.pb.go b/pkg/ttnpb/organization.pb.go index aab5cafa8a..d1adb85c82 100644 --- a/pkg/ttnpb/organization.pb.go +++ b/pkg/ttnpb/organization.pb.go @@ -9,6 +9,7 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" import time "time" @@ -48,7 +49,7 @@ type Organization struct { func (m *Organization) Reset() { *m = Organization{} } func (*Organization) ProtoMessage() {} func (*Organization) Descriptor() ([]byte, []int) { - return fileDescriptor_organization_956fac6cd9b16990, []int{0} + return fileDescriptor_organization_dcf720ca503ecbac, []int{0} } func (m *Organization) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -128,7 +129,7 @@ type Organizations struct { func (m *Organizations) Reset() { *m = Organizations{} } func (*Organizations) ProtoMessage() {} func (*Organizations) Descriptor() ([]byte, []int) { - return fileDescriptor_organization_956fac6cd9b16990, []int{1} + return fileDescriptor_organization_dcf720ca503ecbac, []int{1} } func (m *Organizations) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -174,7 +175,7 @@ type GetOrganizationRequest struct { func (m *GetOrganizationRequest) Reset() { *m = GetOrganizationRequest{} } func (*GetOrganizationRequest) ProtoMessage() {} func (*GetOrganizationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_organization_956fac6cd9b16990, []int{2} + return fileDescriptor_organization_dcf720ca503ecbac, []int{2} } func (m *GetOrganizationRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -229,7 +230,7 @@ type ListOrganizationsRequest struct { func (m *ListOrganizationsRequest) Reset() { *m = ListOrganizationsRequest{} } func (*ListOrganizationsRequest) ProtoMessage() {} func (*ListOrganizationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_organization_956fac6cd9b16990, []int{3} + return fileDescriptor_organization_dcf720ca503ecbac, []int{3} } func (m *ListOrganizationsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -306,7 +307,7 @@ type CreateOrganizationRequest struct { func (m *CreateOrganizationRequest) Reset() { *m = CreateOrganizationRequest{} } func (*CreateOrganizationRequest) ProtoMessage() {} func (*CreateOrganizationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_organization_956fac6cd9b16990, []int{4} + return fileDescriptor_organization_dcf720ca503ecbac, []int{4} } func (m *CreateOrganizationRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -352,7 +353,7 @@ type UpdateOrganizationRequest struct { func (m *UpdateOrganizationRequest) Reset() { *m = UpdateOrganizationRequest{} } func (*UpdateOrganizationRequest) ProtoMessage() {} func (*UpdateOrganizationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_organization_956fac6cd9b16990, []int{5} + return fileDescriptor_organization_dcf720ca503ecbac, []int{5} } func (m *UpdateOrganizationRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -399,7 +400,7 @@ type CreateOrganizationAPIKeyRequest struct { func (m *CreateOrganizationAPIKeyRequest) Reset() { *m = CreateOrganizationAPIKeyRequest{} } func (*CreateOrganizationAPIKeyRequest) ProtoMessage() {} func (*CreateOrganizationAPIKeyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_organization_956fac6cd9b16990, []int{6} + return fileDescriptor_organization_dcf720ca503ecbac, []int{6} } func (m *CreateOrganizationAPIKeyRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -452,7 +453,7 @@ type UpdateOrganizationAPIKeyRequest struct { func (m *UpdateOrganizationAPIKeyRequest) Reset() { *m = UpdateOrganizationAPIKeyRequest{} } func (*UpdateOrganizationAPIKeyRequest) ProtoMessage() {} func (*UpdateOrganizationAPIKeyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_organization_956fac6cd9b16990, []int{7} + return fileDescriptor_organization_dcf720ca503ecbac, []int{7} } func (m *UpdateOrganizationAPIKeyRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -491,7 +492,7 @@ type SetOrganizationCollaboratorRequest struct { func (m *SetOrganizationCollaboratorRequest) Reset() { *m = SetOrganizationCollaboratorRequest{} } func (*SetOrganizationCollaboratorRequest) ProtoMessage() {} func (*SetOrganizationCollaboratorRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_organization_956fac6cd9b16990, []int{8} + return fileDescriptor_organization_dcf720ca503ecbac, []int{8} } func (m *SetOrganizationCollaboratorRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3170,66 +3171,69 @@ var ( ) func init() { - proto.RegisterFile("lorawan-stack/api/organization.proto", fileDescriptor_organization_956fac6cd9b16990) + proto.RegisterFile("lorawan-stack/api/organization.proto", fileDescriptor_organization_dcf720ca503ecbac) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/organization.proto", fileDescriptor_organization_956fac6cd9b16990) -} - -var fileDescriptor_organization_956fac6cd9b16990 = []byte{ - // 857 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x3d, 0x8c, 0x1b, 0x45, - 0x14, 0x9e, 0xb1, 0x2f, 0x0e, 0x1e, 0x9f, 0x93, 0x68, 0x05, 0xd1, 0xc6, 0x44, 0x63, 0x6b, 0x41, - 0xc2, 0x45, 0xbc, 0x96, 0x2e, 0x0d, 0x20, 0x01, 0xb2, 0x2d, 0x82, 0x8e, 0x04, 0x05, 0x36, 0x44, - 0x48, 0x08, 0xc9, 0x1a, 0xdb, 0xe3, 0xf5, 0xc8, 0xf6, 0xce, 0x32, 0x3b, 0x4e, 0x64, 0xaa, 0x94, - 0x29, 0x53, 0x52, 0x22, 0xaa, 0x2b, 0xd3, 0x71, 0xa2, 0x3a, 0x51, 0x9d, 0xa8, 0xae, 0xbc, 0xea, - 0x38, 0xef, 0x36, 0x57, 0xa1, 0x2b, 0xaf, 0x44, 0x3b, 0xbb, 0xc6, 0xbb, 0xb6, 0xb1, 0x04, 0x27, - 0xae, 0x9b, 0xb7, 0xf3, 0xbd, 0x6f, 0xbe, 0xf7, 0xab, 0x45, 0xef, 0x8e, 0xb8, 0x20, 0xcf, 0x89, - 0x53, 0xf3, 0x24, 0xe9, 0x0e, 0xeb, 0xc4, 0x65, 0x75, 0x2e, 0x6c, 0xe2, 0xb0, 0x1f, 0x88, 0x64, - 0xdc, 0x31, 0x5d, 0xc1, 0x25, 0xd7, 0x6e, 0x48, 0xe9, 0x98, 0x31, 0xd2, 0x7c, 0x76, 0xbf, 0x54, - 0xb3, 0x99, 0x1c, 0x4c, 0x3a, 0x66, 0x97, 0x8f, 0xeb, 0x36, 0xb7, 0x79, 0x5d, 0xc1, 0x3a, 0x93, - 0xbe, 0xb2, 0x94, 0xa1, 0x4e, 0x91, 0x7b, 0xa9, 0x62, 0x73, 0x6e, 0x8f, 0xe8, 0x02, 0xd5, 0x67, - 0x74, 0xd4, 0x6b, 0x8f, 0x89, 0x37, 0x8c, 0x11, 0xe5, 0x65, 0x84, 0x64, 0x63, 0xea, 0x49, 0x32, - 0x76, 0x63, 0xc0, 0x1a, 0x9d, 0x5d, 0xee, 0x48, 0xd2, 0x95, 0x6d, 0xe6, 0xf4, 0xe7, 0x0f, 0xbd, - 0xb3, 0x8a, 0x62, 0x3d, 0xea, 0x48, 0xd6, 0x67, 0x54, 0x78, 0x31, 0x08, 0xaf, 0x82, 0x04, 0xb3, - 0x07, 0x32, 0xbe, 0x37, 0x4e, 0xb3, 0x68, 0xfb, 0x71, 0x22, 0x07, 0x5a, 0x0b, 0x65, 0x59, 0xcf, - 0xd3, 0x61, 0x05, 0x56, 0x0b, 0x3b, 0xef, 0x99, 0xe9, 0x5c, 0x98, 0x49, 0xe8, 0xee, 0xe2, 0xb1, - 0xe6, 0x1b, 0x87, 0x27, 0x65, 0x70, 0x74, 0x52, 0x86, 0x56, 0xe8, 0xad, 0xb5, 0x10, 0xea, 0x0a, - 0x4a, 0x24, 0xed, 0xb5, 0x89, 0xd4, 0x33, 0x8a, 0xab, 0x64, 0x46, 0x61, 0x9b, 0xf3, 0xb0, 0xcd, - 0xaf, 0xe7, 0x61, 0x47, 0xee, 0xaf, 0xfe, 0x28, 0x43, 0x2b, 0x1f, 0xfb, 0x35, 0x64, 0x48, 0x32, - 0x71, 0x7b, 0x73, 0x92, 0xec, 0xbf, 0x21, 0x89, 0xfd, 0x1a, 0x52, 0xd3, 0xd0, 0x96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, 0xf6, 0x32, 0x69, 0xa4, 0x26, 0xc1, 0x91, - 0x23, 0x2e, 0x7b, 0x48, 0xa7, 0xc6, 0xef, 0x10, 0x19, 0x4f, 0xd2, 0xab, 0xa9, 0x95, 0x68, 0xa6, - 0xab, 0xd1, 0xff, 0x60, 0xed, 0x28, 0xdc, 0x5d, 0xdd, 0xf9, 0x0b, 0xcc, 0xba, 0xce, 0x6f, 0xfe, - 0x0c, 0x0f, 0x67, 0x18, 0x1e, 0xcd, 0x30, 0x3c, 0x9e, 0x61, 0x70, 0x3a, 0xc3, 0xe0, 0x6c, 0x86, - 0xc1, 0xf9, 0x0c, 0x83, 0x8b, 0x19, 0x86, 0x2f, 0x7c, 0x0c, 0x5f, 0xfa, 0x18, 0xec, 0xf9, 0x18, - 0xbe, 0xf6, 0x31, 0xd8, 0xf7, 0x31, 0x38, 0xf0, 0x31, 0x38, 0xf4, 0x31, 0x3c, 0xf2, 0x31, 0x3c, - 0xf6, 0x31, 0x38, 0xf5, 0x31, 0x3c, 0xf3, 0x31, 0x38, 0xf7, 0x31, 0xbc, 0xf0, 0x31, 0x78, 0x11, - 0x60, 0xf0, 0x32, 0xc0, 0xf0, 0x55, 0x80, 0xc1, 0x8f, 0x01, 0x86, 0x3f, 0x05, 0x18, 0xec, 0x05, - 0x18, 0xbc, 0x0e, 0x30, 0xdc, 0x0f, 0x30, 0x3c, 0x08, 0x30, 0xfc, 0xf6, 0x9e, 0xcd, 0x4d, 0x39, - 0xa0, 0x72, 0xc0, 0x1c, 0xdb, 0x33, 0x1d, 0x2a, 0x9f, 0x73, 0x31, 0xac, 0xa7, 0xff, 0x25, 0xdc, - 0xa1, 0x5d, 0x97, 0xd2, 0x71, 0x3b, 0x9d, 0x9c, 0x1a, 0x8c, 0xfb, 0x7f, 0x05, 0x00, 0x00, 0xff, - 0xff, 0xa6, 0x84, 0x7e, 0xef, 0x60, 0x09, 0x00, 0x00, + golang_proto.RegisterFile("lorawan-stack/api/organization.proto", fileDescriptor_organization_dcf720ca503ecbac) +} + +var fileDescriptor_organization_dcf720ca503ecbac = []byte{ + // 901 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x3d, 0x8c, 0x1b, 0x45, + 0x14, 0x9e, 0xb1, 0xef, 0x2e, 0x78, 0xee, 0x27, 0xa7, 0x15, 0x44, 0xce, 0x11, 0x8d, 0xad, 0x05, + 0x89, 0x2b, 0xe2, 0xb5, 0x74, 0x69, 0x10, 0x08, 0xd0, 0xd9, 0x02, 0x74, 0x4a, 0xa2, 0x84, 0x4d, + 0xd2, 0xd0, 0x58, 0x63, 0x7b, 0x76, 0x3d, 0xf2, 0x7a, 0x67, 0x99, 0x1d, 0x5f, 0x64, 0xaa, 0x94, + 0x11, 0x55, 0x4a, 0x4a, 0x44, 0x95, 0x32, 0xa2, 0x8a, 0xa8, 0x8e, 0xee, 0x0a, 0x84, 0xae, 0xa0, + 0x48, 0x75, 0xc4, 0xbb, 0x4d, 0xa0, 0x40, 0x29, 0x53, 0xa2, 0x99, 0x5d, 0xe3, 0x5d, 0xdb, 0x58, + 0x82, 0x43, 0x97, 0x6e, 0xde, 0xcc, 0xf7, 0xbe, 0x79, 0xdf, 0xfb, 0x99, 0x5d, 0xf4, 0xae, 0xc7, + 0x05, 0xb9, 0x4f, 0xfc, 0x5a, 0x28, 0x49, 0xa7, 0x5f, 0x27, 0x01, 0xab, 0x73, 0xe1, 0x12, 0x9f, + 0x7d, 0x4d, 0x24, 0xe3, 0xbe, 0x15, 0x08, 0x2e, 0xb9, 0xb1, 0x25, 0xa5, 0x6f, 0xa5, 0x48, 0xeb, + 0xf0, 0xda, 0x4e, 0xcd, 0x65, 0xb2, 0x37, 0x6c, 0x5b, 0x1d, 0x3e, 0xa8, 0xbb, 0xdc, 0xe5, 0x75, + 0x0d, 0x6b, 0x0f, 0x1d, 0x6d, 0x69, 0x43, 0xaf, 0x12, 0xf7, 0x9d, 0x0f, 0x33, 0x70, 0x6f, 0xe4, + 0xc8, 0x04, 0xde, 0xa9, 0xb9, 0xd4, 0xaf, 0x1d, 0x12, 0x8f, 0x75, 0x89, 0xa4, 0xf5, 0xb9, 0x45, + 0xea, 0x5c, 0x75, 0x39, 0x77, 0x3d, 0x3a, 0xbd, 0xc2, 0x61, 0xd4, 0xeb, 0xb6, 0x06, 0x24, 0xec, + 0xa7, 0x88, 0xca, 0x2c, 0x42, 0xb2, 0x01, 0x0d, 0x25, 0x19, 0x04, 0x29, 0x60, 0x81, 0xc8, 0x0e, + 0xf7, 0x25, 0xe9, 0xc8, 0x16, 0xf3, 0x9d, 0x49, 0x94, 0xef, 0xcc, 0xa3, 0x58, 0x97, 0xfa, 0x92, + 0x39, 0x8c, 0x8a, 0x30, 0x05, 0xe1, 0x79, 0x90, 0x60, 0x6e, 0x4f, 0xa6, 0xe7, 0xe6, 0x1f, 0x45, + 0xb4, 0x71, 0x2b, 0x93, 0x40, 0xe3, 0x26, 0x2a, 0xb2, 0x6e, 0x58, 0x86, 0x55, 0xb8, 0xbb, 0xbe, + 0xf7, 0x9e, 0x95, 0x4f, 0xa4, 0x95, 0x85, 0x1e, 0x4c, 0x2f, 0x6b, 0x18, 0xc7, 0xa7, 0x15, 0x70, + 0x72, 0x5a, 0x81, 0x3f, 0xfe, 0x7e, 0x54, 0x5c, 0xfd, 0x06, 0x16, 0xb6, 0xa1, 0xad, 0x78, 0x8c, + 0x26, 0x42, 0x1d, 0x41, 0x89, 0xa4, 0xdd, 0x16, 0x91, 0xe5, 0x82, 0x66, 0xdd, 0xb1, 0x92, 0x04, + 0x58, 0x93, 0x04, 0x58, 0x77, 0x27, 0x09, 0x68, 0xbc, 0xa1, 0x88, 0x1e, 0xfd, 0x56, 0x81, 0x76, + 0x29, 0xf5, 0xdb, 0x97, 0x8a, 0x64, 0x18, 0x74, 0x27, 0x24, 0xc5, 0x7f, 0x43, 0x92, 0xfa, 0xed, + 0x4b, 0xc3, 0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x99, + 0x14, 0xe6, 0xd2, 0x2c, 0x7d, 0x12, 0xd7, 0x42, 0xb6, 0x35, 0x12, 0xb0, 0xeb, 0x74, 0x64, 0x9e, + 0x42, 0x64, 0xde, 0xc9, 0x3f, 0x70, 0xcd, 0x4c, 0xd3, 0x9d, 0xb7, 0xa6, 0xdb, 0x0b, 0xc7, 0xe8, + 0xca, 0xfc, 0x37, 0x64, 0x8a, 0x59, 0x3e, 0x35, 0x8d, 0xef, 0xe1, 0xf1, 0x18, 0xc3, 0x93, 0x31, + 0x86, 0xcf, 0xc6, 0x18, 0x3c, 0x1f, 0x63, 0xf0, 0x62, 0x8c, 0xc1, 0xcb, 0x31, 0x06, 0xaf, 0xc6, + 0x18, 0x3e, 0x88, 0x30, 0x7c, 0x18, 0x61, 0xf0, 0x38, 0xc2, 0xf0, 0x49, 0x84, 0xc1, 0xd3, 0x08, + 0x83, 0xa3, 0x08, 0x83, 0xe3, 0x08, 0xc3, 0x93, 0x08, 0xc3, 0x67, 0x11, 0x06, 0xcf, 0x23, 0x0c, + 0x5f, 0x44, 0x18, 0xbc, 0x8c, 0x30, 0x7c, 0x15, 0x61, 0xf0, 0x20, 0xc6, 0xe0, 0x61, 0x8c, 0xe1, + 0xa3, 0x18, 0x83, 0x6f, 0x63, 0x0c, 0xbf, 0x8b, 0x31, 0x78, 0x1c, 0x63, 0xf0, 0x24, 0xc6, 0xf0, + 0x69, 0x8c, 0xe1, 0x51, 0x8c, 0xe1, 0x97, 0x57, 0x5d, 0x6e, 0xc9, 0x1e, 0x95, 0x3d, 0xe6, 0xbb, + 0xa1, 0xe5, 0x53, 0x79, 0x9f, 0x8b, 0x7e, 0x3d, 0xff, 0xbf, 0x12, 0xf4, 0xdd, 0xba, 0x94, 0x7e, + 0xd0, 0x6e, 0xaf, 0xe9, 0x51, 0xba, 0xf6, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb0, 0x08, 0xd0, + 0x0c, 0x01, 0x0a, 0x00, 0x00, } diff --git a/pkg/ttnpb/organization.pb.paths.fm.go b/pkg/ttnpb/organization.pb.paths.fm.go new file mode 100644 index 0000000000..2f6fb181b6 --- /dev/null +++ b/pkg/ttnpb/organization.pb.paths.fm.go @@ -0,0 +1,146 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var OrganizationFieldPathsNested = []string{ + "attributes", + "contact_info", + "created_at", + "description", + "ids", + "ids.organization_id", + "name", + "updated_at", +} + +var OrganizationFieldPathsTopLevel = []string{ + "attributes", + "contact_info", + "created_at", + "description", + "ids", + "name", + "updated_at", +} +var OrganizationsFieldPathsNested = []string{ + "organizations", +} + +var OrganizationsFieldPathsTopLevel = []string{ + "organizations", +} +var GetOrganizationRequestFieldPathsNested = []string{ + "field_mask", + "organization_ids", + "organization_ids.organization_id", +} + +var GetOrganizationRequestFieldPathsTopLevel = []string{ + "field_mask", + "organization_ids", +} +var ListOrganizationsRequestFieldPathsNested = []string{ + "collaborator", + "collaborator.ids", + "collaborator.ids.organization_ids", + "collaborator.ids.organization_ids.organization_id", + "collaborator.ids.user_ids", + "collaborator.ids.user_ids.email", + "collaborator.ids.user_ids.user_id", + "field_mask", + "limit", + "order", + "page", +} + +var ListOrganizationsRequestFieldPathsTopLevel = []string{ + "collaborator", + "field_mask", + "limit", + "order", + "page", +} +var CreateOrganizationRequestFieldPathsNested = []string{ + "collaborator", + "collaborator.ids", + "collaborator.ids.organization_ids", + "collaborator.ids.organization_ids.organization_id", + "collaborator.ids.user_ids", + "collaborator.ids.user_ids.email", + "collaborator.ids.user_ids.user_id", + "organization", + "organization.attributes", + "organization.contact_info", + "organization.created_at", + "organization.description", + "organization.ids", + "organization.ids.organization_id", + "organization.name", + "organization.updated_at", +} + +var CreateOrganizationRequestFieldPathsTopLevel = []string{ + "collaborator", + "organization", +} +var UpdateOrganizationRequestFieldPathsNested = []string{ + "field_mask", + "organization", + "organization.attributes", + "organization.contact_info", + "organization.created_at", + "organization.description", + "organization.ids", + "organization.ids.organization_id", + "organization.name", + "organization.updated_at", +} + +var UpdateOrganizationRequestFieldPathsTopLevel = []string{ + "field_mask", + "organization", +} +var CreateOrganizationAPIKeyRequestFieldPathsNested = []string{ + "name", + "organization_ids", + "organization_ids.organization_id", + "rights", +} + +var CreateOrganizationAPIKeyRequestFieldPathsTopLevel = []string{ + "name", + "organization_ids", + "rights", +} +var UpdateOrganizationAPIKeyRequestFieldPathsNested = []string{ + "api_key", + "api_key.id", + "api_key.key", + "api_key.name", + "api_key.rights", + "organization_ids", + "organization_ids.organization_id", +} + +var UpdateOrganizationAPIKeyRequestFieldPathsTopLevel = []string{ + "api_key", + "organization_ids", +} +var SetOrganizationCollaboratorRequestFieldPathsNested = []string{ + "collaborator", + "collaborator.ids", + "collaborator.ids.ids", + "collaborator.ids.ids.organization_ids", + "collaborator.ids.ids.organization_ids.organization_id", + "collaborator.ids.ids.user_ids", + "collaborator.ids.ids.user_ids.email", + "collaborator.ids.ids.user_ids.user_id", + "collaborator.rights", + "organization_ids", + "organization_ids.organization_id", +} + +var SetOrganizationCollaboratorRequestFieldPathsTopLevel = []string{ + "collaborator", + "organization_ids", +} diff --git a/pkg/ttnpb/organization.pb.fm.go b/pkg/ttnpb/organization.pb.setters.fm.go similarity index 75% rename from pkg/ttnpb/organization.pb.fm.go rename to pkg/ttnpb/organization.pb.setters.fm.go index 5139a1b485..fa70db9889 100644 --- a/pkg/ttnpb/organization.pb.fm.go +++ b/pkg/ttnpb/organization.pb.setters.fm.go @@ -6,30 +6,9 @@ import ( fmt "fmt" time "time" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + types "github.com/gogo/protobuf/types" ) -var OrganizationFieldPathsNested = []string{ - "attributes", - "contact_info", - "created_at", - "description", - "ids", - "ids.organization_id", - "name", - "updated_at", -} - -var OrganizationFieldPathsTopLevel = []string{ - "attributes", - "contact_info", - "created_at", - "description", - "ids", - "name", - "updated_at", -} - func (dst *Organization) SetFields(src *Organization, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -117,14 +96,6 @@ func (dst *Organization) SetFields(src *Organization, paths ...string) error { return nil } -var OrganizationsFieldPathsNested = []string{ - "organizations", -} - -var OrganizationsFieldPathsTopLevel = []string{ - "organizations", -} - func (dst *Organizations) SetFields(src *Organizations, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -145,17 +116,6 @@ func (dst *Organizations) SetFields(src *Organizations, paths ...string) error { return nil } -var GetOrganizationRequestFieldPathsNested = []string{ - "field_mask", - "organization_ids", - "organization_ids.organization_id", -} - -var GetOrganizationRequestFieldPathsTopLevel = []string{ - "field_mask", - "organization_ids", -} - func (dst *GetOrganizationRequest) SetFields(src *GetOrganizationRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -184,7 +144,7 @@ func (dst *GetOrganizationRequest) SetFields(src *GetOrganizationRequest, paths if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } @@ -195,28 +155,6 @@ func (dst *GetOrganizationRequest) SetFields(src *GetOrganizationRequest, paths return nil } -var ListOrganizationsRequestFieldPathsNested = []string{ - "collaborator", - "collaborator.ids", - "collaborator.ids.organization_ids", - "collaborator.ids.organization_ids.organization_id", - "collaborator.ids.user_ids", - "collaborator.ids.user_ids.email", - "collaborator.ids.user_ids.user_id", - "field_mask", - "limit", - "order", - "page", -} - -var ListOrganizationsRequestFieldPathsTopLevel = []string{ - "collaborator", - "field_mask", - "limit", - "order", - "page", -} - func (dst *ListOrganizationsRequest) SetFields(src *ListOrganizationsRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -248,7 +186,7 @@ func (dst *ListOrganizationsRequest) SetFields(src *ListOrganizationsRequest, pa if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } case "order": @@ -289,30 +227,6 @@ func (dst *ListOrganizationsRequest) SetFields(src *ListOrganizationsRequest, pa return nil } -var CreateOrganizationRequestFieldPathsNested = []string{ - "collaborator", - "collaborator.ids", - "collaborator.ids.organization_ids", - "collaborator.ids.organization_ids.organization_id", - "collaborator.ids.user_ids", - "collaborator.ids.user_ids.email", - "collaborator.ids.user_ids.user_id", - "organization", - "organization.attributes", - "organization.contact_info", - "organization.created_at", - "organization.description", - "organization.ids", - "organization.ids.organization_id", - "organization.name", - "organization.updated_at", -} - -var CreateOrganizationRequestFieldPathsTopLevel = []string{ - "collaborator", - "organization", -} - func (dst *CreateOrganizationRequest) SetFields(src *CreateOrganizationRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -360,24 +274,6 @@ func (dst *CreateOrganizationRequest) SetFields(src *CreateOrganizationRequest, return nil } -var UpdateOrganizationRequestFieldPathsNested = []string{ - "field_mask", - "organization", - "organization.attributes", - "organization.contact_info", - "organization.created_at", - "organization.description", - "organization.ids", - "organization.ids.organization_id", - "organization.name", - "organization.updated_at", -} - -var UpdateOrganizationRequestFieldPathsTopLevel = []string{ - "field_mask", - "organization", -} - func (dst *UpdateOrganizationRequest) SetFields(src *UpdateOrganizationRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -406,7 +302,7 @@ func (dst *UpdateOrganizationRequest) SetFields(src *UpdateOrganizationRequest, if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } @@ -417,19 +313,6 @@ func (dst *UpdateOrganizationRequest) SetFields(src *UpdateOrganizationRequest, return nil } -var CreateOrganizationAPIKeyRequestFieldPathsNested = []string{ - "name", - "organization_ids", - "organization_ids.organization_id", - "rights", -} - -var CreateOrganizationAPIKeyRequestFieldPathsTopLevel = []string{ - "name", - "organization_ids", - "rights", -} - func (dst *CreateOrganizationAPIKeyRequest) SetFields(src *CreateOrganizationAPIKeyRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -478,21 +361,6 @@ func (dst *CreateOrganizationAPIKeyRequest) SetFields(src *CreateOrganizationAPI return nil } -var UpdateOrganizationAPIKeyRequestFieldPathsNested = []string{ - "api_key", - "api_key.id", - "api_key.key", - "api_key.name", - "api_key.rights", - "organization_ids", - "organization_ids.organization_id", -} - -var UpdateOrganizationAPIKeyRequestFieldPathsTopLevel = []string{ - "api_key", - "organization_ids", -} - func (dst *UpdateOrganizationAPIKeyRequest) SetFields(src *UpdateOrganizationAPIKeyRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -540,25 +408,6 @@ func (dst *UpdateOrganizationAPIKeyRequest) SetFields(src *UpdateOrganizationAPI return nil } -var SetOrganizationCollaboratorRequestFieldPathsNested = []string{ - "collaborator", - "collaborator.ids", - "collaborator.ids.ids", - "collaborator.ids.ids.organization_ids", - "collaborator.ids.ids.organization_ids.organization_id", - "collaborator.ids.ids.user_ids", - "collaborator.ids.ids.user_ids.email", - "collaborator.ids.ids.user_ids.user_id", - "collaborator.rights", - "organization_ids", - "organization_ids.organization_id", -} - -var SetOrganizationCollaboratorRequestFieldPathsTopLevel = []string{ - "collaborator", - "organization_ids", -} - func (dst *SetOrganizationCollaboratorRequest) SetFields(src *SetOrganizationCollaboratorRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { diff --git a/pkg/ttnpb/organization.pb.validate.go b/pkg/ttnpb/organization.pb.validate.go new file mode 100644 index 0000000000..3c31f825c1 --- /dev/null +++ b/pkg/ttnpb/organization.pb.validate.go @@ -0,0 +1,1006 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on Organization with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *Organization) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = OrganizationFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "ids": + + if v, ok := interface{}(&m.OrganizationIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OrganizationValidationError{ + field: "ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "created_at": + + if v, ok := interface{}(&m.CreatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OrganizationValidationError{ + field: "created_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "updated_at": + + if v, ok := interface{}(&m.UpdatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OrganizationValidationError{ + field: "updated_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "name": + // no validation rules for Name + case "description": + // no validation rules for Description + case "attributes": + // no validation rules for Attributes + case "contact_info": + + for idx, item := range m.GetContactInfo() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OrganizationValidationError{ + field: fmt.Sprintf("contact_info[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + default: + return OrganizationValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// OrganizationValidationError is the validation error returned by +// Organization.ValidateFields if the designated constraints aren't met. +type OrganizationValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e OrganizationValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e OrganizationValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e OrganizationValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e OrganizationValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e OrganizationValidationError) ErrorName() string { return "OrganizationValidationError" } + +// Error satisfies the builtin error interface +func (e OrganizationValidationError) 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 %sOrganization.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = OrganizationValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = OrganizationValidationError{} + +// ValidateFields checks the field values on Organizations with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *Organizations) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = OrganizationsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "organizations": + + for idx, item := range m.GetOrganizations() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return OrganizationsValidationError{ + field: fmt.Sprintf("organizations[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + default: + return OrganizationsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// OrganizationsValidationError is the validation error returned by +// Organizations.ValidateFields if the designated constraints aren't met. +type OrganizationsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e OrganizationsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e OrganizationsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e OrganizationsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e OrganizationsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e OrganizationsValidationError) ErrorName() string { return "OrganizationsValidationError" } + +// Error satisfies the builtin error interface +func (e OrganizationsValidationError) 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 %sOrganizations.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = OrganizationsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = OrganizationsValidationError{} + +// ValidateFields checks the field values on GetOrganizationRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GetOrganizationRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GetOrganizationRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "organization_ids": + + if v, ok := interface{}(&m.OrganizationIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GetOrganizationRequestValidationError{ + field: "organization_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GetOrganizationRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return GetOrganizationRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GetOrganizationRequestValidationError is the validation error returned by +// GetOrganizationRequest.ValidateFields if the designated constraints aren't met. +type GetOrganizationRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetOrganizationRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetOrganizationRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetOrganizationRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetOrganizationRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetOrganizationRequestValidationError) ErrorName() string { + return "GetOrganizationRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetOrganizationRequestValidationError) 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 %sGetOrganizationRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetOrganizationRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetOrganizationRequestValidationError{} + +// ValidateFields checks the field values on ListOrganizationsRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ListOrganizationsRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ListOrganizationsRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "collaborator": + + if v, ok := interface{}(m.GetCollaborator()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ListOrganizationsRequestValidationError{ + field: "collaborator", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ListOrganizationsRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "order": + // no validation rules for Order + case "limit": + // no validation rules for Limit + case "page": + // no validation rules for Page + default: + return ListOrganizationsRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ListOrganizationsRequestValidationError is the validation error returned by +// ListOrganizationsRequest.ValidateFields if the designated constraints +// aren't met. +type ListOrganizationsRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListOrganizationsRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListOrganizationsRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListOrganizationsRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListOrganizationsRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListOrganizationsRequestValidationError) ErrorName() string { + return "ListOrganizationsRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e ListOrganizationsRequestValidationError) 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 %sListOrganizationsRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListOrganizationsRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListOrganizationsRequestValidationError{} + +// ValidateFields checks the field values on CreateOrganizationRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *CreateOrganizationRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = CreateOrganizationRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "organization": + + if v, ok := interface{}(&m.Organization).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return CreateOrganizationRequestValidationError{ + field: "organization", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "collaborator": + + if v, ok := interface{}(&m.Collaborator).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return CreateOrganizationRequestValidationError{ + field: "collaborator", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return CreateOrganizationRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// CreateOrganizationRequestValidationError is the validation error returned by +// CreateOrganizationRequest.ValidateFields if the designated constraints +// aren't met. +type CreateOrganizationRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CreateOrganizationRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CreateOrganizationRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CreateOrganizationRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CreateOrganizationRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CreateOrganizationRequestValidationError) ErrorName() string { + return "CreateOrganizationRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e CreateOrganizationRequestValidationError) 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 %sCreateOrganizationRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CreateOrganizationRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CreateOrganizationRequestValidationError{} + +// ValidateFields checks the field values on UpdateOrganizationRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *UpdateOrganizationRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = UpdateOrganizationRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "organization": + + if v, ok := interface{}(&m.Organization).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UpdateOrganizationRequestValidationError{ + field: "organization", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UpdateOrganizationRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return UpdateOrganizationRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// UpdateOrganizationRequestValidationError is the validation error returned by +// UpdateOrganizationRequest.ValidateFields if the designated constraints +// aren't met. +type UpdateOrganizationRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UpdateOrganizationRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UpdateOrganizationRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UpdateOrganizationRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UpdateOrganizationRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UpdateOrganizationRequestValidationError) ErrorName() string { + return "UpdateOrganizationRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e UpdateOrganizationRequestValidationError) 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 %sUpdateOrganizationRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UpdateOrganizationRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UpdateOrganizationRequestValidationError{} + +// ValidateFields checks the field values on CreateOrganizationAPIKeyRequest +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *CreateOrganizationAPIKeyRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = CreateOrganizationAPIKeyRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "organization_ids": + + if v, ok := interface{}(&m.OrganizationIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return CreateOrganizationAPIKeyRequestValidationError{ + field: "organization_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "name": + // no validation rules for Name + case "rights": + + default: + return CreateOrganizationAPIKeyRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// CreateOrganizationAPIKeyRequestValidationError is the validation error +// returned by CreateOrganizationAPIKeyRequest.ValidateFields if the +// designated constraints aren't met. +type CreateOrganizationAPIKeyRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CreateOrganizationAPIKeyRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CreateOrganizationAPIKeyRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CreateOrganizationAPIKeyRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CreateOrganizationAPIKeyRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CreateOrganizationAPIKeyRequestValidationError) ErrorName() string { + return "CreateOrganizationAPIKeyRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e CreateOrganizationAPIKeyRequestValidationError) 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 %sCreateOrganizationAPIKeyRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CreateOrganizationAPIKeyRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CreateOrganizationAPIKeyRequestValidationError{} + +// ValidateFields checks the field values on UpdateOrganizationAPIKeyRequest +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *UpdateOrganizationAPIKeyRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = UpdateOrganizationAPIKeyRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "organization_ids": + + if v, ok := interface{}(&m.OrganizationIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UpdateOrganizationAPIKeyRequestValidationError{ + field: "organization_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "api_key": + + if v, ok := interface{}(&m.APIKey).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UpdateOrganizationAPIKeyRequestValidationError{ + field: "api_key", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return UpdateOrganizationAPIKeyRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// UpdateOrganizationAPIKeyRequestValidationError is the validation error +// returned by UpdateOrganizationAPIKeyRequest.ValidateFields if the +// designated constraints aren't met. +type UpdateOrganizationAPIKeyRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UpdateOrganizationAPIKeyRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UpdateOrganizationAPIKeyRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UpdateOrganizationAPIKeyRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UpdateOrganizationAPIKeyRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UpdateOrganizationAPIKeyRequestValidationError) ErrorName() string { + return "UpdateOrganizationAPIKeyRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e UpdateOrganizationAPIKeyRequestValidationError) 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 %sUpdateOrganizationAPIKeyRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UpdateOrganizationAPIKeyRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UpdateOrganizationAPIKeyRequestValidationError{} + +// ValidateFields checks the field values on SetOrganizationCollaboratorRequest +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *SetOrganizationCollaboratorRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = SetOrganizationCollaboratorRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "organization_ids": + + if v, ok := interface{}(&m.OrganizationIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SetOrganizationCollaboratorRequestValidationError{ + field: "organization_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "collaborator": + + if v, ok := interface{}(&m.Collaborator).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SetOrganizationCollaboratorRequestValidationError{ + field: "collaborator", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return SetOrganizationCollaboratorRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// SetOrganizationCollaboratorRequestValidationError is the validation error +// returned by SetOrganizationCollaboratorRequest.ValidateFields if the +// designated constraints aren't met. +type SetOrganizationCollaboratorRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SetOrganizationCollaboratorRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SetOrganizationCollaboratorRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SetOrganizationCollaboratorRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SetOrganizationCollaboratorRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SetOrganizationCollaboratorRequestValidationError) ErrorName() string { + return "SetOrganizationCollaboratorRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e SetOrganizationCollaboratorRequestValidationError) 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 %sSetOrganizationCollaboratorRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SetOrganizationCollaboratorRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SetOrganizationCollaboratorRequestValidationError{} diff --git a/pkg/ttnpb/organization.validator.pb.go b/pkg/ttnpb/organization.validator.pb.go deleted file mode 100644 index c49b3a94ad..0000000000 --- a/pkg/ttnpb/organization.validator.pb.go +++ /dev/null @@ -1,113 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/organization.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/timestamp" -import _ "google.golang.org/genproto/protobuf/field_mask" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *Organization) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.OrganizationIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("OrganizationIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.CreatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("CreatedAt", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UpdatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UpdatedAt", err) - } - // Validation of proto3 map<> fields is unsupported. - for _, item := range this.ContactInfo { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ContactInfo", err) - } - } - } - return nil -} -func (this *Organizations) Validate() error { - for _, item := range this.Organizations { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Organizations", err) - } - } - } - return nil -} -func (this *GetOrganizationRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.OrganizationIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("OrganizationIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *ListOrganizationsRequest) Validate() error { - if this.Collaborator != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Collaborator); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Collaborator", err) - } - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *CreateOrganizationRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Organization)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Organization", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Collaborator)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Collaborator", err) - } - return nil -} -func (this *UpdateOrganizationRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Organization)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Organization", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *CreateOrganizationAPIKeyRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.OrganizationIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("OrganizationIdentifiers", err) - } - return nil -} -func (this *UpdateOrganizationAPIKeyRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.OrganizationIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("OrganizationIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.APIKey)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("APIKey", err) - } - return nil -} -func (this *SetOrganizationCollaboratorRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.OrganizationIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("OrganizationIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.Collaborator)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Collaborator", err) - } - return nil -} diff --git a/pkg/ttnpb/organization_services.pb.gw.go b/pkg/ttnpb/organization_services.pb.gw.go index d86ea6a0a8..83cecc1a53 100644 --- a/pkg/ttnpb/organization_services.pb.gw.go +++ b/pkg/ttnpb/organization_services.pb.gw.go @@ -9,11 +9,10 @@ It translates gRPC into RESTful JSON APIs. package ttnpb import ( + "context" "io" "net/http" - "context" - "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" diff --git a/pkg/ttnpb/organization_services.pb.validate.go b/pkg/ttnpb/organization_services.pb.validate.go new file mode 100644 index 0000000000..fb43d9d432 --- /dev/null +++ b/pkg/ttnpb/organization_services.pb.validate.go @@ -0,0 +1,33 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) diff --git a/pkg/ttnpb/organization_services.validator.pb.go b/pkg/ttnpb/organization_services.validator.pb.go deleted file mode 100644 index 3e5054d9a4..0000000000 --- a/pkg/ttnpb/organization_services.validator.pb.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/organization_services.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/empty" -import _ "google.golang.org/genproto/googleapis/api/annotations" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen diff --git a/pkg/ttnpb/regional.pb.go b/pkg/ttnpb/regional.pb.go index 527fb22f23..6e23254411 100644 --- a/pkg/ttnpb/regional.pb.go +++ b/pkg/ttnpb/regional.pb.go @@ -9,6 +9,7 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import _ "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" import time "time" @@ -48,7 +49,7 @@ type ConcentratorConfig struct { func (m *ConcentratorConfig) Reset() { *m = ConcentratorConfig{} } func (*ConcentratorConfig) ProtoMessage() {} func (*ConcentratorConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_regional_d7a7cadcbbda4814, []int{0} + return fileDescriptor_regional_f69214f18cafc4dc, []int{0} } func (m *ConcentratorConfig) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -137,7 +138,7 @@ type ConcentratorConfig_Channel struct { func (m *ConcentratorConfig_Channel) Reset() { *m = ConcentratorConfig_Channel{} } func (*ConcentratorConfig_Channel) ProtoMessage() {} func (*ConcentratorConfig_Channel) Descriptor() ([]byte, []int) { - return fileDescriptor_regional_d7a7cadcbbda4814, []int{0, 0} + return fileDescriptor_regional_f69214f18cafc4dc, []int{0, 0} } func (m *ConcentratorConfig_Channel) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -182,8 +183,9 @@ func (m *ConcentratorConfig_Channel) GetRadio() uint32 { type ConcentratorConfig_LoRaStandardChannel struct { // Frequency (Hz). - Frequency uint64 `protobuf:"varint,1,opt,name=frequency,proto3" json:"frequency,omitempty"` - Radio uint32 `protobuf:"varint,2,opt,name=radio,proto3" json:"radio,omitempty"` + Frequency uint64 `protobuf:"varint,1,opt,name=frequency,proto3" json:"frequency,omitempty"` + Radio uint32 `protobuf:"varint,2,opt,name=radio,proto3" json:"radio,omitempty"` + // Bandwidth (Hz). Bandwidth uint32 `protobuf:"varint,3,opt,name=bandwidth,proto3" json:"bandwidth,omitempty"` SpreadingFactor uint32 `protobuf:"varint,4,opt,name=spreading_factor,json=spreadingFactor,proto3" json:"spreading_factor,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -195,7 +197,7 @@ func (m *ConcentratorConfig_LoRaStandardChannel) Reset() { } func (*ConcentratorConfig_LoRaStandardChannel) ProtoMessage() {} func (*ConcentratorConfig_LoRaStandardChannel) Descriptor() ([]byte, []int) { - return fileDescriptor_regional_d7a7cadcbbda4814, []int{0, 1} + return fileDescriptor_regional_f69214f18cafc4dc, []int{0, 1} } func (m *ConcentratorConfig_LoRaStandardChannel) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -263,7 +265,7 @@ type ConcentratorConfig_FSKChannel struct { func (m *ConcentratorConfig_FSKChannel) Reset() { *m = ConcentratorConfig_FSKChannel{} } func (*ConcentratorConfig_FSKChannel) ProtoMessage() {} func (*ConcentratorConfig_FSKChannel) Descriptor() ([]byte, []int) { - return fileDescriptor_regional_d7a7cadcbbda4814, []int{0, 2} + return fileDescriptor_regional_f69214f18cafc4dc, []int{0, 2} } func (m *ConcentratorConfig_FSKChannel) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -319,7 +321,7 @@ type ConcentratorConfig_LBTConfiguration struct { func (m *ConcentratorConfig_LBTConfiguration) Reset() { *m = ConcentratorConfig_LBTConfiguration{} } func (*ConcentratorConfig_LBTConfiguration) ProtoMessage() {} func (*ConcentratorConfig_LBTConfiguration) Descriptor() ([]byte, []int) { - return fileDescriptor_regional_d7a7cadcbbda4814, []int{0, 3} + return fileDescriptor_regional_f69214f18cafc4dc, []int{0, 3} } func (m *ConcentratorConfig_LBTConfiguration) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1895,56 +1897,58 @@ var ( ) func init() { - proto.RegisterFile("lorawan-stack/api/regional.proto", fileDescriptor_regional_d7a7cadcbbda4814) + proto.RegisterFile("lorawan-stack/api/regional.proto", fileDescriptor_regional_f69214f18cafc4dc) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/regional.proto", fileDescriptor_regional_d7a7cadcbbda4814) -} - -var fileDescriptor_regional_d7a7cadcbbda4814 = []byte{ - // 702 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x3d, 0x4c, 0x1b, 0x4b, - 0x10, 0xde, 0xc5, 0xfc, 0x98, 0xf5, 0x33, 0x0f, 0x1d, 0xef, 0xe9, 0xf9, 0x59, 0x68, 0xec, 0xa4, - 0x72, 0xa2, 0x70, 0x96, 0x20, 0x4a, 0x17, 0x09, 0x99, 0x08, 0x14, 0x05, 0x25, 0xd2, 0xd9, 0x55, - 0x8a, 0x58, 0xeb, 0xf3, 0xdd, 0xf9, 0xe4, 0x63, 0xd7, 0xb9, 0x5b, 0xc7, 0xa2, 0x43, 0xa2, 0xa1, - 0x8c, 0x52, 0x51, 0x46, 0xa9, 0x28, 0xa9, 0x22, 0x4a, 0x4a, 0x4a, 0x4a, 0x2a, 0x07, 0xef, 0x35, - 0x94, 0x94, 0x94, 0xd1, 0xed, 0x9d, 0x6d, 0xfe, 0x0a, 0x42, 0x37, 0xf3, 0xed, 0x7c, 0xdf, 0xec, - 0xec, 0x37, 0x5a, 0x52, 0xf4, 0xb8, 0x4f, 0x7b, 0x94, 0x2d, 0x05, 0x82, 0x9a, 0xed, 0x32, 0xed, - 0xb8, 0x65, 0xdf, 0x72, 0x5c, 0xce, 0xa8, 0xa7, 0x77, 0x7c, 0x2e, 0xb8, 0x36, 0x27, 0x04, 0xd3, - 0x93, 0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 0xea, 0xb4, 0x9d, 0xb2, 0x10, 0xac, 0xd3, 0x68, 0x4c, 0xab, 0x59, 0x56, - 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0xd9, 0x6d, 0x0c, 0x1f, 0x55, 0x05, 0x00, 0x00, + golang_proto.RegisterFile("lorawan-stack/api/regional.proto", fileDescriptor_regional_f69214f18cafc4dc) +} + +var fileDescriptor_regional_f69214f18cafc4dc = []byte{ + // 727 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x3d, 0x4c, 0xe3, 0x48, + 0x18, 0x9d, 0x21, 0xfc, 0x84, 0xc9, 0x85, 0x43, 0xe6, 0x4e, 0x97, 0x8b, 0xd0, 0x24, 0x77, 0x55, + 0xee, 0x74, 0xb1, 0x25, 0x38, 0x5d, 0x73, 0x5a, 0x09, 0x85, 0x15, 0x68, 0xb5, 0x68, 0x57, 0x72, + 0x52, 0x6d, 0xb1, 0xd1, 0xc4, 0x1e, 0x3b, 0x56, 0xcc, 0x4c, 0xd6, 0x9e, 0x10, 0xd1, 0x21, 0xd1, + 0x50, 0xae, 0xb6, 0xa2, 0x5c, 0x6d, 0x45, 0x49, 0xb5, 0xa2, 0xa4, 0xa4, 0xa4, 0xa4, 0xca, 0x92, + 0x71, 0x43, 0x49, 0x49, 0xb9, 0xf2, 0xd8, 0x49, 0xf8, 0x2b, 0x58, 0xba, 0x6f, 0xde, 0xbc, 0xf7, + 0x3e, 0x7f, 0x7e, 0x9f, 0x06, 0x95, 0x7d, 0x1e, 0x90, 0x3e, 0x61, 0xd5, 0x50, 0x10, 0xab, 0x63, + 0x90, 0xae, 0x67, 0x04, 0xd4, 0xf5, 0x38, 0x23, 0xbe, 0xde, 0x0d, 0xb8, 0xe0, 0xda, 0x82, 0x10, + 0x4c, 0x4f, 0x59, 0xfa, 0xce, 0x6a, 0xb1, 0xea, 0x7a, 0xa2, 0xdd, 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0x54, + 0xb4, 0x3d, 0xe6, 0x86, 0x3a, 0xa3, 0xa2, 0xcf, 0x83, 0x8e, 0x71, 0xf7, 0xc9, 0xea, 0x76, 0x5c, + 0x43, 0x08, 0xd6, 0x6d, 0xb5, 0x66, 0xd5, 0x2c, 0xab, 0xdf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x9e, + 0xff, 0xb6, 0x09, 0x92, 0x05, 0x00, 0x00, } diff --git a/pkg/ttnpb/regional.pb.paths.fm.go b/pkg/ttnpb/regional.pb.paths.fm.go new file mode 100644 index 0000000000..c83f62e6d8 --- /dev/null +++ b/pkg/ttnpb/regional.pb.paths.fm.go @@ -0,0 +1,76 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var ConcentratorConfigFieldPathsNested = []string{ + "channels", + "clock_source", + "fsk_channel", + "fsk_channel.frequency", + "fsk_channel.radio", + "lbt", + "lbt.rssi_offset", + "lbt.rssi_target", + "lbt.scan_time", + "lora_standard_channel", + "lora_standard_channel.bandwidth", + "lora_standard_channel.frequency", + "lora_standard_channel.radio", + "lora_standard_channel.spreading_factor", + "ping_slot", + "ping_slot.frequency", + "ping_slot.radio", + "radios", +} + +var ConcentratorConfigFieldPathsTopLevel = []string{ + "channels", + "clock_source", + "fsk_channel", + "lbt", + "lora_standard_channel", + "ping_slot", + "radios", +} +var ConcentratorConfig_ChannelFieldPathsNested = []string{ + "frequency", + "radio", +} + +var ConcentratorConfig_ChannelFieldPathsTopLevel = []string{ + "frequency", + "radio", +} +var ConcentratorConfig_LoRaStandardChannelFieldPathsNested = []string{ + "bandwidth", + "frequency", + "radio", + "spreading_factor", +} + +var ConcentratorConfig_LoRaStandardChannelFieldPathsTopLevel = []string{ + "bandwidth", + "frequency", + "radio", + "spreading_factor", +} +var ConcentratorConfig_FSKChannelFieldPathsNested = []string{ + "frequency", + "radio", +} + +var ConcentratorConfig_FSKChannelFieldPathsTopLevel = []string{ + "frequency", + "radio", +} +var ConcentratorConfig_LBTConfigurationFieldPathsNested = []string{ + "rssi_offset", + "rssi_target", + "scan_time", +} + +var ConcentratorConfig_LBTConfigurationFieldPathsTopLevel = []string{ + "rssi_offset", + "rssi_target", + "scan_time", +} diff --git a/pkg/ttnpb/regional.pb.fm.go b/pkg/ttnpb/regional.pb.setters.fm.go similarity index 82% rename from pkg/ttnpb/regional.pb.fm.go rename to pkg/ttnpb/regional.pb.setters.fm.go index 0ecde0ece3..9577185fe9 100644 --- a/pkg/ttnpb/regional.pb.fm.go +++ b/pkg/ttnpb/regional.pb.setters.fm.go @@ -7,37 +7,6 @@ import ( time "time" ) -var ConcentratorConfigFieldPathsNested = []string{ - "channels", - "clock_source", - "fsk_channel", - "fsk_channel.frequency", - "fsk_channel.radio", - "lbt", - "lbt.rssi_offset", - "lbt.rssi_target", - "lbt.scan_time", - "lora_standard_channel", - "lora_standard_channel.bandwidth", - "lora_standard_channel.frequency", - "lora_standard_channel.radio", - "lora_standard_channel.spreading_factor", - "ping_slot", - "ping_slot.frequency", - "ping_slot.radio", - "radios", -} - -var ConcentratorConfigFieldPathsTopLevel = []string{ - "channels", - "clock_source", - "fsk_channel", - "lbt", - "lora_standard_channel", - "ping_slot", - "radios", -} - func (dst *ConcentratorConfig) SetFields(src *ConcentratorConfig, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -161,16 +130,6 @@ func (dst *ConcentratorConfig) SetFields(src *ConcentratorConfig, paths ...strin return nil } -var ConcentratorConfig_ChannelFieldPathsNested = []string{ - "frequency", - "radio", -} - -var ConcentratorConfig_ChannelFieldPathsTopLevel = []string{ - "frequency", - "radio", -} - func (dst *ConcentratorConfig_Channel) SetFields(src *ConcentratorConfig_Channel, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -202,20 +161,6 @@ func (dst *ConcentratorConfig_Channel) SetFields(src *ConcentratorConfig_Channel return nil } -var ConcentratorConfig_LoRaStandardChannelFieldPathsNested = []string{ - "bandwidth", - "frequency", - "radio", - "spreading_factor", -} - -var ConcentratorConfig_LoRaStandardChannelFieldPathsTopLevel = []string{ - "bandwidth", - "frequency", - "radio", - "spreading_factor", -} - func (dst *ConcentratorConfig_LoRaStandardChannel) SetFields(src *ConcentratorConfig_LoRaStandardChannel, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -267,16 +212,6 @@ func (dst *ConcentratorConfig_LoRaStandardChannel) SetFields(src *ConcentratorCo return nil } -var ConcentratorConfig_FSKChannelFieldPathsNested = []string{ - "frequency", - "radio", -} - -var ConcentratorConfig_FSKChannelFieldPathsTopLevel = []string{ - "frequency", - "radio", -} - func (dst *ConcentratorConfig_FSKChannel) SetFields(src *ConcentratorConfig_FSKChannel, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -308,18 +243,6 @@ func (dst *ConcentratorConfig_FSKChannel) SetFields(src *ConcentratorConfig_FSKC return nil } -var ConcentratorConfig_LBTConfigurationFieldPathsNested = []string{ - "rssi_offset", - "rssi_target", - "scan_time", -} - -var ConcentratorConfig_LBTConfigurationFieldPathsTopLevel = []string{ - "rssi_offset", - "rssi_target", - "scan_time", -} - func (dst *ConcentratorConfig_LBTConfiguration) SetFields(src *ConcentratorConfig_LBTConfiguration, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { diff --git a/pkg/ttnpb/regional.pb.validate.go b/pkg/ttnpb/regional.pb.validate.go new file mode 100644 index 0000000000..b2b12347c8 --- /dev/null +++ b/pkg/ttnpb/regional.pb.validate.go @@ -0,0 +1,558 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on ConcentratorConfig with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ConcentratorConfig) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ConcentratorConfigFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "channels": + + for idx, item := range m.GetChannels() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ConcentratorConfigValidationError{ + field: fmt.Sprintf("channels[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "lora_standard_channel": + + if v, ok := interface{}(m.GetLoRaStandardChannel()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ConcentratorConfigValidationError{ + field: "lora_standard_channel", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "fsk_channel": + + if v, ok := interface{}(m.GetFSKChannel()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ConcentratorConfigValidationError{ + field: "fsk_channel", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "lbt": + + if v, ok := interface{}(m.GetLBT()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ConcentratorConfigValidationError{ + field: "lbt", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "ping_slot": + + if v, ok := interface{}(m.GetPingSlot()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ConcentratorConfigValidationError{ + field: "ping_slot", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "radios": + + for idx, item := range m.GetRadios() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ConcentratorConfigValidationError{ + field: fmt.Sprintf("radios[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "clock_source": + // no validation rules for ClockSource + default: + return ConcentratorConfigValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ConcentratorConfigValidationError is the validation error returned by +// ConcentratorConfig.ValidateFields if the designated constraints aren't met. +type ConcentratorConfigValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ConcentratorConfigValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ConcentratorConfigValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ConcentratorConfigValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ConcentratorConfigValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ConcentratorConfigValidationError) ErrorName() string { + return "ConcentratorConfigValidationError" +} + +// Error satisfies the builtin error interface +func (e ConcentratorConfigValidationError) 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 %sConcentratorConfig.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ConcentratorConfigValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ConcentratorConfigValidationError{} + +// ValidateFields checks the field values on ConcentratorConfig_Channel with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *ConcentratorConfig_Channel) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ConcentratorConfig_ChannelFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "frequency": + // no validation rules for Frequency + case "radio": + // no validation rules for Radio + default: + return ConcentratorConfig_ChannelValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ConcentratorConfig_ChannelValidationError is the validation error returned +// by ConcentratorConfig_Channel.ValidateFields if the designated constraints +// aren't met. +type ConcentratorConfig_ChannelValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ConcentratorConfig_ChannelValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ConcentratorConfig_ChannelValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ConcentratorConfig_ChannelValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ConcentratorConfig_ChannelValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ConcentratorConfig_ChannelValidationError) ErrorName() string { + return "ConcentratorConfig_ChannelValidationError" +} + +// Error satisfies the builtin error interface +func (e ConcentratorConfig_ChannelValidationError) 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 %sConcentratorConfig_Channel.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ConcentratorConfig_ChannelValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ConcentratorConfig_ChannelValidationError{} + +// ValidateFields checks the field values on +// ConcentratorConfig_LoRaStandardChannel with the rules defined in the proto +// definition for this message. If any rules are violated, an error is returned. +func (m *ConcentratorConfig_LoRaStandardChannel) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ConcentratorConfig_LoRaStandardChannelFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "frequency": + // no validation rules for Frequency + case "radio": + // no validation rules for Radio + case "bandwidth": + // no validation rules for Bandwidth + case "spreading_factor": + // no validation rules for SpreadingFactor + default: + return ConcentratorConfig_LoRaStandardChannelValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ConcentratorConfig_LoRaStandardChannelValidationError is the validation +// error returned by ConcentratorConfig_LoRaStandardChannel.ValidateFields if +// the designated constraints aren't met. +type ConcentratorConfig_LoRaStandardChannelValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ConcentratorConfig_LoRaStandardChannelValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ConcentratorConfig_LoRaStandardChannelValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ConcentratorConfig_LoRaStandardChannelValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ConcentratorConfig_LoRaStandardChannelValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ConcentratorConfig_LoRaStandardChannelValidationError) ErrorName() string { + return "ConcentratorConfig_LoRaStandardChannelValidationError" +} + +// Error satisfies the builtin error interface +func (e ConcentratorConfig_LoRaStandardChannelValidationError) 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 %sConcentratorConfig_LoRaStandardChannel.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ConcentratorConfig_LoRaStandardChannelValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ConcentratorConfig_LoRaStandardChannelValidationError{} + +// ValidateFields checks the field values on ConcentratorConfig_FSKChannel with +// the rules defined in the proto definition for this message. If any rules +// are violated, an error is returned. +func (m *ConcentratorConfig_FSKChannel) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ConcentratorConfig_FSKChannelFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "frequency": + // no validation rules for Frequency + case "radio": + // no validation rules for Radio + default: + return ConcentratorConfig_FSKChannelValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ConcentratorConfig_FSKChannelValidationError is the validation error +// returned by ConcentratorConfig_FSKChannel.ValidateFields if the designated +// constraints aren't met. +type ConcentratorConfig_FSKChannelValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ConcentratorConfig_FSKChannelValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ConcentratorConfig_FSKChannelValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ConcentratorConfig_FSKChannelValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ConcentratorConfig_FSKChannelValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ConcentratorConfig_FSKChannelValidationError) ErrorName() string { + return "ConcentratorConfig_FSKChannelValidationError" +} + +// Error satisfies the builtin error interface +func (e ConcentratorConfig_FSKChannelValidationError) 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 %sConcentratorConfig_FSKChannel.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ConcentratorConfig_FSKChannelValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ConcentratorConfig_FSKChannelValidationError{} + +// ValidateFields checks the field values on +// ConcentratorConfig_LBTConfiguration with the rules defined in the proto +// definition for this message. If any rules are violated, an error is returned. +func (m *ConcentratorConfig_LBTConfiguration) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ConcentratorConfig_LBTConfigurationFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "rssi_target": + // no validation rules for RSSITarget + case "rssi_offset": + // no validation rules for RSSIOffset + case "scan_time": + + if v, ok := interface{}(&m.ScanTime).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ConcentratorConfig_LBTConfigurationValidationError{ + field: "scan_time", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return ConcentratorConfig_LBTConfigurationValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ConcentratorConfig_LBTConfigurationValidationError is the validation error +// returned by ConcentratorConfig_LBTConfiguration.ValidateFields if the +// designated constraints aren't met. +type ConcentratorConfig_LBTConfigurationValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ConcentratorConfig_LBTConfigurationValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ConcentratorConfig_LBTConfigurationValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ConcentratorConfig_LBTConfigurationValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ConcentratorConfig_LBTConfigurationValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ConcentratorConfig_LBTConfigurationValidationError) ErrorName() string { + return "ConcentratorConfig_LBTConfigurationValidationError" +} + +// Error satisfies the builtin error interface +func (e ConcentratorConfig_LBTConfigurationValidationError) 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 %sConcentratorConfig_LBTConfiguration.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ConcentratorConfig_LBTConfigurationValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ConcentratorConfig_LBTConfigurationValidationError{} diff --git a/pkg/ttnpb/regional.validator.pb.go b/pkg/ttnpb/regional.validator.pb.go deleted file mode 100644 index a87521b3f3..0000000000 --- a/pkg/ttnpb/regional.validator.pb.go +++ /dev/null @@ -1,72 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/regional.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/duration" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *ConcentratorConfig) Validate() error { - for _, item := range this.Channels { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Channels", err) - } - } - } - if this.LoRaStandardChannel != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.LoRaStandardChannel); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("LoRaStandardChannel", err) - } - } - if this.FSKChannel != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.FSKChannel); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FSKChannel", err) - } - } - if this.LBT != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.LBT); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("LBT", err) - } - } - if this.PingSlot != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.PingSlot); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("PingSlot", err) - } - } - for _, item := range this.Radios { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Radios", err) - } - } - } - return nil -} -func (this *ConcentratorConfig_Channel) Validate() error { - return nil -} -func (this *ConcentratorConfig_LoRaStandardChannel) Validate() error { - return nil -} -func (this *ConcentratorConfig_FSKChannel) Validate() error { - return nil -} -func (this *ConcentratorConfig_LBTConfiguration) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ScanTime)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ScanTime", err) - } - return nil -} diff --git a/pkg/ttnpb/rights.pb.go b/pkg/ttnpb/rights.pb.go index 6e8272ef80..6e72805c88 100644 --- a/pkg/ttnpb/rights.pb.go +++ b/pkg/ttnpb/rights.pb.go @@ -8,6 +8,7 @@ import golang_proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" +import _ "github.com/lyft/protoc-gen-validate/validate" import strconv "strconv" @@ -268,7 +269,7 @@ var Right_value = map[string]int32{ } func (Right) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_rights_adc4ed83d2eec3d9, []int{0} + return fileDescriptor_rights_d3585837a76aef4f, []int{0} } type Rights struct { @@ -280,7 +281,7 @@ type Rights struct { func (m *Rights) Reset() { *m = Rights{} } func (*Rights) ProtoMessage() {} func (*Rights) Descriptor() ([]byte, []int) { - return fileDescriptor_rights_adc4ed83d2eec3d9, []int{0} + return fileDescriptor_rights_d3585837a76aef4f, []int{0} } func (m *Rights) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -334,7 +335,7 @@ type APIKey struct { func (m *APIKey) Reset() { *m = APIKey{} } func (*APIKey) ProtoMessage() {} func (*APIKey) Descriptor() ([]byte, []int) { - return fileDescriptor_rights_adc4ed83d2eec3d9, []int{1} + return fileDescriptor_rights_d3585837a76aef4f, []int{1} } func (m *APIKey) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -400,7 +401,7 @@ type APIKeys struct { func (m *APIKeys) Reset() { *m = APIKeys{} } func (*APIKeys) ProtoMessage() {} func (*APIKeys) Descriptor() ([]byte, []int) { - return fileDescriptor_rights_adc4ed83d2eec3d9, []int{2} + return fileDescriptor_rights_d3585837a76aef4f, []int{2} } func (m *APIKeys) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -446,7 +447,7 @@ type Collaborator struct { func (m *Collaborator) Reset() { *m = Collaborator{} } func (*Collaborator) ProtoMessage() {} func (*Collaborator) Descriptor() ([]byte, []int) { - return fileDescriptor_rights_adc4ed83d2eec3d9, []int{3} + return fileDescriptor_rights_d3585837a76aef4f, []int{3} } func (m *Collaborator) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -491,7 +492,7 @@ type Collaborators struct { func (m *Collaborators) Reset() { *m = Collaborators{} } func (*Collaborators) ProtoMessage() {} func (*Collaborators) Descriptor() ([]byte, []int) { - return fileDescriptor_rights_adc4ed83d2eec3d9, []int{4} + return fileDescriptor_rights_d3585837a76aef4f, []int{4} } func (m *Collaborators) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1946,80 +1947,82 @@ var ( ) func init() { - proto.RegisterFile("lorawan-stack/api/rights.proto", fileDescriptor_rights_adc4ed83d2eec3d9) + proto.RegisterFile("lorawan-stack/api/rights.proto", fileDescriptor_rights_d3585837a76aef4f) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/rights.proto", fileDescriptor_rights_adc4ed83d2eec3d9) + golang_proto.RegisterFile("lorawan-stack/api/rights.proto", fileDescriptor_rights_d3585837a76aef4f) } -var fileDescriptor_rights_adc4ed83d2eec3d9 = []byte{ - // 1080 bytes of a gzipped FileDescriptorProto +var fileDescriptor_rights_d3585837a76aef4f = []byte{ + // 1119 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x96, 0x3d, 0x50, 0xdb, 0x48, - 0x14, 0xc7, 0xb5, 0x86, 0x38, 0xc9, 0x23, 0x90, 0x65, 0x03, 0xc4, 0x18, 0x58, 0x83, 0x21, 0x84, - 0xe3, 0xc0, 0xbe, 0x83, 0xbb, 0x4b, 0x77, 0x33, 0xb2, 0x2d, 0xc8, 0x0e, 0x8a, 0xc5, 0x48, 0x22, - 0x4c, 0x68, 0x34, 0x02, 0x1c, 0xa3, 0x81, 0x58, 0x1e, 0x5b, 0x24, 0xc3, 0x55, 0x29, 0x29, 0xaf, - 0xbc, 0xf2, 0xe6, 0xae, 0x49, 0x99, 0x32, 0x65, 0x4a, 0xba, 0xa3, 0x4c, 0xc5, 0xc4, 0x72, 0x93, - 0x32, 0x65, 0xca, 0x1b, 0x4b, 0x32, 0xfa, 0xb0, 0x9c, 0xa4, 0x93, 0xf7, 0xfd, 0xde, 0xd7, 0xff, - 0xbd, 0xdd, 0x31, 0xd0, 0x13,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 0x61, 0xc8, 0xbe, 0xca, - 0x74, 0xdd, 0xe4, 0x9b, 0x7a, 0xdd, 0xe8, 0x7c, 0x64, 0xcf, 0x11, 0xdc, 0x29, 0x9a, 0x27, 0x27, - 0xfa, 0xbe, 0xd9, 0xd0, 0x2d, 0xb3, 0x41, 0x18, 0x0c, 0x18, 0x87, 0x4d, 0xa7, 0x93, 0xa1, 0xb5, - 0xd5, 0x68, 0x2c, 0xa9, 0x51, 0xd5, 0x6b, 0xc6, 0x1f, 0xba, 0x65, 0x98, 0x35, 0xa9, 0xb1, 0xd3, - 0xac, 0x34, 0x98, 0xaf, 0x66, 0xe1, 0xd6, 0xc5, 0x55, 0x86, 0xbb, 0xbc, 0xca, 0x20, 0xb9, 0x13, - 0x23, 0xd0, 0x55, 0xe2, 0x7b, 0xba, 0x52, 0x60, 0x38, 0x58, 0x49, 0x93, 0x14, 0x60, 0xf8, 0x20, - 0x78, 0xe0, 0x35, 0x38, 0x1d, 0x0d, 0x13, 0xf4, 0x92, 0xc3, 0x2e, 0xcb, 0xff, 0x8d, 0xc0, 0x0d, - 0x27, 0x0d, 0x19, 0x85, 0x61, 0x27, 0x91, 0x66, 0xd4, 0x5e, 0xea, 0x27, 0xc6, 0x21, 0xe6, 0xc8, - 0x3d, 0xb8, 0x2b, 0xb3, 0xcd, 0xc7, 0xaa, 0xb6, 0xa3, 0x08, 0xb2, 0xc6, 0xca, 0x1b, 0x12, 0x46, - 0x64, 0x06, 0x26, 0x03, 0x87, 0x8a, 0xa0, 0xaa, 0xac, 0xbc, 0xa9, 0x68, 0x05, 0x5e, 0x61, 0x45, - 0x9c, 0x20, 0xb3, 0x30, 0x1d, 0x67, 0xe6, 0xb7, 0x99, 0xb6, 0x25, 0x3c, 0x53, 0xf0, 0x00, 0x19, - 0x87, 0xd1, 0x00, 0x51, 0x12, 0x44, 0x41, 0x15, 0xf0, 0x20, 0x99, 0x83, 0x99, 0xc0, 0x31, 0xbf, - 0xa3, 0x3e, 0x96, 0x64,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0x84, 0x39, 0x6f, 0x11, 0xf0, 0x7b, 0x8b, 0x30, 0x7f, 0xb6, 0x08, 0xf8, 0xab, 0x45, 0x98, + 0x57, 0x2d, 0xc2, 0xbc, 0x6e, 0x11, 0xf0, 0xa6, 0x45, 0xc0, 0x45, 0x8b, 0x80, 0xdd, 0x95, 0xaa, + 0x99, 0xb3, 0x8e, 0x34, 0xeb, 0x48, 0x37, 0xaa, 0x8d, 0x9c, 0xa1, 0x59, 0x2f, 0xcc, 0xfa, 0x71, + 0x3e, 0xf8, 0x9f, 0x57, 0x3b, 0xae, 0xe6, 0x2d, 0xcb, 0xa8, 0xed, 0xed, 0x25, 0x9c, 0x5f, 0xbc, + 0xb5, 0x4f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbb, 0xbe, 0x52, 0x46, 0xa5, 0x0a, 0x00, 0x00, } diff --git a/pkg/ttnpb/rights.pb.paths.fm.go b/pkg/ttnpb/rights.pb.paths.fm.go new file mode 100644 index 0000000000..55ea240c50 --- /dev/null +++ b/pkg/ttnpb/rights.pb.paths.fm.go @@ -0,0 +1,53 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var RightsFieldPathsNested = []string{ + "rights", +} + +var RightsFieldPathsTopLevel = []string{ + "rights", +} +var APIKeyFieldPathsNested = []string{ + "id", + "key", + "name", + "rights", +} + +var APIKeyFieldPathsTopLevel = []string{ + "id", + "key", + "name", + "rights", +} +var APIKeysFieldPathsNested = []string{ + "api_keys", +} + +var APIKeysFieldPathsTopLevel = []string{ + "api_keys", +} +var CollaboratorFieldPathsNested = []string{ + "ids", + "ids.ids", + "ids.ids.organization_ids", + "ids.ids.organization_ids.organization_id", + "ids.ids.user_ids", + "ids.ids.user_ids.email", + "ids.ids.user_ids.user_id", + "rights", +} + +var CollaboratorFieldPathsTopLevel = []string{ + "ids", + "rights", +} +var CollaboratorsFieldPathsNested = []string{ + "collaborators", +} + +var CollaboratorsFieldPathsTopLevel = []string{ + "collaborators", +} diff --git a/pkg/ttnpb/rights.pb.fm.go b/pkg/ttnpb/rights.pb.setters.fm.go similarity index 81% rename from pkg/ttnpb/rights.pb.fm.go rename to pkg/ttnpb/rights.pb.setters.fm.go index 2e7fb2d979..5d66ea3dfe 100644 --- a/pkg/ttnpb/rights.pb.fm.go +++ b/pkg/ttnpb/rights.pb.setters.fm.go @@ -4,14 +4,6 @@ package ttnpb import fmt "fmt" -var RightsFieldPathsNested = []string{ - "rights", -} - -var RightsFieldPathsTopLevel = []string{ - "rights", -} - func (dst *Rights) SetFields(src *Rights, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -32,20 +24,6 @@ func (dst *Rights) SetFields(src *Rights, paths ...string) error { return nil } -var APIKeyFieldPathsNested = []string{ - "id", - "key", - "name", - "rights", -} - -var APIKeyFieldPathsTopLevel = []string{ - "id", - "key", - "name", - "rights", -} - func (dst *APIKey) SetFields(src *APIKey, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -96,14 +74,6 @@ func (dst *APIKey) SetFields(src *APIKey, paths ...string) error { return nil } -var APIKeysFieldPathsNested = []string{ - "api_keys", -} - -var APIKeysFieldPathsTopLevel = []string{ - "api_keys", -} - func (dst *APIKeys) SetFields(src *APIKeys, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -124,22 +94,6 @@ func (dst *APIKeys) SetFields(src *APIKeys, paths ...string) error { return nil } -var CollaboratorFieldPathsNested = []string{ - "ids", - "ids.ids", - "ids.ids.organization_ids", - "ids.ids.organization_ids.organization_id", - "ids.ids.user_ids", - "ids.ids.user_ids.email", - "ids.ids.user_ids.user_id", - "rights", -} - -var CollaboratorFieldPathsTopLevel = []string{ - "ids", - "rights", -} - func (dst *Collaborator) SetFields(src *Collaborator, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -178,14 +132,6 @@ func (dst *Collaborator) SetFields(src *Collaborator, paths ...string) error { return nil } -var CollaboratorsFieldPathsNested = []string{ - "collaborators", -} - -var CollaboratorsFieldPathsTopLevel = []string{ - "collaborators", -} - func (dst *Collaborators) SetFields(src *Collaborators, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { diff --git a/pkg/ttnpb/rights.pb.validate.go b/pkg/ttnpb/rights.pb.validate.go new file mode 100644 index 0000000000..756d4ad9ab --- /dev/null +++ b/pkg/ttnpb/rights.pb.validate.go @@ -0,0 +1,486 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on Rights with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *Rights) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = RightsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "rights": + + default: + return RightsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// RightsValidationError is the validation error returned by +// Rights.ValidateFields if the designated constraints aren't met. +type RightsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e RightsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e RightsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e RightsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e RightsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e RightsValidationError) ErrorName() string { return "RightsValidationError" } + +// Error satisfies the builtin error interface +func (e RightsValidationError) 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 %sRights.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = RightsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = RightsValidationError{} + +// ValidateFields checks the field values on APIKey with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *APIKey) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = APIKeyFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "id": + // no validation rules for ID + case "key": + // no validation rules for Key + case "name": + // no validation rules for Name + case "rights": + + default: + return APIKeyValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// APIKeyValidationError is the validation error returned by +// APIKey.ValidateFields if the designated constraints aren't met. +type APIKeyValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e APIKeyValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e APIKeyValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e APIKeyValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e APIKeyValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e APIKeyValidationError) ErrorName() string { return "APIKeyValidationError" } + +// Error satisfies the builtin error interface +func (e APIKeyValidationError) 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 %sAPIKey.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = APIKeyValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = APIKeyValidationError{} + +// ValidateFields checks the field values on APIKeys with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *APIKeys) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = APIKeysFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "api_keys": + + for idx, item := range m.GetAPIKeys() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return APIKeysValidationError{ + field: fmt.Sprintf("api_keys[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + default: + return APIKeysValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// APIKeysValidationError is the validation error returned by +// APIKeys.ValidateFields if the designated constraints aren't met. +type APIKeysValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e APIKeysValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e APIKeysValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e APIKeysValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e APIKeysValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e APIKeysValidationError) ErrorName() string { return "APIKeysValidationError" } + +// Error satisfies the builtin error interface +func (e APIKeysValidationError) 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 %sAPIKeys.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = APIKeysValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = APIKeysValidationError{} + +// ValidateFields checks the field values on Collaborator with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *Collaborator) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = CollaboratorFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "ids": + + if v, ok := interface{}(&m.OrganizationOrUserIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return CollaboratorValidationError{ + field: "ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "rights": + + default: + return CollaboratorValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// CollaboratorValidationError is the validation error returned by +// Collaborator.ValidateFields if the designated constraints aren't met. +type CollaboratorValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CollaboratorValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CollaboratorValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CollaboratorValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CollaboratorValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CollaboratorValidationError) ErrorName() string { return "CollaboratorValidationError" } + +// Error satisfies the builtin error interface +func (e CollaboratorValidationError) 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 %sCollaborator.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CollaboratorValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CollaboratorValidationError{} + +// ValidateFields checks the field values on Collaborators with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *Collaborators) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = CollaboratorsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "collaborators": + + for idx, item := range m.GetCollaborators() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return CollaboratorsValidationError{ + field: fmt.Sprintf("collaborators[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + default: + return CollaboratorsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// CollaboratorsValidationError is the validation error returned by +// Collaborators.ValidateFields if the designated constraints aren't met. +type CollaboratorsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CollaboratorsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CollaboratorsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CollaboratorsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CollaboratorsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CollaboratorsValidationError) ErrorName() string { return "CollaboratorsValidationError" } + +// Error satisfies the builtin error interface +func (e CollaboratorsValidationError) 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 %sCollaborators.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CollaboratorsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CollaboratorsValidationError{} diff --git a/pkg/ttnpb/rights.validator.pb.go b/pkg/ttnpb/rights.validator.pb.go deleted file mode 100644 index a1002986b2..0000000000 --- a/pkg/ttnpb/rights.validator.pb.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/rights.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *Rights) Validate() error { - return nil -} -func (this *APIKey) Validate() error { - return nil -} -func (this *APIKeys) Validate() error { - for _, item := range this.APIKeys { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("APIKeys", err) - } - } - } - return nil -} -func (this *Collaborator) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.OrganizationOrUserIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("OrganizationOrUserIdentifiers", err) - } - return nil -} -func (this *Collaborators) Validate() error { - for _, item := range this.Collaborators { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Collaborators", err) - } - } - } - return nil -} diff --git a/pkg/ttnpb/search_services.pb.go b/pkg/ttnpb/search_services.pb.go index 3f401f0f9e..10e66c1cce 100644 --- a/pkg/ttnpb/search_services.pb.go +++ b/pkg/ttnpb/search_services.pb.go @@ -9,6 +9,7 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import types "github.com/gogo/protobuf/types" +import _ "github.com/lyft/protoc-gen-validate/validate" import _ "google.golang.org/genproto/googleapis/api/annotations" import ( @@ -53,7 +54,7 @@ type SearchEntitiesRequest struct { func (m *SearchEntitiesRequest) Reset() { *m = SearchEntitiesRequest{} } func (*SearchEntitiesRequest) ProtoMessage() {} func (*SearchEntitiesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_search_services_8548a8c7795e28db, []int{0} + return fileDescriptor_search_services_20e4a136298cdca0, []int{0} } func (m *SearchEntitiesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -141,7 +142,7 @@ type SearchEndDevicesRequest struct { func (m *SearchEndDevicesRequest) Reset() { *m = SearchEndDevicesRequest{} } func (*SearchEndDevicesRequest) ProtoMessage() {} func (*SearchEndDevicesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_search_services_8548a8c7795e28db, []int{1} + return fileDescriptor_search_services_20e4a136298cdca0, []int{1} } func (m *SearchEndDevicesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1813,73 +1814,75 @@ var ( ) func init() { - proto.RegisterFile("lorawan-stack/api/search_services.proto", fileDescriptor_search_services_8548a8c7795e28db) + proto.RegisterFile("lorawan-stack/api/search_services.proto", fileDescriptor_search_services_20e4a136298cdca0) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/search_services.proto", fileDescriptor_search_services_8548a8c7795e28db) -} - -var fileDescriptor_search_services_8548a8c7795e28db = []byte{ - // 965 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x3d, 0x6c, 0x23, 0x45, - 0x14, 0xde, 0x89, 0x9d, 0x90, 0x8c, 0x89, 0xed, 0x4c, 0x92, 0xb3, 0x65, 0xe5, 0xc6, 0x91, 0x0f, - 0xb8, 0x14, 0xdc, 0x5a, 0xf8, 0x1a, 0x84, 0x0e, 0xa2, 0xe4, 0x6c, 0x50, 0x4e, 0x42, 0x48, 0x46, - 0x57, 0x40, 0x63, 0x8d, 0xbd, 0x93, 0xf5, 0x60, 0x67, 0xd6, 0xec, 0x8c, 0x1d, 0xf9, 0x10, 0xd2, - 0x89, 0xea, 0x4a, 0x24, 0x1a, 0x44, 0x81, 0x10, 0xd5, 0x95, 0x27, 0xd1, 0x9c, 0xa8, 0xae, 0x42, - 0x29, 0x23, 0xd1, 0x5c, 0x65, 0x9d, 0x77, 0x29, 0xae, 0xbc, 0x32, 0x25, 0xda, 0xd9, 0x5d, 0xaf, - 0xbd, 0x4e, 0x90, 0x53, 0xd1, 0xcd, 0xcf, 0xf7, 0xbe, 0xef, 0xcd, 0xbc, 0x6f, 0xde, 0x2e, 0xbc, - 0xdd, 0xb5, 0x6c, 0x72, 0x4a, 0xf8, 0x1d, 0x21, 0x49, 0xab, 0x53, 0x26, 0x3d, 0x56, 0x16, 0x94, - 0xd8, 0xad, 0x76, 0x43, 0x50, 0x7b, 0xc0, 0x5a, 0x54, 0xe8, 0x3d, 0xdb, 0x92, 0x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, 0xe7, 0x0e, 0x06, 0x2f, 0x1d, 0xac, 0xbd, 0x72, 0x30, 0x78, - 0xed, 0x60, 0xed, 0x8d, 0x83, 0xc1, 0x85, 0x83, 0xb5, 0xc7, 0x2e, 0xd6, 0x9e, 0xb8, 0x18, 0xfc, - 0xe8, 0x62, 0xed, 0x67, 0x17, 0x83, 0xdf, 0x5c, 0xac, 0x3d, 0x75, 0xb1, 0xf6, 0xcc, 0xc5, 0xe0, - 0xb9, 0x8b, 0xc1, 0x0b, 0x17, 0x83, 0xaf, 0xdf, 0x37, 0x2d, 0x5d, 0xb6, 0xa9, 0x6c, 0x33, 0x6e, - 0x0a, 0x9d, 0x53, 0x79, 0x6a, 0xd9, 0x9d, 0xf2, 0xec, 0x2f, 0x40, 0xaf, 0x63, 0x96, 0xa5, 0xe4, - 0xbd, 0x66, 0x73, 0x45, 0x75, 0x85, 0xbb, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x10, 0x40, 0xc0, - 0xa4, 0xa1, 0x09, 0x00, 0x00, + golang_proto.RegisterFile("lorawan-stack/api/search_services.proto", fileDescriptor_search_services_20e4a136298cdca0) +} + +var fileDescriptor_search_services_20e4a136298cdca0 = []byte{ + // 999 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x4d, 0x6c, 0x1b, 0x45, + 0x14, 0xde, 0x89, 0x93, 0xd0, 0x4c, 0x88, 0xe3, 0x4c, 0x92, 0xc6, 0xb2, 0xd2, 0x71, 0xe4, 0x02, + 0xcd, 0x81, 0xec, 0x0a, 0xf7, 0x82, 0xa0, 0x10, 0x25, 0xb5, 0x41, 0xa9, 0x84, 0x90, 0x8c, 0x7a, + 0xe1, 0x62, 0x8d, 0x77, 0xc7, 0xeb, 0xc1, 0xce, 0xac, 0xd9, 0x19, 0x3b, 0x72, 0x11, 0x52, 0xc5, + 0xa9, 0xe2, 0x84, 0xc4, 0x05, 0x71, 0x40, 0x88, 0x53, 0x8f, 0x3d, 0x56, 0x95, 0x90, 0x72, 0x42, + 0x39, 0x46, 0xe2, 0xd2, 0x93, 0x55, 0xaf, 0x39, 0x94, 0x5b, 0x8f, 0x3d, 0xa2, 0x9d, 0xdd, 0xf5, + 0xda, 0xeb, 0x04, 0x39, 0xa7, 0xde, 0xe6, 0xe7, 0x7b, 0xdf, 0xf7, 0xe6, 0xcd, 0x37, 0x6f, 0x17, + 0xde, 0x6a, 0x39, 0x2e, 0x39, 0x21, 0x7c, 0x4f, 0x48, 0x62, 0x36, 0x0d, 0xd2, 0x66, 0x86, 0xa0, + 0xc4, 0x35, 0x1b, 0x55, 0x41, 0xdd, 0x2e, 0x33, 0xa9, 0xd0, 0xdb, 0xae, 0x23, 0x1d, 0x94, 0x96, + 0x92, 0xeb, 0x21, 0x58, 0xef, 0xde, 0xce, 0xed, 0xd9, 0x4c, 0x36, 0x3a, 0x35, 0xdd, 0x74, 0x8e, + 0x0d, 0xdb, 0xb1, 0x1d, 0x43, 0xc1, 0x6a, 0x9d, 0xba, 0x9a, 0xa9, 0x89, 0x1a, 0x05, 0xe1, 0xb9, + 0x8f, 0xc7, 0xe0, 0xad, 0x5e, 0x5d, 0x06, 0x70, 0x73, 0xcf, 0xa6, 0x7c, 0xaf, 0x4b, 0x5a, 0xcc, + 0x22, 0x92, 0x1a, 0x53, 0x83, 0x30, 0x78, 0xdb, 0x76, 0x1c, 0xbb, 0x45, 0x55, 0x76, 0x84, 0x73, + 0x47, 0x12, 0xc9, 0x1c, 0x1e, 0x66, 0x96, 0xdb, 0x09, 0x77, 0x47, 0x09, 0xd4, 0x19, 0x6d, 0x59, + 0xd5, 0x63, 0x22, 0x9a, 0x21, 0xe2, 0xe6, 0xf4, 0x21, 0x49, 0xbb, 0xdd, 0x62, 0xa6, 0xe2, 0x09, + 0x41, 0x78, 0x1a, 0x64, 0xb6, 0x18, 0xe5, 0x32, 0xdc, 0x2f, 0x4c, 0xef, 0x53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 0x79, 0xbb, 0x56, 0x5b, 0x54, 0x5d, 0xe1, 0xf6, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x5b, + 0x2c, 0x1d, 0x34, 0xe8, 0x09, 0x00, 0x00, } diff --git a/pkg/ttnpb/search_services.pb.gw.go b/pkg/ttnpb/search_services.pb.gw.go index c642ee6e0c..240b91ffaa 100644 --- a/pkg/ttnpb/search_services.pb.gw.go +++ b/pkg/ttnpb/search_services.pb.gw.go @@ -9,11 +9,10 @@ It translates gRPC into RESTful JSON APIs. package ttnpb import ( + "context" "io" "net/http" - "context" - "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" diff --git a/pkg/ttnpb/search_services.pb.paths.fm.go b/pkg/ttnpb/search_services.pb.paths.fm.go new file mode 100644 index 0000000000..a36929a915 --- /dev/null +++ b/pkg/ttnpb/search_services.pb.paths.fm.go @@ -0,0 +1,43 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var SearchEntitiesRequestFieldPathsNested = []string{ + "attributes_contain", + "description_contains", + "field_mask", + "id_contains", + "name_contains", +} + +var SearchEntitiesRequestFieldPathsTopLevel = []string{ + "attributes_contain", + "description_contains", + "field_mask", + "id_contains", + "name_contains", +} +var SearchEndDevicesRequestFieldPathsNested = []string{ + "application_ids", + "application_ids.application_id", + "attributes_contain", + "description_contains", + "dev_addr_contains", + "dev_eui_contains", + "field_mask", + "id_contains", + "join_eui_contains", + "name_contains", +} + +var SearchEndDevicesRequestFieldPathsTopLevel = []string{ + "application_ids", + "attributes_contain", + "description_contains", + "dev_addr_contains", + "dev_eui_contains", + "field_mask", + "id_contains", + "join_eui_contains", + "name_contains", +} diff --git a/pkg/ttnpb/search_services.pb.fm.go b/pkg/ttnpb/search_services.pb.setters.fm.go similarity index 81% rename from pkg/ttnpb/search_services.pb.fm.go rename to pkg/ttnpb/search_services.pb.setters.fm.go index dd62dba09d..5311b7e32d 100644 --- a/pkg/ttnpb/search_services.pb.fm.go +++ b/pkg/ttnpb/search_services.pb.setters.fm.go @@ -5,25 +5,9 @@ package ttnpb import ( fmt "fmt" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + types "github.com/gogo/protobuf/types" ) -var SearchEntitiesRequestFieldPathsNested = []string{ - "attributes_contain", - "description_contains", - "field_mask", - "id_contains", - "name_contains", -} - -var SearchEntitiesRequestFieldPathsTopLevel = []string{ - "attributes_contain", - "description_contains", - "field_mask", - "id_contains", - "name_contains", -} - func (dst *SearchEntitiesRequest) SetFields(src *SearchEntitiesRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -73,7 +57,7 @@ func (dst *SearchEntitiesRequest) SetFields(src *SearchEntitiesRequest, paths .. if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } @@ -84,31 +68,6 @@ func (dst *SearchEntitiesRequest) SetFields(src *SearchEntitiesRequest, paths .. return nil } -var SearchEndDevicesRequestFieldPathsNested = []string{ - "application_ids", - "application_ids.application_id", - "attributes_contain", - "description_contains", - "dev_addr_contains", - "dev_eui_contains", - "field_mask", - "id_contains", - "join_eui_contains", - "name_contains", -} - -var SearchEndDevicesRequestFieldPathsTopLevel = []string{ - "application_ids", - "attributes_contain", - "description_contains", - "dev_addr_contains", - "dev_eui_contains", - "field_mask", - "id_contains", - "join_eui_contains", - "name_contains", -} - func (dst *SearchEndDevicesRequest) SetFields(src *SearchEndDevicesRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -206,7 +165,7 @@ func (dst *SearchEndDevicesRequest) SetFields(src *SearchEndDevicesRequest, path if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } diff --git a/pkg/ttnpb/search_services.pb.validate.go b/pkg/ttnpb/search_services.pb.validate.go new file mode 100644 index 0000000000..67f8720570 --- /dev/null +++ b/pkg/ttnpb/search_services.pb.validate.go @@ -0,0 +1,253 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on SearchEntitiesRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *SearchEntitiesRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = SearchEntitiesRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "id_contains": + // no validation rules for IDContains + case "name_contains": + // no validation rules for NameContains + case "description_contains": + // no validation rules for DescriptionContains + case "attributes_contain": + // no validation rules for AttributesContain + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SearchEntitiesRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return SearchEntitiesRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// SearchEntitiesRequestValidationError is the validation error returned by +// SearchEntitiesRequest.ValidateFields if the designated constraints aren't met. +type SearchEntitiesRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SearchEntitiesRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SearchEntitiesRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SearchEntitiesRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SearchEntitiesRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SearchEntitiesRequestValidationError) ErrorName() string { + return "SearchEntitiesRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e SearchEntitiesRequestValidationError) 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 %sSearchEntitiesRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SearchEntitiesRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SearchEntitiesRequestValidationError{} + +// ValidateFields checks the field values on SearchEndDevicesRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *SearchEndDevicesRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = SearchEndDevicesRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "application_ids": + + if v, ok := interface{}(&m.ApplicationIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SearchEndDevicesRequestValidationError{ + field: "application_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "id_contains": + // no validation rules for IDContains + case "name_contains": + // no validation rules for NameContains + case "description_contains": + // no validation rules for DescriptionContains + case "attributes_contain": + // no validation rules for AttributesContain + case "dev_eui_contains": + // no validation rules for DevEUIContains + case "join_eui_contains": + // no validation rules for JoinEUIContains + case "dev_addr_contains": + // no validation rules for DevAddrContains + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return SearchEndDevicesRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return SearchEndDevicesRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// SearchEndDevicesRequestValidationError is the validation error returned by +// SearchEndDevicesRequest.ValidateFields if the designated constraints aren't met. +type SearchEndDevicesRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SearchEndDevicesRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SearchEndDevicesRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SearchEndDevicesRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SearchEndDevicesRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SearchEndDevicesRequestValidationError) ErrorName() string { + return "SearchEndDevicesRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e SearchEndDevicesRequestValidationError) 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 %sSearchEndDevicesRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SearchEndDevicesRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SearchEndDevicesRequestValidationError{} diff --git a/pkg/ttnpb/search_services.validator.pb.go b/pkg/ttnpb/search_services.validator.pb.go deleted file mode 100644 index 8fd9fe0170..0000000000 --- a/pkg/ttnpb/search_services.validator.pb.go +++ /dev/null @@ -1,38 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/search_services.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "google.golang.org/genproto/googleapis/api/annotations" -import _ "google.golang.org/genproto/protobuf/field_mask" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *SearchEntitiesRequest) Validate() error { - // Validation of proto3 map<> fields is unsupported. - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *SearchEndDevicesRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ApplicationIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ApplicationIdentifiers", err) - } - // Validation of proto3 map<> fields is unsupported. - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} diff --git a/pkg/ttnpb/ttnpb.pb.util.fm.go b/pkg/ttnpb/ttnpb.pb.util.fm.go index 5e42adbdfb..443928ed40 100644 --- a/pkg/ttnpb/ttnpb.pb.util.fm.go +++ b/pkg/ttnpb/ttnpb.pb.util.fm.go @@ -1,4 +1,5 @@ // Code generated by protoc-gen-fieldmask. DO NOT EDIT. + package ttnpb import ( diff --git a/pkg/ttnpb/user.go b/pkg/ttnpb/user.go new file mode 100644 index 0000000000..afe6ae09a8 --- /dev/null +++ b/pkg/ttnpb/user.go @@ -0,0 +1,29 @@ +// Copyright © 2019 The Things Network Foundation, The Things Industries B.V. +// +// 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. + +package ttnpb + +import ( + "context" +) + +// ValidateContext wraps the generated validator with (optionally context-based) custom checks. +func (m *UpdateUserRequest) ValidateContext(context.Context) error { + if len(m.FieldMask.Paths) == 0 { + return m.ValidateFields() + } + return m.ValidateFields(append(fieldsWithPrefix("user", m.FieldMask.Paths...), + "user.ids", + )...) +} diff --git a/pkg/ttnpb/user.pb.go b/pkg/ttnpb/user.pb.go index 90720ff41c..918cb83007 100644 --- a/pkg/ttnpb/user.pb.go +++ b/pkg/ttnpb/user.pb.go @@ -9,7 +9,7 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import types "github.com/gogo/protobuf/types" -import _ "github.com/mwitkow/go-proto-validators" +import _ "github.com/lyft/protoc-gen-validate/validate" import time "time" @@ -71,7 +71,7 @@ type User struct { func (m *User) Reset() { *m = User{} } func (*User) ProtoMessage() {} func (*User) Descriptor() ([]byte, []int) { - return fileDescriptor_user_80523f4a1b6083b3, []int{0} + return fileDescriptor_user_503139008509373a, []int{0} } func (m *User) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -232,7 +232,7 @@ type Picture struct { func (m *Picture) Reset() { *m = Picture{} } func (*Picture) ProtoMessage() {} func (*Picture) Descriptor() ([]byte, []int) { - return fileDescriptor_user_80523f4a1b6083b3, []int{1} + return fileDescriptor_user_503139008509373a, []int{1} } func (m *Picture) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -288,7 +288,7 @@ type Picture_Embedded struct { func (m *Picture_Embedded) Reset() { *m = Picture_Embedded{} } func (*Picture_Embedded) ProtoMessage() {} func (*Picture_Embedded) Descriptor() ([]byte, []int) { - return fileDescriptor_user_80523f4a1b6083b3, []int{1, 0} + return fileDescriptor_user_503139008509373a, []int{1, 0} } func (m *Picture_Embedded) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -340,7 +340,7 @@ type Users struct { func (m *Users) Reset() { *m = Users{} } func (*Users) ProtoMessage() {} func (*Users) Descriptor() ([]byte, []int) { - return fileDescriptor_user_80523f4a1b6083b3, []int{2} + return fileDescriptor_user_503139008509373a, []int{2} } func (m *Users) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -386,7 +386,7 @@ type GetUserRequest struct { func (m *GetUserRequest) Reset() { *m = GetUserRequest{} } func (*GetUserRequest) ProtoMessage() {} func (*GetUserRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_user_80523f4a1b6083b3, []int{3} + return fileDescriptor_user_503139008509373a, []int{3} } func (m *GetUserRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -432,7 +432,7 @@ type CreateUserRequest struct { func (m *CreateUserRequest) Reset() { *m = CreateUserRequest{} } func (*CreateUserRequest) ProtoMessage() {} func (*CreateUserRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_user_80523f4a1b6083b3, []int{4} + return fileDescriptor_user_503139008509373a, []int{4} } func (m *CreateUserRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -478,7 +478,7 @@ type UpdateUserRequest struct { func (m *UpdateUserRequest) Reset() { *m = UpdateUserRequest{} } func (*UpdateUserRequest) ProtoMessage() {} func (*UpdateUserRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_user_80523f4a1b6083b3, []int{5} + return fileDescriptor_user_503139008509373a, []int{5} } func (m *UpdateUserRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -523,7 +523,7 @@ type CreateTemporaryPasswordRequest struct { func (m *CreateTemporaryPasswordRequest) Reset() { *m = CreateTemporaryPasswordRequest{} } func (*CreateTemporaryPasswordRequest) ProtoMessage() {} func (*CreateTemporaryPasswordRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_user_80523f4a1b6083b3, []int{6} + return fileDescriptor_user_503139008509373a, []int{6} } func (m *CreateTemporaryPasswordRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -563,7 +563,7 @@ type UpdateUserPasswordRequest struct { func (m *UpdateUserPasswordRequest) Reset() { *m = UpdateUserPasswordRequest{} } func (*UpdateUserPasswordRequest) ProtoMessage() {} func (*UpdateUserPasswordRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_user_80523f4a1b6083b3, []int{7} + return fileDescriptor_user_503139008509373a, []int{7} } func (m *UpdateUserPasswordRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -617,7 +617,7 @@ type CreateUserAPIKeyRequest struct { func (m *CreateUserAPIKeyRequest) Reset() { *m = CreateUserAPIKeyRequest{} } func (*CreateUserAPIKeyRequest) ProtoMessage() {} func (*CreateUserAPIKeyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_user_80523f4a1b6083b3, []int{8} + return fileDescriptor_user_503139008509373a, []int{8} } func (m *CreateUserAPIKeyRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -670,7 +670,7 @@ type UpdateUserAPIKeyRequest struct { func (m *UpdateUserAPIKeyRequest) Reset() { *m = UpdateUserAPIKeyRequest{} } func (*UpdateUserAPIKeyRequest) ProtoMessage() {} func (*UpdateUserAPIKeyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_user_80523f4a1b6083b3, []int{9} + return fileDescriptor_user_503139008509373a, []int{9} } func (m *UpdateUserAPIKeyRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -714,7 +714,7 @@ type Invitation struct { func (m *Invitation) Reset() { *m = Invitation{} } func (*Invitation) ProtoMessage() {} func (*Invitation) Descriptor() ([]byte, []int) { - return fileDescriptor_user_80523f4a1b6083b3, []int{10} + return fileDescriptor_user_503139008509373a, []int{10} } func (m *Invitation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -801,7 +801,7 @@ type Invitations struct { func (m *Invitations) Reset() { *m = Invitations{} } func (*Invitations) ProtoMessage() {} func (*Invitations) Descriptor() ([]byte, []int) { - return fileDescriptor_user_80523f4a1b6083b3, []int{11} + return fileDescriptor_user_503139008509373a, []int{11} } func (m *Invitations) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -846,7 +846,7 @@ type SendInvitationRequest struct { func (m *SendInvitationRequest) Reset() { *m = SendInvitationRequest{} } func (*SendInvitationRequest) ProtoMessage() {} func (*SendInvitationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_user_80523f4a1b6083b3, []int{12} + return fileDescriptor_user_503139008509373a, []int{12} } func (m *SendInvitationRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -891,7 +891,7 @@ type DeleteInvitationRequest struct { func (m *DeleteInvitationRequest) Reset() { *m = DeleteInvitationRequest{} } func (*DeleteInvitationRequest) ProtoMessage() {} func (*DeleteInvitationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_user_80523f4a1b6083b3, []int{13} + return fileDescriptor_user_503139008509373a, []int{13} } func (m *DeleteInvitationRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -937,7 +937,7 @@ type UserSessionIdentifiers struct { func (m *UserSessionIdentifiers) Reset() { *m = UserSessionIdentifiers{} } func (*UserSessionIdentifiers) ProtoMessage() {} func (*UserSessionIdentifiers) Descriptor() ([]byte, []int) { - return fileDescriptor_user_80523f4a1b6083b3, []int{14} + return fileDescriptor_user_503139008509373a, []int{14} } func (m *UserSessionIdentifiers) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -986,7 +986,7 @@ type UserSession struct { func (m *UserSession) Reset() { *m = UserSession{} } func (*UserSession) ProtoMessage() {} func (*UserSession) Descriptor() ([]byte, []int) { - return fileDescriptor_user_80523f4a1b6083b3, []int{15} + return fileDescriptor_user_503139008509373a, []int{15} } func (m *UserSession) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1052,7 +1052,7 @@ type UserSessions struct { func (m *UserSessions) Reset() { *m = UserSessions{} } func (*UserSessions) ProtoMessage() {} func (*UserSessions) Descriptor() ([]byte, []int) { - return fileDescriptor_user_80523f4a1b6083b3, []int{16} + return fileDescriptor_user_503139008509373a, []int{16} } func (m *UserSessions) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1104,7 +1104,7 @@ type ListUserSessionsRequest struct { func (m *ListUserSessionsRequest) Reset() { *m = ListUserSessionsRequest{} } func (*ListUserSessionsRequest) ProtoMessage() {} func (*ListUserSessionsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_user_80523f4a1b6083b3, []int{17} + return fileDescriptor_user_503139008509373a, []int{17} } func (m *ListUserSessionsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -6701,101 +6701,103 @@ var ( ErrIntOverflowUser = fmt.Errorf("proto: integer overflow") ) -func init() { proto.RegisterFile("lorawan-stack/api/user.proto", fileDescriptor_user_80523f4a1b6083b3) } +func init() { proto.RegisterFile("lorawan-stack/api/user.proto", fileDescriptor_user_503139008509373a) } func init() { - golang_proto.RegisterFile("lorawan-stack/api/user.proto", fileDescriptor_user_80523f4a1b6083b3) -} - -var fileDescriptor_user_80523f4a1b6083b3 = []byte{ - // 1435 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0x3f, 0x70, 0x13, 0xc7, - 0x1a, 0xbf, 0xb5, 0x24, 0x5b, 0xfa, 0xe4, 0x3f, 0xf8, 0xc0, 0x58, 0x4f, 0x86, 0xb5, 0xe6, 0x1e, - 0x85, 0xdf, 0x7b, 0x58, 0x9a, 0x31, 0xf3, 0x80, 0x04, 0x12, 0x22, 0x63, 0x87, 0xf1, 0x90, 0xcc, - 0x30, 0x67, 0x93, 0xc9, 0xa4, 0xd1, 0x9c, 0x75, 0x2b, 0x79, 0x47, 0xba, 0x3f, 0xdc, 0xae, 0xec, - 0x28, 0x15, 0x4d, 0x66, 0x28, 0x28, 0xe8, 0x92, 0xa1, 0x49, 0x86, 0x8a, 0x92, 0x92, 0x92, 0x92, - 0x22, 0x05, 0x25, 0x15, 0xe0, 0x53, 0x43, 0x49, 0x49, 0x99, 0xd9, 0xbd, 0x3b, 0xdd, 0x59, 0x96, - 0x07, 0x1b, 0xcc, 0xa4, 0xdb, 0xdd, 0xef, 0xf7, 0xfd, 0xbe, 0xbf, 0xfb, 0xed, 0x1d, 0x9c, 0x69, -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 0x78, 0xa4, 0xa0, 0x4a, 0xea, 0xd9, 0xc1, 0x6c, 0xde, 0x0a, 0xc4, 0xfa, - 0x64, 0x88, 0x0f, 0xf7, 0xc5, 0xaf, 0x60, 0x6a, 0xe0, 0xc2, 0xa8, 0x27, 0x20, 0xd5, 0x22, 0x5d, - 0x39, 0x67, 0x72, 0xba, 0x58, 0x8a, 0xec, 0x6f, 0x1b, 0xed, 0x0e, 0x91, 0x73, 0x23, 0xa7, 0x07, - 0x9b, 0x2f, 0x47, 0x2e, 0x23, 0xed, 0x3d, 0x82, 0xb1, 0x90, 0x4a, 0xbd, 0x0a, 0x59, 0x62, 0x6d, - 0x12, 0xd3, 0x24, 0x66, 0x38, 0xa4, 0x4a, 0x07, 0x78, 0x51, 0x5e, 0x0d, 0x71, 0x7a, 0x5f, 0x43, - 0xbd, 0x0c, 0x19, 0x46, 0x7f, 0x21, 0xac, 0x30, 0x22, 0xef, 0xa4, 0x76, 0x90, 0xea, 0xba, 0x00, - 0x05, 0x37, 0x3b, 0x50, 0x28, 0x5e, 0x81, 0x6c, 0xc4, 0xa7, 0xce, 0x41, 0xce, 0xa2, 0x16, 0xa9, - 0xf1, 0xae, 0x4b, 0xc2, 0x08, 0xb2, 0xe2, 0x60, 0xa3, 0xeb, 0x12, 0x31, 0x79, 0x4c, 0x83, 0x1b, - 0x32, 0x8a, 0x71, 0x5d, 0xae, 0x8b, 0x97, 0x01, 0x62, 0xc6, 0x64, 0xe8, 0x13, 0x1f, 0x0a, 0xfd, - 0x02, 0x64, 0xc4, 0xbc, 0x61, 0xea, 0x7f, 0x21, 0x23, 0xde, 0x4b, 0x31, 0x99, 0x85, 0xe7, 0xa7, - 0x86, 0x4d, 0x25, 0x3d, 0x80, 0x68, 0xbf, 0x21, 0x98, 0xbc, 0x41, 0xb8, 0x3c, 0x22, 0x77, 0x3a, - 0x84, 0x71, 0x75, 0x05, 0xb2, 0x42, 0x56, 0xfb, 0xa8, 0xd9, 0x3e, 0xd6, 0x91, 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xbe, 0xe9, 0x94, - 0xf9, 0x16, 0xe1, 0x5b, 0xd4, 0x6e, 0xb2, 0xb2, 0x4d, 0xf8, 0x8e, 0xe3, 0xb5, 0x2a, 0x7b, 0x7f, - 0xac, 0xdd, 0x56, 0xb3, 0xc2, 0xb9, 0xed, 0x6e, 0x6e, 0x8e, 0xca, 0xa2, 0x5d, 0xf8, 0x3b, 0x00, - 0x00, 0xff, 0xff, 0x66, 0x05, 0xca, 0x8f, 0xf9, 0x10, 0x00, 0x00, + golang_proto.RegisterFile("lorawan-stack/api/user.proto", fileDescriptor_user_503139008509373a) +} + +var fileDescriptor_user_503139008509373a = []byte{ + // 1461 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0x3d, 0x6c, 0x1b, 0x47, + 0x16, 0xde, 0x11, 0x49, 0x89, 0x7c, 0xd4, 0xef, 0xd8, 0xb2, 0x78, 0xd4, 0x79, 0x44, 0xec, 0xb9, + 0xd0, 0x1d, 0x2c, 0x0a, 0xb0, 0x81, 0xb3, 0xe0, 0x9f, 0xf3, 0x91, 0xb2, 0xce, 0x10, 0x7c, 0x77, + 0x30, 0x56, 0x72, 0x8a, 0x34, 0xcc, 0x8a, 0x3b, 0xa4, 0x06, 0x22, 0x77, 0xd7, 0x3b, 0x43, 0x29, + 0x0c, 0x52, 0x18, 0xa9, 0x8c, 0x34, 0x31, 0x52, 0x24, 0x29, 0x93, 0x54, 0x0e, 0x10, 0x04, 0x06, + 0xd2, 0x18, 0xa9, 0x5c, 0xba, 0x74, 0x15, 0xb8, 0x72, 0x2c, 0xb2, 0x71, 0x3a, 0x97, 0x2e, 0x83, + 0x99, 0xdd, 0xe5, 0xae, 0x28, 0x0a, 0x96, 0x65, 0x09, 0xe9, 0x76, 0xe6, 0x7d, 0xef, 0x7b, 0x6f, + 0xde, 0xdf, 0xcc, 0xc2, 0x5f, 0x1b, 0x8e, 0x67, 0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x04, 0x7d, 0xdb, 0x25, 0xda, 0xc3, 0x2e, 0xd1, 0x1e, 0x75, 0x09, 0x7a, 0xdc, 0x25, + 0xe8, 0x49, 0x97, 0xa0, 0x0f, 0xcf, 0xd7, 0x9d, 0xa2, 0xd8, 0xa4, 0x62, 0x93, 0xd9, 0x75, 0x5e, + 0xb4, 0xa9, 0xd8, 0x71, 0xbc, 0xad, 0xc5, 0xbd, 0x3f, 0xfc, 0xee, 0x56, 0x7d, 0x51, 0x08, 0xdb, + 0xdd, 0xd8, 0x18, 0x56, 0xe9, 0xbb, 0xf8, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0x02, 0xac, 0xe5, + 0x0a, 0x96, 0x11, 0x00, 0x00, } diff --git a/pkg/ttnpb/user.pb.paths.fm.go b/pkg/ttnpb/user.pb.paths.fm.go new file mode 100644 index 0000000000..e3787f558d --- /dev/null +++ b/pkg/ttnpb/user.pb.paths.fm.go @@ -0,0 +1,297 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +var UserFieldPathsNested = []string{ + "admin", + "attributes", + "contact_info", + "created_at", + "description", + "ids", + "ids.email", + "ids.user_id", + "name", + "password", + "password_updated_at", + "primary_email_address", + "primary_email_address_validated_at", + "profile_picture", + "profile_picture.embedded", + "profile_picture.embedded.data", + "profile_picture.embedded.mime_type", + "profile_picture.sizes", + "require_password_update", + "state", + "temporary_password", + "temporary_password_created_at", + "temporary_password_expires_at", + "updated_at", +} + +var UserFieldPathsTopLevel = []string{ + "admin", + "attributes", + "contact_info", + "created_at", + "description", + "ids", + "name", + "password", + "password_updated_at", + "primary_email_address", + "primary_email_address_validated_at", + "profile_picture", + "require_password_update", + "state", + "temporary_password", + "temporary_password_created_at", + "temporary_password_expires_at", + "updated_at", +} +var PictureFieldPathsNested = []string{ + "embedded", + "embedded.data", + "embedded.mime_type", + "sizes", +} + +var PictureFieldPathsTopLevel = []string{ + "embedded", + "sizes", +} +var UsersFieldPathsNested = []string{ + "users", +} + +var UsersFieldPathsTopLevel = []string{ + "users", +} +var GetUserRequestFieldPathsNested = []string{ + "field_mask", + "user_ids", + "user_ids.email", + "user_ids.user_id", +} + +var GetUserRequestFieldPathsTopLevel = []string{ + "field_mask", + "user_ids", +} +var CreateUserRequestFieldPathsNested = []string{ + "invitation_token", + "user", + "user.admin", + "user.attributes", + "user.contact_info", + "user.created_at", + "user.description", + "user.ids", + "user.ids.email", + "user.ids.user_id", + "user.name", + "user.password", + "user.password_updated_at", + "user.primary_email_address", + "user.primary_email_address_validated_at", + "user.profile_picture", + "user.profile_picture.embedded", + "user.profile_picture.embedded.data", + "user.profile_picture.embedded.mime_type", + "user.profile_picture.sizes", + "user.require_password_update", + "user.state", + "user.temporary_password", + "user.temporary_password_created_at", + "user.temporary_password_expires_at", + "user.updated_at", +} + +var CreateUserRequestFieldPathsTopLevel = []string{ + "invitation_token", + "user", +} +var UpdateUserRequestFieldPathsNested = []string{ + "field_mask", + "user", + "user.admin", + "user.attributes", + "user.contact_info", + "user.created_at", + "user.description", + "user.ids", + "user.ids.email", + "user.ids.user_id", + "user.name", + "user.password", + "user.password_updated_at", + "user.primary_email_address", + "user.primary_email_address_validated_at", + "user.profile_picture", + "user.profile_picture.embedded", + "user.profile_picture.embedded.data", + "user.profile_picture.embedded.mime_type", + "user.profile_picture.sizes", + "user.require_password_update", + "user.state", + "user.temporary_password", + "user.temporary_password_created_at", + "user.temporary_password_expires_at", + "user.updated_at", +} + +var UpdateUserRequestFieldPathsTopLevel = []string{ + "field_mask", + "user", +} +var CreateTemporaryPasswordRequestFieldPathsNested = []string{ + "user_ids", + "user_ids.email", + "user_ids.user_id", +} + +var CreateTemporaryPasswordRequestFieldPathsTopLevel = []string{ + "user_ids", +} +var UpdateUserPasswordRequestFieldPathsNested = []string{ + "new", + "old", + "user_ids", + "user_ids.email", + "user_ids.user_id", +} + +var UpdateUserPasswordRequestFieldPathsTopLevel = []string{ + "new", + "old", + "user_ids", +} +var CreateUserAPIKeyRequestFieldPathsNested = []string{ + "name", + "rights", + "user_ids", + "user_ids.email", + "user_ids.user_id", +} + +var CreateUserAPIKeyRequestFieldPathsTopLevel = []string{ + "name", + "rights", + "user_ids", +} +var UpdateUserAPIKeyRequestFieldPathsNested = []string{ + "api_key", + "api_key.id", + "api_key.key", + "api_key.name", + "api_key.rights", + "user_ids", + "user_ids.email", + "user_ids.user_id", +} + +var UpdateUserAPIKeyRequestFieldPathsTopLevel = []string{ + "api_key", + "user_ids", +} +var InvitationFieldPathsNested = []string{ + "accepted_at", + "accepted_by", + "accepted_by.email", + "accepted_by.user_id", + "created_at", + "email", + "expires_at", + "token", + "updated_at", +} + +var InvitationFieldPathsTopLevel = []string{ + "accepted_at", + "accepted_by", + "created_at", + "email", + "expires_at", + "token", + "updated_at", +} +var InvitationsFieldPathsNested = []string{ + "invitations", +} + +var InvitationsFieldPathsTopLevel = []string{ + "invitations", +} +var SendInvitationRequestFieldPathsNested = []string{ + "email", +} + +var SendInvitationRequestFieldPathsTopLevel = []string{ + "email", +} +var DeleteInvitationRequestFieldPathsNested = []string{ + "email", +} + +var DeleteInvitationRequestFieldPathsTopLevel = []string{ + "email", +} +var UserSessionIdentifiersFieldPathsNested = []string{ + "session_id", + "user_ids", + "user_ids.email", + "user_ids.user_id", +} + +var UserSessionIdentifiersFieldPathsTopLevel = []string{ + "session_id", + "user_ids", +} +var UserSessionFieldPathsNested = []string{ + "created_at", + "expires_at", + "session_id", + "updated_at", + "user_ids", + "user_ids.email", + "user_ids.user_id", +} + +var UserSessionFieldPathsTopLevel = []string{ + "created_at", + "expires_at", + "session_id", + "updated_at", + "user_ids", +} +var UserSessionsFieldPathsNested = []string{ + "sessions", +} + +var UserSessionsFieldPathsTopLevel = []string{ + "sessions", +} +var ListUserSessionsRequestFieldPathsNested = []string{ + "limit", + "order", + "page", + "user_ids", + "user_ids.email", + "user_ids.user_id", +} + +var ListUserSessionsRequestFieldPathsTopLevel = []string{ + "limit", + "order", + "page", + "user_ids", +} +var Picture_EmbeddedFieldPathsNested = []string{ + "data", + "mime_type", +} + +var Picture_EmbeddedFieldPathsTopLevel = []string{ + "data", + "mime_type", +} diff --git a/pkg/ttnpb/user.pb.fm.go b/pkg/ttnpb/user.pb.setters.fm.go similarity index 78% rename from pkg/ttnpb/user.pb.fm.go rename to pkg/ttnpb/user.pb.setters.fm.go index bcc221b68d..cb5fc73277 100644 --- a/pkg/ttnpb/user.pb.fm.go +++ b/pkg/ttnpb/user.pb.setters.fm.go @@ -6,57 +6,9 @@ import ( fmt "fmt" time "time" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + types "github.com/gogo/protobuf/types" ) -var UserFieldPathsNested = []string{ - "admin", - "attributes", - "contact_info", - "created_at", - "description", - "ids", - "ids.email", - "ids.user_id", - "name", - "password", - "password_updated_at", - "primary_email_address", - "primary_email_address_validated_at", - "profile_picture", - "profile_picture.embedded", - "profile_picture.embedded.data", - "profile_picture.embedded.mime_type", - "profile_picture.sizes", - "require_password_update", - "state", - "temporary_password", - "temporary_password_created_at", - "temporary_password_expires_at", - "updated_at", -} - -var UserFieldPathsTopLevel = []string{ - "admin", - "attributes", - "contact_info", - "created_at", - "description", - "ids", - "name", - "password", - "password_updated_at", - "primary_email_address", - "primary_email_address_validated_at", - "profile_picture", - "require_password_update", - "state", - "temporary_password", - "temporary_password_created_at", - "temporary_password_expires_at", - "updated_at", -} - func (dst *User) SetFields(src *User, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -262,18 +214,6 @@ func (dst *User) SetFields(src *User, paths ...string) error { return nil } -var PictureFieldPathsNested = []string{ - "embedded", - "embedded.data", - "embedded.mime_type", - "sizes", -} - -var PictureFieldPathsTopLevel = []string{ - "embedded", - "sizes", -} - func (dst *Picture) SetFields(src *Picture, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -315,55 +255,6 @@ func (dst *Picture) SetFields(src *Picture, paths ...string) error { return nil } -var Picture_EmbeddedFieldPathsNested = []string{ - "data", - "mime_type", -} - -var Picture_EmbeddedFieldPathsTopLevel = []string{ - "data", - "mime_type", -} - -func (dst *Picture_Embedded) SetFields(src *Picture_Embedded, paths ...string) error { - for name, subs := range _processPaths(append(paths[:0:0], paths...)) { - switch name { - case "mime_type": - if len(subs) > 0 { - return fmt.Errorf("'mime_type' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.MimeType = src.MimeType - } else { - var zero string - dst.MimeType = zero - } - case "data": - if len(subs) > 0 { - return fmt.Errorf("'data' has no subfields, but %s were specified", subs) - } - if src != nil { - dst.Data = src.Data - } else { - var zero []byte - dst.Data = zero - } - - default: - return fmt.Errorf("invalid field: '%s'", name) - } - } - return nil -} - -var UsersFieldPathsNested = []string{ - "users", -} - -var UsersFieldPathsTopLevel = []string{ - "users", -} - func (dst *Users) SetFields(src *Users, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -384,18 +275,6 @@ func (dst *Users) SetFields(src *Users, paths ...string) error { return nil } -var GetUserRequestFieldPathsNested = []string{ - "field_mask", - "user_ids", - "user_ids.email", - "user_ids.user_id", -} - -var GetUserRequestFieldPathsTopLevel = []string{ - "field_mask", - "user_ids", -} - func (dst *GetUserRequest) SetFields(src *GetUserRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -424,7 +303,7 @@ func (dst *GetUserRequest) SetFields(src *GetUserRequest, paths ...string) error if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } @@ -435,40 +314,6 @@ func (dst *GetUserRequest) SetFields(src *GetUserRequest, paths ...string) error return nil } -var CreateUserRequestFieldPathsNested = []string{ - "invitation_token", - "user", - "user.admin", - "user.attributes", - "user.contact_info", - "user.created_at", - "user.description", - "user.ids", - "user.ids.email", - "user.ids.user_id", - "user.name", - "user.password", - "user.password_updated_at", - "user.primary_email_address", - "user.primary_email_address_validated_at", - "user.profile_picture", - "user.profile_picture.embedded", - "user.profile_picture.embedded.data", - "user.profile_picture.embedded.mime_type", - "user.profile_picture.sizes", - "user.require_password_update", - "user.state", - "user.temporary_password", - "user.temporary_password_created_at", - "user.temporary_password_expires_at", - "user.updated_at", -} - -var CreateUserRequestFieldPathsTopLevel = []string{ - "invitation_token", - "user", -} - func (dst *CreateUserRequest) SetFields(src *CreateUserRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -508,40 +353,6 @@ func (dst *CreateUserRequest) SetFields(src *CreateUserRequest, paths ...string) return nil } -var UpdateUserRequestFieldPathsNested = []string{ - "field_mask", - "user", - "user.admin", - "user.attributes", - "user.contact_info", - "user.created_at", - "user.description", - "user.ids", - "user.ids.email", - "user.ids.user_id", - "user.name", - "user.password", - "user.password_updated_at", - "user.primary_email_address", - "user.primary_email_address_validated_at", - "user.profile_picture", - "user.profile_picture.embedded", - "user.profile_picture.embedded.data", - "user.profile_picture.embedded.mime_type", - "user.profile_picture.sizes", - "user.require_password_update", - "user.state", - "user.temporary_password", - "user.temporary_password_created_at", - "user.temporary_password_expires_at", - "user.updated_at", -} - -var UpdateUserRequestFieldPathsTopLevel = []string{ - "field_mask", - "user", -} - func (dst *UpdateUserRequest) SetFields(src *UpdateUserRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -570,7 +381,7 @@ func (dst *UpdateUserRequest) SetFields(src *UpdateUserRequest, paths ...string) if src != nil { dst.FieldMask = src.FieldMask } else { - var zero github_com_gogo_protobuf_types.FieldMask + var zero types.FieldMask dst.FieldMask = zero } @@ -581,16 +392,6 @@ func (dst *UpdateUserRequest) SetFields(src *UpdateUserRequest, paths ...string) return nil } -var CreateTemporaryPasswordRequestFieldPathsNested = []string{ - "user_ids", - "user_ids.email", - "user_ids.user_id", -} - -var CreateTemporaryPasswordRequestFieldPathsTopLevel = []string{ - "user_ids", -} - func (dst *CreateTemporaryPasswordRequest) SetFields(src *CreateTemporaryPasswordRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -620,20 +421,6 @@ func (dst *CreateTemporaryPasswordRequest) SetFields(src *CreateTemporaryPasswor return nil } -var UpdateUserPasswordRequestFieldPathsNested = []string{ - "new", - "old", - "user_ids", - "user_ids.email", - "user_ids.user_id", -} - -var UpdateUserPasswordRequestFieldPathsTopLevel = []string{ - "new", - "old", - "user_ids", -} - func (dst *UpdateUserPasswordRequest) SetFields(src *UpdateUserPasswordRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -683,20 +470,6 @@ func (dst *UpdateUserPasswordRequest) SetFields(src *UpdateUserPasswordRequest, return nil } -var CreateUserAPIKeyRequestFieldPathsNested = []string{ - "name", - "rights", - "user_ids", - "user_ids.email", - "user_ids.user_id", -} - -var CreateUserAPIKeyRequestFieldPathsTopLevel = []string{ - "name", - "rights", - "user_ids", -} - func (dst *CreateUserAPIKeyRequest) SetFields(src *CreateUserAPIKeyRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -745,22 +518,6 @@ func (dst *CreateUserAPIKeyRequest) SetFields(src *CreateUserAPIKeyRequest, path return nil } -var UpdateUserAPIKeyRequestFieldPathsNested = []string{ - "api_key", - "api_key.id", - "api_key.key", - "api_key.name", - "api_key.rights", - "user_ids", - "user_ids.email", - "user_ids.user_id", -} - -var UpdateUserAPIKeyRequestFieldPathsTopLevel = []string{ - "api_key", - "user_ids", -} - func (dst *UpdateUserAPIKeyRequest) SetFields(src *UpdateUserAPIKeyRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -808,28 +565,6 @@ func (dst *UpdateUserAPIKeyRequest) SetFields(src *UpdateUserAPIKeyRequest, path return nil } -var InvitationFieldPathsNested = []string{ - "accepted_at", - "accepted_by", - "accepted_by.email", - "accepted_by.user_id", - "created_at", - "email", - "expires_at", - "token", - "updated_at", -} - -var InvitationFieldPathsTopLevel = []string{ - "accepted_at", - "accepted_by", - "created_at", - "email", - "expires_at", - "token", - "updated_at", -} - func (dst *Invitation) SetFields(src *Invitation, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -921,14 +656,6 @@ func (dst *Invitation) SetFields(src *Invitation, paths ...string) error { return nil } -var InvitationsFieldPathsNested = []string{ - "invitations", -} - -var InvitationsFieldPathsTopLevel = []string{ - "invitations", -} - func (dst *Invitations) SetFields(src *Invitations, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -949,14 +676,6 @@ func (dst *Invitations) SetFields(src *Invitations, paths ...string) error { return nil } -var SendInvitationRequestFieldPathsNested = []string{ - "email", -} - -var SendInvitationRequestFieldPathsTopLevel = []string{ - "email", -} - func (dst *SendInvitationRequest) SetFields(src *SendInvitationRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -978,14 +697,6 @@ func (dst *SendInvitationRequest) SetFields(src *SendInvitationRequest, paths .. return nil } -var DeleteInvitationRequestFieldPathsNested = []string{ - "email", -} - -var DeleteInvitationRequestFieldPathsTopLevel = []string{ - "email", -} - func (dst *DeleteInvitationRequest) SetFields(src *DeleteInvitationRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1007,18 +718,6 @@ func (dst *DeleteInvitationRequest) SetFields(src *DeleteInvitationRequest, path return nil } -var UserSessionIdentifiersFieldPathsNested = []string{ - "session_id", - "user_ids", - "user_ids.email", - "user_ids.user_id", -} - -var UserSessionIdentifiersFieldPathsTopLevel = []string{ - "session_id", - "user_ids", -} - func (dst *UserSessionIdentifiers) SetFields(src *UserSessionIdentifiers, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1058,24 +757,6 @@ func (dst *UserSessionIdentifiers) SetFields(src *UserSessionIdentifiers, paths return nil } -var UserSessionFieldPathsNested = []string{ - "created_at", - "expires_at", - "session_id", - "updated_at", - "user_ids", - "user_ids.email", - "user_ids.user_id", -} - -var UserSessionFieldPathsTopLevel = []string{ - "created_at", - "expires_at", - "session_id", - "updated_at", - "user_ids", -} - func (dst *UserSession) SetFields(src *UserSession, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1144,14 +825,6 @@ func (dst *UserSession) SetFields(src *UserSession, paths ...string) error { return nil } -var UserSessionsFieldPathsNested = []string{ - "sessions", -} - -var UserSessionsFieldPathsTopLevel = []string{ - "sessions", -} - func (dst *UserSessions) SetFields(src *UserSessions, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1172,22 +845,6 @@ func (dst *UserSessions) SetFields(src *UserSessions, paths ...string) error { return nil } -var ListUserSessionsRequestFieldPathsNested = []string{ - "limit", - "order", - "page", - "user_ids", - "user_ids.email", - "user_ids.user_id", -} - -var ListUserSessionsRequestFieldPathsTopLevel = []string{ - "limit", - "order", - "page", - "user_ids", -} - func (dst *ListUserSessionsRequest) SetFields(src *ListUserSessionsRequest, paths ...string) error { for name, subs := range _processPaths(append(paths[:0:0], paths...)) { switch name { @@ -1246,3 +903,33 @@ func (dst *ListUserSessionsRequest) SetFields(src *ListUserSessionsRequest, path } return nil } + +func (dst *Picture_Embedded) SetFields(src *Picture_Embedded, paths ...string) error { + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + switch name { + case "mime_type": + if len(subs) > 0 { + return fmt.Errorf("'mime_type' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.MimeType = src.MimeType + } else { + var zero string + dst.MimeType = zero + } + case "data": + if len(subs) > 0 { + return fmt.Errorf("'data' has no subfields, but %s were specified", subs) + } + if src != nil { + dst.Data = src.Data + } else { + dst.Data = nil + } + + default: + return fmt.Errorf("invalid field: '%s'", name) + } + } + return nil +} diff --git a/pkg/ttnpb/user.pb.validate.go b/pkg/ttnpb/user.pb.validate.go new file mode 100644 index 0000000000..1f48b0956e --- /dev/null +++ b/pkg/ttnpb/user.pb.validate.go @@ -0,0 +1,2274 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) + +// ValidateFields checks the field values on User with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *User) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = UserFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "ids": + + if v, ok := interface{}(&m.UserIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UserValidationError{ + field: "ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "created_at": + + if v, ok := interface{}(&m.CreatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UserValidationError{ + field: "created_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "updated_at": + + if v, ok := interface{}(&m.UpdatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UserValidationError{ + field: "updated_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "name": + // no validation rules for Name + case "description": + // no validation rules for Description + case "attributes": + // no validation rules for Attributes + case "contact_info": + + for idx, item := range m.GetContactInfo() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UserValidationError{ + field: fmt.Sprintf("contact_info[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + case "primary_email_address": + + if err := m._validateEmail(m.GetPrimaryEmailAddress()); err != nil { + return UserValidationError{ + field: "primary_email_address", + reason: "value must be a valid email address", + cause: err, + } + } + + case "primary_email_address_validated_at": + + if v, ok := interface{}(m.GetPrimaryEmailAddressValidatedAt()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UserValidationError{ + field: "primary_email_address_validated_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "password": + // no validation rules for Password + case "password_updated_at": + + if v, ok := interface{}(&m.PasswordUpdatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UserValidationError{ + field: "password_updated_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "require_password_update": + // no validation rules for RequirePasswordUpdate + case "state": + + if _, ok := State_name[int32(m.GetState())]; !ok { + return UserValidationError{ + field: "state", + reason: "value must be one of the defined enum values", + } + } + + case "admin": + // no validation rules for Admin + case "temporary_password": + // no validation rules for TemporaryPassword + case "temporary_password_created_at": + + if v, ok := interface{}(m.GetTemporaryPasswordCreatedAt()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UserValidationError{ + field: "temporary_password_created_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "temporary_password_expires_at": + + if v, ok := interface{}(m.GetTemporaryPasswordExpiresAt()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UserValidationError{ + field: "temporary_password_expires_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "profile_picture": + + if v, ok := interface{}(m.GetProfilePicture()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UserValidationError{ + field: "profile_picture", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return UserValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +func (m *User) _validateHostname(host string) error { + s := strings.ToLower(strings.TrimSuffix(host, ".")) + + if len(host) > 253 { + return errors.New("hostname cannot exceed 253 characters") + } + + for _, part := range strings.Split(s, ".") { + if l := len(part); l == 0 || l > 63 { + return errors.New("hostname part must be non-empty and cannot exceed 63 characters") + } + + if part[0] == '-' { + return errors.New("hostname parts cannot begin with hyphens") + } + + if part[len(part)-1] == '-' { + return errors.New("hostname parts cannot end with hyphens") + } + + for _, r := range part { + if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { + return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) + } + } + } + + return nil +} + +func (m *User) _validateEmail(addr string) error { + a, err := mail.ParseAddress(addr) + if err != nil { + return err + } + addr = a.Address + + if len(addr) > 254 { + return errors.New("email addresses cannot exceed 254 characters") + } + + parts := strings.SplitN(addr, "@", 2) + + if len(parts[0]) > 64 { + return errors.New("email address local phrase cannot exceed 64 characters") + } + + return m._validateHostname(parts[1]) +} + +// UserValidationError is the validation error returned by User.ValidateFields +// if the designated constraints aren't met. +type UserValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UserValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UserValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UserValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UserValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UserValidationError) ErrorName() string { return "UserValidationError" } + +// Error satisfies the builtin error interface +func (e UserValidationError) 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 %sUser.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UserValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UserValidationError{} + +// ValidateFields checks the field values on Picture with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *Picture) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = PictureFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "embedded": + + if v, ok := interface{}(m.GetEmbedded()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return PictureValidationError{ + field: "embedded", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "sizes": + // no validation rules for Sizes + default: + return PictureValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// PictureValidationError is the validation error returned by +// Picture.ValidateFields if the designated constraints aren't met. +type PictureValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e PictureValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e PictureValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e PictureValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e PictureValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e PictureValidationError) ErrorName() string { return "PictureValidationError" } + +// Error satisfies the builtin error interface +func (e PictureValidationError) 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 %sPicture.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = PictureValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = PictureValidationError{} + +// ValidateFields checks the field values on Users with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *Users) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = UsersFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "users": + + for idx, item := range m.GetUsers() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UsersValidationError{ + field: fmt.Sprintf("users[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + default: + return UsersValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// UsersValidationError is the validation error returned by +// Users.ValidateFields if the designated constraints aren't met. +type UsersValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UsersValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UsersValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UsersValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UsersValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UsersValidationError) ErrorName() string { return "UsersValidationError" } + +// Error satisfies the builtin error interface +func (e UsersValidationError) 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 %sUsers.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UsersValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UsersValidationError{} + +// ValidateFields checks the field values on GetUserRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *GetUserRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = GetUserRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "user_ids": + + if v, ok := interface{}(&m.UserIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GetUserRequestValidationError{ + field: "user_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return GetUserRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return GetUserRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// GetUserRequestValidationError is the validation error returned by +// GetUserRequest.ValidateFields if the designated constraints aren't met. +type GetUserRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetUserRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetUserRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetUserRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetUserRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetUserRequestValidationError) ErrorName() string { return "GetUserRequestValidationError" } + +// Error satisfies the builtin error interface +func (e GetUserRequestValidationError) 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 %sGetUserRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetUserRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetUserRequestValidationError{} + +// ValidateFields checks the field values on CreateUserRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *CreateUserRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = CreateUserRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "user": + + if v, ok := interface{}(&m.User).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return CreateUserRequestValidationError{ + field: "user", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "invitation_token": + // no validation rules for InvitationToken + default: + return CreateUserRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// CreateUserRequestValidationError is the validation error returned by +// CreateUserRequest.ValidateFields if the designated constraints aren't met. +type CreateUserRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CreateUserRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CreateUserRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CreateUserRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CreateUserRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CreateUserRequestValidationError) ErrorName() string { + return "CreateUserRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e CreateUserRequestValidationError) 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 %sCreateUserRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CreateUserRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CreateUserRequestValidationError{} + +// ValidateFields checks the field values on UpdateUserRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *UpdateUserRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = UpdateUserRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "user": + + if v, ok := interface{}(&m.User).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UpdateUserRequestValidationError{ + field: "user", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "field_mask": + + if v, ok := interface{}(&m.FieldMask).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UpdateUserRequestValidationError{ + field: "field_mask", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return UpdateUserRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// UpdateUserRequestValidationError is the validation error returned by +// UpdateUserRequest.ValidateFields if the designated constraints aren't met. +type UpdateUserRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UpdateUserRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UpdateUserRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UpdateUserRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UpdateUserRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UpdateUserRequestValidationError) ErrorName() string { + return "UpdateUserRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e UpdateUserRequestValidationError) 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 %sUpdateUserRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UpdateUserRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UpdateUserRequestValidationError{} + +// ValidateFields checks the field values on CreateTemporaryPasswordRequest +// with the rules defined in the proto definition for this message. If any +// rules are violated, an error is returned. +func (m *CreateTemporaryPasswordRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = CreateTemporaryPasswordRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "user_ids": + + if v, ok := interface{}(&m.UserIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return CreateTemporaryPasswordRequestValidationError{ + field: "user_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return CreateTemporaryPasswordRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// CreateTemporaryPasswordRequestValidationError is the validation error +// returned by CreateTemporaryPasswordRequest.ValidateFields if the designated +// constraints aren't met. +type CreateTemporaryPasswordRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CreateTemporaryPasswordRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CreateTemporaryPasswordRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CreateTemporaryPasswordRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CreateTemporaryPasswordRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CreateTemporaryPasswordRequestValidationError) ErrorName() string { + return "CreateTemporaryPasswordRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e CreateTemporaryPasswordRequestValidationError) 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 %sCreateTemporaryPasswordRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CreateTemporaryPasswordRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CreateTemporaryPasswordRequestValidationError{} + +// ValidateFields checks the field values on UpdateUserPasswordRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *UpdateUserPasswordRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = UpdateUserPasswordRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "user_ids": + + if v, ok := interface{}(&m.UserIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UpdateUserPasswordRequestValidationError{ + field: "user_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "new": + // no validation rules for New + case "old": + // no validation rules for Old + default: + return UpdateUserPasswordRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// UpdateUserPasswordRequestValidationError is the validation error returned by +// UpdateUserPasswordRequest.ValidateFields if the designated constraints +// aren't met. +type UpdateUserPasswordRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UpdateUserPasswordRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UpdateUserPasswordRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UpdateUserPasswordRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UpdateUserPasswordRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UpdateUserPasswordRequestValidationError) ErrorName() string { + return "UpdateUserPasswordRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e UpdateUserPasswordRequestValidationError) 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 %sUpdateUserPasswordRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UpdateUserPasswordRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UpdateUserPasswordRequestValidationError{} + +// ValidateFields checks the field values on CreateUserAPIKeyRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *CreateUserAPIKeyRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = CreateUserAPIKeyRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "user_ids": + + if v, ok := interface{}(&m.UserIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return CreateUserAPIKeyRequestValidationError{ + field: "user_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "name": + // no validation rules for Name + case "rights": + + default: + return CreateUserAPIKeyRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// CreateUserAPIKeyRequestValidationError is the validation error returned by +// CreateUserAPIKeyRequest.ValidateFields if the designated constraints aren't met. +type CreateUserAPIKeyRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CreateUserAPIKeyRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CreateUserAPIKeyRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CreateUserAPIKeyRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CreateUserAPIKeyRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CreateUserAPIKeyRequestValidationError) ErrorName() string { + return "CreateUserAPIKeyRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e CreateUserAPIKeyRequestValidationError) 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 %sCreateUserAPIKeyRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CreateUserAPIKeyRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CreateUserAPIKeyRequestValidationError{} + +// ValidateFields checks the field values on UpdateUserAPIKeyRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *UpdateUserAPIKeyRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = UpdateUserAPIKeyRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "user_ids": + + if v, ok := interface{}(&m.UserIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UpdateUserAPIKeyRequestValidationError{ + field: "user_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "api_key": + + if v, ok := interface{}(&m.APIKey).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UpdateUserAPIKeyRequestValidationError{ + field: "api_key", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return UpdateUserAPIKeyRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// UpdateUserAPIKeyRequestValidationError is the validation error returned by +// UpdateUserAPIKeyRequest.ValidateFields if the designated constraints aren't met. +type UpdateUserAPIKeyRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UpdateUserAPIKeyRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UpdateUserAPIKeyRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UpdateUserAPIKeyRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UpdateUserAPIKeyRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UpdateUserAPIKeyRequestValidationError) ErrorName() string { + return "UpdateUserAPIKeyRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e UpdateUserAPIKeyRequestValidationError) 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 %sUpdateUserAPIKeyRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UpdateUserAPIKeyRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UpdateUserAPIKeyRequestValidationError{} + +// ValidateFields checks the field values on Invitation with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *Invitation) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = InvitationFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "email": + + if err := m._validateEmail(m.GetEmail()); err != nil { + return InvitationValidationError{ + field: "email", + reason: "value must be a valid email address", + cause: err, + } + } + + case "token": + // no validation rules for Token + case "expires_at": + + if v, ok := interface{}(&m.ExpiresAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return InvitationValidationError{ + field: "expires_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "created_at": + + if v, ok := interface{}(&m.CreatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return InvitationValidationError{ + field: "created_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "updated_at": + + if v, ok := interface{}(&m.UpdatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return InvitationValidationError{ + field: "updated_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "accepted_at": + + if v, ok := interface{}(m.GetAcceptedAt()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return InvitationValidationError{ + field: "accepted_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "accepted_by": + + if v, ok := interface{}(m.GetAcceptedBy()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return InvitationValidationError{ + field: "accepted_by", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return InvitationValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +func (m *Invitation) _validateHostname(host string) error { + s := strings.ToLower(strings.TrimSuffix(host, ".")) + + if len(host) > 253 { + return errors.New("hostname cannot exceed 253 characters") + } + + for _, part := range strings.Split(s, ".") { + if l := len(part); l == 0 || l > 63 { + return errors.New("hostname part must be non-empty and cannot exceed 63 characters") + } + + if part[0] == '-' { + return errors.New("hostname parts cannot begin with hyphens") + } + + if part[len(part)-1] == '-' { + return errors.New("hostname parts cannot end with hyphens") + } + + for _, r := range part { + if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { + return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) + } + } + } + + return nil +} + +func (m *Invitation) _validateEmail(addr string) error { + a, err := mail.ParseAddress(addr) + if err != nil { + return err + } + addr = a.Address + + if len(addr) > 254 { + return errors.New("email addresses cannot exceed 254 characters") + } + + parts := strings.SplitN(addr, "@", 2) + + if len(parts[0]) > 64 { + return errors.New("email address local phrase cannot exceed 64 characters") + } + + return m._validateHostname(parts[1]) +} + +// InvitationValidationError is the validation error returned by +// Invitation.ValidateFields if the designated constraints aren't met. +type InvitationValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e InvitationValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e InvitationValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e InvitationValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e InvitationValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e InvitationValidationError) ErrorName() string { return "InvitationValidationError" } + +// Error satisfies the builtin error interface +func (e InvitationValidationError) 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 %sInvitation.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = InvitationValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = InvitationValidationError{} + +// ValidateFields checks the field values on Invitations with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *Invitations) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = InvitationsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "invitations": + + for idx, item := range m.GetInvitations() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return InvitationsValidationError{ + field: fmt.Sprintf("invitations[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + default: + return InvitationsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// InvitationsValidationError is the validation error returned by +// Invitations.ValidateFields if the designated constraints aren't met. +type InvitationsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e InvitationsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e InvitationsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e InvitationsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e InvitationsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e InvitationsValidationError) ErrorName() string { return "InvitationsValidationError" } + +// Error satisfies the builtin error interface +func (e InvitationsValidationError) 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 %sInvitations.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = InvitationsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = InvitationsValidationError{} + +// ValidateFields checks the field values on SendInvitationRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *SendInvitationRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = SendInvitationRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "email": + + if err := m._validateEmail(m.GetEmail()); err != nil { + return SendInvitationRequestValidationError{ + field: "email", + reason: "value must be a valid email address", + cause: err, + } + } + + default: + return SendInvitationRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +func (m *SendInvitationRequest) _validateHostname(host string) error { + s := strings.ToLower(strings.TrimSuffix(host, ".")) + + if len(host) > 253 { + return errors.New("hostname cannot exceed 253 characters") + } + + for _, part := range strings.Split(s, ".") { + if l := len(part); l == 0 || l > 63 { + return errors.New("hostname part must be non-empty and cannot exceed 63 characters") + } + + if part[0] == '-' { + return errors.New("hostname parts cannot begin with hyphens") + } + + if part[len(part)-1] == '-' { + return errors.New("hostname parts cannot end with hyphens") + } + + for _, r := range part { + if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { + return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) + } + } + } + + return nil +} + +func (m *SendInvitationRequest) _validateEmail(addr string) error { + a, err := mail.ParseAddress(addr) + if err != nil { + return err + } + addr = a.Address + + if len(addr) > 254 { + return errors.New("email addresses cannot exceed 254 characters") + } + + parts := strings.SplitN(addr, "@", 2) + + if len(parts[0]) > 64 { + return errors.New("email address local phrase cannot exceed 64 characters") + } + + return m._validateHostname(parts[1]) +} + +// SendInvitationRequestValidationError is the validation error returned by +// SendInvitationRequest.ValidateFields if the designated constraints aren't met. +type SendInvitationRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SendInvitationRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SendInvitationRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SendInvitationRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SendInvitationRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SendInvitationRequestValidationError) ErrorName() string { + return "SendInvitationRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e SendInvitationRequestValidationError) 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 %sSendInvitationRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SendInvitationRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SendInvitationRequestValidationError{} + +// ValidateFields checks the field values on DeleteInvitationRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *DeleteInvitationRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = DeleteInvitationRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "email": + + if err := m._validateEmail(m.GetEmail()); err != nil { + return DeleteInvitationRequestValidationError{ + field: "email", + reason: "value must be a valid email address", + cause: err, + } + } + + default: + return DeleteInvitationRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +func (m *DeleteInvitationRequest) _validateHostname(host string) error { + s := strings.ToLower(strings.TrimSuffix(host, ".")) + + if len(host) > 253 { + return errors.New("hostname cannot exceed 253 characters") + } + + for _, part := range strings.Split(s, ".") { + if l := len(part); l == 0 || l > 63 { + return errors.New("hostname part must be non-empty and cannot exceed 63 characters") + } + + if part[0] == '-' { + return errors.New("hostname parts cannot begin with hyphens") + } + + if part[len(part)-1] == '-' { + return errors.New("hostname parts cannot end with hyphens") + } + + for _, r := range part { + if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { + return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) + } + } + } + + return nil +} + +func (m *DeleteInvitationRequest) _validateEmail(addr string) error { + a, err := mail.ParseAddress(addr) + if err != nil { + return err + } + addr = a.Address + + if len(addr) > 254 { + return errors.New("email addresses cannot exceed 254 characters") + } + + parts := strings.SplitN(addr, "@", 2) + + if len(parts[0]) > 64 { + return errors.New("email address local phrase cannot exceed 64 characters") + } + + return m._validateHostname(parts[1]) +} + +// DeleteInvitationRequestValidationError is the validation error returned by +// DeleteInvitationRequest.ValidateFields if the designated constraints aren't met. +type DeleteInvitationRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e DeleteInvitationRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e DeleteInvitationRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e DeleteInvitationRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e DeleteInvitationRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e DeleteInvitationRequestValidationError) ErrorName() string { + return "DeleteInvitationRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e DeleteInvitationRequestValidationError) 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 %sDeleteInvitationRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = DeleteInvitationRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = DeleteInvitationRequestValidationError{} + +// ValidateFields checks the field values on UserSessionIdentifiers with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *UserSessionIdentifiers) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = UserSessionIdentifiersFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "user_ids": + + if v, ok := interface{}(&m.UserIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UserSessionIdentifiersValidationError{ + field: "user_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "session_id": + // no validation rules for SessionID + default: + return UserSessionIdentifiersValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// UserSessionIdentifiersValidationError is the validation error returned by +// UserSessionIdentifiers.ValidateFields if the designated constraints aren't met. +type UserSessionIdentifiersValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UserSessionIdentifiersValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UserSessionIdentifiersValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UserSessionIdentifiersValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UserSessionIdentifiersValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UserSessionIdentifiersValidationError) ErrorName() string { + return "UserSessionIdentifiersValidationError" +} + +// Error satisfies the builtin error interface +func (e UserSessionIdentifiersValidationError) 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 %sUserSessionIdentifiers.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UserSessionIdentifiersValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UserSessionIdentifiersValidationError{} + +// ValidateFields checks the field values on UserSession with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *UserSession) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = UserSessionFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "user_ids": + + if v, ok := interface{}(&m.UserIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UserSessionValidationError{ + field: "user_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "session_id": + // no validation rules for SessionID + case "created_at": + + if v, ok := interface{}(&m.CreatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UserSessionValidationError{ + field: "created_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "updated_at": + + if v, ok := interface{}(&m.UpdatedAt).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UserSessionValidationError{ + field: "updated_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "expires_at": + + if v, ok := interface{}(m.GetExpiresAt()).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UserSessionValidationError{ + field: "expires_at", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return UserSessionValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// UserSessionValidationError is the validation error returned by +// UserSession.ValidateFields if the designated constraints aren't met. +type UserSessionValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UserSessionValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UserSessionValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UserSessionValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UserSessionValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UserSessionValidationError) ErrorName() string { return "UserSessionValidationError" } + +// Error satisfies the builtin error interface +func (e UserSessionValidationError) 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 %sUserSession.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UserSessionValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UserSessionValidationError{} + +// ValidateFields checks the field values on UserSessions with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *UserSessions) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = UserSessionsFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "sessions": + + for idx, item := range m.GetSessions() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return UserSessionsValidationError{ + field: fmt.Sprintf("sessions[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + default: + return UserSessionsValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// UserSessionsValidationError is the validation error returned by +// UserSessions.ValidateFields if the designated constraints aren't met. +type UserSessionsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UserSessionsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UserSessionsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UserSessionsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UserSessionsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UserSessionsValidationError) ErrorName() string { return "UserSessionsValidationError" } + +// Error satisfies the builtin error interface +func (e UserSessionsValidationError) 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 %sUserSessions.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UserSessionsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UserSessionsValidationError{} + +// ValidateFields checks the field values on ListUserSessionsRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ListUserSessionsRequest) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = ListUserSessionsRequestFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "user_ids": + + if v, ok := interface{}(&m.UserIdentifiers).(interface{ ValidateFields(...string) error }); ok { + if err := v.ValidateFields(subs...); err != nil { + return ListUserSessionsRequestValidationError{ + field: "user_ids", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case "order": + // no validation rules for Order + case "limit": + // no validation rules for Limit + case "page": + // no validation rules for Page + default: + return ListUserSessionsRequestValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// ListUserSessionsRequestValidationError is the validation error returned by +// ListUserSessionsRequest.ValidateFields if the designated constraints aren't met. +type ListUserSessionsRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListUserSessionsRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListUserSessionsRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListUserSessionsRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListUserSessionsRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListUserSessionsRequestValidationError) ErrorName() string { + return "ListUserSessionsRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e ListUserSessionsRequestValidationError) 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 %sListUserSessionsRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListUserSessionsRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListUserSessionsRequestValidationError{} + +// ValidateFields checks the field values on Picture_Embedded with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *Picture_Embedded) ValidateFields(paths ...string) error { + if m == nil { + return nil + } + + if len(paths) == 0 { + paths = Picture_EmbeddedFieldPathsNested + } + + for name, subs := range _processPaths(append(paths[:0:0], paths...)) { + _ = subs + switch name { + case "mime_type": + // no validation rules for MimeType + case "data": + // no validation rules for Data + default: + return Picture_EmbeddedValidationError{ + field: name, + reason: "invalid field path", + } + } + } + return nil +} + +// Picture_EmbeddedValidationError is the validation error returned by +// Picture_Embedded.ValidateFields if the designated constraints aren't met. +type Picture_EmbeddedValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e Picture_EmbeddedValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e Picture_EmbeddedValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e Picture_EmbeddedValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e Picture_EmbeddedValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e Picture_EmbeddedValidationError) ErrorName() string { return "Picture_EmbeddedValidationError" } + +// Error satisfies the builtin error interface +func (e Picture_EmbeddedValidationError) 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 %sPicture_Embedded.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = Picture_EmbeddedValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = Picture_EmbeddedValidationError{} diff --git a/pkg/ttnpb/user.validator.pb.go b/pkg/ttnpb/user.validator.pb.go deleted file mode 100644 index 0961700ef3..0000000000 --- a/pkg/ttnpb/user.validator.pb.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/user.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import fmt "fmt" -import github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" -import proto "github.com/gogo/protobuf/proto" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/empty" -import _ "github.com/golang/protobuf/ptypes/timestamp" -import _ "github.com/mwitkow/go-proto-validators" -import _ "google.golang.org/genproto/protobuf/field_mask" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -func (this *User) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UserIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UserIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.CreatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("CreatedAt", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UpdatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UpdatedAt", err) - } - // Validation of proto3 map<> fields is unsupported. - for _, item := range this.ContactInfo { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ContactInfo", err) - } - } - } - if this.PrimaryEmailAddressValidatedAt != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.PrimaryEmailAddressValidatedAt); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("PrimaryEmailAddressValidatedAt", err) - } - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.PasswordUpdatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("PasswordUpdatedAt", err) - } - if this.TemporaryPasswordCreatedAt != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.TemporaryPasswordCreatedAt); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("TemporaryPasswordCreatedAt", err) - } - } - if this.TemporaryPasswordExpiresAt != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.TemporaryPasswordExpiresAt); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("TemporaryPasswordExpiresAt", err) - } - } - if this.ProfilePicture != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ProfilePicture); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ProfilePicture", err) - } - } - return nil -} -func (this *Picture) Validate() error { - if this.Embedded != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Embedded); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Embedded", err) - } - } - // Validation of proto3 map<> fields is unsupported. - return nil -} -func (this *Picture_Embedded) Validate() error { - return nil -} -func (this *Users) Validate() error { - for _, item := range this.Users { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Users", err) - } - } - } - return nil -} -func (this *GetUserRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UserIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UserIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *CreateUserRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.User)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("User", err) - } - return nil -} -func (this *UpdateUserRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.User)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("User", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.FieldMask)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("FieldMask", err) - } - return nil -} -func (this *CreateTemporaryPasswordRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UserIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UserIdentifiers", err) - } - return nil -} -func (this *UpdateUserPasswordRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UserIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UserIdentifiers", err) - } - return nil -} -func (this *CreateUserAPIKeyRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UserIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UserIdentifiers", err) - } - return nil -} -func (this *UpdateUserAPIKeyRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UserIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UserIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.APIKey)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("APIKey", err) - } - return nil -} -func (this *Invitation) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.ExpiresAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ExpiresAt", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.CreatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("CreatedAt", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UpdatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UpdatedAt", err) - } - if this.AcceptedAt != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.AcceptedAt); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("AcceptedAt", err) - } - } - if this.AcceptedBy != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.AcceptedBy); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("AcceptedBy", err) - } - } - return nil -} -func (this *Invitations) Validate() error { - for _, item := range this.Invitations { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Invitations", err) - } - } - } - return nil -} -func (this *SendInvitationRequest) Validate() error { - if this.Email == "" { - return github_com_mwitkow_go_proto_validators.FieldError("Email", fmt.Errorf(`value '%v' must not be an empty string`, this.Email)) - } - return nil -} -func (this *DeleteInvitationRequest) Validate() error { - if this.Email == "" { - return github_com_mwitkow_go_proto_validators.FieldError("Email", fmt.Errorf(`value '%v' must not be an empty string`, this.Email)) - } - return nil -} -func (this *UserSessionIdentifiers) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UserIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UserIdentifiers", err) - } - return nil -} -func (this *UserSession) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UserIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UserIdentifiers", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.CreatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("CreatedAt", err) - } - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UpdatedAt)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UpdatedAt", err) - } - if this.ExpiresAt != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ExpiresAt); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("ExpiresAt", err) - } - } - return nil -} -func (this *UserSessions) Validate() error { - for _, item := range this.Sessions { - if item != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Sessions", err) - } - } - } - return nil -} -func (this *ListUserSessionsRequest) Validate() error { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(&(this.UserIdentifiers)); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("UserIdentifiers", err) - } - return nil -} diff --git a/pkg/ttnpb/user_services.pb.gw.go b/pkg/ttnpb/user_services.pb.gw.go index 910b3f0d94..04cee63ee8 100644 --- a/pkg/ttnpb/user_services.pb.gw.go +++ b/pkg/ttnpb/user_services.pb.gw.go @@ -9,11 +9,10 @@ It translates gRPC into RESTful JSON APIs. package ttnpb import ( + "context" "io" "net/http" - "context" - "github.com/gogo/protobuf/types" "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" diff --git a/pkg/ttnpb/user_services.pb.validate.go b/pkg/ttnpb/user_services.pb.validate.go new file mode 100644 index 0000000000..fb43d9d432 --- /dev/null +++ b/pkg/ttnpb/user_services.pb.validate.go @@ -0,0 +1,33 @@ +// Code generated by protoc-gen-fieldmask. DO NOT EDIT. + +package ttnpb + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/gogo/protobuf/types" +) + +// 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) + _ = types.DynamicAny{} +) diff --git a/pkg/ttnpb/user_services.validator.pb.go b/pkg/ttnpb/user_services.validator.pb.go deleted file mode 100644 index 32d178aefd..0000000000 --- a/pkg/ttnpb/user_services.validator.pb.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lorawan-stack/api/user_services.proto - -package ttnpb // import "go.thethings.network/lorawan-stack/pkg/ttnpb" - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/empty" -import _ "google.golang.org/genproto/googleapis/api/annotations" - -import time "time" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen diff --git a/pkg/unique/unique.go b/pkg/unique/unique.go index 55abd2e8bb..a9e4639aa8 100644 --- a/pkg/unique/unique.go +++ b/pkg/unique/unique.go @@ -88,7 +88,7 @@ func WithContext(ctx context.Context, uid string) (context.Context, error) { // ToApplicationID returns the application identifier of the specified unique ID. func ToApplicationID(uid string) (ttnpb.ApplicationIdentifiers, error) { ids := ttnpb.ApplicationIdentifiers{ApplicationID: uid} - if err := ids.Validate(); err != nil { + if err := ids.ValidateFields("application_id"); err != nil { return ttnpb.ApplicationIdentifiers{}, errUniqueIdentifier.WithCause(err).WithAttributes("uid", uid) } return ids, nil @@ -97,7 +97,7 @@ func ToApplicationID(uid string) (ttnpb.ApplicationIdentifiers, error) { // ToClientID returns the client identifier of the specified unique ID. func ToClientID(uid string) (ttnpb.ClientIdentifiers, error) { ids := ttnpb.ClientIdentifiers{ClientID: uid} - if err := ids.Validate(); err != nil { + if err := ids.ValidateFields("client_id"); err != nil { return ttnpb.ClientIdentifiers{}, errUniqueIdentifier.WithCause(err).WithAttributes("uid", uid) } return ids, nil @@ -107,7 +107,7 @@ func ToClientID(uid string) (ttnpb.ClientIdentifiers, error) { func ToDeviceID(uid string) (id ttnpb.EndDeviceIdentifiers, err error) { if parts := strings.SplitN(uid, separator, 2); len(parts) == 2 { devIDs := ttnpb.EndDeviceIdentifiers{DeviceID: parts[1], ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: parts[0]}} - if err := devIDs.Validate(); err != nil { + if err := devIDs.ValidateFields("device_id", "application_ids"); err != nil { return ttnpb.EndDeviceIdentifiers{}, errUniqueIdentifier.WithCause(err).WithAttributes("uid", uid) } return devIDs, nil @@ -118,7 +118,7 @@ func ToDeviceID(uid string) (id ttnpb.EndDeviceIdentifiers, err error) { // ToGatewayID returns the gateway identifier of the specified unique ID. func ToGatewayID(uid string) (ttnpb.GatewayIdentifiers, error) { ids := ttnpb.GatewayIdentifiers{GatewayID: uid} - if err := ids.Validate(); err != nil { + if err := ids.ValidateFields("gateway_id"); err != nil { return ttnpb.GatewayIdentifiers{}, errUniqueIdentifier.WithCause(err).WithAttributes("uid", uid) } return ids, nil @@ -127,7 +127,7 @@ func ToGatewayID(uid string) (ttnpb.GatewayIdentifiers, error) { // ToOrganizationID returns the organization identifier of the specified unique ID. func ToOrganizationID(uid string) (ttnpb.OrganizationIdentifiers, error) { ids := ttnpb.OrganizationIdentifiers{OrganizationID: uid} - if err := ids.Validate(); err != nil { + if err := ids.ValidateFields("organization_id"); err != nil { return ttnpb.OrganizationIdentifiers{}, errUniqueIdentifier.WithCause(err).WithAttributes("uid", uid) } return ids, nil @@ -136,7 +136,7 @@ func ToOrganizationID(uid string) (ttnpb.OrganizationIdentifiers, error) { // ToUserID returns the user identifier of the specified unique ID. func ToUserID(uid string) (ttnpb.UserIdentifiers, error) { ids := ttnpb.UserIdentifiers{UserID: uid} - if err := ids.Validate(); err != nil { + if err := ids.ValidateFields("user_id"); err != nil { return ttnpb.UserIdentifiers{}, errUniqueIdentifier.WithCause(err).WithAttributes("uid", uid) } return ids, nil