-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
cloudiot-gen.go
5606 lines (5138 loc) · 222 KB
/
cloudiot-gen.go
1
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2023 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated file. DO NOT EDIT.
// Package cloudiot provides access to the Cloud IoT API.
//
// For product documentation, see: https://cloud.google.com/iot
//
// # Creating a client
//
// Usage example:
//
// import "google.golang.org/api/cloudiot/v1"
// ...
// ctx := context.Background()
// cloudiotService, err := cloudiot.NewService(ctx)
//
// In this example, Google Application Default Credentials are used for authentication.
//
// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
//
// # Other authentication options
//
// By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
//
// cloudiotService, err := cloudiot.NewService(ctx, option.WithScopes(cloudiot.CloudiotScope))
//
// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
//
// cloudiotService, err := cloudiot.NewService(ctx, option.WithAPIKey("AIza..."))
//
// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
//
// config := &oauth2.Config{...}
// // ...
// token, err := config.Exchange(ctx, ...)
// cloudiotService, err := cloudiot.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
//
// See https://godoc.org/google.golang.org/api/option/ for details on options.
package cloudiot // import "google.golang.org/api/cloudiot/v1"
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"net/url"
"strconv"
"strings"
googleapi "google.golang.org/api/googleapi"
internal "google.golang.org/api/internal"
gensupport "google.golang.org/api/internal/gensupport"
option "google.golang.org/api/option"
internaloption "google.golang.org/api/option/internaloption"
htransport "google.golang.org/api/transport/http"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = gensupport.MarshalJSON
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = context.Canceled
var _ = internaloption.WithDefaultEndpoint
var _ = internal.Version
const apiId = "cloudiot:v1"
const apiName = "cloudiot"
const apiVersion = "v1"
const basePath = "https://cloudiot.googleapis.com/"
const mtlsBasePath = "https://cloudiot.mtls.googleapis.com/"
// OAuth2 scopes used by this API.
const (
// See, edit, configure, and delete your Google Cloud data and see the
// email address for your Google Account.
CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
// Register and manage devices in the Google Cloud IoT service
CloudiotScope = "https://www.googleapis.com/auth/cloudiot"
)
// NewService creates a new Service.
func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
scopesOption := internaloption.WithDefaultScopes(
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloudiot",
)
// NOTE: prepend, so we don't override user-specified scopes.
opts = append([]option.ClientOption{scopesOption}, opts...)
opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
client, endpoint, err := htransport.NewClient(ctx, opts...)
if err != nil {
return nil, err
}
s, err := New(client)
if err != nil {
return nil, err
}
if endpoint != "" {
s.BasePath = endpoint
}
return s, nil
}
// New creates a new Service. It uses the provided http.Client for requests.
//
// Deprecated: please use NewService instead.
// To provide a custom HTTP client, use option.WithHTTPClient.
// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
s.Projects = NewProjectsService(s)
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
Projects *ProjectsService
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
func NewProjectsService(s *Service) *ProjectsService {
rs := &ProjectsService{s: s}
rs.Locations = NewProjectsLocationsService(s)
return rs
}
type ProjectsService struct {
s *Service
Locations *ProjectsLocationsService
}
func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
rs := &ProjectsLocationsService{s: s}
rs.Registries = NewProjectsLocationsRegistriesService(s)
return rs
}
type ProjectsLocationsService struct {
s *Service
Registries *ProjectsLocationsRegistriesService
}
func NewProjectsLocationsRegistriesService(s *Service) *ProjectsLocationsRegistriesService {
rs := &ProjectsLocationsRegistriesService{s: s}
rs.Devices = NewProjectsLocationsRegistriesDevicesService(s)
rs.Groups = NewProjectsLocationsRegistriesGroupsService(s)
return rs
}
type ProjectsLocationsRegistriesService struct {
s *Service
Devices *ProjectsLocationsRegistriesDevicesService
Groups *ProjectsLocationsRegistriesGroupsService
}
func NewProjectsLocationsRegistriesDevicesService(s *Service) *ProjectsLocationsRegistriesDevicesService {
rs := &ProjectsLocationsRegistriesDevicesService{s: s}
rs.ConfigVersions = NewProjectsLocationsRegistriesDevicesConfigVersionsService(s)
rs.States = NewProjectsLocationsRegistriesDevicesStatesService(s)
return rs
}
type ProjectsLocationsRegistriesDevicesService struct {
s *Service
ConfigVersions *ProjectsLocationsRegistriesDevicesConfigVersionsService
States *ProjectsLocationsRegistriesDevicesStatesService
}
func NewProjectsLocationsRegistriesDevicesConfigVersionsService(s *Service) *ProjectsLocationsRegistriesDevicesConfigVersionsService {
rs := &ProjectsLocationsRegistriesDevicesConfigVersionsService{s: s}
return rs
}
type ProjectsLocationsRegistriesDevicesConfigVersionsService struct {
s *Service
}
func NewProjectsLocationsRegistriesDevicesStatesService(s *Service) *ProjectsLocationsRegistriesDevicesStatesService {
rs := &ProjectsLocationsRegistriesDevicesStatesService{s: s}
return rs
}
type ProjectsLocationsRegistriesDevicesStatesService struct {
s *Service
}
func NewProjectsLocationsRegistriesGroupsService(s *Service) *ProjectsLocationsRegistriesGroupsService {
rs := &ProjectsLocationsRegistriesGroupsService{s: s}
rs.Devices = NewProjectsLocationsRegistriesGroupsDevicesService(s)
return rs
}
type ProjectsLocationsRegistriesGroupsService struct {
s *Service
Devices *ProjectsLocationsRegistriesGroupsDevicesService
}
func NewProjectsLocationsRegistriesGroupsDevicesService(s *Service) *ProjectsLocationsRegistriesGroupsDevicesService {
rs := &ProjectsLocationsRegistriesGroupsDevicesService{s: s}
return rs
}
type ProjectsLocationsRegistriesGroupsDevicesService struct {
s *Service
}
// BindDeviceToGatewayRequest: Request for `BindDeviceToGateway`.
type BindDeviceToGatewayRequest struct {
// DeviceId: Required. The device to associate with the specified
// gateway. The value of `device_id` can be either the device numeric ID
// or the user-defined device identifier.
DeviceId string `json:"deviceId,omitempty"`
// GatewayId: Required. The value of `gateway_id` can be either the
// device numeric ID or the user-defined device identifier.
GatewayId string `json:"gatewayId,omitempty"`
// ForceSendFields is a list of field names (e.g. "DeviceId") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "DeviceId") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *BindDeviceToGatewayRequest) MarshalJSON() ([]byte, error) {
type NoMethod BindDeviceToGatewayRequest
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// BindDeviceToGatewayResponse: Response for `BindDeviceToGateway`.
type BindDeviceToGatewayResponse struct {
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
}
// Binding: Associates `members`, or principals, with a `role`.
type Binding struct {
// Condition: The condition that is associated with this binding. If the
// condition evaluates to `true`, then this binding applies to the
// current request. If the condition evaluates to `false`, then this
// binding does not apply to the current request. However, a different
// role binding might grant the same role to one or more of the
// principals in this binding. To learn which resources support
// conditions in their IAM policies, see the IAM documentation
// (https://cloud.google.com/iam/help/conditions/resource-policies).
Condition *Expr `json:"condition,omitempty"`
// Members: Specifies the principals requesting access for a Google
// Cloud resource. `members` can have the following values: *
// `allUsers`: A special identifier that represents anyone who is on the
// internet; with or without a Google account. *
// `allAuthenticatedUsers`: A special identifier that represents anyone
// who is authenticated with a Google account or a service account. Does
// not include identities that come from external identity providers
// (IdPs) through identity federation. * `user:{emailid}`: An email
// address that represents a specific Google account. For example,
// `alice@example.com` . * `serviceAccount:{emailid}`: An email address
// that represents a Google service account. For example,
// `my-other-app@appspot.gserviceaccount.com`. *
// `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`:
// An identifier for a Kubernetes service account
// (https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts).
// For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`.
// * `group:{emailid}`: An email address that represents a Google group.
// For example, `admins@example.com`. * `domain:{domain}`: The G Suite
// domain (primary) that represents all the users of that domain. For
// example, `google.com` or `example.com`. *
// `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus
// unique identifier) representing a user that has been recently
// deleted. For example, `alice@example.com?uid=123456789012345678901`.
// If the user is recovered, this value reverts to `user:{emailid}` and
// the recovered user retains the role in the binding. *
// `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address
// (plus unique identifier) representing a service account that has been
// recently deleted. For example,
// `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`.
// If the service account is undeleted, this value reverts to
// `serviceAccount:{emailid}` and the undeleted service account retains
// the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`:
// An email address (plus unique identifier) representing a Google group
// that has been recently deleted. For example,
// `admins@example.com?uid=123456789012345678901`. If the group is
// recovered, this value reverts to `group:{emailid}` and the recovered
// group retains the role in the binding.
Members []string `json:"members,omitempty"`
// Role: Role that is assigned to the list of `members`, or principals.
// For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
Role string `json:"role,omitempty"`
// ForceSendFields is a list of field names (e.g. "Condition") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Condition") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Binding) MarshalJSON() ([]byte, error) {
type NoMethod Binding
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Device: The device resource.
type Device struct {
// Blocked: If a device is blocked, connections or requests from this
// device will fail. Can be used to temporarily prevent the device from
// connecting if, for example, the sensor is generating bad data and
// needs maintenance.
Blocked bool `json:"blocked,omitempty"`
// Config: The most recent device configuration, which is eventually
// sent from Cloud IoT Core to the device. If not present on creation,
// the configuration will be initialized with an empty payload and
// version value of `1`. To update this field after creation, use the
// `DeviceManager.ModifyCloudToDeviceConfig` method.
Config *DeviceConfig `json:"config,omitempty"`
// Credentials: The credentials used to authenticate this device. To
// allow credential rotation without interruption, multiple device
// credentials can be bound to this device. No more than 3 credentials
// can be bound to a single device at a time. When new credentials are
// added to a device, they are verified against the registry
// credentials. For details, see the description of the
// `DeviceRegistry.credentials` field.
Credentials []*DeviceCredential `json:"credentials,omitempty"`
// GatewayConfig: Gateway-related configuration and state.
GatewayConfig *GatewayConfig `json:"gatewayConfig,omitempty"`
// Id: The user-defined device identifier. The device ID must be unique
// within a device registry.
Id string `json:"id,omitempty"`
// LastConfigAckTime: [Output only] The last time a cloud-to-device
// config version acknowledgment was received from the device. This
// field is only for configurations sent through MQTT.
LastConfigAckTime string `json:"lastConfigAckTime,omitempty"`
// LastConfigSendTime: [Output only] The last time a cloud-to-device
// config version was sent to the device.
LastConfigSendTime string `json:"lastConfigSendTime,omitempty"`
// LastErrorStatus: [Output only] The error message of the most recent
// error, such as a failure to publish to Cloud Pub/Sub.
// 'last_error_time' is the timestamp of this field. If no errors have
// occurred, this field has an empty message and the status code 0 ==
// OK. Otherwise, this field is expected to have a status code other
// than OK.
LastErrorStatus *Status `json:"lastErrorStatus,omitempty"`
// LastErrorTime: [Output only] The time the most recent error occurred,
// such as a failure to publish to Cloud Pub/Sub. This field is the
// timestamp of 'last_error_status'.
LastErrorTime string `json:"lastErrorTime,omitempty"`
// LastEventTime: [Output only] The last time a telemetry event was
// received. Timestamps are periodically collected and written to
// storage; they may be stale by a few minutes.
LastEventTime string `json:"lastEventTime,omitempty"`
// LastHeartbeatTime: [Output only] The last time an MQTT `PINGREQ` was
// received. This field applies only to devices connecting through MQTT.
// MQTT clients usually only send `PINGREQ` messages if the connection
// is idle, and no other messages have been sent. Timestamps are
// periodically collected and written to storage; they may be stale by a
// few minutes.
LastHeartbeatTime string `json:"lastHeartbeatTime,omitempty"`
// LastStateTime: [Output only] The last time a state event was
// received. Timestamps are periodically collected and written to
// storage; they may be stale by a few minutes.
LastStateTime string `json:"lastStateTime,omitempty"`
// LogLevel: **Beta Feature** The logging verbosity for device activity.
// If unspecified, DeviceRegistry.log_level will be used.
//
// Possible values:
// "LOG_LEVEL_UNSPECIFIED" - No logging specified. If not specified,
// logging will be disabled.
// "NONE" - Disables logging.
// "ERROR" - Error events will be logged.
// "INFO" - Informational events will be logged, such as connections
// and disconnections.
// "DEBUG" - All events will be logged.
LogLevel string `json:"logLevel,omitempty"`
// Metadata: The metadata key-value pairs assigned to the device. This
// metadata is not interpreted or indexed by Cloud IoT Core. It can be
// used to add contextual information for the device. Keys must conform
// to the regular expression a-zA-Z+ and be less than 128 bytes in
// length. Values are free-form strings. Each value must be less than or
// equal to 32 KB in size. The total size of all keys and values must be
// less than 256 KB, and the maximum number of key-value pairs is 500.
Metadata map[string]string `json:"metadata,omitempty"`
// Name: The resource path name. For example,
// `projects/p1/locations/us-central1/registries/registry0/devices/dev0`
// or
// `projects/p1/locations/us-central1/registries/registry0/devices/{num_i
// d}`. When `name` is populated as a response from the service, it
// always ends in the device numeric ID.
Name string `json:"name,omitempty"`
// NumId: [Output only] A server-defined unique numeric ID for the
// device. This is a more compact way to identify devices, and it is
// globally unique.
NumId uint64 `json:"numId,omitempty,string"`
// State: [Output only] The state most recently received from the
// device. If no state has been reported, this field is not present.
State *DeviceState `json:"state,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Blocked") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Blocked") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Device) MarshalJSON() ([]byte, error) {
type NoMethod Device
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// DeviceConfig: The device configuration. Eventually delivered to
// devices.
type DeviceConfig struct {
// BinaryData: The device configuration data.
BinaryData string `json:"binaryData,omitempty"`
// CloudUpdateTime: [Output only] The time at which this configuration
// version was updated in Cloud IoT Core. This timestamp is set by the
// server.
CloudUpdateTime string `json:"cloudUpdateTime,omitempty"`
// DeviceAckTime: [Output only] The time at which Cloud IoT Core
// received the acknowledgment from the device, indicating that the
// device has received this configuration version. If this field is not
// present, the device has not yet acknowledged that it received this
// version. Note that when the config was sent to the device, many
// config versions may have been available in Cloud IoT Core while the
// device was disconnected, and on connection, only the latest version
// is sent to the device. Some versions may never be sent to the device,
// and therefore are never acknowledged. This timestamp is set by Cloud
// IoT Core.
DeviceAckTime string `json:"deviceAckTime,omitempty"`
// Version: [Output only] The version of this update. The version number
// is assigned by the server, and is always greater than 0 after device
// creation. The version must be 0 on the `CreateDevice` request if a
// `config` is specified; the response of `CreateDevice` will always
// have a value of 1.
Version int64 `json:"version,omitempty,string"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "BinaryData") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "BinaryData") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *DeviceConfig) MarshalJSON() ([]byte, error) {
type NoMethod DeviceConfig
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// DeviceCredential: A server-stored device credential used for
// authentication.
type DeviceCredential struct {
// ExpirationTime: [Optional] The time at which this credential becomes
// invalid. This credential will be ignored for new client
// authentication requests after this timestamp; however, it will not be
// automatically deleted.
ExpirationTime string `json:"expirationTime,omitempty"`
// PublicKey: A public key used to verify the signature of JSON Web
// Tokens (JWTs). When adding a new device credential, either via device
// creation or via modifications, this public key credential may be
// required to be signed by one of the registry level certificates. More
// specifically, if the registry contains at least one certificate, any
// new device credential must be signed by one of the registry
// certificates. As a result, when the registry contains certificates,
// only X.509 certificates are accepted as device credentials. However,
// if the registry does not contain a certificate, self-signed
// certificates and public keys will be accepted. New device credentials
// must be different from every registry-level certificate.
PublicKey *PublicKeyCredential `json:"publicKey,omitempty"`
// ForceSendFields is a list of field names (e.g. "ExpirationTime") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "ExpirationTime") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *DeviceCredential) MarshalJSON() ([]byte, error) {
type NoMethod DeviceCredential
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// DeviceRegistry: A container for a group of devices.
type DeviceRegistry struct {
// Credentials: The credentials used to verify the device credentials.
// No more than 10 credentials can be bound to a single registry at a
// time. The verification process occurs at the time of device creation
// or update. If this field is empty, no verification is performed.
// Otherwise, the credentials of a newly created device or added
// credentials of an updated device should be signed with one of these
// registry credentials. Note, however, that existing devices will never
// be affected by modifications to this list of credentials: after a
// device has been successfully created in a registry, it should be able
// to connect even if its registry credentials are revoked, deleted, or
// modified.
Credentials []*RegistryCredential `json:"credentials,omitempty"`
// EventNotificationConfigs: The configuration for notification of
// telemetry events received from the device. All telemetry events that
// were successfully published by the device and acknowledged by Cloud
// IoT Core are guaranteed to be delivered to Cloud Pub/Sub. If multiple
// configurations match a message, only the first matching configuration
// is used. If you try to publish a device telemetry event using MQTT
// without specifying a Cloud Pub/Sub topic for the device's registry,
// the connection closes automatically. If you try to do so using an
// HTTP connection, an error is returned. Up to 10 configurations may be
// provided.
EventNotificationConfigs []*EventNotificationConfig `json:"eventNotificationConfigs,omitempty"`
// HttpConfig: The DeviceService (HTTP) configuration for this device
// registry.
HttpConfig *HttpConfig `json:"httpConfig,omitempty"`
// Id: The identifier of this device registry. For example,
// `myRegistry`.
Id string `json:"id,omitempty"`
// LogLevel: **Beta Feature** The default logging verbosity for activity
// from devices in this registry. The verbosity level can be overridden
// by Device.log_level.
//
// Possible values:
// "LOG_LEVEL_UNSPECIFIED" - No logging specified. If not specified,
// logging will be disabled.
// "NONE" - Disables logging.
// "ERROR" - Error events will be logged.
// "INFO" - Informational events will be logged, such as connections
// and disconnections.
// "DEBUG" - All events will be logged.
LogLevel string `json:"logLevel,omitempty"`
// MqttConfig: The MQTT configuration for this device registry.
MqttConfig *MqttConfig `json:"mqttConfig,omitempty"`
// Name: The resource path name. For example,
// `projects/example-project/locations/us-central1/registries/my-registry
// `.
Name string `json:"name,omitempty"`
// StateNotificationConfig: The configuration for notification of new
// states received from the device. State updates are guaranteed to be
// stored in the state history, but notifications to Cloud Pub/Sub are
// not guaranteed. For example, if permissions are misconfigured or the
// specified topic doesn't exist, no notification will be published but
// the state will still be stored in Cloud IoT Core.
StateNotificationConfig *StateNotificationConfig `json:"stateNotificationConfig,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Credentials") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Credentials") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *DeviceRegistry) MarshalJSON() ([]byte, error) {
type NoMethod DeviceRegistry
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// DeviceState: The device state, as reported by the device.
type DeviceState struct {
// BinaryData: The device state data.
BinaryData string `json:"binaryData,omitempty"`
// UpdateTime: [Output only] The time at which this state version was
// updated in Cloud IoT Core.
UpdateTime string `json:"updateTime,omitempty"`
// ForceSendFields is a list of field names (e.g. "BinaryData") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "BinaryData") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *DeviceState) MarshalJSON() ([]byte, error) {
type NoMethod DeviceState
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Empty: A generic empty message that you can re-use to avoid defining
// duplicated empty messages in your APIs. A typical example is to use
// it as the request or the response type of an API method. For
// instance: service Foo { rpc Bar(google.protobuf.Empty) returns
// (google.protobuf.Empty); }
type Empty struct {
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
}
// EventNotificationConfig: The configuration for forwarding telemetry
// events.
type EventNotificationConfig struct {
// PubsubTopicName: A Cloud Pub/Sub topic name. For example,
// `projects/myProject/topics/deviceEvents`.
PubsubTopicName string `json:"pubsubTopicName,omitempty"`
// SubfolderMatches: If the subfolder name matches this string exactly,
// this configuration will be used. The string must not include the
// leading '/' character. If empty, all strings are matched. This field
// is used only for telemetry events; subfolders are not supported for
// state changes.
SubfolderMatches string `json:"subfolderMatches,omitempty"`
// ForceSendFields is a list of field names (e.g. "PubsubTopicName") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "PubsubTopicName") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *EventNotificationConfig) MarshalJSON() ([]byte, error) {
type NoMethod EventNotificationConfig
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Expr: Represents a textual expression in the Common Expression
// Language (CEL) syntax. CEL is a C-like expression language. The
// syntax and semantics of CEL are documented at
// https://github.com/google/cel-spec. Example (Comparison): title:
// "Summary size limit" description: "Determines if a summary is less
// than 100 chars" expression: "document.summary.size() < 100" Example
// (Equality): title: "Requestor is owner" description: "Determines if
// requestor is the document owner" expression: "document.owner ==
// request.auth.claims.email" Example (Logic): title: "Public documents"
// description: "Determine whether the document should be publicly
// visible" expression: "document.type != 'private' && document.type !=
// 'internal'" Example (Data Manipulation): title: "Notification string"
// description: "Create a notification string with a timestamp."
// expression: "'New message received at ' +
// string(document.create_time)" The exact variables and functions that
// may be referenced within an expression are determined by the service
// that evaluates it. See the service documentation for additional
// information.
type Expr struct {
// Description: Optional. Description of the expression. This is a
// longer text which describes the expression, e.g. when hovered over it
// in a UI.
Description string `json:"description,omitempty"`
// Expression: Textual representation of an expression in Common
// Expression Language syntax.
Expression string `json:"expression,omitempty"`
// Location: Optional. String indicating the location of the expression
// for error reporting, e.g. a file name and a position in the file.
Location string `json:"location,omitempty"`
// Title: Optional. Title for the expression, i.e. a short string
// describing its purpose. This can be used e.g. in UIs which allow to
// enter the expression.
Title string `json:"title,omitempty"`
// ForceSendFields is a list of field names (e.g. "Description") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Description") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Expr) MarshalJSON() ([]byte, error) {
type NoMethod Expr
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GatewayConfig: Gateway-related configuration and state.
type GatewayConfig struct {
// GatewayAuthMethod: Indicates how to authorize and/or authenticate
// devices to access the gateway.
//
// Possible values:
// "GATEWAY_AUTH_METHOD_UNSPECIFIED" - No authentication/authorization
// method specified. No devices are allowed to access the gateway.
// "ASSOCIATION_ONLY" - The device is authenticated through the
// gateway association only. Device credentials are ignored even if
// provided.
// "DEVICE_AUTH_TOKEN_ONLY" - The device is authenticated through its
// own credentials. Gateway association is not checked.
// "ASSOCIATION_AND_DEVICE_AUTH_TOKEN" - The device is authenticated
// through both device credentials and gateway association. The device
// must be bound to the gateway and must provide its own credentials.
GatewayAuthMethod string `json:"gatewayAuthMethod,omitempty"`
// GatewayType: Indicates whether the device is a gateway.
//
// Possible values:
// "GATEWAY_TYPE_UNSPECIFIED" - If unspecified, the device is
// considered a non-gateway device.
// "GATEWAY" - The device is a gateway.
// "NON_GATEWAY" - The device is not a gateway.
GatewayType string `json:"gatewayType,omitempty"`
// LastAccessedGatewayId: [Output only] The ID of the gateway the device
// accessed most recently.
LastAccessedGatewayId string `json:"lastAccessedGatewayId,omitempty"`
// LastAccessedGatewayTime: [Output only] The most recent time at which
// the device accessed the gateway specified in `last_accessed_gateway`.
LastAccessedGatewayTime string `json:"lastAccessedGatewayTime,omitempty"`
// ForceSendFields is a list of field names (e.g. "GatewayAuthMethod")
// to unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "GatewayAuthMethod") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *GatewayConfig) MarshalJSON() ([]byte, error) {
type NoMethod GatewayConfig
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GetIamPolicyRequest: Request message for `GetIamPolicy` method.
type GetIamPolicyRequest struct {
// Options: OPTIONAL: A `GetPolicyOptions` object for specifying options
// to `GetIamPolicy`.
Options *GetPolicyOptions `json:"options,omitempty"`
// ForceSendFields is a list of field names (e.g. "Options") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Options") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GetIamPolicyRequest) MarshalJSON() ([]byte, error) {
type NoMethod GetIamPolicyRequest
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GetPolicyOptions: Encapsulates settings provided to GetIamPolicy.
type GetPolicyOptions struct {
// RequestedPolicyVersion: Optional. The maximum policy version that
// will be used to format the policy. Valid values are 0, 1, and 3.
// Requests specifying an invalid value will be rejected. Requests for
// policies with any conditional role bindings must specify version 3.
// Policies with no conditional role bindings may specify any valid
// value or leave the field unset. The policy in the response might use
// the policy version that you specified, or it might use a lower policy
// version. For example, if you specify version 3, but the policy has no
// conditional role bindings, the response uses version 1. To learn
// which resources support conditions in their IAM policies, see the IAM
// documentation
// (https://cloud.google.com/iam/help/conditions/resource-policies).
RequestedPolicyVersion int64 `json:"requestedPolicyVersion,omitempty"`
// ForceSendFields is a list of field names (e.g.
// "RequestedPolicyVersion") to unconditionally include in API requests.
// By default, fields with empty or default values are omitted from API
// requests. However, any non-pointer, non-interface field appearing in
// ForceSendFields will be sent to the server regardless of whether the
// field is empty or not. This may be used to include empty fields in
// Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "RequestedPolicyVersion")
// to include in API requests with the JSON null value. By default,
// fields with empty values are omitted from API requests. However, any
// field with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *GetPolicyOptions) MarshalJSON() ([]byte, error) {
type NoMethod GetPolicyOptions
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// HttpConfig: The configuration of the HTTP bridge for a device
// registry.
type HttpConfig struct {
// HttpEnabledState: If enabled, allows devices to use DeviceService via
// the HTTP protocol. Otherwise, any requests to DeviceService will fail
// for this registry.
//
// Possible values:
// "HTTP_STATE_UNSPECIFIED" - No HTTP state specified. If not
// specified, DeviceService will be enabled by default.
// "HTTP_ENABLED" - Enables DeviceService (HTTP) service for the
// registry.
// "HTTP_DISABLED" - Disables DeviceService (HTTP) service for the
// registry.
HttpEnabledState string `json:"httpEnabledState,omitempty"`
// ForceSendFields is a list of field names (e.g. "HttpEnabledState") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "HttpEnabledState") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *HttpConfig) MarshalJSON() ([]byte, error) {
type NoMethod HttpConfig
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)