1 // Copyright 2023 Google LLC. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Code generated file. DO NOT EDIT. 6 7 // Package cloudiot provides access to the Cloud IoT API. 8 // 9 // For product documentation, see: https://cloud.google.com/iot 10 // 11 // # Creating a client 12 // 13 // Usage example: 14 // 15 // import "google.golang.org/api/cloudiot/v1" 16 // ... 17 // ctx := context.Background() 18 // cloudiotService, err := cloudiot.NewService(ctx) 19 // 20 // In this example, Google Application Default Credentials are used for authentication. 21 // 22 // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 23 // 24 // # Other authentication options 25 // 26 // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes: 27 // 28 // cloudiotService, err := cloudiot.NewService(ctx, option.WithScopes(cloudiot.CloudiotScope)) 29 // 30 // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 31 // 32 // cloudiotService, err := cloudiot.NewService(ctx, option.WithAPIKey("AIza...")) 33 // 34 // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 35 // 36 // config := &oauth2.Config{...} 37 // // ... 38 // token, err := config.Exchange(ctx, ...) 39 // cloudiotService, err := cloudiot.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 40 // 41 // See https://godoc.org/google.golang.org/api/option/ for details on options. 42 package cloudiot // import "google.golang.org/api/cloudiot/v1" 43 44 import ( 45 "bytes" 46 "context" 47 "encoding/json" 48 "errors" 49 "fmt" 50 "io" 51 "net/http" 52 "net/url" 53 "strconv" 54 "strings" 55 56 googleapi "google.golang.org/api/googleapi" 57 internal "google.golang.org/api/internal" 58 gensupport "google.golang.org/api/internal/gensupport" 59 option "google.golang.org/api/option" 60 internaloption "google.golang.org/api/option/internaloption" 61 htransport "google.golang.org/api/transport/http" 62 ) 63 64 // Always reference these packages, just in case the auto-generated code 65 // below doesn't. 66 var _ = bytes.NewBuffer 67 var _ = strconv.Itoa 68 var _ = fmt.Sprintf 69 var _ = json.NewDecoder 70 var _ = io.Copy 71 var _ = url.Parse 72 var _ = gensupport.MarshalJSON 73 var _ = googleapi.Version 74 var _ = errors.New 75 var _ = strings.Replace 76 var _ = context.Canceled 77 var _ = internaloption.WithDefaultEndpoint 78 var _ = internal.Version 79 80 const apiId = "cloudiot:v1" 81 const apiName = "cloudiot" 82 const apiVersion = "v1" 83 const basePath = "https://cloudiot.googleapis.com/" 84 const mtlsBasePath = "https://cloudiot.mtls.googleapis.com/" 85 86 // OAuth2 scopes used by this API. 87 const ( 88 // See, edit, configure, and delete your Google Cloud data and see the 89 // email address for your Google Account. 90 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 91 92 // Register and manage devices in the Google Cloud IoT service 93 CloudiotScope = "https://www.googleapis.com/auth/cloudiot" 94 ) 95 96 // NewService creates a new Service. 97 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 98 scopesOption := internaloption.WithDefaultScopes( 99 "https://www.googleapis.com/auth/cloud-platform", 100 "https://www.googleapis.com/auth/cloudiot", 101 ) 102 // NOTE: prepend, so we don't override user-specified scopes. 103 opts = append([]option.ClientOption{scopesOption}, opts...) 104 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 105 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) 106 client, endpoint, err := htransport.NewClient(ctx, opts...) 107 if err != nil { 108 return nil, err 109 } 110 s, err := New(client) 111 if err != nil { 112 return nil, err 113 } 114 if endpoint != "" { 115 s.BasePath = endpoint 116 } 117 return s, nil 118 } 119 120 // New creates a new Service. It uses the provided http.Client for requests. 121 // 122 // Deprecated: please use NewService instead. 123 // To provide a custom HTTP client, use option.WithHTTPClient. 124 // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 125 func New(client *http.Client) (*Service, error) { 126 if client == nil { 127 return nil, errors.New("client is nil") 128 } 129 s := &Service{client: client, BasePath: basePath} 130 s.Projects = NewProjectsService(s) 131 return s, nil 132 } 133 134 type Service struct { 135 client *http.Client 136 BasePath string // API endpoint base URL 137 UserAgent string // optional additional User-Agent fragment 138 139 Projects *ProjectsService 140 } 141 142 func (s *Service) userAgent() string { 143 if s.UserAgent == "" { 144 return googleapi.UserAgent 145 } 146 return googleapi.UserAgent + " " + s.UserAgent 147 } 148 149 func NewProjectsService(s *Service) *ProjectsService { 150 rs := &ProjectsService{s: s} 151 rs.Locations = NewProjectsLocationsService(s) 152 return rs 153 } 154 155 type ProjectsService struct { 156 s *Service 157 158 Locations *ProjectsLocationsService 159 } 160 161 func NewProjectsLocationsService(s *Service) *ProjectsLocationsService { 162 rs := &ProjectsLocationsService{s: s} 163 rs.Registries = NewProjectsLocationsRegistriesService(s) 164 return rs 165 } 166 167 type ProjectsLocationsService struct { 168 s *Service 169 170 Registries *ProjectsLocationsRegistriesService 171 } 172 173 func NewProjectsLocationsRegistriesService(s *Service) *ProjectsLocationsRegistriesService { 174 rs := &ProjectsLocationsRegistriesService{s: s} 175 rs.Devices = NewProjectsLocationsRegistriesDevicesService(s) 176 rs.Groups = NewProjectsLocationsRegistriesGroupsService(s) 177 return rs 178 } 179 180 type ProjectsLocationsRegistriesService struct { 181 s *Service 182 183 Devices *ProjectsLocationsRegistriesDevicesService 184 185 Groups *ProjectsLocationsRegistriesGroupsService 186 } 187 188 func NewProjectsLocationsRegistriesDevicesService(s *Service) *ProjectsLocationsRegistriesDevicesService { 189 rs := &ProjectsLocationsRegistriesDevicesService{s: s} 190 rs.ConfigVersions = NewProjectsLocationsRegistriesDevicesConfigVersionsService(s) 191 rs.States = NewProjectsLocationsRegistriesDevicesStatesService(s) 192 return rs 193 } 194 195 type ProjectsLocationsRegistriesDevicesService struct { 196 s *Service 197 198 ConfigVersions *ProjectsLocationsRegistriesDevicesConfigVersionsService 199 200 States *ProjectsLocationsRegistriesDevicesStatesService 201 } 202 203 func NewProjectsLocationsRegistriesDevicesConfigVersionsService(s *Service) *ProjectsLocationsRegistriesDevicesConfigVersionsService { 204 rs := &ProjectsLocationsRegistriesDevicesConfigVersionsService{s: s} 205 return rs 206 } 207 208 type ProjectsLocationsRegistriesDevicesConfigVersionsService struct { 209 s *Service 210 } 211 212 func NewProjectsLocationsRegistriesDevicesStatesService(s *Service) *ProjectsLocationsRegistriesDevicesStatesService { 213 rs := &ProjectsLocationsRegistriesDevicesStatesService{s: s} 214 return rs 215 } 216 217 type ProjectsLocationsRegistriesDevicesStatesService struct { 218 s *Service 219 } 220 221 func NewProjectsLocationsRegistriesGroupsService(s *Service) *ProjectsLocationsRegistriesGroupsService { 222 rs := &ProjectsLocationsRegistriesGroupsService{s: s} 223 rs.Devices = NewProjectsLocationsRegistriesGroupsDevicesService(s) 224 return rs 225 } 226 227 type ProjectsLocationsRegistriesGroupsService struct { 228 s *Service 229 230 Devices *ProjectsLocationsRegistriesGroupsDevicesService 231 } 232 233 func NewProjectsLocationsRegistriesGroupsDevicesService(s *Service) *ProjectsLocationsRegistriesGroupsDevicesService { 234 rs := &ProjectsLocationsRegistriesGroupsDevicesService{s: s} 235 return rs 236 } 237 238 type ProjectsLocationsRegistriesGroupsDevicesService struct { 239 s *Service 240 } 241 242 // BindDeviceToGatewayRequest: Request for `BindDeviceToGateway`. 243 type BindDeviceToGatewayRequest struct { 244 // DeviceId: Required. The device to associate with the specified 245 // gateway. The value of `device_id` can be either the device numeric ID 246 // or the user-defined device identifier. 247 DeviceId string `json:"deviceId,omitempty"` 248 249 // GatewayId: Required. The value of `gateway_id` can be either the 250 // device numeric ID or the user-defined device identifier. 251 GatewayId string `json:"gatewayId,omitempty"` 252 253 // ForceSendFields is a list of field names (e.g. "DeviceId") to 254 // unconditionally include in API requests. By default, fields with 255 // empty or default values are omitted from API requests. However, any 256 // non-pointer, non-interface field appearing in ForceSendFields will be 257 // sent to the server regardless of whether the field is empty or not. 258 // This may be used to include empty fields in Patch requests. 259 ForceSendFields []string `json:"-"` 260 261 // NullFields is a list of field names (e.g. "DeviceId") to include in 262 // API requests with the JSON null value. By default, fields with empty 263 // values are omitted from API requests. However, any field with an 264 // empty value appearing in NullFields will be sent to the server as 265 // null. It is an error if a field in this list has a non-empty value. 266 // This may be used to include null fields in Patch requests. 267 NullFields []string `json:"-"` 268 } 269 270 func (s *BindDeviceToGatewayRequest) MarshalJSON() ([]byte, error) { 271 type NoMethod BindDeviceToGatewayRequest 272 raw := NoMethod(*s) 273 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 274 } 275 276 // BindDeviceToGatewayResponse: Response for `BindDeviceToGateway`. 277 type BindDeviceToGatewayResponse struct { 278 // ServerResponse contains the HTTP response code and headers from the 279 // server. 280 googleapi.ServerResponse `json:"-"` 281 } 282 283 // Binding: Associates `members`, or principals, with a `role`. 284 type Binding struct { 285 // Condition: The condition that is associated with this binding. If the 286 // condition evaluates to `true`, then this binding applies to the 287 // current request. If the condition evaluates to `false`, then this 288 // binding does not apply to the current request. However, a different 289 // role binding might grant the same role to one or more of the 290 // principals in this binding. To learn which resources support 291 // conditions in their IAM policies, see the IAM documentation 292 // (https://cloud.google.com/iam/help/conditions/resource-policies). 293 Condition *Expr `json:"condition,omitempty"` 294 295 // Members: Specifies the principals requesting access for a Google 296 // Cloud resource. `members` can have the following values: * 297 // `allUsers`: A special identifier that represents anyone who is on the 298 // internet; with or without a Google account. * 299 // `allAuthenticatedUsers`: A special identifier that represents anyone 300 // who is authenticated with a Google account or a service account. Does 301 // not include identities that come from external identity providers 302 // (IdPs) through identity federation. * `user:{emailid}`: An email 303 // address that represents a specific Google account. For example, 304 // `alice@example.com` . * `serviceAccount:{emailid}`: An email address 305 // that represents a Google service account. For example, 306 // `my-other-app@appspot.gserviceaccount.com`. * 307 // `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: 308 // An identifier for a Kubernetes service account 309 // (https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). 310 // For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. 311 // * `group:{emailid}`: An email address that represents a Google group. 312 // For example, `admins@example.com`. * `domain:{domain}`: The G Suite 313 // domain (primary) that represents all the users of that domain. For 314 // example, `google.com` or `example.com`. * 315 // `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus 316 // unique identifier) representing a user that has been recently 317 // deleted. For example, `alice@example.com?uid=123456789012345678901`. 318 // If the user is recovered, this value reverts to `user:{emailid}` and 319 // the recovered user retains the role in the binding. * 320 // `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address 321 // (plus unique identifier) representing a service account that has been 322 // recently deleted. For example, 323 // `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. 324 // If the service account is undeleted, this value reverts to 325 // `serviceAccount:{emailid}` and the undeleted service account retains 326 // the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: 327 // An email address (plus unique identifier) representing a Google group 328 // that has been recently deleted. For example, 329 // `admins@example.com?uid=123456789012345678901`. If the group is 330 // recovered, this value reverts to `group:{emailid}` and the recovered 331 // group retains the role in the binding. 332 Members []string `json:"members,omitempty"` 333 334 // Role: Role that is assigned to the list of `members`, or principals. 335 // For example, `roles/viewer`, `roles/editor`, or `roles/owner`. 336 Role string `json:"role,omitempty"` 337 338 // ForceSendFields is a list of field names (e.g. "Condition") to 339 // unconditionally include in API requests. By default, fields with 340 // empty or default values are omitted from API requests. However, any 341 // non-pointer, non-interface field appearing in ForceSendFields will be 342 // sent to the server regardless of whether the field is empty or not. 343 // This may be used to include empty fields in Patch requests. 344 ForceSendFields []string `json:"-"` 345 346 // NullFields is a list of field names (e.g. "Condition") to include in 347 // API requests with the JSON null value. By default, fields with empty 348 // values are omitted from API requests. However, any field with an 349 // empty value appearing in NullFields will be sent to the server as 350 // null. It is an error if a field in this list has a non-empty value. 351 // This may be used to include null fields in Patch requests. 352 NullFields []string `json:"-"` 353 } 354 355 func (s *Binding) MarshalJSON() ([]byte, error) { 356 type NoMethod Binding 357 raw := NoMethod(*s) 358 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 359 } 360 361 // Device: The device resource. 362 type Device struct { 363 // Blocked: If a device is blocked, connections or requests from this 364 // device will fail. Can be used to temporarily prevent the device from 365 // connecting if, for example, the sensor is generating bad data and 366 // needs maintenance. 367 Blocked bool `json:"blocked,omitempty"` 368 369 // Config: The most recent device configuration, which is eventually 370 // sent from Cloud IoT Core to the device. If not present on creation, 371 // the configuration will be initialized with an empty payload and 372 // version value of `1`. To update this field after creation, use the 373 // `DeviceManager.ModifyCloudToDeviceConfig` method. 374 Config *DeviceConfig `json:"config,omitempty"` 375 376 // Credentials: The credentials used to authenticate this device. To 377 // allow credential rotation without interruption, multiple device 378 // credentials can be bound to this device. No more than 3 credentials 379 // can be bound to a single device at a time. When new credentials are 380 // added to a device, they are verified against the registry 381 // credentials. For details, see the description of the 382 // `DeviceRegistry.credentials` field. 383 Credentials []*DeviceCredential `json:"credentials,omitempty"` 384 385 // GatewayConfig: Gateway-related configuration and state. 386 GatewayConfig *GatewayConfig `json:"gatewayConfig,omitempty"` 387 388 // Id: The user-defined device identifier. The device ID must be unique 389 // within a device registry. 390 Id string `json:"id,omitempty"` 391 392 // LastConfigAckTime: [Output only] The last time a cloud-to-device 393 // config version acknowledgment was received from the device. This 394 // field is only for configurations sent through MQTT. 395 LastConfigAckTime string `json:"lastConfigAckTime,omitempty"` 396 397 // LastConfigSendTime: [Output only] The last time a cloud-to-device 398 // config version was sent to the device. 399 LastConfigSendTime string `json:"lastConfigSendTime,omitempty"` 400 401 // LastErrorStatus: [Output only] The error message of the most recent 402 // error, such as a failure to publish to Cloud Pub/Sub. 403 // 'last_error_time' is the timestamp of this field. If no errors have 404 // occurred, this field has an empty message and the status code 0 == 405 // OK. Otherwise, this field is expected to have a status code other 406 // than OK. 407 LastErrorStatus *Status `json:"lastErrorStatus,omitempty"` 408 409 // LastErrorTime: [Output only] The time the most recent error occurred, 410 // such as a failure to publish to Cloud Pub/Sub. This field is the 411 // timestamp of 'last_error_status'. 412 LastErrorTime string `json:"lastErrorTime,omitempty"` 413 414 // LastEventTime: [Output only] The last time a telemetry event was 415 // received. Timestamps are periodically collected and written to 416 // storage; they may be stale by a few minutes. 417 LastEventTime string `json:"lastEventTime,omitempty"` 418 419 // LastHeartbeatTime: [Output only] The last time an MQTT `PINGREQ` was 420 // received. This field applies only to devices connecting through MQTT. 421 // MQTT clients usually only send `PINGREQ` messages if the connection 422 // is idle, and no other messages have been sent. Timestamps are 423 // periodically collected and written to storage; they may be stale by a 424 // few minutes. 425 LastHeartbeatTime string `json:"lastHeartbeatTime,omitempty"` 426 427 // LastStateTime: [Output only] The last time a state event was 428 // received. Timestamps are periodically collected and written to 429 // storage; they may be stale by a few minutes. 430 LastStateTime string `json:"lastStateTime,omitempty"` 431 432 // LogLevel: **Beta Feature** The logging verbosity for device activity. 433 // If unspecified, DeviceRegistry.log_level will be used. 434 // 435 // Possible values: 436 // "LOG_LEVEL_UNSPECIFIED" - No logging specified. If not specified, 437 // logging will be disabled. 438 // "NONE" - Disables logging. 439 // "ERROR" - Error events will be logged. 440 // "INFO" - Informational events will be logged, such as connections 441 // and disconnections. 442 // "DEBUG" - All events will be logged. 443 LogLevel string `json:"logLevel,omitempty"` 444 445 // Metadata: The metadata key-value pairs assigned to the device. This 446 // metadata is not interpreted or indexed by Cloud IoT Core. It can be 447 // used to add contextual information for the device. Keys must conform 448 // to the regular expression a-zA-Z+ and be less than 128 bytes in 449 // length. Values are free-form strings. Each value must be less than or 450 // equal to 32 KB in size. The total size of all keys and values must be 451 // less than 256 KB, and the maximum number of key-value pairs is 500. 452 Metadata map[string]string `json:"metadata,omitempty"` 453 454 // Name: The resource path name. For example, 455 // `projects/p1/locations/us-central1/registries/registry0/devices/dev0` 456 // or 457 // `projects/p1/locations/us-central1/registries/registry0/devices/{num_i 458 // d}`. When `name` is populated as a response from the service, it 459 // always ends in the device numeric ID. 460 Name string `json:"name,omitempty"` 461 462 // NumId: [Output only] A server-defined unique numeric ID for the 463 // device. This is a more compact way to identify devices, and it is 464 // globally unique. 465 NumId uint64 `json:"numId,omitempty,string"` 466 467 // State: [Output only] The state most recently received from the 468 // device. If no state has been reported, this field is not present. 469 State *DeviceState `json:"state,omitempty"` 470 471 // ServerResponse contains the HTTP response code and headers from the 472 // server. 473 googleapi.ServerResponse `json:"-"` 474 475 // ForceSendFields is a list of field names (e.g. "Blocked") to 476 // unconditionally include in API requests. By default, fields with 477 // empty or default values are omitted from API requests. However, any 478 // non-pointer, non-interface field appearing in ForceSendFields will be 479 // sent to the server regardless of whether the field is empty or not. 480 // This may be used to include empty fields in Patch requests. 481 ForceSendFields []string `json:"-"` 482 483 // NullFields is a list of field names (e.g. "Blocked") to include in 484 // API requests with the JSON null value. By default, fields with empty 485 // values are omitted from API requests. However, any field with an 486 // empty value appearing in NullFields will be sent to the server as 487 // null. It is an error if a field in this list has a non-empty value. 488 // This may be used to include null fields in Patch requests. 489 NullFields []string `json:"-"` 490 } 491 492 func (s *Device) MarshalJSON() ([]byte, error) { 493 type NoMethod Device 494 raw := NoMethod(*s) 495 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 496 } 497 498 // DeviceConfig: The device configuration. Eventually delivered to 499 // devices. 500 type DeviceConfig struct { 501 // BinaryData: The device configuration data. 502 BinaryData string `json:"binaryData,omitempty"` 503 504 // CloudUpdateTime: [Output only] The time at which this configuration 505 // version was updated in Cloud IoT Core. This timestamp is set by the 506 // server. 507 CloudUpdateTime string `json:"cloudUpdateTime,omitempty"` 508 509 // DeviceAckTime: [Output only] The time at which Cloud IoT Core 510 // received the acknowledgment from the device, indicating that the 511 // device has received this configuration version. If this field is not 512 // present, the device has not yet acknowledged that it received this 513 // version. Note that when the config was sent to the device, many 514 // config versions may have been available in Cloud IoT Core while the 515 // device was disconnected, and on connection, only the latest version 516 // is sent to the device. Some versions may never be sent to the device, 517 // and therefore are never acknowledged. This timestamp is set by Cloud 518 // IoT Core. 519 DeviceAckTime string `json:"deviceAckTime,omitempty"` 520 521 // Version: [Output only] The version of this update. The version number 522 // is assigned by the server, and is always greater than 0 after device 523 // creation. The version must be 0 on the `CreateDevice` request if a 524 // `config` is specified; the response of `CreateDevice` will always 525 // have a value of 1. 526 Version int64 `json:"version,omitempty,string"` 527 528 // ServerResponse contains the HTTP response code and headers from the 529 // server. 530 googleapi.ServerResponse `json:"-"` 531 532 // ForceSendFields is a list of field names (e.g. "BinaryData") to 533 // unconditionally include in API requests. By default, fields with 534 // empty or default values are omitted from API requests. However, any 535 // non-pointer, non-interface field appearing in ForceSendFields will be 536 // sent to the server regardless of whether the field is empty or not. 537 // This may be used to include empty fields in Patch requests. 538 ForceSendFields []string `json:"-"` 539 540 // NullFields is a list of field names (e.g. "BinaryData") to include in 541 // API requests with the JSON null value. By default, fields with empty 542 // values are omitted from API requests. However, any field with an 543 // empty value appearing in NullFields will be sent to the server as 544 // null. It is an error if a field in this list has a non-empty value. 545 // This may be used to include null fields in Patch requests. 546 NullFields []string `json:"-"` 547 } 548 549 func (s *DeviceConfig) MarshalJSON() ([]byte, error) { 550 type NoMethod DeviceConfig 551 raw := NoMethod(*s) 552 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 553 } 554 555 // DeviceCredential: A server-stored device credential used for 556 // authentication. 557 type DeviceCredential struct { 558 // ExpirationTime: [Optional] The time at which this credential becomes 559 // invalid. This credential will be ignored for new client 560 // authentication requests after this timestamp; however, it will not be 561 // automatically deleted. 562 ExpirationTime string `json:"expirationTime,omitempty"` 563 564 // PublicKey: A public key used to verify the signature of JSON Web 565 // Tokens (JWTs). When adding a new device credential, either via device 566 // creation or via modifications, this public key credential may be 567 // required to be signed by one of the registry level certificates. More 568 // specifically, if the registry contains at least one certificate, any 569 // new device credential must be signed by one of the registry 570 // certificates. As a result, when the registry contains certificates, 571 // only X.509 certificates are accepted as device credentials. However, 572 // if the registry does not contain a certificate, self-signed 573 // certificates and public keys will be accepted. New device credentials 574 // must be different from every registry-level certificate. 575 PublicKey *PublicKeyCredential `json:"publicKey,omitempty"` 576 577 // ForceSendFields is a list of field names (e.g. "ExpirationTime") to 578 // unconditionally include in API requests. By default, fields with 579 // empty or default values are omitted from API requests. However, any 580 // non-pointer, non-interface field appearing in ForceSendFields will be 581 // sent to the server regardless of whether the field is empty or not. 582 // This may be used to include empty fields in Patch requests. 583 ForceSendFields []string `json:"-"` 584 585 // NullFields is a list of field names (e.g. "ExpirationTime") to 586 // include in API requests with the JSON null value. By default, fields 587 // with empty values are omitted from API requests. However, any field 588 // with an empty value appearing in NullFields will be sent to the 589 // server as null. It is an error if a field in this list has a 590 // non-empty value. This may be used to include null fields in Patch 591 // requests. 592 NullFields []string `json:"-"` 593 } 594 595 func (s *DeviceCredential) MarshalJSON() ([]byte, error) { 596 type NoMethod DeviceCredential 597 raw := NoMethod(*s) 598 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 599 } 600 601 // DeviceRegistry: A container for a group of devices. 602 type DeviceRegistry struct { 603 // Credentials: The credentials used to verify the device credentials. 604 // No more than 10 credentials can be bound to a single registry at a 605 // time. The verification process occurs at the time of device creation 606 // or update. If this field is empty, no verification is performed. 607 // Otherwise, the credentials of a newly created device or added 608 // credentials of an updated device should be signed with one of these 609 // registry credentials. Note, however, that existing devices will never 610 // be affected by modifications to this list of credentials: after a 611 // device has been successfully created in a registry, it should be able 612 // to connect even if its registry credentials are revoked, deleted, or 613 // modified. 614 Credentials []*RegistryCredential `json:"credentials,omitempty"` 615 616 // EventNotificationConfigs: The configuration for notification of 617 // telemetry events received from the device. All telemetry events that 618 // were successfully published by the device and acknowledged by Cloud 619 // IoT Core are guaranteed to be delivered to Cloud Pub/Sub. If multiple 620 // configurations match a message, only the first matching configuration 621 // is used. If you try to publish a device telemetry event using MQTT 622 // without specifying a Cloud Pub/Sub topic for the device's registry, 623 // the connection closes automatically. If you try to do so using an 624 // HTTP connection, an error is returned. Up to 10 configurations may be 625 // provided. 626 EventNotificationConfigs []*EventNotificationConfig `json:"eventNotificationConfigs,omitempty"` 627 628 // HttpConfig: The DeviceService (HTTP) configuration for this device 629 // registry. 630 HttpConfig *HttpConfig `json:"httpConfig,omitempty"` 631 632 // Id: The identifier of this device registry. For example, 633 // `myRegistry`. 634 Id string `json:"id,omitempty"` 635 636 // LogLevel: **Beta Feature** The default logging verbosity for activity 637 // from devices in this registry. The verbosity level can be overridden 638 // by Device.log_level. 639 // 640 // Possible values: 641 // "LOG_LEVEL_UNSPECIFIED" - No logging specified. If not specified, 642 // logging will be disabled. 643 // "NONE" - Disables logging. 644 // "ERROR" - Error events will be logged. 645 // "INFO" - Informational events will be logged, such as connections 646 // and disconnections. 647 // "DEBUG" - All events will be logged. 648 LogLevel string `json:"logLevel,omitempty"` 649 650 // MqttConfig: The MQTT configuration for this device registry. 651 MqttConfig *MqttConfig `json:"mqttConfig,omitempty"` 652 653 // Name: The resource path name. For example, 654 // `projects/example-project/locations/us-central1/registries/my-registry 655 // `. 656 Name string `json:"name,omitempty"` 657 658 // StateNotificationConfig: The configuration for notification of new 659 // states received from the device. State updates are guaranteed to be 660 // stored in the state history, but notifications to Cloud Pub/Sub are 661 // not guaranteed. For example, if permissions are misconfigured or the 662 // specified topic doesn't exist, no notification will be published but 663 // the state will still be stored in Cloud IoT Core. 664 StateNotificationConfig *StateNotificationConfig `json:"stateNotificationConfig,omitempty"` 665 666 // ServerResponse contains the HTTP response code and headers from the 667 // server. 668 googleapi.ServerResponse `json:"-"` 669 670 // ForceSendFields is a list of field names (e.g. "Credentials") to 671 // unconditionally include in API requests. By default, fields with 672 // empty or default values are omitted from API requests. However, any 673 // non-pointer, non-interface field appearing in ForceSendFields will be 674 // sent to the server regardless of whether the field is empty or not. 675 // This may be used to include empty fields in Patch requests. 676 ForceSendFields []string `json:"-"` 677 678 // NullFields is a list of field names (e.g. "Credentials") to include 679 // in API requests with the JSON null value. By default, fields with 680 // empty values are omitted from API requests. However, any field with 681 // an empty value appearing in NullFields will be sent to the server as 682 // null. It is an error if a field in this list has a non-empty value. 683 // This may be used to include null fields in Patch requests. 684 NullFields []string `json:"-"` 685 } 686 687 func (s *DeviceRegistry) MarshalJSON() ([]byte, error) { 688 type NoMethod DeviceRegistry 689 raw := NoMethod(*s) 690 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 691 } 692 693 // DeviceState: The device state, as reported by the device. 694 type DeviceState struct { 695 // BinaryData: The device state data. 696 BinaryData string `json:"binaryData,omitempty"` 697 698 // UpdateTime: [Output only] The time at which this state version was 699 // updated in Cloud IoT Core. 700 UpdateTime string `json:"updateTime,omitempty"` 701 702 // ForceSendFields is a list of field names (e.g. "BinaryData") to 703 // unconditionally include in API requests. By default, fields with 704 // empty or default values are omitted from API requests. However, any 705 // non-pointer, non-interface field appearing in ForceSendFields will be 706 // sent to the server regardless of whether the field is empty or not. 707 // This may be used to include empty fields in Patch requests. 708 ForceSendFields []string `json:"-"` 709 710 // NullFields is a list of field names (e.g. "BinaryData") to include in 711 // API requests with the JSON null value. By default, fields with empty 712 // values are omitted from API requests. However, any field with an 713 // empty value appearing in NullFields will be sent to the server as 714 // null. It is an error if a field in this list has a non-empty value. 715 // This may be used to include null fields in Patch requests. 716 NullFields []string `json:"-"` 717 } 718 719 func (s *DeviceState) MarshalJSON() ([]byte, error) { 720 type NoMethod DeviceState 721 raw := NoMethod(*s) 722 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 723 } 724 725 // Empty: A generic empty message that you can re-use to avoid defining 726 // duplicated empty messages in your APIs. A typical example is to use 727 // it as the request or the response type of an API method. For 728 // instance: service Foo { rpc Bar(google.protobuf.Empty) returns 729 // (google.protobuf.Empty); } 730 type Empty struct { 731 // ServerResponse contains the HTTP response code and headers from the 732 // server. 733 googleapi.ServerResponse `json:"-"` 734 } 735 736 // EventNotificationConfig: The configuration for forwarding telemetry 737 // events. 738 type EventNotificationConfig struct { 739 // PubsubTopicName: A Cloud Pub/Sub topic name. For example, 740 // `projects/myProject/topics/deviceEvents`. 741 PubsubTopicName string `json:"pubsubTopicName,omitempty"` 742 743 // SubfolderMatches: If the subfolder name matches this string exactly, 744 // this configuration will be used. The string must not include the 745 // leading '/' character. If empty, all strings are matched. This field 746 // is used only for telemetry events; subfolders are not supported for 747 // state changes. 748 SubfolderMatches string `json:"subfolderMatches,omitempty"` 749 750 // ForceSendFields is a list of field names (e.g. "PubsubTopicName") to 751 // unconditionally include in API requests. By default, fields with 752 // empty or default values are omitted from API requests. However, any 753 // non-pointer, non-interface field appearing in ForceSendFields will be 754 // sent to the server regardless of whether the field is empty or not. 755 // This may be used to include empty fields in Patch requests. 756 ForceSendFields []string `json:"-"` 757 758 // NullFields is a list of field names (e.g. "PubsubTopicName") to 759 // include in API requests with the JSON null value. By default, fields 760 // with empty values are omitted from API requests. However, any field 761 // with an empty value appearing in NullFields will be sent to the 762 // server as null. It is an error if a field in this list has a 763 // non-empty value. This may be used to include null fields in Patch 764 // requests. 765 NullFields []string `json:"-"` 766 } 767 768 func (s *EventNotificationConfig) MarshalJSON() ([]byte, error) { 769 type NoMethod EventNotificationConfig 770 raw := NoMethod(*s) 771 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 772 } 773 774 // Expr: Represents a textual expression in the Common Expression 775 // Language (CEL) syntax. CEL is a C-like expression language. The 776 // syntax and semantics of CEL are documented at 777 // https://github.com/google/cel-spec. Example (Comparison): title: 778 // "Summary size limit" description: "Determines if a summary is less 779 // than 100 chars" expression: "document.summary.size() < 100" Example 780 // (Equality): title: "Requestor is owner" description: "Determines if 781 // requestor is the document owner" expression: "document.owner == 782 // request.auth.claims.email" Example (Logic): title: "Public documents" 783 // description: "Determine whether the document should be publicly 784 // visible" expression: "document.type != 'private' && document.type != 785 // 'internal'" Example (Data Manipulation): title: "Notification string" 786 // description: "Create a notification string with a timestamp." 787 // expression: "'New message received at ' + 788 // string(document.create_time)" The exact variables and functions that 789 // may be referenced within an expression are determined by the service 790 // that evaluates it. See the service documentation for additional 791 // information. 792 type Expr struct { 793 // Description: Optional. Description of the expression. This is a 794 // longer text which describes the expression, e.g. when hovered over it 795 // in a UI. 796 Description string `json:"description,omitempty"` 797 798 // Expression: Textual representation of an expression in Common 799 // Expression Language syntax. 800 Expression string `json:"expression,omitempty"` 801 802 // Location: Optional. String indicating the location of the expression 803 // for error reporting, e.g. a file name and a position in the file. 804 Location string `json:"location,omitempty"` 805 806 // Title: Optional. Title for the expression, i.e. a short string 807 // describing its purpose. This can be used e.g. in UIs which allow to 808 // enter the expression. 809 Title string `json:"title,omitempty"` 810 811 // ForceSendFields is a list of field names (e.g. "Description") to 812 // unconditionally include in API requests. By default, fields with 813 // empty or default values are omitted from API requests. However, any 814 // non-pointer, non-interface field appearing in ForceSendFields will be 815 // sent to the server regardless of whether the field is empty or not. 816 // This may be used to include empty fields in Patch requests. 817 ForceSendFields []string `json:"-"` 818 819 // NullFields is a list of field names (e.g. "Description") to include 820 // in API requests with the JSON null value. By default, fields with 821 // empty values are omitted from API requests. However, any field with 822 // an empty value appearing in NullFields will be sent to the server as 823 // null. It is an error if a field in this list has a non-empty value. 824 // This may be used to include null fields in Patch requests. 825 NullFields []string `json:"-"` 826 } 827 828 func (s *Expr) MarshalJSON() ([]byte, error) { 829 type NoMethod Expr 830 raw := NoMethod(*s) 831 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 832 } 833 834 // GatewayConfig: Gateway-related configuration and state. 835 type GatewayConfig struct { 836 // GatewayAuthMethod: Indicates how to authorize and/or authenticate 837 // devices to access the gateway. 838 // 839 // Possible values: 840 // "GATEWAY_AUTH_METHOD_UNSPECIFIED" - No authentication/authorization 841 // method specified. No devices are allowed to access the gateway. 842 // "ASSOCIATION_ONLY" - The device is authenticated through the 843 // gateway association only. Device credentials are ignored even if 844 // provided. 845 // "DEVICE_AUTH_TOKEN_ONLY" - The device is authenticated through its 846 // own credentials. Gateway association is not checked. 847 // "ASSOCIATION_AND_DEVICE_AUTH_TOKEN" - The device is authenticated 848 // through both device credentials and gateway association. The device 849 // must be bound to the gateway and must provide its own credentials. 850 GatewayAuthMethod string `json:"gatewayAuthMethod,omitempty"` 851 852 // GatewayType: Indicates whether the device is a gateway. 853 // 854 // Possible values: 855 // "GATEWAY_TYPE_UNSPECIFIED" - If unspecified, the device is 856 // considered a non-gateway device. 857 // "GATEWAY" - The device is a gateway. 858 // "NON_GATEWAY" - The device is not a gateway. 859 GatewayType string `json:"gatewayType,omitempty"` 860 861 // LastAccessedGatewayId: [Output only] The ID of the gateway the device 862 // accessed most recently. 863 LastAccessedGatewayId string `json:"lastAccessedGatewayId,omitempty"` 864 865 // LastAccessedGatewayTime: [Output only] The most recent time at which 866 // the device accessed the gateway specified in `last_accessed_gateway`. 867 LastAccessedGatewayTime string `json:"lastAccessedGatewayTime,omitempty"` 868 869 // ForceSendFields is a list of field names (e.g. "GatewayAuthMethod") 870 // to unconditionally include in API requests. By default, fields with 871 // empty or default values are omitted from API requests. However, any 872 // non-pointer, non-interface field appearing in ForceSendFields will be 873 // sent to the server regardless of whether the field is empty or not. 874 // This may be used to include empty fields in Patch requests. 875 ForceSendFields []string `json:"-"` 876 877 // NullFields is a list of field names (e.g. "GatewayAuthMethod") to 878 // include in API requests with the JSON null value. By default, fields 879 // with empty values are omitted from API requests. However, any field 880 // with an empty value appearing in NullFields will be sent to the 881 // server as null. It is an error if a field in this list has a 882 // non-empty value. This may be used to include null fields in Patch 883 // requests. 884 NullFields []string `json:"-"` 885 } 886 887 func (s *GatewayConfig) MarshalJSON() ([]byte, error) { 888 type NoMethod GatewayConfig 889 raw := NoMethod(*s) 890 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 891 } 892 893 // GetIamPolicyRequest: Request message for `GetIamPolicy` method. 894 type GetIamPolicyRequest struct { 895 // Options: OPTIONAL: A `GetPolicyOptions` object for specifying options 896 // to `GetIamPolicy`. 897 Options *GetPolicyOptions `json:"options,omitempty"` 898 899 // ForceSendFields is a list of field names (e.g. "Options") to 900 // unconditionally include in API requests. By default, fields with 901 // empty or default values are omitted from API requests. However, any 902 // non-pointer, non-interface field appearing in ForceSendFields will be 903 // sent to the server regardless of whether the field is empty or not. 904 // This may be used to include empty fields in Patch requests. 905 ForceSendFields []string `json:"-"` 906 907 // NullFields is a list of field names (e.g. "Options") to include in 908 // API requests with the JSON null value. By default, fields with empty 909 // values are omitted from API requests. However, any field with an 910 // empty value appearing in NullFields will be sent to the server as 911 // null. It is an error if a field in this list has a non-empty value. 912 // This may be used to include null fields in Patch requests. 913 NullFields []string `json:"-"` 914 } 915 916 func (s *GetIamPolicyRequest) MarshalJSON() ([]byte, error) { 917 type NoMethod GetIamPolicyRequest 918 raw := NoMethod(*s) 919 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 920 } 921 922 // GetPolicyOptions: Encapsulates settings provided to GetIamPolicy. 923 type GetPolicyOptions struct { 924 // RequestedPolicyVersion: Optional. The maximum policy version that 925 // will be used to format the policy. Valid values are 0, 1, and 3. 926 // Requests specifying an invalid value will be rejected. Requests for 927 // policies with any conditional role bindings must specify version 3. 928 // Policies with no conditional role bindings may specify any valid 929 // value or leave the field unset. The policy in the response might use 930 // the policy version that you specified, or it might use a lower policy 931 // version. For example, if you specify version 3, but the policy has no 932 // conditional role bindings, the response uses version 1. To learn 933 // which resources support conditions in their IAM policies, see the IAM 934 // documentation 935 // (https://cloud.google.com/iam/help/conditions/resource-policies). 936 RequestedPolicyVersion int64 `json:"requestedPolicyVersion,omitempty"` 937 938 // ForceSendFields is a list of field names (e.g. 939 // "RequestedPolicyVersion") to unconditionally include in API requests. 940 // By default, fields with empty or default values are omitted from API 941 // requests. However, any non-pointer, non-interface field appearing in 942 // ForceSendFields will be sent to the server regardless of whether the 943 // field is empty or not. This may be used to include empty fields in 944 // Patch requests. 945 ForceSendFields []string `json:"-"` 946 947 // NullFields is a list of field names (e.g. "RequestedPolicyVersion") 948 // to include in API requests with the JSON null value. By default, 949 // fields with empty values are omitted from API requests. However, any 950 // field with an empty value appearing in NullFields will be sent to the 951 // server as null. It is an error if a field in this list has a 952 // non-empty value. This may be used to include null fields in Patch 953 // requests. 954 NullFields []string `json:"-"` 955 } 956 957 func (s *GetPolicyOptions) MarshalJSON() ([]byte, error) { 958 type NoMethod GetPolicyOptions 959 raw := NoMethod(*s) 960 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 961 } 962 963 // HttpConfig: The configuration of the HTTP bridge for a device 964 // registry. 965 type HttpConfig struct { 966 // HttpEnabledState: If enabled, allows devices to use DeviceService via 967 // the HTTP protocol. Otherwise, any requests to DeviceService will fail 968 // for this registry. 969 // 970 // Possible values: 971 // "HTTP_STATE_UNSPECIFIED" - No HTTP state specified. If not 972 // specified, DeviceService will be enabled by default. 973 // "HTTP_ENABLED" - Enables DeviceService (HTTP) service for the 974 // registry. 975 // "HTTP_DISABLED" - Disables DeviceService (HTTP) service for the 976 // registry. 977 HttpEnabledState string `json:"httpEnabledState,omitempty"` 978 979 // ForceSendFields is a list of field names (e.g. "HttpEnabledState") to 980 // unconditionally include in API requests. By default, fields with 981 // empty or default values are omitted from API requests. However, any 982 // non-pointer, non-interface field appearing in ForceSendFields will be 983 // sent to the server regardless of whether the field is empty or not. 984 // This may be used to include empty fields in Patch requests. 985 ForceSendFields []string `json:"-"` 986 987 // NullFields is a list of field names (e.g. "HttpEnabledState") to 988 // include in API requests with the JSON null value. By default, fields 989 // with empty values are omitted from API requests. However, any field 990 // with an empty value appearing in NullFields will be sent to the 991 // server as null. It is an error if a field in this list has a 992 // non-empty value. This may be used to include null fields in Patch 993 // requests. 994 NullFields []string `json:"-"` 995 } 996 997 func (s *HttpConfig) MarshalJSON() ([]byte, error) { 998 type NoMethod HttpConfig 999 raw := NoMethod(*s) 1000 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1001 } 1002 1003 // ListDeviceConfigVersionsResponse: Response for 1004 // `ListDeviceConfigVersions`. 1005 type ListDeviceConfigVersionsResponse struct { 1006 // DeviceConfigs: The device configuration for the last few versions. 1007 // Versions are listed in decreasing order, starting from the most 1008 // recent one. 1009 DeviceConfigs []*DeviceConfig `json:"deviceConfigs,omitempty"` 1010 1011 // ServerResponse contains the HTTP response code and headers from the 1012 // server. 1013 googleapi.ServerResponse `json:"-"` 1014 1015 // ForceSendFields is a list of field names (e.g. "DeviceConfigs") to 1016 // unconditionally include in API requests. By default, fields with 1017 // empty or default values are omitted from API requests. However, any 1018 // non-pointer, non-interface field appearing in ForceSendFields will be 1019 // sent to the server regardless of whether the field is empty or not. 1020 // This may be used to include empty fields in Patch requests. 1021 ForceSendFields []string `json:"-"` 1022 1023 // NullFields is a list of field names (e.g. "DeviceConfigs") to include 1024 // in API requests with the JSON null value. By default, fields with 1025 // empty values are omitted from API requests. However, any field with 1026 // an empty value appearing in NullFields will be sent to the server as 1027 // null. It is an error if a field in this list has a non-empty value. 1028 // This may be used to include null fields in Patch requests. 1029 NullFields []string `json:"-"` 1030 } 1031 1032 func (s *ListDeviceConfigVersionsResponse) MarshalJSON() ([]byte, error) { 1033 type NoMethod ListDeviceConfigVersionsResponse 1034 raw := NoMethod(*s) 1035 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1036 } 1037 1038 // ListDeviceRegistriesResponse: Response for `ListDeviceRegistries`. 1039 type ListDeviceRegistriesResponse struct { 1040 // DeviceRegistries: The registries that matched the query. 1041 DeviceRegistries []*DeviceRegistry `json:"deviceRegistries,omitempty"` 1042 1043 // NextPageToken: If not empty, indicates that there may be more 1044 // registries that match the request; this value should be passed in a 1045 // new `ListDeviceRegistriesRequest`. 1046 NextPageToken string `json:"nextPageToken,omitempty"` 1047 1048 // ServerResponse contains the HTTP response code and headers from the 1049 // server. 1050 googleapi.ServerResponse `json:"-"` 1051 1052 // ForceSendFields is a list of field names (e.g. "DeviceRegistries") to 1053 // unconditionally include in API requests. By default, fields with 1054 // empty or default values are omitted from API requests. However, any 1055 // non-pointer, non-interface field appearing in ForceSendFields will be 1056 // sent to the server regardless of whether the field is empty or not. 1057 // This may be used to include empty fields in Patch requests. 1058 ForceSendFields []string `json:"-"` 1059 1060 // NullFields is a list of field names (e.g. "DeviceRegistries") to 1061 // include in API requests with the JSON null value. By default, fields 1062 // with empty values are omitted from API requests. However, any field 1063 // with an empty value appearing in NullFields will be sent to the 1064 // server as null. It is an error if a field in this list has a 1065 // non-empty value. This may be used to include null fields in Patch 1066 // requests. 1067 NullFields []string `json:"-"` 1068 } 1069 1070 func (s *ListDeviceRegistriesResponse) MarshalJSON() ([]byte, error) { 1071 type NoMethod ListDeviceRegistriesResponse 1072 raw := NoMethod(*s) 1073 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1074 } 1075 1076 // ListDeviceStatesResponse: Response for `ListDeviceStates`. 1077 type ListDeviceStatesResponse struct { 1078 // DeviceStates: The last few device states. States are listed in 1079 // descending order of server update time, starting from the most recent 1080 // one. 1081 DeviceStates []*DeviceState `json:"deviceStates,omitempty"` 1082 1083 // ServerResponse contains the HTTP response code and headers from the 1084 // server. 1085 googleapi.ServerResponse `json:"-"` 1086 1087 // ForceSendFields is a list of field names (e.g. "DeviceStates") to 1088 // unconditionally include in API requests. By default, fields with 1089 // empty or default values are omitted from API requests. However, any 1090 // non-pointer, non-interface field appearing in ForceSendFields will be 1091 // sent to the server regardless of whether the field is empty or not. 1092 // This may be used to include empty fields in Patch requests. 1093 ForceSendFields []string `json:"-"` 1094 1095 // NullFields is a list of field names (e.g. "DeviceStates") to include 1096 // in API requests with the JSON null value. By default, fields with 1097 // empty values are omitted from API requests. However, any field with 1098 // an empty value appearing in NullFields will be sent to the server as 1099 // null. It is an error if a field in this list has a non-empty value. 1100 // This may be used to include null fields in Patch requests. 1101 NullFields []string `json:"-"` 1102 } 1103 1104 func (s *ListDeviceStatesResponse) MarshalJSON() ([]byte, error) { 1105 type NoMethod ListDeviceStatesResponse 1106 raw := NoMethod(*s) 1107 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1108 } 1109 1110 // ListDevicesResponse: Response for `ListDevices`. 1111 type ListDevicesResponse struct { 1112 // Devices: The devices that match the request. 1113 Devices []*Device `json:"devices,omitempty"` 1114 1115 // NextPageToken: If not empty, indicates that there may be more devices 1116 // that match the request; this value should be passed in a new 1117 // `ListDevicesRequest`. 1118 NextPageToken string `json:"nextPageToken,omitempty"` 1119 1120 // ServerResponse contains the HTTP response code and headers from the 1121 // server. 1122 googleapi.ServerResponse `json:"-"` 1123 1124 // ForceSendFields is a list of field names (e.g. "Devices") to 1125 // unconditionally include in API requests. By default, fields with 1126 // empty or default values are omitted from API requests. However, any 1127 // non-pointer, non-interface field appearing in ForceSendFields will be 1128 // sent to the server regardless of whether the field is empty or not. 1129 // This may be used to include empty fields in Patch requests. 1130 ForceSendFields []string `json:"-"` 1131 1132 // NullFields is a list of field names (e.g. "Devices") to include in 1133 // API requests with the JSON null value. By default, fields with empty 1134 // values are omitted from API requests. However, any field with an 1135 // empty value appearing in NullFields will be sent to the server as 1136 // null. It is an error if a field in this list has a non-empty value. 1137 // This may be used to include null fields in Patch requests. 1138 NullFields []string `json:"-"` 1139 } 1140 1141 func (s *ListDevicesResponse) MarshalJSON() ([]byte, error) { 1142 type NoMethod ListDevicesResponse 1143 raw := NoMethod(*s) 1144 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1145 } 1146 1147 // ModifyCloudToDeviceConfigRequest: Request for 1148 // `ModifyCloudToDeviceConfig`. 1149 type ModifyCloudToDeviceConfigRequest struct { 1150 // BinaryData: Required. The configuration data for the device. 1151 BinaryData string `json:"binaryData,omitempty"` 1152 1153 // VersionToUpdate: The version number to update. If this value is zero, 1154 // it will not check the version number of the server and will always 1155 // update the current version; otherwise, this update will fail if the 1156 // version number found on the server does not match this version 1157 // number. This is used to support multiple simultaneous updates without 1158 // losing data. 1159 VersionToUpdate int64 `json:"versionToUpdate,omitempty,string"` 1160 1161 // ForceSendFields is a list of field names (e.g. "BinaryData") to 1162 // unconditionally include in API requests. By default, fields with 1163 // empty or default values are omitted from API requests. However, any 1164 // non-pointer, non-interface field appearing in ForceSendFields will be 1165 // sent to the server regardless of whether the field is empty or not. 1166 // This may be used to include empty fields in Patch requests. 1167 ForceSendFields []string `json:"-"` 1168 1169 // NullFields is a list of field names (e.g. "BinaryData") to include in 1170 // API requests with the JSON null value. By default, fields with empty 1171 // values are omitted from API requests. However, any field with an 1172 // empty value appearing in NullFields will be sent to the server as 1173 // null. It is an error if a field in this list has a non-empty value. 1174 // This may be used to include null fields in Patch requests. 1175 NullFields []string `json:"-"` 1176 } 1177 1178 func (s *ModifyCloudToDeviceConfigRequest) MarshalJSON() ([]byte, error) { 1179 type NoMethod ModifyCloudToDeviceConfigRequest 1180 raw := NoMethod(*s) 1181 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1182 } 1183 1184 // MqttConfig: The configuration of MQTT for a device registry. 1185 type MqttConfig struct { 1186 // MqttEnabledState: If enabled, allows connections using the MQTT 1187 // protocol. Otherwise, MQTT connections to this registry will fail. 1188 // 1189 // Possible values: 1190 // "MQTT_STATE_UNSPECIFIED" - No MQTT state specified. If not 1191 // specified, MQTT will be enabled by default. 1192 // "MQTT_ENABLED" - Enables a MQTT connection. 1193 // "MQTT_DISABLED" - Disables a MQTT connection. 1194 MqttEnabledState string `json:"mqttEnabledState,omitempty"` 1195 1196 // ForceSendFields is a list of field names (e.g. "MqttEnabledState") to 1197 // unconditionally include in API requests. By default, fields with 1198 // empty or default values are omitted from API requests. However, any 1199 // non-pointer, non-interface field appearing in ForceSendFields will be 1200 // sent to the server regardless of whether the field is empty or not. 1201 // This may be used to include empty fields in Patch requests. 1202 ForceSendFields []string `json:"-"` 1203 1204 // NullFields is a list of field names (e.g. "MqttEnabledState") to 1205 // include in API requests with the JSON null value. By default, fields 1206 // with empty values are omitted from API requests. However, any field 1207 // with an empty value appearing in NullFields will be sent to the 1208 // server as null. It is an error if a field in this list has a 1209 // non-empty value. This may be used to include null fields in Patch 1210 // requests. 1211 NullFields []string `json:"-"` 1212 } 1213 1214 func (s *MqttConfig) MarshalJSON() ([]byte, error) { 1215 type NoMethod MqttConfig 1216 raw := NoMethod(*s) 1217 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1218 } 1219 1220 // Policy: An Identity and Access Management (IAM) policy, which 1221 // specifies access controls for Google Cloud resources. A `Policy` is a 1222 // collection of `bindings`. A `binding` binds one or more `members`, or 1223 // principals, to a single `role`. Principals can be user accounts, 1224 // service accounts, Google groups, and domains (such as G Suite). A 1225 // `role` is a named list of permissions; each `role` can be an IAM 1226 // predefined role or a user-created custom role. For some types of 1227 // Google Cloud resources, a `binding` can also specify a `condition`, 1228 // which is a logical expression that allows access to a resource only 1229 // if the expression evaluates to `true`. A condition can add 1230 // constraints based on attributes of the request, the resource, or 1231 // both. To learn which resources support conditions in their IAM 1232 // policies, see the IAM documentation 1233 // (https://cloud.google.com/iam/help/conditions/resource-policies). 1234 // **JSON example:** { "bindings": [ { "role": 1235 // "roles/resourcemanager.organizationAdmin", "members": [ 1236 // "user:mike@example.com", "group:admins@example.com", 1237 // "domain:google.com", 1238 // "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { 1239 // "role": "roles/resourcemanager.organizationViewer", "members": [ 1240 // "user:eve@example.com" ], "condition": { "title": "expirable access", 1241 // "description": "Does not grant access after Sep 2020", "expression": 1242 // "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], 1243 // "etag": "BwWWja0YfJA=", "version": 3 } **YAML example:** bindings: - 1244 // members: - user:mike@example.com - group:admins@example.com - 1245 // domain:google.com - 1246 // serviceAccount:my-project-id@appspot.gserviceaccount.com role: 1247 // roles/resourcemanager.organizationAdmin - members: - 1248 // user:eve@example.com role: roles/resourcemanager.organizationViewer 1249 // condition: title: expirable access description: Does not grant access 1250 // after Sep 2020 expression: request.time < 1251 // timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3 1252 // For a description of IAM and its features, see the IAM documentation 1253 // (https://cloud.google.com/iam/docs/). 1254 type Policy struct { 1255 // Bindings: Associates a list of `members`, or principals, with a 1256 // `role`. Optionally, may specify a `condition` that determines how and 1257 // when the `bindings` are applied. Each of the `bindings` must contain 1258 // at least one principal. The `bindings` in a `Policy` can refer to up 1259 // to 1,500 principals; up to 250 of these principals can be Google 1260 // groups. Each occurrence of a principal counts towards these limits. 1261 // For example, if the `bindings` grant 50 different roles to 1262 // `user:alice@example.com`, and not to any other principal, then you 1263 // can add another 1,450 principals to the `bindings` in the `Policy`. 1264 Bindings []*Binding `json:"bindings,omitempty"` 1265 1266 // Etag: `etag` is used for optimistic concurrency control as a way to 1267 // help prevent simultaneous updates of a policy from overwriting each 1268 // other. It is strongly suggested that systems make use of the `etag` 1269 // in the read-modify-write cycle to perform policy updates in order to 1270 // avoid race conditions: An `etag` is returned in the response to 1271 // `getIamPolicy`, and systems are expected to put that etag in the 1272 // request to `setIamPolicy` to ensure that their change will be applied 1273 // to the same version of the policy. **Important:** If you use IAM 1274 // Conditions, you must include the `etag` field whenever you call 1275 // `setIamPolicy`. If you omit this field, then IAM allows you to 1276 // overwrite a version `3` policy with a version `1` policy, and all of 1277 // the conditions in the version `3` policy are lost. 1278 Etag string `json:"etag,omitempty"` 1279 1280 // Version: Specifies the format of the policy. Valid values are `0`, 1281 // `1`, and `3`. Requests that specify an invalid value are rejected. 1282 // Any operation that affects conditional role bindings must specify 1283 // version `3`. This requirement applies to the following operations: * 1284 // Getting a policy that includes a conditional role binding * Adding a 1285 // conditional role binding to a policy * Changing a conditional role 1286 // binding in a policy * Removing any role binding, with or without a 1287 // condition, from a policy that includes conditions **Important:** If 1288 // you use IAM Conditions, you must include the `etag` field whenever 1289 // you call `setIamPolicy`. If you omit this field, then IAM allows you 1290 // to overwrite a version `3` policy with a version `1` policy, and all 1291 // of the conditions in the version `3` policy are lost. If a policy 1292 // does not include any conditions, operations on that policy may 1293 // specify any valid version or leave the field unset. To learn which 1294 // resources support conditions in their IAM policies, see the IAM 1295 // documentation 1296 // (https://cloud.google.com/iam/help/conditions/resource-policies). 1297 Version int64 `json:"version,omitempty"` 1298 1299 // ServerResponse contains the HTTP response code and headers from the 1300 // server. 1301 googleapi.ServerResponse `json:"-"` 1302 1303 // ForceSendFields is a list of field names (e.g. "Bindings") to 1304 // unconditionally include in API requests. By default, fields with 1305 // empty or default values are omitted from API requests. However, any 1306 // non-pointer, non-interface field appearing in ForceSendFields will be 1307 // sent to the server regardless of whether the field is empty or not. 1308 // This may be used to include empty fields in Patch requests. 1309 ForceSendFields []string `json:"-"` 1310 1311 // NullFields is a list of field names (e.g. "Bindings") to include in 1312 // API requests with the JSON null value. By default, fields with empty 1313 // values are omitted from API requests. However, any field with an 1314 // empty value appearing in NullFields will be sent to the server as 1315 // null. It is an error if a field in this list has a non-empty value. 1316 // This may be used to include null fields in Patch requests. 1317 NullFields []string `json:"-"` 1318 } 1319 1320 func (s *Policy) MarshalJSON() ([]byte, error) { 1321 type NoMethod Policy 1322 raw := NoMethod(*s) 1323 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1324 } 1325 1326 // PublicKeyCertificate: A public key certificate format and data. 1327 type PublicKeyCertificate struct { 1328 // Certificate: The certificate data. 1329 Certificate string `json:"certificate,omitempty"` 1330 1331 // Format: The certificate format. 1332 // 1333 // Possible values: 1334 // "UNSPECIFIED_PUBLIC_KEY_CERTIFICATE_FORMAT" - The format has not 1335 // been specified. This is an invalid default value and must not be 1336 // used. 1337 // "X509_CERTIFICATE_PEM" - An X.509v3 certificate 1338 // ([RFC5280](https://www.ietf.org/rfc/rfc5280.txt)), encoded in base64, 1339 // and wrapped by `-----BEGIN CERTIFICATE-----` and `-----END 1340 // CERTIFICATE-----`. 1341 Format string `json:"format,omitempty"` 1342 1343 // X509Details: [Output only] The certificate details. Used only for 1344 // X.509 certificates. 1345 X509Details *X509CertificateDetails `json:"x509Details,omitempty"` 1346 1347 // ForceSendFields is a list of field names (e.g. "Certificate") to 1348 // unconditionally include in API requests. By default, fields with 1349 // empty or default values are omitted from API requests. However, any 1350 // non-pointer, non-interface field appearing in ForceSendFields will be 1351 // sent to the server regardless of whether the field is empty or not. 1352 // This may be used to include empty fields in Patch requests. 1353 ForceSendFields []string `json:"-"` 1354 1355 // NullFields is a list of field names (e.g. "Certificate") to include 1356 // in API requests with the JSON null value. By default, fields with 1357 // empty values are omitted from API requests. However, any field with 1358 // an empty value appearing in NullFields will be sent to the server as 1359 // null. It is an error if a field in this list has a non-empty value. 1360 // This may be used to include null fields in Patch requests. 1361 NullFields []string `json:"-"` 1362 } 1363 1364 func (s *PublicKeyCertificate) MarshalJSON() ([]byte, error) { 1365 type NoMethod PublicKeyCertificate 1366 raw := NoMethod(*s) 1367 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1368 } 1369 1370 // PublicKeyCredential: A public key format and data. 1371 type PublicKeyCredential struct { 1372 // Format: The format of the key. 1373 // 1374 // Possible values: 1375 // "UNSPECIFIED_PUBLIC_KEY_FORMAT" - The format has not been 1376 // specified. This is an invalid default value and must not be used. 1377 // "RSA_PEM" - An RSA public key encoded in base64, and wrapped by 1378 // `-----BEGIN PUBLIC KEY-----` and `-----END PUBLIC KEY-----`. This can 1379 // be used to verify `RS256` signatures in JWT tokens ([RFC7518]( 1380 // https://www.ietf.org/rfc/rfc7518.txt)). 1381 // "RSA_X509_PEM" - As RSA_PEM, but wrapped in an X.509v3 certificate 1382 // ([RFC5280]( https://www.ietf.org/rfc/rfc5280.txt)), encoded in 1383 // base64, and wrapped by `-----BEGIN CERTIFICATE-----` and `-----END 1384 // CERTIFICATE-----`. 1385 // "ES256_PEM" - Public key for the ECDSA algorithm using P-256 and 1386 // SHA-256, encoded in base64, and wrapped by `-----BEGIN PUBLIC 1387 // KEY-----` and `-----END PUBLIC KEY-----`. This can be used to verify 1388 // JWT tokens with the `ES256` algorithm 1389 // ([RFC7518](https://www.ietf.org/rfc/rfc7518.txt)). This curve is 1390 // defined in [OpenSSL](https://www.openssl.org/) as the `prime256v1` 1391 // curve. 1392 // "ES256_X509_PEM" - As ES256_PEM, but wrapped in an X.509v3 1393 // certificate ([RFC5280]( https://www.ietf.org/rfc/rfc5280.txt)), 1394 // encoded in base64, and wrapped by `-----BEGIN CERTIFICATE-----` and 1395 // `-----END CERTIFICATE-----`. 1396 Format string `json:"format,omitempty"` 1397 1398 // Key: The key data. 1399 Key string `json:"key,omitempty"` 1400 1401 // ForceSendFields is a list of field names (e.g. "Format") to 1402 // unconditionally include in API requests. By default, fields with 1403 // empty or default values are omitted from API requests. However, any 1404 // non-pointer, non-interface field appearing in ForceSendFields will be 1405 // sent to the server regardless of whether the field is empty or not. 1406 // This may be used to include empty fields in Patch requests. 1407 ForceSendFields []string `json:"-"` 1408 1409 // NullFields is a list of field names (e.g. "Format") to include in API 1410 // requests with the JSON null value. By default, fields with empty 1411 // values are omitted from API requests. However, any field with an 1412 // empty value appearing in NullFields will be sent to the server as 1413 // null. It is an error if a field in this list has a non-empty value. 1414 // This may be used to include null fields in Patch requests. 1415 NullFields []string `json:"-"` 1416 } 1417 1418 func (s *PublicKeyCredential) MarshalJSON() ([]byte, error) { 1419 type NoMethod PublicKeyCredential 1420 raw := NoMethod(*s) 1421 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1422 } 1423 1424 // RegistryCredential: A server-stored registry credential used to 1425 // validate device credentials. 1426 type RegistryCredential struct { 1427 // PublicKeyCertificate: A public key certificate used to verify the 1428 // device credentials. 1429 PublicKeyCertificate *PublicKeyCertificate `json:"publicKeyCertificate,omitempty"` 1430 1431 // ForceSendFields is a list of field names (e.g. 1432 // "PublicKeyCertificate") to unconditionally include in API requests. 1433 // By default, fields with empty or default values are omitted from API 1434 // requests. However, any non-pointer, non-interface field appearing in 1435 // ForceSendFields will be sent to the server regardless of whether the 1436 // field is empty or not. This may be used to include empty fields in 1437 // Patch requests. 1438 ForceSendFields []string `json:"-"` 1439 1440 // NullFields is a list of field names (e.g. "PublicKeyCertificate") to 1441 // include in API requests with the JSON null value. By default, fields 1442 // with empty values are omitted from API requests. However, any field 1443 // with an empty value appearing in NullFields will be sent to the 1444 // server as null. It is an error if a field in this list has a 1445 // non-empty value. This may be used to include null fields in Patch 1446 // requests. 1447 NullFields []string `json:"-"` 1448 } 1449 1450 func (s *RegistryCredential) MarshalJSON() ([]byte, error) { 1451 type NoMethod RegistryCredential 1452 raw := NoMethod(*s) 1453 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1454 } 1455 1456 // SendCommandToDeviceRequest: Request for `SendCommandToDevice`. 1457 type SendCommandToDeviceRequest struct { 1458 // BinaryData: Required. The command data to send to the device. 1459 BinaryData string `json:"binaryData,omitempty"` 1460 1461 // Subfolder: Optional subfolder for the command. If empty, the command 1462 // will be delivered to the /devices/{device-id}/commands topic, 1463 // otherwise it will be delivered to the 1464 // /devices/{device-id}/commands/{subfolder} topic. Multi-level 1465 // subfolders are allowed. This field must not have more than 256 1466 // characters, and must not contain any MQTT wildcards ("+" or "#") or 1467 // null characters. 1468 Subfolder string `json:"subfolder,omitempty"` 1469 1470 // ForceSendFields is a list of field names (e.g. "BinaryData") to 1471 // unconditionally include in API requests. By default, fields with 1472 // empty or default values are omitted from API requests. However, any 1473 // non-pointer, non-interface field appearing in ForceSendFields will be 1474 // sent to the server regardless of whether the field is empty or not. 1475 // This may be used to include empty fields in Patch requests. 1476 ForceSendFields []string `json:"-"` 1477 1478 // NullFields is a list of field names (e.g. "BinaryData") to include in 1479 // API requests with the JSON null value. By default, fields with empty 1480 // values are omitted from API requests. However, any field with an 1481 // empty value appearing in NullFields will be sent to the server as 1482 // null. It is an error if a field in this list has a non-empty value. 1483 // This may be used to include null fields in Patch requests. 1484 NullFields []string `json:"-"` 1485 } 1486 1487 func (s *SendCommandToDeviceRequest) MarshalJSON() ([]byte, error) { 1488 type NoMethod SendCommandToDeviceRequest 1489 raw := NoMethod(*s) 1490 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1491 } 1492 1493 // SendCommandToDeviceResponse: Response for `SendCommandToDevice`. 1494 type SendCommandToDeviceResponse struct { 1495 // ServerResponse contains the HTTP response code and headers from the 1496 // server. 1497 googleapi.ServerResponse `json:"-"` 1498 } 1499 1500 // SetIamPolicyRequest: Request message for `SetIamPolicy` method. 1501 type SetIamPolicyRequest struct { 1502 // Policy: REQUIRED: The complete policy to be applied to the 1503 // `resource`. The size of the policy is limited to a few 10s of KB. An 1504 // empty policy is a valid policy but certain Google Cloud services 1505 // (such as Projects) might reject them. 1506 Policy *Policy `json:"policy,omitempty"` 1507 1508 // ForceSendFields is a list of field names (e.g. "Policy") to 1509 // unconditionally include in API requests. By default, fields with 1510 // empty or default values are omitted from API requests. However, any 1511 // non-pointer, non-interface field appearing in ForceSendFields will be 1512 // sent to the server regardless of whether the field is empty or not. 1513 // This may be used to include empty fields in Patch requests. 1514 ForceSendFields []string `json:"-"` 1515 1516 // NullFields is a list of field names (e.g. "Policy") to include in API 1517 // requests with the JSON null value. By default, fields with empty 1518 // values are omitted from API requests. However, any field with an 1519 // empty value appearing in NullFields will be sent to the server as 1520 // null. It is an error if a field in this list has a non-empty value. 1521 // This may be used to include null fields in Patch requests. 1522 NullFields []string `json:"-"` 1523 } 1524 1525 func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) { 1526 type NoMethod SetIamPolicyRequest 1527 raw := NoMethod(*s) 1528 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1529 } 1530 1531 // StateNotificationConfig: The configuration for notification of new 1532 // states received from the device. 1533 type StateNotificationConfig struct { 1534 // PubsubTopicName: A Cloud Pub/Sub topic name. For example, 1535 // `projects/myProject/topics/deviceEvents`. 1536 PubsubTopicName string `json:"pubsubTopicName,omitempty"` 1537 1538 // ForceSendFields is a list of field names (e.g. "PubsubTopicName") to 1539 // unconditionally include in API requests. By default, fields with 1540 // empty or default values are omitted from API requests. However, any 1541 // non-pointer, non-interface field appearing in ForceSendFields will be 1542 // sent to the server regardless of whether the field is empty or not. 1543 // This may be used to include empty fields in Patch requests. 1544 ForceSendFields []string `json:"-"` 1545 1546 // NullFields is a list of field names (e.g. "PubsubTopicName") to 1547 // include in API requests with the JSON null value. By default, fields 1548 // with empty values are omitted from API requests. However, any field 1549 // with an empty value appearing in NullFields will be sent to the 1550 // server as null. It is an error if a field in this list has a 1551 // non-empty value. This may be used to include null fields in Patch 1552 // requests. 1553 NullFields []string `json:"-"` 1554 } 1555 1556 func (s *StateNotificationConfig) MarshalJSON() ([]byte, error) { 1557 type NoMethod StateNotificationConfig 1558 raw := NoMethod(*s) 1559 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1560 } 1561 1562 // Status: The `Status` type defines a logical error model that is 1563 // suitable for different programming environments, including REST APIs 1564 // and RPC APIs. It is used by gRPC (https://github.com/grpc). Each 1565 // `Status` message contains three pieces of data: error code, error 1566 // message, and error details. You can find out more about this error 1567 // model and how to work with it in the API Design Guide 1568 // (https://cloud.google.com/apis/design/errors). 1569 type Status struct { 1570 // Code: The status code, which should be an enum value of 1571 // google.rpc.Code. 1572 Code int64 `json:"code,omitempty"` 1573 1574 // Details: A list of messages that carry the error details. There is a 1575 // common set of message types for APIs to use. 1576 Details []googleapi.RawMessage `json:"details,omitempty"` 1577 1578 // Message: A developer-facing error message, which should be in 1579 // English. Any user-facing error message should be localized and sent 1580 // in the google.rpc.Status.details field, or localized by the client. 1581 Message string `json:"message,omitempty"` 1582 1583 // ForceSendFields is a list of field names (e.g. "Code") to 1584 // unconditionally include in API requests. By default, fields with 1585 // empty or default values are omitted from API requests. However, any 1586 // non-pointer, non-interface field appearing in ForceSendFields will be 1587 // sent to the server regardless of whether the field is empty or not. 1588 // This may be used to include empty fields in Patch requests. 1589 ForceSendFields []string `json:"-"` 1590 1591 // NullFields is a list of field names (e.g. "Code") to include in API 1592 // requests with the JSON null value. By default, fields with empty 1593 // values are omitted from API requests. However, any field with an 1594 // empty value appearing in NullFields will be sent to the server as 1595 // null. It is an error if a field in this list has a non-empty value. 1596 // This may be used to include null fields in Patch requests. 1597 NullFields []string `json:"-"` 1598 } 1599 1600 func (s *Status) MarshalJSON() ([]byte, error) { 1601 type NoMethod Status 1602 raw := NoMethod(*s) 1603 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1604 } 1605 1606 // TestIamPermissionsRequest: Request message for `TestIamPermissions` 1607 // method. 1608 type TestIamPermissionsRequest struct { 1609 // Permissions: The set of permissions to check for the `resource`. 1610 // Permissions with wildcards (such as `*` or `storage.*`) are not 1611 // allowed. For more information see IAM Overview 1612 // (https://cloud.google.com/iam/docs/overview#permissions). 1613 Permissions []string `json:"permissions,omitempty"` 1614 1615 // ForceSendFields is a list of field names (e.g. "Permissions") to 1616 // unconditionally include in API requests. By default, fields with 1617 // empty or default values are omitted from API requests. However, any 1618 // non-pointer, non-interface field appearing in ForceSendFields will be 1619 // sent to the server regardless of whether the field is empty or not. 1620 // This may be used to include empty fields in Patch requests. 1621 ForceSendFields []string `json:"-"` 1622 1623 // NullFields is a list of field names (e.g. "Permissions") to include 1624 // in API requests with the JSON null value. By default, fields with 1625 // empty values are omitted from API requests. However, any field with 1626 // an empty value appearing in NullFields will be sent to the server as 1627 // null. It is an error if a field in this list has a non-empty value. 1628 // This may be used to include null fields in Patch requests. 1629 NullFields []string `json:"-"` 1630 } 1631 1632 func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) { 1633 type NoMethod TestIamPermissionsRequest 1634 raw := NoMethod(*s) 1635 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1636 } 1637 1638 // TestIamPermissionsResponse: Response message for `TestIamPermissions` 1639 // method. 1640 type TestIamPermissionsResponse struct { 1641 // Permissions: A subset of `TestPermissionsRequest.permissions` that 1642 // the caller is allowed. 1643 Permissions []string `json:"permissions,omitempty"` 1644 1645 // ServerResponse contains the HTTP response code and headers from the 1646 // server. 1647 googleapi.ServerResponse `json:"-"` 1648 1649 // ForceSendFields is a list of field names (e.g. "Permissions") to 1650 // unconditionally include in API requests. By default, fields with 1651 // empty or default values are omitted from API requests. However, any 1652 // non-pointer, non-interface field appearing in ForceSendFields will be 1653 // sent to the server regardless of whether the field is empty or not. 1654 // This may be used to include empty fields in Patch requests. 1655 ForceSendFields []string `json:"-"` 1656 1657 // NullFields is a list of field names (e.g. "Permissions") to include 1658 // in API requests with the JSON null value. By default, fields with 1659 // empty values are omitted from API requests. However, any field with 1660 // an empty value appearing in NullFields will be sent to the server as 1661 // null. It is an error if a field in this list has a non-empty value. 1662 // This may be used to include null fields in Patch requests. 1663 NullFields []string `json:"-"` 1664 } 1665 1666 func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) { 1667 type NoMethod TestIamPermissionsResponse 1668 raw := NoMethod(*s) 1669 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1670 } 1671 1672 // UnbindDeviceFromGatewayRequest: Request for 1673 // `UnbindDeviceFromGateway`. 1674 type UnbindDeviceFromGatewayRequest struct { 1675 // DeviceId: Required. The device to disassociate from the specified 1676 // gateway. The value of `device_id` can be either the device numeric ID 1677 // or the user-defined device identifier. 1678 DeviceId string `json:"deviceId,omitempty"` 1679 1680 // GatewayId: Required. The value of `gateway_id` can be either the 1681 // device numeric ID or the user-defined device identifier. 1682 GatewayId string `json:"gatewayId,omitempty"` 1683 1684 // ForceSendFields is a list of field names (e.g. "DeviceId") to 1685 // unconditionally include in API requests. By default, fields with 1686 // empty or default values are omitted from API requests. However, any 1687 // non-pointer, non-interface field appearing in ForceSendFields will be 1688 // sent to the server regardless of whether the field is empty or not. 1689 // This may be used to include empty fields in Patch requests. 1690 ForceSendFields []string `json:"-"` 1691 1692 // NullFields is a list of field names (e.g. "DeviceId") to include in 1693 // API requests with the JSON null value. By default, fields with empty 1694 // values are omitted from API requests. However, any field with an 1695 // empty value appearing in NullFields will be sent to the server as 1696 // null. It is an error if a field in this list has a non-empty value. 1697 // This may be used to include null fields in Patch requests. 1698 NullFields []string `json:"-"` 1699 } 1700 1701 func (s *UnbindDeviceFromGatewayRequest) MarshalJSON() ([]byte, error) { 1702 type NoMethod UnbindDeviceFromGatewayRequest 1703 raw := NoMethod(*s) 1704 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1705 } 1706 1707 // UnbindDeviceFromGatewayResponse: Response for 1708 // `UnbindDeviceFromGateway`. 1709 type UnbindDeviceFromGatewayResponse struct { 1710 // ServerResponse contains the HTTP response code and headers from the 1711 // server. 1712 googleapi.ServerResponse `json:"-"` 1713 } 1714 1715 // X509CertificateDetails: Details of an X.509 certificate. For 1716 // informational purposes only. 1717 type X509CertificateDetails struct { 1718 // ExpiryTime: The time the certificate becomes invalid. 1719 ExpiryTime string `json:"expiryTime,omitempty"` 1720 1721 // Issuer: The entity that signed the certificate. 1722 Issuer string `json:"issuer,omitempty"` 1723 1724 // PublicKeyType: The type of public key in the certificate. 1725 PublicKeyType string `json:"publicKeyType,omitempty"` 1726 1727 // SignatureAlgorithm: The algorithm used to sign the certificate. 1728 SignatureAlgorithm string `json:"signatureAlgorithm,omitempty"` 1729 1730 // StartTime: The time the certificate becomes valid. 1731 StartTime string `json:"startTime,omitempty"` 1732 1733 // Subject: The entity the certificate and public key belong to. 1734 Subject string `json:"subject,omitempty"` 1735 1736 // ForceSendFields is a list of field names (e.g. "ExpiryTime") to 1737 // unconditionally include in API requests. By default, fields with 1738 // empty or default values are omitted from API requests. However, any 1739 // non-pointer, non-interface field appearing in ForceSendFields will be 1740 // sent to the server regardless of whether the field is empty or not. 1741 // This may be used to include empty fields in Patch requests. 1742 ForceSendFields []string `json:"-"` 1743 1744 // NullFields is a list of field names (e.g. "ExpiryTime") to include in 1745 // API requests with the JSON null value. By default, fields with empty 1746 // values are omitted from API requests. However, any field with an 1747 // empty value appearing in NullFields will be sent to the server as 1748 // null. It is an error if a field in this list has a non-empty value. 1749 // This may be used to include null fields in Patch requests. 1750 NullFields []string `json:"-"` 1751 } 1752 1753 func (s *X509CertificateDetails) MarshalJSON() ([]byte, error) { 1754 type NoMethod X509CertificateDetails 1755 raw := NoMethod(*s) 1756 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1757 } 1758 1759 // method id "cloudiot.projects.locations.registries.bindDeviceToGateway": 1760 1761 type ProjectsLocationsRegistriesBindDeviceToGatewayCall struct { 1762 s *Service 1763 parent string 1764 binddevicetogatewayrequest *BindDeviceToGatewayRequest 1765 urlParams_ gensupport.URLParams 1766 ctx_ context.Context 1767 header_ http.Header 1768 } 1769 1770 // BindDeviceToGateway: Associates the device with the gateway. 1771 // 1772 // - parent: The name of the registry. For example, 1773 // `projects/example-project/locations/us-central1/registries/my-regist 1774 // ry`. 1775 func (r *ProjectsLocationsRegistriesService) BindDeviceToGateway(parent string, binddevicetogatewayrequest *BindDeviceToGatewayRequest) *ProjectsLocationsRegistriesBindDeviceToGatewayCall { 1776 c := &ProjectsLocationsRegistriesBindDeviceToGatewayCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1777 c.parent = parent 1778 c.binddevicetogatewayrequest = binddevicetogatewayrequest 1779 return c 1780 } 1781 1782 // Fields allows partial responses to be retrieved. See 1783 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1784 // for more information. 1785 func (c *ProjectsLocationsRegistriesBindDeviceToGatewayCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesBindDeviceToGatewayCall { 1786 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1787 return c 1788 } 1789 1790 // Context sets the context to be used in this call's Do method. Any 1791 // pending HTTP request will be aborted if the provided context is 1792 // canceled. 1793 func (c *ProjectsLocationsRegistriesBindDeviceToGatewayCall) Context(ctx context.Context) *ProjectsLocationsRegistriesBindDeviceToGatewayCall { 1794 c.ctx_ = ctx 1795 return c 1796 } 1797 1798 // Header returns an http.Header that can be modified by the caller to 1799 // add HTTP headers to the request. 1800 func (c *ProjectsLocationsRegistriesBindDeviceToGatewayCall) Header() http.Header { 1801 if c.header_ == nil { 1802 c.header_ = make(http.Header) 1803 } 1804 return c.header_ 1805 } 1806 1807 func (c *ProjectsLocationsRegistriesBindDeviceToGatewayCall) doRequest(alt string) (*http.Response, error) { 1808 reqHeaders := make(http.Header) 1809 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 1810 for k, v := range c.header_ { 1811 reqHeaders[k] = v 1812 } 1813 reqHeaders.Set("User-Agent", c.s.userAgent()) 1814 var body io.Reader = nil 1815 body, err := googleapi.WithoutDataWrapper.JSONReader(c.binddevicetogatewayrequest) 1816 if err != nil { 1817 return nil, err 1818 } 1819 reqHeaders.Set("Content-Type", "application/json") 1820 c.urlParams_.Set("alt", alt) 1821 c.urlParams_.Set("prettyPrint", "false") 1822 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}:bindDeviceToGateway") 1823 urls += "?" + c.urlParams_.Encode() 1824 req, err := http.NewRequest("POST", urls, body) 1825 if err != nil { 1826 return nil, err 1827 } 1828 req.Header = reqHeaders 1829 googleapi.Expand(req.URL, map[string]string{ 1830 "parent": c.parent, 1831 }) 1832 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1833 } 1834 1835 // Do executes the "cloudiot.projects.locations.registries.bindDeviceToGateway" call. 1836 // Exactly one of *BindDeviceToGatewayResponse or error will be non-nil. 1837 // Any non-2xx status code is an error. Response headers are in either 1838 // *BindDeviceToGatewayResponse.ServerResponse.Header or (if a response 1839 // was returned at all) in error.(*googleapi.Error).Header. Use 1840 // googleapi.IsNotModified to check whether the returned error was 1841 // because http.StatusNotModified was returned. 1842 func (c *ProjectsLocationsRegistriesBindDeviceToGatewayCall) Do(opts ...googleapi.CallOption) (*BindDeviceToGatewayResponse, error) { 1843 gensupport.SetOptions(c.urlParams_, opts...) 1844 res, err := c.doRequest("json") 1845 if res != nil && res.StatusCode == http.StatusNotModified { 1846 if res.Body != nil { 1847 res.Body.Close() 1848 } 1849 return nil, gensupport.WrapError(&googleapi.Error{ 1850 Code: res.StatusCode, 1851 Header: res.Header, 1852 }) 1853 } 1854 if err != nil { 1855 return nil, err 1856 } 1857 defer googleapi.CloseBody(res) 1858 if err := googleapi.CheckResponse(res); err != nil { 1859 return nil, gensupport.WrapError(err) 1860 } 1861 ret := &BindDeviceToGatewayResponse{ 1862 ServerResponse: googleapi.ServerResponse{ 1863 Header: res.Header, 1864 HTTPStatusCode: res.StatusCode, 1865 }, 1866 } 1867 target := &ret 1868 if err := gensupport.DecodeResponse(target, res); err != nil { 1869 return nil, err 1870 } 1871 return ret, nil 1872 // { 1873 // "description": "Associates the device with the gateway.", 1874 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}:bindDeviceToGateway", 1875 // "httpMethod": "POST", 1876 // "id": "cloudiot.projects.locations.registries.bindDeviceToGateway", 1877 // "parameterOrder": [ 1878 // "parent" 1879 // ], 1880 // "parameters": { 1881 // "parent": { 1882 // "description": "Required. The name of the registry. For example, `projects/example-project/locations/us-central1/registries/my-registry`.", 1883 // "location": "path", 1884 // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$", 1885 // "required": true, 1886 // "type": "string" 1887 // } 1888 // }, 1889 // "path": "v1/{+parent}:bindDeviceToGateway", 1890 // "request": { 1891 // "$ref": "BindDeviceToGatewayRequest" 1892 // }, 1893 // "response": { 1894 // "$ref": "BindDeviceToGatewayResponse" 1895 // }, 1896 // "scopes": [ 1897 // "https://www.googleapis.com/auth/cloud-platform", 1898 // "https://www.googleapis.com/auth/cloudiot" 1899 // ] 1900 // } 1901 1902 } 1903 1904 // method id "cloudiot.projects.locations.registries.create": 1905 1906 type ProjectsLocationsRegistriesCreateCall struct { 1907 s *Service 1908 parent string 1909 deviceregistry *DeviceRegistry 1910 urlParams_ gensupport.URLParams 1911 ctx_ context.Context 1912 header_ http.Header 1913 } 1914 1915 // Create: Creates a device registry that contains devices. 1916 // 1917 // - parent: The project and cloud region where this device registry 1918 // must be created. For example, 1919 // `projects/example-project/locations/us-central1`. 1920 func (r *ProjectsLocationsRegistriesService) Create(parent string, deviceregistry *DeviceRegistry) *ProjectsLocationsRegistriesCreateCall { 1921 c := &ProjectsLocationsRegistriesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1922 c.parent = parent 1923 c.deviceregistry = deviceregistry 1924 return c 1925 } 1926 1927 // Fields allows partial responses to be retrieved. See 1928 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1929 // for more information. 1930 func (c *ProjectsLocationsRegistriesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesCreateCall { 1931 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1932 return c 1933 } 1934 1935 // Context sets the context to be used in this call's Do method. Any 1936 // pending HTTP request will be aborted if the provided context is 1937 // canceled. 1938 func (c *ProjectsLocationsRegistriesCreateCall) Context(ctx context.Context) *ProjectsLocationsRegistriesCreateCall { 1939 c.ctx_ = ctx 1940 return c 1941 } 1942 1943 // Header returns an http.Header that can be modified by the caller to 1944 // add HTTP headers to the request. 1945 func (c *ProjectsLocationsRegistriesCreateCall) Header() http.Header { 1946 if c.header_ == nil { 1947 c.header_ = make(http.Header) 1948 } 1949 return c.header_ 1950 } 1951 1952 func (c *ProjectsLocationsRegistriesCreateCall) doRequest(alt string) (*http.Response, error) { 1953 reqHeaders := make(http.Header) 1954 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 1955 for k, v := range c.header_ { 1956 reqHeaders[k] = v 1957 } 1958 reqHeaders.Set("User-Agent", c.s.userAgent()) 1959 var body io.Reader = nil 1960 body, err := googleapi.WithoutDataWrapper.JSONReader(c.deviceregistry) 1961 if err != nil { 1962 return nil, err 1963 } 1964 reqHeaders.Set("Content-Type", "application/json") 1965 c.urlParams_.Set("alt", alt) 1966 c.urlParams_.Set("prettyPrint", "false") 1967 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/registries") 1968 urls += "?" + c.urlParams_.Encode() 1969 req, err := http.NewRequest("POST", urls, body) 1970 if err != nil { 1971 return nil, err 1972 } 1973 req.Header = reqHeaders 1974 googleapi.Expand(req.URL, map[string]string{ 1975 "parent": c.parent, 1976 }) 1977 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1978 } 1979 1980 // Do executes the "cloudiot.projects.locations.registries.create" call. 1981 // Exactly one of *DeviceRegistry or error will be non-nil. Any non-2xx 1982 // status code is an error. Response headers are in either 1983 // *DeviceRegistry.ServerResponse.Header or (if a response was returned 1984 // at all) in error.(*googleapi.Error).Header. Use 1985 // googleapi.IsNotModified to check whether the returned error was 1986 // because http.StatusNotModified was returned. 1987 func (c *ProjectsLocationsRegistriesCreateCall) Do(opts ...googleapi.CallOption) (*DeviceRegistry, error) { 1988 gensupport.SetOptions(c.urlParams_, opts...) 1989 res, err := c.doRequest("json") 1990 if res != nil && res.StatusCode == http.StatusNotModified { 1991 if res.Body != nil { 1992 res.Body.Close() 1993 } 1994 return nil, gensupport.WrapError(&googleapi.Error{ 1995 Code: res.StatusCode, 1996 Header: res.Header, 1997 }) 1998 } 1999 if err != nil { 2000 return nil, err 2001 } 2002 defer googleapi.CloseBody(res) 2003 if err := googleapi.CheckResponse(res); err != nil { 2004 return nil, gensupport.WrapError(err) 2005 } 2006 ret := &DeviceRegistry{ 2007 ServerResponse: googleapi.ServerResponse{ 2008 Header: res.Header, 2009 HTTPStatusCode: res.StatusCode, 2010 }, 2011 } 2012 target := &ret 2013 if err := gensupport.DecodeResponse(target, res); err != nil { 2014 return nil, err 2015 } 2016 return ret, nil 2017 // { 2018 // "description": "Creates a device registry that contains devices.", 2019 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries", 2020 // "httpMethod": "POST", 2021 // "id": "cloudiot.projects.locations.registries.create", 2022 // "parameterOrder": [ 2023 // "parent" 2024 // ], 2025 // "parameters": { 2026 // "parent": { 2027 // "description": "Required. The project and cloud region where this device registry must be created. For example, `projects/example-project/locations/us-central1`.", 2028 // "location": "path", 2029 // "pattern": "^projects/[^/]+/locations/[^/]+$", 2030 // "required": true, 2031 // "type": "string" 2032 // } 2033 // }, 2034 // "path": "v1/{+parent}/registries", 2035 // "request": { 2036 // "$ref": "DeviceRegistry" 2037 // }, 2038 // "response": { 2039 // "$ref": "DeviceRegistry" 2040 // }, 2041 // "scopes": [ 2042 // "https://www.googleapis.com/auth/cloud-platform", 2043 // "https://www.googleapis.com/auth/cloudiot" 2044 // ] 2045 // } 2046 2047 } 2048 2049 // method id "cloudiot.projects.locations.registries.delete": 2050 2051 type ProjectsLocationsRegistriesDeleteCall struct { 2052 s *Service 2053 name string 2054 urlParams_ gensupport.URLParams 2055 ctx_ context.Context 2056 header_ http.Header 2057 } 2058 2059 // Delete: Deletes a device registry configuration. 2060 // 2061 // - name: The name of the device registry. For example, 2062 // `projects/example-project/locations/us-central1/registries/my-regist 2063 // ry`. 2064 func (r *ProjectsLocationsRegistriesService) Delete(name string) *ProjectsLocationsRegistriesDeleteCall { 2065 c := &ProjectsLocationsRegistriesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2066 c.name = name 2067 return c 2068 } 2069 2070 // Fields allows partial responses to be retrieved. See 2071 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2072 // for more information. 2073 func (c *ProjectsLocationsRegistriesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDeleteCall { 2074 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2075 return c 2076 } 2077 2078 // Context sets the context to be used in this call's Do method. Any 2079 // pending HTTP request will be aborted if the provided context is 2080 // canceled. 2081 func (c *ProjectsLocationsRegistriesDeleteCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDeleteCall { 2082 c.ctx_ = ctx 2083 return c 2084 } 2085 2086 // Header returns an http.Header that can be modified by the caller to 2087 // add HTTP headers to the request. 2088 func (c *ProjectsLocationsRegistriesDeleteCall) Header() http.Header { 2089 if c.header_ == nil { 2090 c.header_ = make(http.Header) 2091 } 2092 return c.header_ 2093 } 2094 2095 func (c *ProjectsLocationsRegistriesDeleteCall) doRequest(alt string) (*http.Response, error) { 2096 reqHeaders := make(http.Header) 2097 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 2098 for k, v := range c.header_ { 2099 reqHeaders[k] = v 2100 } 2101 reqHeaders.Set("User-Agent", c.s.userAgent()) 2102 var body io.Reader = nil 2103 c.urlParams_.Set("alt", alt) 2104 c.urlParams_.Set("prettyPrint", "false") 2105 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 2106 urls += "?" + c.urlParams_.Encode() 2107 req, err := http.NewRequest("DELETE", urls, body) 2108 if err != nil { 2109 return nil, err 2110 } 2111 req.Header = reqHeaders 2112 googleapi.Expand(req.URL, map[string]string{ 2113 "name": c.name, 2114 }) 2115 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2116 } 2117 2118 // Do executes the "cloudiot.projects.locations.registries.delete" call. 2119 // Exactly one of *Empty or error will be non-nil. Any non-2xx status 2120 // code is an error. Response headers are in either 2121 // *Empty.ServerResponse.Header or (if a response was returned at all) 2122 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2123 // check whether the returned error was because http.StatusNotModified 2124 // was returned. 2125 func (c *ProjectsLocationsRegistriesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 2126 gensupport.SetOptions(c.urlParams_, opts...) 2127 res, err := c.doRequest("json") 2128 if res != nil && res.StatusCode == http.StatusNotModified { 2129 if res.Body != nil { 2130 res.Body.Close() 2131 } 2132 return nil, gensupport.WrapError(&googleapi.Error{ 2133 Code: res.StatusCode, 2134 Header: res.Header, 2135 }) 2136 } 2137 if err != nil { 2138 return nil, err 2139 } 2140 defer googleapi.CloseBody(res) 2141 if err := googleapi.CheckResponse(res); err != nil { 2142 return nil, gensupport.WrapError(err) 2143 } 2144 ret := &Empty{ 2145 ServerResponse: googleapi.ServerResponse{ 2146 Header: res.Header, 2147 HTTPStatusCode: res.StatusCode, 2148 }, 2149 } 2150 target := &ret 2151 if err := gensupport.DecodeResponse(target, res); err != nil { 2152 return nil, err 2153 } 2154 return ret, nil 2155 // { 2156 // "description": "Deletes a device registry configuration.", 2157 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}", 2158 // "httpMethod": "DELETE", 2159 // "id": "cloudiot.projects.locations.registries.delete", 2160 // "parameterOrder": [ 2161 // "name" 2162 // ], 2163 // "parameters": { 2164 // "name": { 2165 // "description": "Required. The name of the device registry. For example, `projects/example-project/locations/us-central1/registries/my-registry`.", 2166 // "location": "path", 2167 // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$", 2168 // "required": true, 2169 // "type": "string" 2170 // } 2171 // }, 2172 // "path": "v1/{+name}", 2173 // "response": { 2174 // "$ref": "Empty" 2175 // }, 2176 // "scopes": [ 2177 // "https://www.googleapis.com/auth/cloud-platform", 2178 // "https://www.googleapis.com/auth/cloudiot" 2179 // ] 2180 // } 2181 2182 } 2183 2184 // method id "cloudiot.projects.locations.registries.get": 2185 2186 type ProjectsLocationsRegistriesGetCall struct { 2187 s *Service 2188 name string 2189 urlParams_ gensupport.URLParams 2190 ifNoneMatch_ string 2191 ctx_ context.Context 2192 header_ http.Header 2193 } 2194 2195 // Get: Gets a device registry configuration. 2196 // 2197 // - name: The name of the device registry. For example, 2198 // `projects/example-project/locations/us-central1/registries/my-regist 2199 // ry`. 2200 func (r *ProjectsLocationsRegistriesService) Get(name string) *ProjectsLocationsRegistriesGetCall { 2201 c := &ProjectsLocationsRegistriesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2202 c.name = name 2203 return c 2204 } 2205 2206 // Fields allows partial responses to be retrieved. See 2207 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2208 // for more information. 2209 func (c *ProjectsLocationsRegistriesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGetCall { 2210 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2211 return c 2212 } 2213 2214 // IfNoneMatch sets the optional parameter which makes the operation 2215 // fail if the object's ETag matches the given value. This is useful for 2216 // getting updates only after the object has changed since the last 2217 // request. Use googleapi.IsNotModified to check whether the response 2218 // error from Do is the result of In-None-Match. 2219 func (c *ProjectsLocationsRegistriesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesGetCall { 2220 c.ifNoneMatch_ = entityTag 2221 return c 2222 } 2223 2224 // Context sets the context to be used in this call's Do method. Any 2225 // pending HTTP request will be aborted if the provided context is 2226 // canceled. 2227 func (c *ProjectsLocationsRegistriesGetCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGetCall { 2228 c.ctx_ = ctx 2229 return c 2230 } 2231 2232 // Header returns an http.Header that can be modified by the caller to 2233 // add HTTP headers to the request. 2234 func (c *ProjectsLocationsRegistriesGetCall) Header() http.Header { 2235 if c.header_ == nil { 2236 c.header_ = make(http.Header) 2237 } 2238 return c.header_ 2239 } 2240 2241 func (c *ProjectsLocationsRegistriesGetCall) doRequest(alt string) (*http.Response, error) { 2242 reqHeaders := make(http.Header) 2243 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 2244 for k, v := range c.header_ { 2245 reqHeaders[k] = v 2246 } 2247 reqHeaders.Set("User-Agent", c.s.userAgent()) 2248 if c.ifNoneMatch_ != "" { 2249 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2250 } 2251 var body io.Reader = nil 2252 c.urlParams_.Set("alt", alt) 2253 c.urlParams_.Set("prettyPrint", "false") 2254 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 2255 urls += "?" + c.urlParams_.Encode() 2256 req, err := http.NewRequest("GET", urls, body) 2257 if err != nil { 2258 return nil, err 2259 } 2260 req.Header = reqHeaders 2261 googleapi.Expand(req.URL, map[string]string{ 2262 "name": c.name, 2263 }) 2264 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2265 } 2266 2267 // Do executes the "cloudiot.projects.locations.registries.get" call. 2268 // Exactly one of *DeviceRegistry or error will be non-nil. Any non-2xx 2269 // status code is an error. Response headers are in either 2270 // *DeviceRegistry.ServerResponse.Header or (if a response was returned 2271 // at all) in error.(*googleapi.Error).Header. Use 2272 // googleapi.IsNotModified to check whether the returned error was 2273 // because http.StatusNotModified was returned. 2274 func (c *ProjectsLocationsRegistriesGetCall) Do(opts ...googleapi.CallOption) (*DeviceRegistry, error) { 2275 gensupport.SetOptions(c.urlParams_, opts...) 2276 res, err := c.doRequest("json") 2277 if res != nil && res.StatusCode == http.StatusNotModified { 2278 if res.Body != nil { 2279 res.Body.Close() 2280 } 2281 return nil, gensupport.WrapError(&googleapi.Error{ 2282 Code: res.StatusCode, 2283 Header: res.Header, 2284 }) 2285 } 2286 if err != nil { 2287 return nil, err 2288 } 2289 defer googleapi.CloseBody(res) 2290 if err := googleapi.CheckResponse(res); err != nil { 2291 return nil, gensupport.WrapError(err) 2292 } 2293 ret := &DeviceRegistry{ 2294 ServerResponse: googleapi.ServerResponse{ 2295 Header: res.Header, 2296 HTTPStatusCode: res.StatusCode, 2297 }, 2298 } 2299 target := &ret 2300 if err := gensupport.DecodeResponse(target, res); err != nil { 2301 return nil, err 2302 } 2303 return ret, nil 2304 // { 2305 // "description": "Gets a device registry configuration.", 2306 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}", 2307 // "httpMethod": "GET", 2308 // "id": "cloudiot.projects.locations.registries.get", 2309 // "parameterOrder": [ 2310 // "name" 2311 // ], 2312 // "parameters": { 2313 // "name": { 2314 // "description": "Required. The name of the device registry. For example, `projects/example-project/locations/us-central1/registries/my-registry`.", 2315 // "location": "path", 2316 // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$", 2317 // "required": true, 2318 // "type": "string" 2319 // } 2320 // }, 2321 // "path": "v1/{+name}", 2322 // "response": { 2323 // "$ref": "DeviceRegistry" 2324 // }, 2325 // "scopes": [ 2326 // "https://www.googleapis.com/auth/cloud-platform", 2327 // "https://www.googleapis.com/auth/cloudiot" 2328 // ] 2329 // } 2330 2331 } 2332 2333 // method id "cloudiot.projects.locations.registries.getIamPolicy": 2334 2335 type ProjectsLocationsRegistriesGetIamPolicyCall struct { 2336 s *Service 2337 resource string 2338 getiampolicyrequest *GetIamPolicyRequest 2339 urlParams_ gensupport.URLParams 2340 ctx_ context.Context 2341 header_ http.Header 2342 } 2343 2344 // GetIamPolicy: Gets the access control policy for a resource. Returns 2345 // an empty policy if the resource exists and does not have a policy 2346 // set. 2347 // 2348 // - resource: REQUIRED: The resource for which the policy is being 2349 // requested. See Resource names 2350 // (https://cloud.google.com/apis/design/resource_names) for the 2351 // appropriate value for this field. 2352 func (r *ProjectsLocationsRegistriesService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *ProjectsLocationsRegistriesGetIamPolicyCall { 2353 c := &ProjectsLocationsRegistriesGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2354 c.resource = resource 2355 c.getiampolicyrequest = getiampolicyrequest 2356 return c 2357 } 2358 2359 // Fields allows partial responses to be retrieved. See 2360 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2361 // for more information. 2362 func (c *ProjectsLocationsRegistriesGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGetIamPolicyCall { 2363 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2364 return c 2365 } 2366 2367 // Context sets the context to be used in this call's Do method. Any 2368 // pending HTTP request will be aborted if the provided context is 2369 // canceled. 2370 func (c *ProjectsLocationsRegistriesGetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGetIamPolicyCall { 2371 c.ctx_ = ctx 2372 return c 2373 } 2374 2375 // Header returns an http.Header that can be modified by the caller to 2376 // add HTTP headers to the request. 2377 func (c *ProjectsLocationsRegistriesGetIamPolicyCall) Header() http.Header { 2378 if c.header_ == nil { 2379 c.header_ = make(http.Header) 2380 } 2381 return c.header_ 2382 } 2383 2384 func (c *ProjectsLocationsRegistriesGetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 2385 reqHeaders := make(http.Header) 2386 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 2387 for k, v := range c.header_ { 2388 reqHeaders[k] = v 2389 } 2390 reqHeaders.Set("User-Agent", c.s.userAgent()) 2391 var body io.Reader = nil 2392 body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest) 2393 if err != nil { 2394 return nil, err 2395 } 2396 reqHeaders.Set("Content-Type", "application/json") 2397 c.urlParams_.Set("alt", alt) 2398 c.urlParams_.Set("prettyPrint", "false") 2399 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy") 2400 urls += "?" + c.urlParams_.Encode() 2401 req, err := http.NewRequest("POST", urls, body) 2402 if err != nil { 2403 return nil, err 2404 } 2405 req.Header = reqHeaders 2406 googleapi.Expand(req.URL, map[string]string{ 2407 "resource": c.resource, 2408 }) 2409 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2410 } 2411 2412 // Do executes the "cloudiot.projects.locations.registries.getIamPolicy" call. 2413 // Exactly one of *Policy or error will be non-nil. Any non-2xx status 2414 // code is an error. Response headers are in either 2415 // *Policy.ServerResponse.Header or (if a response was returned at all) 2416 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2417 // check whether the returned error was because http.StatusNotModified 2418 // was returned. 2419 func (c *ProjectsLocationsRegistriesGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 2420 gensupport.SetOptions(c.urlParams_, opts...) 2421 res, err := c.doRequest("json") 2422 if res != nil && res.StatusCode == http.StatusNotModified { 2423 if res.Body != nil { 2424 res.Body.Close() 2425 } 2426 return nil, gensupport.WrapError(&googleapi.Error{ 2427 Code: res.StatusCode, 2428 Header: res.Header, 2429 }) 2430 } 2431 if err != nil { 2432 return nil, err 2433 } 2434 defer googleapi.CloseBody(res) 2435 if err := googleapi.CheckResponse(res); err != nil { 2436 return nil, gensupport.WrapError(err) 2437 } 2438 ret := &Policy{ 2439 ServerResponse: googleapi.ServerResponse{ 2440 Header: res.Header, 2441 HTTPStatusCode: res.StatusCode, 2442 }, 2443 } 2444 target := &ret 2445 if err := gensupport.DecodeResponse(target, res); err != nil { 2446 return nil, err 2447 } 2448 return ret, nil 2449 // { 2450 // "description": "Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.", 2451 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}:getIamPolicy", 2452 // "httpMethod": "POST", 2453 // "id": "cloudiot.projects.locations.registries.getIamPolicy", 2454 // "parameterOrder": [ 2455 // "resource" 2456 // ], 2457 // "parameters": { 2458 // "resource": { 2459 // "description": "REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.", 2460 // "location": "path", 2461 // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$", 2462 // "required": true, 2463 // "type": "string" 2464 // } 2465 // }, 2466 // "path": "v1/{+resource}:getIamPolicy", 2467 // "request": { 2468 // "$ref": "GetIamPolicyRequest" 2469 // }, 2470 // "response": { 2471 // "$ref": "Policy" 2472 // }, 2473 // "scopes": [ 2474 // "https://www.googleapis.com/auth/cloud-platform", 2475 // "https://www.googleapis.com/auth/cloudiot" 2476 // ] 2477 // } 2478 2479 } 2480 2481 // method id "cloudiot.projects.locations.registries.list": 2482 2483 type ProjectsLocationsRegistriesListCall struct { 2484 s *Service 2485 parent string 2486 urlParams_ gensupport.URLParams 2487 ifNoneMatch_ string 2488 ctx_ context.Context 2489 header_ http.Header 2490 } 2491 2492 // List: Lists device registries. 2493 // 2494 // - parent: The project and cloud region path. For example, 2495 // `projects/example-project/locations/us-central1`. 2496 func (r *ProjectsLocationsRegistriesService) List(parent string) *ProjectsLocationsRegistriesListCall { 2497 c := &ProjectsLocationsRegistriesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2498 c.parent = parent 2499 return c 2500 } 2501 2502 // PageSize sets the optional parameter "pageSize": The maximum number 2503 // of registries to return in the response. If this value is zero, the 2504 // service will select a default size. A call may return fewer objects 2505 // than requested. A non-empty `next_page_token` in the response 2506 // indicates that more data is available. 2507 func (c *ProjectsLocationsRegistriesListCall) PageSize(pageSize int64) *ProjectsLocationsRegistriesListCall { 2508 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2509 return c 2510 } 2511 2512 // PageToken sets the optional parameter "pageToken": The value returned 2513 // by the last `ListDeviceRegistriesResponse`; indicates that this is a 2514 // continuation of a prior `ListDeviceRegistries` call and the system 2515 // should return the next page of data. 2516 func (c *ProjectsLocationsRegistriesListCall) PageToken(pageToken string) *ProjectsLocationsRegistriesListCall { 2517 c.urlParams_.Set("pageToken", pageToken) 2518 return c 2519 } 2520 2521 // Fields allows partial responses to be retrieved. See 2522 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2523 // for more information. 2524 func (c *ProjectsLocationsRegistriesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesListCall { 2525 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2526 return c 2527 } 2528 2529 // IfNoneMatch sets the optional parameter which makes the operation 2530 // fail if the object's ETag matches the given value. This is useful for 2531 // getting updates only after the object has changed since the last 2532 // request. Use googleapi.IsNotModified to check whether the response 2533 // error from Do is the result of In-None-Match. 2534 func (c *ProjectsLocationsRegistriesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesListCall { 2535 c.ifNoneMatch_ = entityTag 2536 return c 2537 } 2538 2539 // Context sets the context to be used in this call's Do method. Any 2540 // pending HTTP request will be aborted if the provided context is 2541 // canceled. 2542 func (c *ProjectsLocationsRegistriesListCall) Context(ctx context.Context) *ProjectsLocationsRegistriesListCall { 2543 c.ctx_ = ctx 2544 return c 2545 } 2546 2547 // Header returns an http.Header that can be modified by the caller to 2548 // add HTTP headers to the request. 2549 func (c *ProjectsLocationsRegistriesListCall) Header() http.Header { 2550 if c.header_ == nil { 2551 c.header_ = make(http.Header) 2552 } 2553 return c.header_ 2554 } 2555 2556 func (c *ProjectsLocationsRegistriesListCall) doRequest(alt string) (*http.Response, error) { 2557 reqHeaders := make(http.Header) 2558 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 2559 for k, v := range c.header_ { 2560 reqHeaders[k] = v 2561 } 2562 reqHeaders.Set("User-Agent", c.s.userAgent()) 2563 if c.ifNoneMatch_ != "" { 2564 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2565 } 2566 var body io.Reader = nil 2567 c.urlParams_.Set("alt", alt) 2568 c.urlParams_.Set("prettyPrint", "false") 2569 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/registries") 2570 urls += "?" + c.urlParams_.Encode() 2571 req, err := http.NewRequest("GET", urls, body) 2572 if err != nil { 2573 return nil, err 2574 } 2575 req.Header = reqHeaders 2576 googleapi.Expand(req.URL, map[string]string{ 2577 "parent": c.parent, 2578 }) 2579 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2580 } 2581 2582 // Do executes the "cloudiot.projects.locations.registries.list" call. 2583 // Exactly one of *ListDeviceRegistriesResponse or error will be 2584 // non-nil. Any non-2xx status code is an error. Response headers are in 2585 // either *ListDeviceRegistriesResponse.ServerResponse.Header or (if a 2586 // response was returned at all) in error.(*googleapi.Error).Header. Use 2587 // googleapi.IsNotModified to check whether the returned error was 2588 // because http.StatusNotModified was returned. 2589 func (c *ProjectsLocationsRegistriesListCall) Do(opts ...googleapi.CallOption) (*ListDeviceRegistriesResponse, error) { 2590 gensupport.SetOptions(c.urlParams_, opts...) 2591 res, err := c.doRequest("json") 2592 if res != nil && res.StatusCode == http.StatusNotModified { 2593 if res.Body != nil { 2594 res.Body.Close() 2595 } 2596 return nil, gensupport.WrapError(&googleapi.Error{ 2597 Code: res.StatusCode, 2598 Header: res.Header, 2599 }) 2600 } 2601 if err != nil { 2602 return nil, err 2603 } 2604 defer googleapi.CloseBody(res) 2605 if err := googleapi.CheckResponse(res); err != nil { 2606 return nil, gensupport.WrapError(err) 2607 } 2608 ret := &ListDeviceRegistriesResponse{ 2609 ServerResponse: googleapi.ServerResponse{ 2610 Header: res.Header, 2611 HTTPStatusCode: res.StatusCode, 2612 }, 2613 } 2614 target := &ret 2615 if err := gensupport.DecodeResponse(target, res); err != nil { 2616 return nil, err 2617 } 2618 return ret, nil 2619 // { 2620 // "description": "Lists device registries.", 2621 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries", 2622 // "httpMethod": "GET", 2623 // "id": "cloudiot.projects.locations.registries.list", 2624 // "parameterOrder": [ 2625 // "parent" 2626 // ], 2627 // "parameters": { 2628 // "pageSize": { 2629 // "description": "The maximum number of registries to return in the response. If this value is zero, the service will select a default size. A call may return fewer objects than requested. A non-empty `next_page_token` in the response indicates that more data is available.", 2630 // "format": "int32", 2631 // "location": "query", 2632 // "type": "integer" 2633 // }, 2634 // "pageToken": { 2635 // "description": "The value returned by the last `ListDeviceRegistriesResponse`; indicates that this is a continuation of a prior `ListDeviceRegistries` call and the system should return the next page of data.", 2636 // "location": "query", 2637 // "type": "string" 2638 // }, 2639 // "parent": { 2640 // "description": "Required. The project and cloud region path. For example, `projects/example-project/locations/us-central1`.", 2641 // "location": "path", 2642 // "pattern": "^projects/[^/]+/locations/[^/]+$", 2643 // "required": true, 2644 // "type": "string" 2645 // } 2646 // }, 2647 // "path": "v1/{+parent}/registries", 2648 // "response": { 2649 // "$ref": "ListDeviceRegistriesResponse" 2650 // }, 2651 // "scopes": [ 2652 // "https://www.googleapis.com/auth/cloud-platform", 2653 // "https://www.googleapis.com/auth/cloudiot" 2654 // ] 2655 // } 2656 2657 } 2658 2659 // Pages invokes f for each page of results. 2660 // A non-nil error returned from f will halt the iteration. 2661 // The provided context supersedes any context provided to the Context method. 2662 func (c *ProjectsLocationsRegistriesListCall) Pages(ctx context.Context, f func(*ListDeviceRegistriesResponse) error) error { 2663 c.ctx_ = ctx 2664 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2665 for { 2666 x, err := c.Do() 2667 if err != nil { 2668 return err 2669 } 2670 if err := f(x); err != nil { 2671 return err 2672 } 2673 if x.NextPageToken == "" { 2674 return nil 2675 } 2676 c.PageToken(x.NextPageToken) 2677 } 2678 } 2679 2680 // method id "cloudiot.projects.locations.registries.patch": 2681 2682 type ProjectsLocationsRegistriesPatchCall struct { 2683 s *Service 2684 name string 2685 deviceregistry *DeviceRegistry 2686 urlParams_ gensupport.URLParams 2687 ctx_ context.Context 2688 header_ http.Header 2689 } 2690 2691 // Patch: Updates a device registry configuration. 2692 // 2693 // - name: The resource path name. For example, 2694 // `projects/example-project/locations/us-central1/registries/my-regist 2695 // ry`. 2696 func (r *ProjectsLocationsRegistriesService) Patch(name string, deviceregistry *DeviceRegistry) *ProjectsLocationsRegistriesPatchCall { 2697 c := &ProjectsLocationsRegistriesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2698 c.name = name 2699 c.deviceregistry = deviceregistry 2700 return c 2701 } 2702 2703 // UpdateMask sets the optional parameter "updateMask": Required. Only 2704 // updates the `device_registry` fields indicated by this mask. The 2705 // field mask must not be empty, and it must not contain fields that are 2706 // immutable or only set by the server. Mutable top-level fields: 2707 // `event_notification_config`, `http_config`, `mqtt_config`, and 2708 // `state_notification_config`. 2709 func (c *ProjectsLocationsRegistriesPatchCall) UpdateMask(updateMask string) *ProjectsLocationsRegistriesPatchCall { 2710 c.urlParams_.Set("updateMask", updateMask) 2711 return c 2712 } 2713 2714 // Fields allows partial responses to be retrieved. See 2715 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2716 // for more information. 2717 func (c *ProjectsLocationsRegistriesPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesPatchCall { 2718 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2719 return c 2720 } 2721 2722 // Context sets the context to be used in this call's Do method. Any 2723 // pending HTTP request will be aborted if the provided context is 2724 // canceled. 2725 func (c *ProjectsLocationsRegistriesPatchCall) Context(ctx context.Context) *ProjectsLocationsRegistriesPatchCall { 2726 c.ctx_ = ctx 2727 return c 2728 } 2729 2730 // Header returns an http.Header that can be modified by the caller to 2731 // add HTTP headers to the request. 2732 func (c *ProjectsLocationsRegistriesPatchCall) Header() http.Header { 2733 if c.header_ == nil { 2734 c.header_ = make(http.Header) 2735 } 2736 return c.header_ 2737 } 2738 2739 func (c *ProjectsLocationsRegistriesPatchCall) doRequest(alt string) (*http.Response, error) { 2740 reqHeaders := make(http.Header) 2741 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 2742 for k, v := range c.header_ { 2743 reqHeaders[k] = v 2744 } 2745 reqHeaders.Set("User-Agent", c.s.userAgent()) 2746 var body io.Reader = nil 2747 body, err := googleapi.WithoutDataWrapper.JSONReader(c.deviceregistry) 2748 if err != nil { 2749 return nil, err 2750 } 2751 reqHeaders.Set("Content-Type", "application/json") 2752 c.urlParams_.Set("alt", alt) 2753 c.urlParams_.Set("prettyPrint", "false") 2754 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 2755 urls += "?" + c.urlParams_.Encode() 2756 req, err := http.NewRequest("PATCH", urls, body) 2757 if err != nil { 2758 return nil, err 2759 } 2760 req.Header = reqHeaders 2761 googleapi.Expand(req.URL, map[string]string{ 2762 "name": c.name, 2763 }) 2764 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2765 } 2766 2767 // Do executes the "cloudiot.projects.locations.registries.patch" call. 2768 // Exactly one of *DeviceRegistry or error will be non-nil. Any non-2xx 2769 // status code is an error. Response headers are in either 2770 // *DeviceRegistry.ServerResponse.Header or (if a response was returned 2771 // at all) in error.(*googleapi.Error).Header. Use 2772 // googleapi.IsNotModified to check whether the returned error was 2773 // because http.StatusNotModified was returned. 2774 func (c *ProjectsLocationsRegistriesPatchCall) Do(opts ...googleapi.CallOption) (*DeviceRegistry, error) { 2775 gensupport.SetOptions(c.urlParams_, opts...) 2776 res, err := c.doRequest("json") 2777 if res != nil && res.StatusCode == http.StatusNotModified { 2778 if res.Body != nil { 2779 res.Body.Close() 2780 } 2781 return nil, gensupport.WrapError(&googleapi.Error{ 2782 Code: res.StatusCode, 2783 Header: res.Header, 2784 }) 2785 } 2786 if err != nil { 2787 return nil, err 2788 } 2789 defer googleapi.CloseBody(res) 2790 if err := googleapi.CheckResponse(res); err != nil { 2791 return nil, gensupport.WrapError(err) 2792 } 2793 ret := &DeviceRegistry{ 2794 ServerResponse: googleapi.ServerResponse{ 2795 Header: res.Header, 2796 HTTPStatusCode: res.StatusCode, 2797 }, 2798 } 2799 target := &ret 2800 if err := gensupport.DecodeResponse(target, res); err != nil { 2801 return nil, err 2802 } 2803 return ret, nil 2804 // { 2805 // "description": "Updates a device registry configuration.", 2806 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}", 2807 // "httpMethod": "PATCH", 2808 // "id": "cloudiot.projects.locations.registries.patch", 2809 // "parameterOrder": [ 2810 // "name" 2811 // ], 2812 // "parameters": { 2813 // "name": { 2814 // "description": "The resource path name. For example, `projects/example-project/locations/us-central1/registries/my-registry`.", 2815 // "location": "path", 2816 // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$", 2817 // "required": true, 2818 // "type": "string" 2819 // }, 2820 // "updateMask": { 2821 // "description": "Required. Only updates the `device_registry` fields indicated by this mask. The field mask must not be empty, and it must not contain fields that are immutable or only set by the server. Mutable top-level fields: `event_notification_config`, `http_config`, `mqtt_config`, and `state_notification_config`.", 2822 // "format": "google-fieldmask", 2823 // "location": "query", 2824 // "type": "string" 2825 // } 2826 // }, 2827 // "path": "v1/{+name}", 2828 // "request": { 2829 // "$ref": "DeviceRegistry" 2830 // }, 2831 // "response": { 2832 // "$ref": "DeviceRegistry" 2833 // }, 2834 // "scopes": [ 2835 // "https://www.googleapis.com/auth/cloud-platform", 2836 // "https://www.googleapis.com/auth/cloudiot" 2837 // ] 2838 // } 2839 2840 } 2841 2842 // method id "cloudiot.projects.locations.registries.setIamPolicy": 2843 2844 type ProjectsLocationsRegistriesSetIamPolicyCall struct { 2845 s *Service 2846 resource string 2847 setiampolicyrequest *SetIamPolicyRequest 2848 urlParams_ gensupport.URLParams 2849 ctx_ context.Context 2850 header_ http.Header 2851 } 2852 2853 // SetIamPolicy: Sets the access control policy on the specified 2854 // resource. Replaces any existing policy. 2855 // 2856 // - resource: REQUIRED: The resource for which the policy is being 2857 // specified. See Resource names 2858 // (https://cloud.google.com/apis/design/resource_names) for the 2859 // appropriate value for this field. 2860 func (r *ProjectsLocationsRegistriesService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsLocationsRegistriesSetIamPolicyCall { 2861 c := &ProjectsLocationsRegistriesSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2862 c.resource = resource 2863 c.setiampolicyrequest = setiampolicyrequest 2864 return c 2865 } 2866 2867 // Fields allows partial responses to be retrieved. See 2868 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2869 // for more information. 2870 func (c *ProjectsLocationsRegistriesSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesSetIamPolicyCall { 2871 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2872 return c 2873 } 2874 2875 // Context sets the context to be used in this call's Do method. Any 2876 // pending HTTP request will be aborted if the provided context is 2877 // canceled. 2878 func (c *ProjectsLocationsRegistriesSetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsRegistriesSetIamPolicyCall { 2879 c.ctx_ = ctx 2880 return c 2881 } 2882 2883 // Header returns an http.Header that can be modified by the caller to 2884 // add HTTP headers to the request. 2885 func (c *ProjectsLocationsRegistriesSetIamPolicyCall) Header() http.Header { 2886 if c.header_ == nil { 2887 c.header_ = make(http.Header) 2888 } 2889 return c.header_ 2890 } 2891 2892 func (c *ProjectsLocationsRegistriesSetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 2893 reqHeaders := make(http.Header) 2894 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 2895 for k, v := range c.header_ { 2896 reqHeaders[k] = v 2897 } 2898 reqHeaders.Set("User-Agent", c.s.userAgent()) 2899 var body io.Reader = nil 2900 body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest) 2901 if err != nil { 2902 return nil, err 2903 } 2904 reqHeaders.Set("Content-Type", "application/json") 2905 c.urlParams_.Set("alt", alt) 2906 c.urlParams_.Set("prettyPrint", "false") 2907 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy") 2908 urls += "?" + c.urlParams_.Encode() 2909 req, err := http.NewRequest("POST", urls, body) 2910 if err != nil { 2911 return nil, err 2912 } 2913 req.Header = reqHeaders 2914 googleapi.Expand(req.URL, map[string]string{ 2915 "resource": c.resource, 2916 }) 2917 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2918 } 2919 2920 // Do executes the "cloudiot.projects.locations.registries.setIamPolicy" call. 2921 // Exactly one of *Policy or error will be non-nil. Any non-2xx status 2922 // code is an error. Response headers are in either 2923 // *Policy.ServerResponse.Header or (if a response was returned at all) 2924 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2925 // check whether the returned error was because http.StatusNotModified 2926 // was returned. 2927 func (c *ProjectsLocationsRegistriesSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 2928 gensupport.SetOptions(c.urlParams_, opts...) 2929 res, err := c.doRequest("json") 2930 if res != nil && res.StatusCode == http.StatusNotModified { 2931 if res.Body != nil { 2932 res.Body.Close() 2933 } 2934 return nil, gensupport.WrapError(&googleapi.Error{ 2935 Code: res.StatusCode, 2936 Header: res.Header, 2937 }) 2938 } 2939 if err != nil { 2940 return nil, err 2941 } 2942 defer googleapi.CloseBody(res) 2943 if err := googleapi.CheckResponse(res); err != nil { 2944 return nil, gensupport.WrapError(err) 2945 } 2946 ret := &Policy{ 2947 ServerResponse: googleapi.ServerResponse{ 2948 Header: res.Header, 2949 HTTPStatusCode: res.StatusCode, 2950 }, 2951 } 2952 target := &ret 2953 if err := gensupport.DecodeResponse(target, res); err != nil { 2954 return nil, err 2955 } 2956 return ret, nil 2957 // { 2958 // "description": "Sets the access control policy on the specified resource. Replaces any existing policy.", 2959 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}:setIamPolicy", 2960 // "httpMethod": "POST", 2961 // "id": "cloudiot.projects.locations.registries.setIamPolicy", 2962 // "parameterOrder": [ 2963 // "resource" 2964 // ], 2965 // "parameters": { 2966 // "resource": { 2967 // "description": "REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.", 2968 // "location": "path", 2969 // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$", 2970 // "required": true, 2971 // "type": "string" 2972 // } 2973 // }, 2974 // "path": "v1/{+resource}:setIamPolicy", 2975 // "request": { 2976 // "$ref": "SetIamPolicyRequest" 2977 // }, 2978 // "response": { 2979 // "$ref": "Policy" 2980 // }, 2981 // "scopes": [ 2982 // "https://www.googleapis.com/auth/cloud-platform", 2983 // "https://www.googleapis.com/auth/cloudiot" 2984 // ] 2985 // } 2986 2987 } 2988 2989 // method id "cloudiot.projects.locations.registries.testIamPermissions": 2990 2991 type ProjectsLocationsRegistriesTestIamPermissionsCall struct { 2992 s *Service 2993 resource string 2994 testiampermissionsrequest *TestIamPermissionsRequest 2995 urlParams_ gensupport.URLParams 2996 ctx_ context.Context 2997 header_ http.Header 2998 } 2999 3000 // TestIamPermissions: Returns permissions that a caller has on the 3001 // specified resource. If the resource does not exist, this will return 3002 // an empty set of permissions, not a NOT_FOUND error. 3003 // 3004 // - resource: REQUIRED: The resource for which the policy detail is 3005 // being requested. See Resource names 3006 // (https://cloud.google.com/apis/design/resource_names) for the 3007 // appropriate value for this field. 3008 func (r *ProjectsLocationsRegistriesService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsLocationsRegistriesTestIamPermissionsCall { 3009 c := &ProjectsLocationsRegistriesTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3010 c.resource = resource 3011 c.testiampermissionsrequest = testiampermissionsrequest 3012 return c 3013 } 3014 3015 // Fields allows partial responses to be retrieved. See 3016 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3017 // for more information. 3018 func (c *ProjectsLocationsRegistriesTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesTestIamPermissionsCall { 3019 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3020 return c 3021 } 3022 3023 // Context sets the context to be used in this call's Do method. Any 3024 // pending HTTP request will be aborted if the provided context is 3025 // canceled. 3026 func (c *ProjectsLocationsRegistriesTestIamPermissionsCall) Context(ctx context.Context) *ProjectsLocationsRegistriesTestIamPermissionsCall { 3027 c.ctx_ = ctx 3028 return c 3029 } 3030 3031 // Header returns an http.Header that can be modified by the caller to 3032 // add HTTP headers to the request. 3033 func (c *ProjectsLocationsRegistriesTestIamPermissionsCall) Header() http.Header { 3034 if c.header_ == nil { 3035 c.header_ = make(http.Header) 3036 } 3037 return c.header_ 3038 } 3039 3040 func (c *ProjectsLocationsRegistriesTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) { 3041 reqHeaders := make(http.Header) 3042 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 3043 for k, v := range c.header_ { 3044 reqHeaders[k] = v 3045 } 3046 reqHeaders.Set("User-Agent", c.s.userAgent()) 3047 var body io.Reader = nil 3048 body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest) 3049 if err != nil { 3050 return nil, err 3051 } 3052 reqHeaders.Set("Content-Type", "application/json") 3053 c.urlParams_.Set("alt", alt) 3054 c.urlParams_.Set("prettyPrint", "false") 3055 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions") 3056 urls += "?" + c.urlParams_.Encode() 3057 req, err := http.NewRequest("POST", urls, body) 3058 if err != nil { 3059 return nil, err 3060 } 3061 req.Header = reqHeaders 3062 googleapi.Expand(req.URL, map[string]string{ 3063 "resource": c.resource, 3064 }) 3065 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3066 } 3067 3068 // Do executes the "cloudiot.projects.locations.registries.testIamPermissions" call. 3069 // Exactly one of *TestIamPermissionsResponse or error will be non-nil. 3070 // Any non-2xx status code is an error. Response headers are in either 3071 // *TestIamPermissionsResponse.ServerResponse.Header or (if a response 3072 // was returned at all) in error.(*googleapi.Error).Header. Use 3073 // googleapi.IsNotModified to check whether the returned error was 3074 // because http.StatusNotModified was returned. 3075 func (c *ProjectsLocationsRegistriesTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) { 3076 gensupport.SetOptions(c.urlParams_, opts...) 3077 res, err := c.doRequest("json") 3078 if res != nil && res.StatusCode == http.StatusNotModified { 3079 if res.Body != nil { 3080 res.Body.Close() 3081 } 3082 return nil, gensupport.WrapError(&googleapi.Error{ 3083 Code: res.StatusCode, 3084 Header: res.Header, 3085 }) 3086 } 3087 if err != nil { 3088 return nil, err 3089 } 3090 defer googleapi.CloseBody(res) 3091 if err := googleapi.CheckResponse(res); err != nil { 3092 return nil, gensupport.WrapError(err) 3093 } 3094 ret := &TestIamPermissionsResponse{ 3095 ServerResponse: googleapi.ServerResponse{ 3096 Header: res.Header, 3097 HTTPStatusCode: res.StatusCode, 3098 }, 3099 } 3100 target := &ret 3101 if err := gensupport.DecodeResponse(target, res); err != nil { 3102 return nil, err 3103 } 3104 return ret, nil 3105 // { 3106 // "description": "Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.", 3107 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}:testIamPermissions", 3108 // "httpMethod": "POST", 3109 // "id": "cloudiot.projects.locations.registries.testIamPermissions", 3110 // "parameterOrder": [ 3111 // "resource" 3112 // ], 3113 // "parameters": { 3114 // "resource": { 3115 // "description": "REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.", 3116 // "location": "path", 3117 // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$", 3118 // "required": true, 3119 // "type": "string" 3120 // } 3121 // }, 3122 // "path": "v1/{+resource}:testIamPermissions", 3123 // "request": { 3124 // "$ref": "TestIamPermissionsRequest" 3125 // }, 3126 // "response": { 3127 // "$ref": "TestIamPermissionsResponse" 3128 // }, 3129 // "scopes": [ 3130 // "https://www.googleapis.com/auth/cloud-platform", 3131 // "https://www.googleapis.com/auth/cloudiot" 3132 // ] 3133 // } 3134 3135 } 3136 3137 // method id "cloudiot.projects.locations.registries.unbindDeviceFromGateway": 3138 3139 type ProjectsLocationsRegistriesUnbindDeviceFromGatewayCall struct { 3140 s *Service 3141 parent string 3142 unbinddevicefromgatewayrequest *UnbindDeviceFromGatewayRequest 3143 urlParams_ gensupport.URLParams 3144 ctx_ context.Context 3145 header_ http.Header 3146 } 3147 3148 // UnbindDeviceFromGateway: Deletes the association between the device 3149 // and the gateway. 3150 // 3151 // - parent: The name of the registry. For example, 3152 // `projects/example-project/locations/us-central1/registries/my-regist 3153 // ry`. 3154 func (r *ProjectsLocationsRegistriesService) UnbindDeviceFromGateway(parent string, unbinddevicefromgatewayrequest *UnbindDeviceFromGatewayRequest) *ProjectsLocationsRegistriesUnbindDeviceFromGatewayCall { 3155 c := &ProjectsLocationsRegistriesUnbindDeviceFromGatewayCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3156 c.parent = parent 3157 c.unbinddevicefromgatewayrequest = unbinddevicefromgatewayrequest 3158 return c 3159 } 3160 3161 // Fields allows partial responses to be retrieved. See 3162 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3163 // for more information. 3164 func (c *ProjectsLocationsRegistriesUnbindDeviceFromGatewayCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesUnbindDeviceFromGatewayCall { 3165 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3166 return c 3167 } 3168 3169 // Context sets the context to be used in this call's Do method. Any 3170 // pending HTTP request will be aborted if the provided context is 3171 // canceled. 3172 func (c *ProjectsLocationsRegistriesUnbindDeviceFromGatewayCall) Context(ctx context.Context) *ProjectsLocationsRegistriesUnbindDeviceFromGatewayCall { 3173 c.ctx_ = ctx 3174 return c 3175 } 3176 3177 // Header returns an http.Header that can be modified by the caller to 3178 // add HTTP headers to the request. 3179 func (c *ProjectsLocationsRegistriesUnbindDeviceFromGatewayCall) Header() http.Header { 3180 if c.header_ == nil { 3181 c.header_ = make(http.Header) 3182 } 3183 return c.header_ 3184 } 3185 3186 func (c *ProjectsLocationsRegistriesUnbindDeviceFromGatewayCall) doRequest(alt string) (*http.Response, error) { 3187 reqHeaders := make(http.Header) 3188 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 3189 for k, v := range c.header_ { 3190 reqHeaders[k] = v 3191 } 3192 reqHeaders.Set("User-Agent", c.s.userAgent()) 3193 var body io.Reader = nil 3194 body, err := googleapi.WithoutDataWrapper.JSONReader(c.unbinddevicefromgatewayrequest) 3195 if err != nil { 3196 return nil, err 3197 } 3198 reqHeaders.Set("Content-Type", "application/json") 3199 c.urlParams_.Set("alt", alt) 3200 c.urlParams_.Set("prettyPrint", "false") 3201 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}:unbindDeviceFromGateway") 3202 urls += "?" + c.urlParams_.Encode() 3203 req, err := http.NewRequest("POST", urls, body) 3204 if err != nil { 3205 return nil, err 3206 } 3207 req.Header = reqHeaders 3208 googleapi.Expand(req.URL, map[string]string{ 3209 "parent": c.parent, 3210 }) 3211 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3212 } 3213 3214 // Do executes the "cloudiot.projects.locations.registries.unbindDeviceFromGateway" call. 3215 // Exactly one of *UnbindDeviceFromGatewayResponse or error will be 3216 // non-nil. Any non-2xx status code is an error. Response headers are in 3217 // either *UnbindDeviceFromGatewayResponse.ServerResponse.Header or (if 3218 // a response was returned at all) in error.(*googleapi.Error).Header. 3219 // Use googleapi.IsNotModified to check whether the returned error was 3220 // because http.StatusNotModified was returned. 3221 func (c *ProjectsLocationsRegistriesUnbindDeviceFromGatewayCall) Do(opts ...googleapi.CallOption) (*UnbindDeviceFromGatewayResponse, error) { 3222 gensupport.SetOptions(c.urlParams_, opts...) 3223 res, err := c.doRequest("json") 3224 if res != nil && res.StatusCode == http.StatusNotModified { 3225 if res.Body != nil { 3226 res.Body.Close() 3227 } 3228 return nil, gensupport.WrapError(&googleapi.Error{ 3229 Code: res.StatusCode, 3230 Header: res.Header, 3231 }) 3232 } 3233 if err != nil { 3234 return nil, err 3235 } 3236 defer googleapi.CloseBody(res) 3237 if err := googleapi.CheckResponse(res); err != nil { 3238 return nil, gensupport.WrapError(err) 3239 } 3240 ret := &UnbindDeviceFromGatewayResponse{ 3241 ServerResponse: googleapi.ServerResponse{ 3242 Header: res.Header, 3243 HTTPStatusCode: res.StatusCode, 3244 }, 3245 } 3246 target := &ret 3247 if err := gensupport.DecodeResponse(target, res); err != nil { 3248 return nil, err 3249 } 3250 return ret, nil 3251 // { 3252 // "description": "Deletes the association between the device and the gateway.", 3253 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}:unbindDeviceFromGateway", 3254 // "httpMethod": "POST", 3255 // "id": "cloudiot.projects.locations.registries.unbindDeviceFromGateway", 3256 // "parameterOrder": [ 3257 // "parent" 3258 // ], 3259 // "parameters": { 3260 // "parent": { 3261 // "description": "Required. The name of the registry. For example, `projects/example-project/locations/us-central1/registries/my-registry`.", 3262 // "location": "path", 3263 // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$", 3264 // "required": true, 3265 // "type": "string" 3266 // } 3267 // }, 3268 // "path": "v1/{+parent}:unbindDeviceFromGateway", 3269 // "request": { 3270 // "$ref": "UnbindDeviceFromGatewayRequest" 3271 // }, 3272 // "response": { 3273 // "$ref": "UnbindDeviceFromGatewayResponse" 3274 // }, 3275 // "scopes": [ 3276 // "https://www.googleapis.com/auth/cloud-platform", 3277 // "https://www.googleapis.com/auth/cloudiot" 3278 // ] 3279 // } 3280 3281 } 3282 3283 // method id "cloudiot.projects.locations.registries.devices.create": 3284 3285 type ProjectsLocationsRegistriesDevicesCreateCall struct { 3286 s *Service 3287 parent string 3288 device *Device 3289 urlParams_ gensupport.URLParams 3290 ctx_ context.Context 3291 header_ http.Header 3292 } 3293 3294 // Create: Creates a device in a device registry. 3295 // 3296 // - parent: The name of the device registry where this device should be 3297 // created. For example, 3298 // `projects/example-project/locations/us-central1/registries/my-regist 3299 // ry`. 3300 func (r *ProjectsLocationsRegistriesDevicesService) Create(parent string, device *Device) *ProjectsLocationsRegistriesDevicesCreateCall { 3301 c := &ProjectsLocationsRegistriesDevicesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3302 c.parent = parent 3303 c.device = device 3304 return c 3305 } 3306 3307 // Fields allows partial responses to be retrieved. See 3308 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3309 // for more information. 3310 func (c *ProjectsLocationsRegistriesDevicesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesCreateCall { 3311 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3312 return c 3313 } 3314 3315 // Context sets the context to be used in this call's Do method. Any 3316 // pending HTTP request will be aborted if the provided context is 3317 // canceled. 3318 func (c *ProjectsLocationsRegistriesDevicesCreateCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesCreateCall { 3319 c.ctx_ = ctx 3320 return c 3321 } 3322 3323 // Header returns an http.Header that can be modified by the caller to 3324 // add HTTP headers to the request. 3325 func (c *ProjectsLocationsRegistriesDevicesCreateCall) Header() http.Header { 3326 if c.header_ == nil { 3327 c.header_ = make(http.Header) 3328 } 3329 return c.header_ 3330 } 3331 3332 func (c *ProjectsLocationsRegistriesDevicesCreateCall) doRequest(alt string) (*http.Response, error) { 3333 reqHeaders := make(http.Header) 3334 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 3335 for k, v := range c.header_ { 3336 reqHeaders[k] = v 3337 } 3338 reqHeaders.Set("User-Agent", c.s.userAgent()) 3339 var body io.Reader = nil 3340 body, err := googleapi.WithoutDataWrapper.JSONReader(c.device) 3341 if err != nil { 3342 return nil, err 3343 } 3344 reqHeaders.Set("Content-Type", "application/json") 3345 c.urlParams_.Set("alt", alt) 3346 c.urlParams_.Set("prettyPrint", "false") 3347 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/devices") 3348 urls += "?" + c.urlParams_.Encode() 3349 req, err := http.NewRequest("POST", urls, body) 3350 if err != nil { 3351 return nil, err 3352 } 3353 req.Header = reqHeaders 3354 googleapi.Expand(req.URL, map[string]string{ 3355 "parent": c.parent, 3356 }) 3357 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3358 } 3359 3360 // Do executes the "cloudiot.projects.locations.registries.devices.create" call. 3361 // Exactly one of *Device or error will be non-nil. Any non-2xx status 3362 // code is an error. Response headers are in either 3363 // *Device.ServerResponse.Header or (if a response was returned at all) 3364 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3365 // check whether the returned error was because http.StatusNotModified 3366 // was returned. 3367 func (c *ProjectsLocationsRegistriesDevicesCreateCall) Do(opts ...googleapi.CallOption) (*Device, error) { 3368 gensupport.SetOptions(c.urlParams_, opts...) 3369 res, err := c.doRequest("json") 3370 if res != nil && res.StatusCode == http.StatusNotModified { 3371 if res.Body != nil { 3372 res.Body.Close() 3373 } 3374 return nil, gensupport.WrapError(&googleapi.Error{ 3375 Code: res.StatusCode, 3376 Header: res.Header, 3377 }) 3378 } 3379 if err != nil { 3380 return nil, err 3381 } 3382 defer googleapi.CloseBody(res) 3383 if err := googleapi.CheckResponse(res); err != nil { 3384 return nil, gensupport.WrapError(err) 3385 } 3386 ret := &Device{ 3387 ServerResponse: googleapi.ServerResponse{ 3388 Header: res.Header, 3389 HTTPStatusCode: res.StatusCode, 3390 }, 3391 } 3392 target := &ret 3393 if err := gensupport.DecodeResponse(target, res); err != nil { 3394 return nil, err 3395 } 3396 return ret, nil 3397 // { 3398 // "description": "Creates a device in a device registry.", 3399 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices", 3400 // "httpMethod": "POST", 3401 // "id": "cloudiot.projects.locations.registries.devices.create", 3402 // "parameterOrder": [ 3403 // "parent" 3404 // ], 3405 // "parameters": { 3406 // "parent": { 3407 // "description": "Required. The name of the device registry where this device should be created. For example, `projects/example-project/locations/us-central1/registries/my-registry`.", 3408 // "location": "path", 3409 // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$", 3410 // "required": true, 3411 // "type": "string" 3412 // } 3413 // }, 3414 // "path": "v1/{+parent}/devices", 3415 // "request": { 3416 // "$ref": "Device" 3417 // }, 3418 // "response": { 3419 // "$ref": "Device" 3420 // }, 3421 // "scopes": [ 3422 // "https://www.googleapis.com/auth/cloud-platform", 3423 // "https://www.googleapis.com/auth/cloudiot" 3424 // ] 3425 // } 3426 3427 } 3428 3429 // method id "cloudiot.projects.locations.registries.devices.delete": 3430 3431 type ProjectsLocationsRegistriesDevicesDeleteCall struct { 3432 s *Service 3433 name string 3434 urlParams_ gensupport.URLParams 3435 ctx_ context.Context 3436 header_ http.Header 3437 } 3438 3439 // Delete: Deletes a device. 3440 // 3441 // - name: The name of the device. For example, 3442 // `projects/p0/locations/us-central1/registries/registry0/devices/devi 3443 // ce0` or 3444 // `projects/p0/locations/us-central1/registries/registry0/devices/{num 3445 // _id}`. 3446 func (r *ProjectsLocationsRegistriesDevicesService) Delete(name string) *ProjectsLocationsRegistriesDevicesDeleteCall { 3447 c := &ProjectsLocationsRegistriesDevicesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3448 c.name = name 3449 return c 3450 } 3451 3452 // Fields allows partial responses to be retrieved. See 3453 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3454 // for more information. 3455 func (c *ProjectsLocationsRegistriesDevicesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesDeleteCall { 3456 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3457 return c 3458 } 3459 3460 // Context sets the context to be used in this call's Do method. Any 3461 // pending HTTP request will be aborted if the provided context is 3462 // canceled. 3463 func (c *ProjectsLocationsRegistriesDevicesDeleteCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesDeleteCall { 3464 c.ctx_ = ctx 3465 return c 3466 } 3467 3468 // Header returns an http.Header that can be modified by the caller to 3469 // add HTTP headers to the request. 3470 func (c *ProjectsLocationsRegistriesDevicesDeleteCall) Header() http.Header { 3471 if c.header_ == nil { 3472 c.header_ = make(http.Header) 3473 } 3474 return c.header_ 3475 } 3476 3477 func (c *ProjectsLocationsRegistriesDevicesDeleteCall) doRequest(alt string) (*http.Response, error) { 3478 reqHeaders := make(http.Header) 3479 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 3480 for k, v := range c.header_ { 3481 reqHeaders[k] = v 3482 } 3483 reqHeaders.Set("User-Agent", c.s.userAgent()) 3484 var body io.Reader = nil 3485 c.urlParams_.Set("alt", alt) 3486 c.urlParams_.Set("prettyPrint", "false") 3487 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 3488 urls += "?" + c.urlParams_.Encode() 3489 req, err := http.NewRequest("DELETE", urls, body) 3490 if err != nil { 3491 return nil, err 3492 } 3493 req.Header = reqHeaders 3494 googleapi.Expand(req.URL, map[string]string{ 3495 "name": c.name, 3496 }) 3497 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3498 } 3499 3500 // Do executes the "cloudiot.projects.locations.registries.devices.delete" call. 3501 // Exactly one of *Empty or error will be non-nil. Any non-2xx status 3502 // code is an error. Response headers are in either 3503 // *Empty.ServerResponse.Header or (if a response was returned at all) 3504 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3505 // check whether the returned error was because http.StatusNotModified 3506 // was returned. 3507 func (c *ProjectsLocationsRegistriesDevicesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 3508 gensupport.SetOptions(c.urlParams_, opts...) 3509 res, err := c.doRequest("json") 3510 if res != nil && res.StatusCode == http.StatusNotModified { 3511 if res.Body != nil { 3512 res.Body.Close() 3513 } 3514 return nil, gensupport.WrapError(&googleapi.Error{ 3515 Code: res.StatusCode, 3516 Header: res.Header, 3517 }) 3518 } 3519 if err != nil { 3520 return nil, err 3521 } 3522 defer googleapi.CloseBody(res) 3523 if err := googleapi.CheckResponse(res); err != nil { 3524 return nil, gensupport.WrapError(err) 3525 } 3526 ret := &Empty{ 3527 ServerResponse: googleapi.ServerResponse{ 3528 Header: res.Header, 3529 HTTPStatusCode: res.StatusCode, 3530 }, 3531 } 3532 target := &ret 3533 if err := gensupport.DecodeResponse(target, res); err != nil { 3534 return nil, err 3535 } 3536 return ret, nil 3537 // { 3538 // "description": "Deletes a device.", 3539 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices/{devicesId}", 3540 // "httpMethod": "DELETE", 3541 // "id": "cloudiot.projects.locations.registries.devices.delete", 3542 // "parameterOrder": [ 3543 // "name" 3544 // ], 3545 // "parameters": { 3546 // "name": { 3547 // "description": "Required. The name of the device. For example, `projects/p0/locations/us-central1/registries/registry0/devices/device0` or `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.", 3548 // "location": "path", 3549 // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/devices/[^/]+$", 3550 // "required": true, 3551 // "type": "string" 3552 // } 3553 // }, 3554 // "path": "v1/{+name}", 3555 // "response": { 3556 // "$ref": "Empty" 3557 // }, 3558 // "scopes": [ 3559 // "https://www.googleapis.com/auth/cloud-platform", 3560 // "https://www.googleapis.com/auth/cloudiot" 3561 // ] 3562 // } 3563 3564 } 3565 3566 // method id "cloudiot.projects.locations.registries.devices.get": 3567 3568 type ProjectsLocationsRegistriesDevicesGetCall struct { 3569 s *Service 3570 name string 3571 urlParams_ gensupport.URLParams 3572 ifNoneMatch_ string 3573 ctx_ context.Context 3574 header_ http.Header 3575 } 3576 3577 // Get: Gets details about a device. 3578 // 3579 // - name: The name of the device. For example, 3580 // `projects/p0/locations/us-central1/registries/registry0/devices/devi 3581 // ce0` or 3582 // `projects/p0/locations/us-central1/registries/registry0/devices/{num 3583 // _id}`. 3584 func (r *ProjectsLocationsRegistriesDevicesService) Get(name string) *ProjectsLocationsRegistriesDevicesGetCall { 3585 c := &ProjectsLocationsRegistriesDevicesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3586 c.name = name 3587 return c 3588 } 3589 3590 // FieldMask sets the optional parameter "fieldMask": The fields of the 3591 // `Device` resource to be returned in the response. If the field mask 3592 // is unset or empty, all fields are returned. Fields have to be 3593 // provided in snake_case format, for example: `last_heartbeat_time`. 3594 func (c *ProjectsLocationsRegistriesDevicesGetCall) FieldMask(fieldMask string) *ProjectsLocationsRegistriesDevicesGetCall { 3595 c.urlParams_.Set("fieldMask", fieldMask) 3596 return c 3597 } 3598 3599 // Fields allows partial responses to be retrieved. See 3600 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3601 // for more information. 3602 func (c *ProjectsLocationsRegistriesDevicesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesGetCall { 3603 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3604 return c 3605 } 3606 3607 // IfNoneMatch sets the optional parameter which makes the operation 3608 // fail if the object's ETag matches the given value. This is useful for 3609 // getting updates only after the object has changed since the last 3610 // request. Use googleapi.IsNotModified to check whether the response 3611 // error from Do is the result of In-None-Match. 3612 func (c *ProjectsLocationsRegistriesDevicesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesDevicesGetCall { 3613 c.ifNoneMatch_ = entityTag 3614 return c 3615 } 3616 3617 // Context sets the context to be used in this call's Do method. Any 3618 // pending HTTP request will be aborted if the provided context is 3619 // canceled. 3620 func (c *ProjectsLocationsRegistriesDevicesGetCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesGetCall { 3621 c.ctx_ = ctx 3622 return c 3623 } 3624 3625 // Header returns an http.Header that can be modified by the caller to 3626 // add HTTP headers to the request. 3627 func (c *ProjectsLocationsRegistriesDevicesGetCall) Header() http.Header { 3628 if c.header_ == nil { 3629 c.header_ = make(http.Header) 3630 } 3631 return c.header_ 3632 } 3633 3634 func (c *ProjectsLocationsRegistriesDevicesGetCall) doRequest(alt string) (*http.Response, error) { 3635 reqHeaders := make(http.Header) 3636 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 3637 for k, v := range c.header_ { 3638 reqHeaders[k] = v 3639 } 3640 reqHeaders.Set("User-Agent", c.s.userAgent()) 3641 if c.ifNoneMatch_ != "" { 3642 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3643 } 3644 var body io.Reader = nil 3645 c.urlParams_.Set("alt", alt) 3646 c.urlParams_.Set("prettyPrint", "false") 3647 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 3648 urls += "?" + c.urlParams_.Encode() 3649 req, err := http.NewRequest("GET", urls, body) 3650 if err != nil { 3651 return nil, err 3652 } 3653 req.Header = reqHeaders 3654 googleapi.Expand(req.URL, map[string]string{ 3655 "name": c.name, 3656 }) 3657 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3658 } 3659 3660 // Do executes the "cloudiot.projects.locations.registries.devices.get" call. 3661 // Exactly one of *Device or error will be non-nil. Any non-2xx status 3662 // code is an error. Response headers are in either 3663 // *Device.ServerResponse.Header or (if a response was returned at all) 3664 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3665 // check whether the returned error was because http.StatusNotModified 3666 // was returned. 3667 func (c *ProjectsLocationsRegistriesDevicesGetCall) Do(opts ...googleapi.CallOption) (*Device, error) { 3668 gensupport.SetOptions(c.urlParams_, opts...) 3669 res, err := c.doRequest("json") 3670 if res != nil && res.StatusCode == http.StatusNotModified { 3671 if res.Body != nil { 3672 res.Body.Close() 3673 } 3674 return nil, gensupport.WrapError(&googleapi.Error{ 3675 Code: res.StatusCode, 3676 Header: res.Header, 3677 }) 3678 } 3679 if err != nil { 3680 return nil, err 3681 } 3682 defer googleapi.CloseBody(res) 3683 if err := googleapi.CheckResponse(res); err != nil { 3684 return nil, gensupport.WrapError(err) 3685 } 3686 ret := &Device{ 3687 ServerResponse: googleapi.ServerResponse{ 3688 Header: res.Header, 3689 HTTPStatusCode: res.StatusCode, 3690 }, 3691 } 3692 target := &ret 3693 if err := gensupport.DecodeResponse(target, res); err != nil { 3694 return nil, err 3695 } 3696 return ret, nil 3697 // { 3698 // "description": "Gets details about a device.", 3699 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices/{devicesId}", 3700 // "httpMethod": "GET", 3701 // "id": "cloudiot.projects.locations.registries.devices.get", 3702 // "parameterOrder": [ 3703 // "name" 3704 // ], 3705 // "parameters": { 3706 // "fieldMask": { 3707 // "description": "The fields of the `Device` resource to be returned in the response. If the field mask is unset or empty, all fields are returned. Fields have to be provided in snake_case format, for example: `last_heartbeat_time`.", 3708 // "format": "google-fieldmask", 3709 // "location": "query", 3710 // "type": "string" 3711 // }, 3712 // "name": { 3713 // "description": "Required. The name of the device. For example, `projects/p0/locations/us-central1/registries/registry0/devices/device0` or `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.", 3714 // "location": "path", 3715 // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/devices/[^/]+$", 3716 // "required": true, 3717 // "type": "string" 3718 // } 3719 // }, 3720 // "path": "v1/{+name}", 3721 // "response": { 3722 // "$ref": "Device" 3723 // }, 3724 // "scopes": [ 3725 // "https://www.googleapis.com/auth/cloud-platform", 3726 // "https://www.googleapis.com/auth/cloudiot" 3727 // ] 3728 // } 3729 3730 } 3731 3732 // method id "cloudiot.projects.locations.registries.devices.list": 3733 3734 type ProjectsLocationsRegistriesDevicesListCall struct { 3735 s *Service 3736 parent string 3737 urlParams_ gensupport.URLParams 3738 ifNoneMatch_ string 3739 ctx_ context.Context 3740 header_ http.Header 3741 } 3742 3743 // List: List devices in a device registry. 3744 // 3745 // - parent: The device registry path. Required. For example, 3746 // `projects/my-project/locations/us-central1/registries/my-registry`. 3747 func (r *ProjectsLocationsRegistriesDevicesService) List(parent string) *ProjectsLocationsRegistriesDevicesListCall { 3748 c := &ProjectsLocationsRegistriesDevicesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3749 c.parent = parent 3750 return c 3751 } 3752 3753 // DeviceIds sets the optional parameter "deviceIds": A list of device 3754 // string IDs. For example, `['device0', 'device12']`. If empty, this 3755 // field is ignored. Maximum IDs: 10,000 3756 func (c *ProjectsLocationsRegistriesDevicesListCall) DeviceIds(deviceIds ...string) *ProjectsLocationsRegistriesDevicesListCall { 3757 c.urlParams_.SetMulti("deviceIds", append([]string{}, deviceIds...)) 3758 return c 3759 } 3760 3761 // DeviceNumIds sets the optional parameter "deviceNumIds": A list of 3762 // device numeric IDs. If empty, this field is ignored. Maximum IDs: 3763 // 10,000. 3764 func (c *ProjectsLocationsRegistriesDevicesListCall) DeviceNumIds(deviceNumIds ...uint64) *ProjectsLocationsRegistriesDevicesListCall { 3765 var deviceNumIds_ []string 3766 for _, v := range deviceNumIds { 3767 deviceNumIds_ = append(deviceNumIds_, fmt.Sprint(v)) 3768 } 3769 c.urlParams_.SetMulti("deviceNumIds", deviceNumIds_) 3770 return c 3771 } 3772 3773 // FieldMask sets the optional parameter "fieldMask": The fields of the 3774 // `Device` resource to be returned in the response. The fields `id` and 3775 // `num_id` are always returned, along with any other fields specified 3776 // in snake_case format, for example: `last_heartbeat_time`. 3777 func (c *ProjectsLocationsRegistriesDevicesListCall) FieldMask(fieldMask string) *ProjectsLocationsRegistriesDevicesListCall { 3778 c.urlParams_.Set("fieldMask", fieldMask) 3779 return c 3780 } 3781 3782 // GatewayListOptionsAssociationsDeviceId sets the optional parameter 3783 // "gatewayListOptions.associationsDeviceId": If set, returns only the 3784 // gateways with which the specified device is associated. The device ID 3785 // can be numeric (`num_id`) or the user-defined string (`id`). For 3786 // example, if `456` is specified, returns only the gateways to which 3787 // the device with `num_id` 456 is bound. 3788 func (c *ProjectsLocationsRegistriesDevicesListCall) GatewayListOptionsAssociationsDeviceId(gatewayListOptionsAssociationsDeviceId string) *ProjectsLocationsRegistriesDevicesListCall { 3789 c.urlParams_.Set("gatewayListOptions.associationsDeviceId", gatewayListOptionsAssociationsDeviceId) 3790 return c 3791 } 3792 3793 // GatewayListOptionsAssociationsGatewayId sets the optional parameter 3794 // "gatewayListOptions.associationsGatewayId": If set, only devices 3795 // associated with the specified gateway are returned. The gateway ID 3796 // can be numeric (`num_id`) or the user-defined string (`id`). For 3797 // example, if `123` is specified, only devices bound to the gateway 3798 // with `num_id` 123 are returned. 3799 func (c *ProjectsLocationsRegistriesDevicesListCall) GatewayListOptionsAssociationsGatewayId(gatewayListOptionsAssociationsGatewayId string) *ProjectsLocationsRegistriesDevicesListCall { 3800 c.urlParams_.Set("gatewayListOptions.associationsGatewayId", gatewayListOptionsAssociationsGatewayId) 3801 return c 3802 } 3803 3804 // GatewayListOptionsGatewayType sets the optional parameter 3805 // "gatewayListOptions.gatewayType": If `GATEWAY` is specified, only 3806 // gateways are returned. If `NON_GATEWAY` is specified, only 3807 // non-gateway devices are returned. If `GATEWAY_TYPE_UNSPECIFIED` is 3808 // specified, all devices are returned. 3809 // 3810 // Possible values: 3811 // 3812 // "GATEWAY_TYPE_UNSPECIFIED" - If unspecified, the device is 3813 // 3814 // considered a non-gateway device. 3815 // 3816 // "GATEWAY" - The device is a gateway. 3817 // "NON_GATEWAY" - The device is not a gateway. 3818 func (c *ProjectsLocationsRegistriesDevicesListCall) GatewayListOptionsGatewayType(gatewayListOptionsGatewayType string) *ProjectsLocationsRegistriesDevicesListCall { 3819 c.urlParams_.Set("gatewayListOptions.gatewayType", gatewayListOptionsGatewayType) 3820 return c 3821 } 3822 3823 // PageSize sets the optional parameter "pageSize": The maximum number 3824 // of devices to return in the response. If this value is zero, the 3825 // service will select a default size. A call may return fewer objects 3826 // than requested. A non-empty `next_page_token` in the response 3827 // indicates that more data is available. 3828 func (c *ProjectsLocationsRegistriesDevicesListCall) PageSize(pageSize int64) *ProjectsLocationsRegistriesDevicesListCall { 3829 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 3830 return c 3831 } 3832 3833 // PageToken sets the optional parameter "pageToken": The value returned 3834 // by the last `ListDevicesResponse`; indicates that this is a 3835 // continuation of a prior `ListDevices` call and the system should 3836 // return the next page of data. 3837 func (c *ProjectsLocationsRegistriesDevicesListCall) PageToken(pageToken string) *ProjectsLocationsRegistriesDevicesListCall { 3838 c.urlParams_.Set("pageToken", pageToken) 3839 return c 3840 } 3841 3842 // Fields allows partial responses to be retrieved. See 3843 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3844 // for more information. 3845 func (c *ProjectsLocationsRegistriesDevicesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesListCall { 3846 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3847 return c 3848 } 3849 3850 // IfNoneMatch sets the optional parameter which makes the operation 3851 // fail if the object's ETag matches the given value. This is useful for 3852 // getting updates only after the object has changed since the last 3853 // request. Use googleapi.IsNotModified to check whether the response 3854 // error from Do is the result of In-None-Match. 3855 func (c *ProjectsLocationsRegistriesDevicesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesDevicesListCall { 3856 c.ifNoneMatch_ = entityTag 3857 return c 3858 } 3859 3860 // Context sets the context to be used in this call's Do method. Any 3861 // pending HTTP request will be aborted if the provided context is 3862 // canceled. 3863 func (c *ProjectsLocationsRegistriesDevicesListCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesListCall { 3864 c.ctx_ = ctx 3865 return c 3866 } 3867 3868 // Header returns an http.Header that can be modified by the caller to 3869 // add HTTP headers to the request. 3870 func (c *ProjectsLocationsRegistriesDevicesListCall) Header() http.Header { 3871 if c.header_ == nil { 3872 c.header_ = make(http.Header) 3873 } 3874 return c.header_ 3875 } 3876 3877 func (c *ProjectsLocationsRegistriesDevicesListCall) doRequest(alt string) (*http.Response, error) { 3878 reqHeaders := make(http.Header) 3879 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 3880 for k, v := range c.header_ { 3881 reqHeaders[k] = v 3882 } 3883 reqHeaders.Set("User-Agent", c.s.userAgent()) 3884 if c.ifNoneMatch_ != "" { 3885 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3886 } 3887 var body io.Reader = nil 3888 c.urlParams_.Set("alt", alt) 3889 c.urlParams_.Set("prettyPrint", "false") 3890 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/devices") 3891 urls += "?" + c.urlParams_.Encode() 3892 req, err := http.NewRequest("GET", urls, body) 3893 if err != nil { 3894 return nil, err 3895 } 3896 req.Header = reqHeaders 3897 googleapi.Expand(req.URL, map[string]string{ 3898 "parent": c.parent, 3899 }) 3900 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3901 } 3902 3903 // Do executes the "cloudiot.projects.locations.registries.devices.list" call. 3904 // Exactly one of *ListDevicesResponse or error will be non-nil. Any 3905 // non-2xx status code is an error. Response headers are in either 3906 // *ListDevicesResponse.ServerResponse.Header or (if a response was 3907 // returned at all) in error.(*googleapi.Error).Header. Use 3908 // googleapi.IsNotModified to check whether the returned error was 3909 // because http.StatusNotModified was returned. 3910 func (c *ProjectsLocationsRegistriesDevicesListCall) Do(opts ...googleapi.CallOption) (*ListDevicesResponse, error) { 3911 gensupport.SetOptions(c.urlParams_, opts...) 3912 res, err := c.doRequest("json") 3913 if res != nil && res.StatusCode == http.StatusNotModified { 3914 if res.Body != nil { 3915 res.Body.Close() 3916 } 3917 return nil, gensupport.WrapError(&googleapi.Error{ 3918 Code: res.StatusCode, 3919 Header: res.Header, 3920 }) 3921 } 3922 if err != nil { 3923 return nil, err 3924 } 3925 defer googleapi.CloseBody(res) 3926 if err := googleapi.CheckResponse(res); err != nil { 3927 return nil, gensupport.WrapError(err) 3928 } 3929 ret := &ListDevicesResponse{ 3930 ServerResponse: googleapi.ServerResponse{ 3931 Header: res.Header, 3932 HTTPStatusCode: res.StatusCode, 3933 }, 3934 } 3935 target := &ret 3936 if err := gensupport.DecodeResponse(target, res); err != nil { 3937 return nil, err 3938 } 3939 return ret, nil 3940 // { 3941 // "description": "List devices in a device registry.", 3942 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices", 3943 // "httpMethod": "GET", 3944 // "id": "cloudiot.projects.locations.registries.devices.list", 3945 // "parameterOrder": [ 3946 // "parent" 3947 // ], 3948 // "parameters": { 3949 // "deviceIds": { 3950 // "description": "A list of device string IDs. For example, `['device0', 'device12']`. If empty, this field is ignored. Maximum IDs: 10,000", 3951 // "location": "query", 3952 // "repeated": true, 3953 // "type": "string" 3954 // }, 3955 // "deviceNumIds": { 3956 // "description": "A list of device numeric IDs. If empty, this field is ignored. Maximum IDs: 10,000.", 3957 // "format": "uint64", 3958 // "location": "query", 3959 // "repeated": true, 3960 // "type": "string" 3961 // }, 3962 // "fieldMask": { 3963 // "description": "The fields of the `Device` resource to be returned in the response. The fields `id` and `num_id` are always returned, along with any other fields specified in snake_case format, for example: `last_heartbeat_time`.", 3964 // "format": "google-fieldmask", 3965 // "location": "query", 3966 // "type": "string" 3967 // }, 3968 // "gatewayListOptions.associationsDeviceId": { 3969 // "description": "If set, returns only the gateways with which the specified device is associated. The device ID can be numeric (`num_id`) or the user-defined string (`id`). For example, if `456` is specified, returns only the gateways to which the device with `num_id` 456 is bound.", 3970 // "location": "query", 3971 // "type": "string" 3972 // }, 3973 // "gatewayListOptions.associationsGatewayId": { 3974 // "description": "If set, only devices associated with the specified gateway are returned. The gateway ID can be numeric (`num_id`) or the user-defined string (`id`). For example, if `123` is specified, only devices bound to the gateway with `num_id` 123 are returned.", 3975 // "location": "query", 3976 // "type": "string" 3977 // }, 3978 // "gatewayListOptions.gatewayType": { 3979 // "description": "If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY` is specified, only non-gateway devices are returned. If `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned.", 3980 // "enum": [ 3981 // "GATEWAY_TYPE_UNSPECIFIED", 3982 // "GATEWAY", 3983 // "NON_GATEWAY" 3984 // ], 3985 // "enumDescriptions": [ 3986 // "If unspecified, the device is considered a non-gateway device.", 3987 // "The device is a gateway.", 3988 // "The device is not a gateway." 3989 // ], 3990 // "location": "query", 3991 // "type": "string" 3992 // }, 3993 // "pageSize": { 3994 // "description": "The maximum number of devices to return in the response. If this value is zero, the service will select a default size. A call may return fewer objects than requested. A non-empty `next_page_token` in the response indicates that more data is available.", 3995 // "format": "int32", 3996 // "location": "query", 3997 // "type": "integer" 3998 // }, 3999 // "pageToken": { 4000 // "description": "The value returned by the last `ListDevicesResponse`; indicates that this is a continuation of a prior `ListDevices` call and the system should return the next page of data.", 4001 // "location": "query", 4002 // "type": "string" 4003 // }, 4004 // "parent": { 4005 // "description": "Required. The device registry path. Required. For example, `projects/my-project/locations/us-central1/registries/my-registry`.", 4006 // "location": "path", 4007 // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$", 4008 // "required": true, 4009 // "type": "string" 4010 // } 4011 // }, 4012 // "path": "v1/{+parent}/devices", 4013 // "response": { 4014 // "$ref": "ListDevicesResponse" 4015 // }, 4016 // "scopes": [ 4017 // "https://www.googleapis.com/auth/cloud-platform", 4018 // "https://www.googleapis.com/auth/cloudiot" 4019 // ] 4020 // } 4021 4022 } 4023 4024 // Pages invokes f for each page of results. 4025 // A non-nil error returned from f will halt the iteration. 4026 // The provided context supersedes any context provided to the Context method. 4027 func (c *ProjectsLocationsRegistriesDevicesListCall) Pages(ctx context.Context, f func(*ListDevicesResponse) error) error { 4028 c.ctx_ = ctx 4029 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 4030 for { 4031 x, err := c.Do() 4032 if err != nil { 4033 return err 4034 } 4035 if err := f(x); err != nil { 4036 return err 4037 } 4038 if x.NextPageToken == "" { 4039 return nil 4040 } 4041 c.PageToken(x.NextPageToken) 4042 } 4043 } 4044 4045 // method id "cloudiot.projects.locations.registries.devices.modifyCloudToDeviceConfig": 4046 4047 type ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall struct { 4048 s *Service 4049 name string 4050 modifycloudtodeviceconfigrequest *ModifyCloudToDeviceConfigRequest 4051 urlParams_ gensupport.URLParams 4052 ctx_ context.Context 4053 header_ http.Header 4054 } 4055 4056 // ModifyCloudToDeviceConfig: Modifies the configuration for the device, 4057 // which is eventually sent from the Cloud IoT Core servers. Returns the 4058 // modified configuration version and its metadata. 4059 // 4060 // - name: The name of the device. For example, 4061 // `projects/p0/locations/us-central1/registries/registry0/devices/devi 4062 // ce0` or 4063 // `projects/p0/locations/us-central1/registries/registry0/devices/{num 4064 // _id}`. 4065 func (r *ProjectsLocationsRegistriesDevicesService) ModifyCloudToDeviceConfig(name string, modifycloudtodeviceconfigrequest *ModifyCloudToDeviceConfigRequest) *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall { 4066 c := &ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4067 c.name = name 4068 c.modifycloudtodeviceconfigrequest = modifycloudtodeviceconfigrequest 4069 return c 4070 } 4071 4072 // Fields allows partial responses to be retrieved. See 4073 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4074 // for more information. 4075 func (c *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall { 4076 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4077 return c 4078 } 4079 4080 // Context sets the context to be used in this call's Do method. Any 4081 // pending HTTP request will be aborted if the provided context is 4082 // canceled. 4083 func (c *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall { 4084 c.ctx_ = ctx 4085 return c 4086 } 4087 4088 // Header returns an http.Header that can be modified by the caller to 4089 // add HTTP headers to the request. 4090 func (c *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall) Header() http.Header { 4091 if c.header_ == nil { 4092 c.header_ = make(http.Header) 4093 } 4094 return c.header_ 4095 } 4096 4097 func (c *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall) doRequest(alt string) (*http.Response, error) { 4098 reqHeaders := make(http.Header) 4099 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 4100 for k, v := range c.header_ { 4101 reqHeaders[k] = v 4102 } 4103 reqHeaders.Set("User-Agent", c.s.userAgent()) 4104 var body io.Reader = nil 4105 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifycloudtodeviceconfigrequest) 4106 if err != nil { 4107 return nil, err 4108 } 4109 reqHeaders.Set("Content-Type", "application/json") 4110 c.urlParams_.Set("alt", alt) 4111 c.urlParams_.Set("prettyPrint", "false") 4112 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:modifyCloudToDeviceConfig") 4113 urls += "?" + c.urlParams_.Encode() 4114 req, err := http.NewRequest("POST", urls, body) 4115 if err != nil { 4116 return nil, err 4117 } 4118 req.Header = reqHeaders 4119 googleapi.Expand(req.URL, map[string]string{ 4120 "name": c.name, 4121 }) 4122 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4123 } 4124 4125 // Do executes the "cloudiot.projects.locations.registries.devices.modifyCloudToDeviceConfig" call. 4126 // Exactly one of *DeviceConfig or error will be non-nil. Any non-2xx 4127 // status code is an error. Response headers are in either 4128 // *DeviceConfig.ServerResponse.Header or (if a response was returned at 4129 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4130 // to check whether the returned error was because 4131 // http.StatusNotModified was returned. 4132 func (c *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall) Do(opts ...googleapi.CallOption) (*DeviceConfig, error) { 4133 gensupport.SetOptions(c.urlParams_, opts...) 4134 res, err := c.doRequest("json") 4135 if res != nil && res.StatusCode == http.StatusNotModified { 4136 if res.Body != nil { 4137 res.Body.Close() 4138 } 4139 return nil, gensupport.WrapError(&googleapi.Error{ 4140 Code: res.StatusCode, 4141 Header: res.Header, 4142 }) 4143 } 4144 if err != nil { 4145 return nil, err 4146 } 4147 defer googleapi.CloseBody(res) 4148 if err := googleapi.CheckResponse(res); err != nil { 4149 return nil, gensupport.WrapError(err) 4150 } 4151 ret := &DeviceConfig{ 4152 ServerResponse: googleapi.ServerResponse{ 4153 Header: res.Header, 4154 HTTPStatusCode: res.StatusCode, 4155 }, 4156 } 4157 target := &ret 4158 if err := gensupport.DecodeResponse(target, res); err != nil { 4159 return nil, err 4160 } 4161 return ret, nil 4162 // { 4163 // "description": "Modifies the configuration for the device, which is eventually sent from the Cloud IoT Core servers. Returns the modified configuration version and its metadata.", 4164 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices/{devicesId}:modifyCloudToDeviceConfig", 4165 // "httpMethod": "POST", 4166 // "id": "cloudiot.projects.locations.registries.devices.modifyCloudToDeviceConfig", 4167 // "parameterOrder": [ 4168 // "name" 4169 // ], 4170 // "parameters": { 4171 // "name": { 4172 // "description": "Required. The name of the device. For example, `projects/p0/locations/us-central1/registries/registry0/devices/device0` or `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.", 4173 // "location": "path", 4174 // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/devices/[^/]+$", 4175 // "required": true, 4176 // "type": "string" 4177 // } 4178 // }, 4179 // "path": "v1/{+name}:modifyCloudToDeviceConfig", 4180 // "request": { 4181 // "$ref": "ModifyCloudToDeviceConfigRequest" 4182 // }, 4183 // "response": { 4184 // "$ref": "DeviceConfig" 4185 // }, 4186 // "scopes": [ 4187 // "https://www.googleapis.com/auth/cloud-platform", 4188 // "https://www.googleapis.com/auth/cloudiot" 4189 // ] 4190 // } 4191 4192 } 4193 4194 // method id "cloudiot.projects.locations.registries.devices.patch": 4195 4196 type ProjectsLocationsRegistriesDevicesPatchCall struct { 4197 s *Service 4198 name string 4199 device *Device 4200 urlParams_ gensupport.URLParams 4201 ctx_ context.Context 4202 header_ http.Header 4203 } 4204 4205 // Patch: Updates a device. 4206 // 4207 // - name: The resource path name. For example, 4208 // `projects/p1/locations/us-central1/registries/registry0/devices/dev0 4209 // ` or 4210 // `projects/p1/locations/us-central1/registries/registry0/devices/{num 4211 // _id}`. When `name` is populated as a response from the service, it 4212 // always ends in the device numeric ID. 4213 func (r *ProjectsLocationsRegistriesDevicesService) Patch(name string, device *Device) *ProjectsLocationsRegistriesDevicesPatchCall { 4214 c := &ProjectsLocationsRegistriesDevicesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4215 c.name = name 4216 c.device = device 4217 return c 4218 } 4219 4220 // UpdateMask sets the optional parameter "updateMask": Required. Only 4221 // updates the `device` fields indicated by this mask. The field mask 4222 // must not be empty, and it must not contain fields that are immutable 4223 // or only set by the server. Mutable top-level fields: `credentials`, 4224 // `blocked`, and `metadata` 4225 func (c *ProjectsLocationsRegistriesDevicesPatchCall) UpdateMask(updateMask string) *ProjectsLocationsRegistriesDevicesPatchCall { 4226 c.urlParams_.Set("updateMask", updateMask) 4227 return c 4228 } 4229 4230 // Fields allows partial responses to be retrieved. See 4231 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4232 // for more information. 4233 func (c *ProjectsLocationsRegistriesDevicesPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesPatchCall { 4234 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4235 return c 4236 } 4237 4238 // Context sets the context to be used in this call's Do method. Any 4239 // pending HTTP request will be aborted if the provided context is 4240 // canceled. 4241 func (c *ProjectsLocationsRegistriesDevicesPatchCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesPatchCall { 4242 c.ctx_ = ctx 4243 return c 4244 } 4245 4246 // Header returns an http.Header that can be modified by the caller to 4247 // add HTTP headers to the request. 4248 func (c *ProjectsLocationsRegistriesDevicesPatchCall) Header() http.Header { 4249 if c.header_ == nil { 4250 c.header_ = make(http.Header) 4251 } 4252 return c.header_ 4253 } 4254 4255 func (c *ProjectsLocationsRegistriesDevicesPatchCall) doRequest(alt string) (*http.Response, error) { 4256 reqHeaders := make(http.Header) 4257 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 4258 for k, v := range c.header_ { 4259 reqHeaders[k] = v 4260 } 4261 reqHeaders.Set("User-Agent", c.s.userAgent()) 4262 var body io.Reader = nil 4263 body, err := googleapi.WithoutDataWrapper.JSONReader(c.device) 4264 if err != nil { 4265 return nil, err 4266 } 4267 reqHeaders.Set("Content-Type", "application/json") 4268 c.urlParams_.Set("alt", alt) 4269 c.urlParams_.Set("prettyPrint", "false") 4270 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 4271 urls += "?" + c.urlParams_.Encode() 4272 req, err := http.NewRequest("PATCH", urls, body) 4273 if err != nil { 4274 return nil, err 4275 } 4276 req.Header = reqHeaders 4277 googleapi.Expand(req.URL, map[string]string{ 4278 "name": c.name, 4279 }) 4280 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4281 } 4282 4283 // Do executes the "cloudiot.projects.locations.registries.devices.patch" call. 4284 // Exactly one of *Device or error will be non-nil. Any non-2xx status 4285 // code is an error. Response headers are in either 4286 // *Device.ServerResponse.Header or (if a response was returned at all) 4287 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4288 // check whether the returned error was because http.StatusNotModified 4289 // was returned. 4290 func (c *ProjectsLocationsRegistriesDevicesPatchCall) Do(opts ...googleapi.CallOption) (*Device, error) { 4291 gensupport.SetOptions(c.urlParams_, opts...) 4292 res, err := c.doRequest("json") 4293 if res != nil && res.StatusCode == http.StatusNotModified { 4294 if res.Body != nil { 4295 res.Body.Close() 4296 } 4297 return nil, gensupport.WrapError(&googleapi.Error{ 4298 Code: res.StatusCode, 4299 Header: res.Header, 4300 }) 4301 } 4302 if err != nil { 4303 return nil, err 4304 } 4305 defer googleapi.CloseBody(res) 4306 if err := googleapi.CheckResponse(res); err != nil { 4307 return nil, gensupport.WrapError(err) 4308 } 4309 ret := &Device{ 4310 ServerResponse: googleapi.ServerResponse{ 4311 Header: res.Header, 4312 HTTPStatusCode: res.StatusCode, 4313 }, 4314 } 4315 target := &ret 4316 if err := gensupport.DecodeResponse(target, res); err != nil { 4317 return nil, err 4318 } 4319 return ret, nil 4320 // { 4321 // "description": "Updates a device.", 4322 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices/{devicesId}", 4323 // "httpMethod": "PATCH", 4324 // "id": "cloudiot.projects.locations.registries.devices.patch", 4325 // "parameterOrder": [ 4326 // "name" 4327 // ], 4328 // "parameters": { 4329 // "name": { 4330 // "description": "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_id}`. When `name` is populated as a response from the service, it always ends in the device numeric ID.", 4331 // "location": "path", 4332 // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/devices/[^/]+$", 4333 // "required": true, 4334 // "type": "string" 4335 // }, 4336 // "updateMask": { 4337 // "description": "Required. Only updates the `device` fields indicated by this mask. The field mask must not be empty, and it must not contain fields that are immutable or only set by the server. Mutable top-level fields: `credentials`, `blocked`, and `metadata`", 4338 // "format": "google-fieldmask", 4339 // "location": "query", 4340 // "type": "string" 4341 // } 4342 // }, 4343 // "path": "v1/{+name}", 4344 // "request": { 4345 // "$ref": "Device" 4346 // }, 4347 // "response": { 4348 // "$ref": "Device" 4349 // }, 4350 // "scopes": [ 4351 // "https://www.googleapis.com/auth/cloud-platform", 4352 // "https://www.googleapis.com/auth/cloudiot" 4353 // ] 4354 // } 4355 4356 } 4357 4358 // method id "cloudiot.projects.locations.registries.devices.sendCommandToDevice": 4359 4360 type ProjectsLocationsRegistriesDevicesSendCommandToDeviceCall struct { 4361 s *Service 4362 name string 4363 sendcommandtodevicerequest *SendCommandToDeviceRequest 4364 urlParams_ gensupport.URLParams 4365 ctx_ context.Context 4366 header_ http.Header 4367 } 4368 4369 // SendCommandToDevice: Sends a command to the specified device. In 4370 // order for a device to be able to receive commands, it must: 1) be 4371 // connected to Cloud IoT Core using the MQTT protocol, and 2) be 4372 // subscribed to the group of MQTT topics specified by 4373 // /devices/{device-id}/commands/#. This subscription will receive 4374 // commands at the top-level topic /devices/{device-id}/commands as well 4375 // as commands for subfolders, like 4376 // /devices/{device-id}/commands/subfolder. Note that subscribing to 4377 // specific subfolders is not supported. If the command could not be 4378 // delivered to the device, this method will return an error; in 4379 // particular, if the device is not subscribed, this method will return 4380 // FAILED_PRECONDITION. Otherwise, this method will return OK. If the 4381 // subscription is QoS 1, at least once delivery will be guaranteed; for 4382 // QoS 0, no acknowledgment will be expected from the device. 4383 // 4384 // - name: The name of the device. For example, 4385 // `projects/p0/locations/us-central1/registries/registry0/devices/devi 4386 // ce0` or 4387 // `projects/p0/locations/us-central1/registries/registry0/devices/{num 4388 // _id}`. 4389 func (r *ProjectsLocationsRegistriesDevicesService) SendCommandToDevice(name string, sendcommandtodevicerequest *SendCommandToDeviceRequest) *ProjectsLocationsRegistriesDevicesSendCommandToDeviceCall { 4390 c := &ProjectsLocationsRegistriesDevicesSendCommandToDeviceCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4391 c.name = name 4392 c.sendcommandtodevicerequest = sendcommandtodevicerequest 4393 return c 4394 } 4395 4396 // Fields allows partial responses to be retrieved. See 4397 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4398 // for more information. 4399 func (c *ProjectsLocationsRegistriesDevicesSendCommandToDeviceCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesSendCommandToDeviceCall { 4400 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4401 return c 4402 } 4403 4404 // Context sets the context to be used in this call's Do method. Any 4405 // pending HTTP request will be aborted if the provided context is 4406 // canceled. 4407 func (c *ProjectsLocationsRegistriesDevicesSendCommandToDeviceCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesSendCommandToDeviceCall { 4408 c.ctx_ = ctx 4409 return c 4410 } 4411 4412 // Header returns an http.Header that can be modified by the caller to 4413 // add HTTP headers to the request. 4414 func (c *ProjectsLocationsRegistriesDevicesSendCommandToDeviceCall) Header() http.Header { 4415 if c.header_ == nil { 4416 c.header_ = make(http.Header) 4417 } 4418 return c.header_ 4419 } 4420 4421 func (c *ProjectsLocationsRegistriesDevicesSendCommandToDeviceCall) doRequest(alt string) (*http.Response, error) { 4422 reqHeaders := make(http.Header) 4423 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 4424 for k, v := range c.header_ { 4425 reqHeaders[k] = v 4426 } 4427 reqHeaders.Set("User-Agent", c.s.userAgent()) 4428 var body io.Reader = nil 4429 body, err := googleapi.WithoutDataWrapper.JSONReader(c.sendcommandtodevicerequest) 4430 if err != nil { 4431 return nil, err 4432 } 4433 reqHeaders.Set("Content-Type", "application/json") 4434 c.urlParams_.Set("alt", alt) 4435 c.urlParams_.Set("prettyPrint", "false") 4436 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:sendCommandToDevice") 4437 urls += "?" + c.urlParams_.Encode() 4438 req, err := http.NewRequest("POST", urls, body) 4439 if err != nil { 4440 return nil, err 4441 } 4442 req.Header = reqHeaders 4443 googleapi.Expand(req.URL, map[string]string{ 4444 "name": c.name, 4445 }) 4446 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4447 } 4448 4449 // Do executes the "cloudiot.projects.locations.registries.devices.sendCommandToDevice" call. 4450 // Exactly one of *SendCommandToDeviceResponse or error will be non-nil. 4451 // Any non-2xx status code is an error. Response headers are in either 4452 // *SendCommandToDeviceResponse.ServerResponse.Header or (if a response 4453 // was returned at all) in error.(*googleapi.Error).Header. Use 4454 // googleapi.IsNotModified to check whether the returned error was 4455 // because http.StatusNotModified was returned. 4456 func (c *ProjectsLocationsRegistriesDevicesSendCommandToDeviceCall) Do(opts ...googleapi.CallOption) (*SendCommandToDeviceResponse, error) { 4457 gensupport.SetOptions(c.urlParams_, opts...) 4458 res, err := c.doRequest("json") 4459 if res != nil && res.StatusCode == http.StatusNotModified { 4460 if res.Body != nil { 4461 res.Body.Close() 4462 } 4463 return nil, gensupport.WrapError(&googleapi.Error{ 4464 Code: res.StatusCode, 4465 Header: res.Header, 4466 }) 4467 } 4468 if err != nil { 4469 return nil, err 4470 } 4471 defer googleapi.CloseBody(res) 4472 if err := googleapi.CheckResponse(res); err != nil { 4473 return nil, gensupport.WrapError(err) 4474 } 4475 ret := &SendCommandToDeviceResponse{ 4476 ServerResponse: googleapi.ServerResponse{ 4477 Header: res.Header, 4478 HTTPStatusCode: res.StatusCode, 4479 }, 4480 } 4481 target := &ret 4482 if err := gensupport.DecodeResponse(target, res); err != nil { 4483 return nil, err 4484 } 4485 return ret, nil 4486 // { 4487 // "description": "Sends a command to the specified device. In order for a device to be able to receive commands, it must: 1) be connected to Cloud IoT Core using the MQTT protocol, and 2) be subscribed to the group of MQTT topics specified by /devices/{device-id}/commands/#. This subscription will receive commands at the top-level topic /devices/{device-id}/commands as well as commands for subfolders, like /devices/{device-id}/commands/subfolder. Note that subscribing to specific subfolders is not supported. If the command could not be delivered to the device, this method will return an error; in particular, if the device is not subscribed, this method will return FAILED_PRECONDITION. Otherwise, this method will return OK. If the subscription is QoS 1, at least once delivery will be guaranteed; for QoS 0, no acknowledgment will be expected from the device.", 4488 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices/{devicesId}:sendCommandToDevice", 4489 // "httpMethod": "POST", 4490 // "id": "cloudiot.projects.locations.registries.devices.sendCommandToDevice", 4491 // "parameterOrder": [ 4492 // "name" 4493 // ], 4494 // "parameters": { 4495 // "name": { 4496 // "description": "Required. The name of the device. For example, `projects/p0/locations/us-central1/registries/registry0/devices/device0` or `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.", 4497 // "location": "path", 4498 // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/devices/[^/]+$", 4499 // "required": true, 4500 // "type": "string" 4501 // } 4502 // }, 4503 // "path": "v1/{+name}:sendCommandToDevice", 4504 // "request": { 4505 // "$ref": "SendCommandToDeviceRequest" 4506 // }, 4507 // "response": { 4508 // "$ref": "SendCommandToDeviceResponse" 4509 // }, 4510 // "scopes": [ 4511 // "https://www.googleapis.com/auth/cloud-platform", 4512 // "https://www.googleapis.com/auth/cloudiot" 4513 // ] 4514 // } 4515 4516 } 4517 4518 // method id "cloudiot.projects.locations.registries.devices.configVersions.list": 4519 4520 type ProjectsLocationsRegistriesDevicesConfigVersionsListCall struct { 4521 s *Service 4522 name string 4523 urlParams_ gensupport.URLParams 4524 ifNoneMatch_ string 4525 ctx_ context.Context 4526 header_ http.Header 4527 } 4528 4529 // List: Lists the last few versions of the device configuration in 4530 // descending order (i.e.: newest first). 4531 // 4532 // - name: The name of the device. For example, 4533 // `projects/p0/locations/us-central1/registries/registry0/devices/devi 4534 // ce0` or 4535 // `projects/p0/locations/us-central1/registries/registry0/devices/{num 4536 // _id}`. 4537 func (r *ProjectsLocationsRegistriesDevicesConfigVersionsService) List(name string) *ProjectsLocationsRegistriesDevicesConfigVersionsListCall { 4538 c := &ProjectsLocationsRegistriesDevicesConfigVersionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4539 c.name = name 4540 return c 4541 } 4542 4543 // NumVersions sets the optional parameter "numVersions": The number of 4544 // versions to list. Versions are listed in decreasing order of the 4545 // version number. The maximum number of versions retained is 10. If 4546 // this value is zero, it will return all the versions available. 4547 func (c *ProjectsLocationsRegistriesDevicesConfigVersionsListCall) NumVersions(numVersions int64) *ProjectsLocationsRegistriesDevicesConfigVersionsListCall { 4548 c.urlParams_.Set("numVersions", fmt.Sprint(numVersions)) 4549 return c 4550 } 4551 4552 // Fields allows partial responses to be retrieved. See 4553 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4554 // for more information. 4555 func (c *ProjectsLocationsRegistriesDevicesConfigVersionsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesConfigVersionsListCall { 4556 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4557 return c 4558 } 4559 4560 // IfNoneMatch sets the optional parameter which makes the operation 4561 // fail if the object's ETag matches the given value. This is useful for 4562 // getting updates only after the object has changed since the last 4563 // request. Use googleapi.IsNotModified to check whether the response 4564 // error from Do is the result of In-None-Match. 4565 func (c *ProjectsLocationsRegistriesDevicesConfigVersionsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesDevicesConfigVersionsListCall { 4566 c.ifNoneMatch_ = entityTag 4567 return c 4568 } 4569 4570 // Context sets the context to be used in this call's Do method. Any 4571 // pending HTTP request will be aborted if the provided context is 4572 // canceled. 4573 func (c *ProjectsLocationsRegistriesDevicesConfigVersionsListCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesConfigVersionsListCall { 4574 c.ctx_ = ctx 4575 return c 4576 } 4577 4578 // Header returns an http.Header that can be modified by the caller to 4579 // add HTTP headers to the request. 4580 func (c *ProjectsLocationsRegistriesDevicesConfigVersionsListCall) Header() http.Header { 4581 if c.header_ == nil { 4582 c.header_ = make(http.Header) 4583 } 4584 return c.header_ 4585 } 4586 4587 func (c *ProjectsLocationsRegistriesDevicesConfigVersionsListCall) doRequest(alt string) (*http.Response, error) { 4588 reqHeaders := make(http.Header) 4589 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 4590 for k, v := range c.header_ { 4591 reqHeaders[k] = v 4592 } 4593 reqHeaders.Set("User-Agent", c.s.userAgent()) 4594 if c.ifNoneMatch_ != "" { 4595 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4596 } 4597 var body io.Reader = nil 4598 c.urlParams_.Set("alt", alt) 4599 c.urlParams_.Set("prettyPrint", "false") 4600 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/configVersions") 4601 urls += "?" + c.urlParams_.Encode() 4602 req, err := http.NewRequest("GET", urls, body) 4603 if err != nil { 4604 return nil, err 4605 } 4606 req.Header = reqHeaders 4607 googleapi.Expand(req.URL, map[string]string{ 4608 "name": c.name, 4609 }) 4610 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4611 } 4612 4613 // Do executes the "cloudiot.projects.locations.registries.devices.configVersions.list" call. 4614 // Exactly one of *ListDeviceConfigVersionsResponse or error will be 4615 // non-nil. Any non-2xx status code is an error. Response headers are in 4616 // either *ListDeviceConfigVersionsResponse.ServerResponse.Header or (if 4617 // a response was returned at all) in error.(*googleapi.Error).Header. 4618 // Use googleapi.IsNotModified to check whether the returned error was 4619 // because http.StatusNotModified was returned. 4620 func (c *ProjectsLocationsRegistriesDevicesConfigVersionsListCall) Do(opts ...googleapi.CallOption) (*ListDeviceConfigVersionsResponse, error) { 4621 gensupport.SetOptions(c.urlParams_, opts...) 4622 res, err := c.doRequest("json") 4623 if res != nil && res.StatusCode == http.StatusNotModified { 4624 if res.Body != nil { 4625 res.Body.Close() 4626 } 4627 return nil, gensupport.WrapError(&googleapi.Error{ 4628 Code: res.StatusCode, 4629 Header: res.Header, 4630 }) 4631 } 4632 if err != nil { 4633 return nil, err 4634 } 4635 defer googleapi.CloseBody(res) 4636 if err := googleapi.CheckResponse(res); err != nil { 4637 return nil, gensupport.WrapError(err) 4638 } 4639 ret := &ListDeviceConfigVersionsResponse{ 4640 ServerResponse: googleapi.ServerResponse{ 4641 Header: res.Header, 4642 HTTPStatusCode: res.StatusCode, 4643 }, 4644 } 4645 target := &ret 4646 if err := gensupport.DecodeResponse(target, res); err != nil { 4647 return nil, err 4648 } 4649 return ret, nil 4650 // { 4651 // "description": "Lists the last few versions of the device configuration in descending order (i.e.: newest first).", 4652 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices/{devicesId}/configVersions", 4653 // "httpMethod": "GET", 4654 // "id": "cloudiot.projects.locations.registries.devices.configVersions.list", 4655 // "parameterOrder": [ 4656 // "name" 4657 // ], 4658 // "parameters": { 4659 // "name": { 4660 // "description": "Required. The name of the device. For example, `projects/p0/locations/us-central1/registries/registry0/devices/device0` or `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.", 4661 // "location": "path", 4662 // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/devices/[^/]+$", 4663 // "required": true, 4664 // "type": "string" 4665 // }, 4666 // "numVersions": { 4667 // "description": "The number of versions to list. Versions are listed in decreasing order of the version number. The maximum number of versions retained is 10. If this value is zero, it will return all the versions available.", 4668 // "format": "int32", 4669 // "location": "query", 4670 // "type": "integer" 4671 // } 4672 // }, 4673 // "path": "v1/{+name}/configVersions", 4674 // "response": { 4675 // "$ref": "ListDeviceConfigVersionsResponse" 4676 // }, 4677 // "scopes": [ 4678 // "https://www.googleapis.com/auth/cloud-platform", 4679 // "https://www.googleapis.com/auth/cloudiot" 4680 // ] 4681 // } 4682 4683 } 4684 4685 // method id "cloudiot.projects.locations.registries.devices.states.list": 4686 4687 type ProjectsLocationsRegistriesDevicesStatesListCall struct { 4688 s *Service 4689 name string 4690 urlParams_ gensupport.URLParams 4691 ifNoneMatch_ string 4692 ctx_ context.Context 4693 header_ http.Header 4694 } 4695 4696 // List: Lists the last few versions of the device state in descending 4697 // order (i.e.: newest first). 4698 // 4699 // - name: The name of the device. For example, 4700 // `projects/p0/locations/us-central1/registries/registry0/devices/devi 4701 // ce0` or 4702 // `projects/p0/locations/us-central1/registries/registry0/devices/{num 4703 // _id}`. 4704 func (r *ProjectsLocationsRegistriesDevicesStatesService) List(name string) *ProjectsLocationsRegistriesDevicesStatesListCall { 4705 c := &ProjectsLocationsRegistriesDevicesStatesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4706 c.name = name 4707 return c 4708 } 4709 4710 // NumStates sets the optional parameter "numStates": The number of 4711 // states to list. States are listed in descending order of update time. 4712 // The maximum number of states retained is 10. If this value is zero, 4713 // it will return all the states available. 4714 func (c *ProjectsLocationsRegistriesDevicesStatesListCall) NumStates(numStates int64) *ProjectsLocationsRegistriesDevicesStatesListCall { 4715 c.urlParams_.Set("numStates", fmt.Sprint(numStates)) 4716 return c 4717 } 4718 4719 // Fields allows partial responses to be retrieved. See 4720 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4721 // for more information. 4722 func (c *ProjectsLocationsRegistriesDevicesStatesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesStatesListCall { 4723 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4724 return c 4725 } 4726 4727 // IfNoneMatch sets the optional parameter which makes the operation 4728 // fail if the object's ETag matches the given value. This is useful for 4729 // getting updates only after the object has changed since the last 4730 // request. Use googleapi.IsNotModified to check whether the response 4731 // error from Do is the result of In-None-Match. 4732 func (c *ProjectsLocationsRegistriesDevicesStatesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesDevicesStatesListCall { 4733 c.ifNoneMatch_ = entityTag 4734 return c 4735 } 4736 4737 // Context sets the context to be used in this call's Do method. Any 4738 // pending HTTP request will be aborted if the provided context is 4739 // canceled. 4740 func (c *ProjectsLocationsRegistriesDevicesStatesListCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesStatesListCall { 4741 c.ctx_ = ctx 4742 return c 4743 } 4744 4745 // Header returns an http.Header that can be modified by the caller to 4746 // add HTTP headers to the request. 4747 func (c *ProjectsLocationsRegistriesDevicesStatesListCall) Header() http.Header { 4748 if c.header_ == nil { 4749 c.header_ = make(http.Header) 4750 } 4751 return c.header_ 4752 } 4753 4754 func (c *ProjectsLocationsRegistriesDevicesStatesListCall) doRequest(alt string) (*http.Response, error) { 4755 reqHeaders := make(http.Header) 4756 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 4757 for k, v := range c.header_ { 4758 reqHeaders[k] = v 4759 } 4760 reqHeaders.Set("User-Agent", c.s.userAgent()) 4761 if c.ifNoneMatch_ != "" { 4762 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4763 } 4764 var body io.Reader = nil 4765 c.urlParams_.Set("alt", alt) 4766 c.urlParams_.Set("prettyPrint", "false") 4767 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/states") 4768 urls += "?" + c.urlParams_.Encode() 4769 req, err := http.NewRequest("GET", urls, body) 4770 if err != nil { 4771 return nil, err 4772 } 4773 req.Header = reqHeaders 4774 googleapi.Expand(req.URL, map[string]string{ 4775 "name": c.name, 4776 }) 4777 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4778 } 4779 4780 // Do executes the "cloudiot.projects.locations.registries.devices.states.list" call. 4781 // Exactly one of *ListDeviceStatesResponse or error will be non-nil. 4782 // Any non-2xx status code is an error. Response headers are in either 4783 // *ListDeviceStatesResponse.ServerResponse.Header or (if a response was 4784 // returned at all) in error.(*googleapi.Error).Header. Use 4785 // googleapi.IsNotModified to check whether the returned error was 4786 // because http.StatusNotModified was returned. 4787 func (c *ProjectsLocationsRegistriesDevicesStatesListCall) Do(opts ...googleapi.CallOption) (*ListDeviceStatesResponse, error) { 4788 gensupport.SetOptions(c.urlParams_, opts...) 4789 res, err := c.doRequest("json") 4790 if res != nil && res.StatusCode == http.StatusNotModified { 4791 if res.Body != nil { 4792 res.Body.Close() 4793 } 4794 return nil, gensupport.WrapError(&googleapi.Error{ 4795 Code: res.StatusCode, 4796 Header: res.Header, 4797 }) 4798 } 4799 if err != nil { 4800 return nil, err 4801 } 4802 defer googleapi.CloseBody(res) 4803 if err := googleapi.CheckResponse(res); err != nil { 4804 return nil, gensupport.WrapError(err) 4805 } 4806 ret := &ListDeviceStatesResponse{ 4807 ServerResponse: googleapi.ServerResponse{ 4808 Header: res.Header, 4809 HTTPStatusCode: res.StatusCode, 4810 }, 4811 } 4812 target := &ret 4813 if err := gensupport.DecodeResponse(target, res); err != nil { 4814 return nil, err 4815 } 4816 return ret, nil 4817 // { 4818 // "description": "Lists the last few versions of the device state in descending order (i.e.: newest first).", 4819 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices/{devicesId}/states", 4820 // "httpMethod": "GET", 4821 // "id": "cloudiot.projects.locations.registries.devices.states.list", 4822 // "parameterOrder": [ 4823 // "name" 4824 // ], 4825 // "parameters": { 4826 // "name": { 4827 // "description": "Required. The name of the device. For example, `projects/p0/locations/us-central1/registries/registry0/devices/device0` or `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.", 4828 // "location": "path", 4829 // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/devices/[^/]+$", 4830 // "required": true, 4831 // "type": "string" 4832 // }, 4833 // "numStates": { 4834 // "description": "The number of states to list. States are listed in descending order of update time. The maximum number of states retained is 10. If this value is zero, it will return all the states available.", 4835 // "format": "int32", 4836 // "location": "query", 4837 // "type": "integer" 4838 // } 4839 // }, 4840 // "path": "v1/{+name}/states", 4841 // "response": { 4842 // "$ref": "ListDeviceStatesResponse" 4843 // }, 4844 // "scopes": [ 4845 // "https://www.googleapis.com/auth/cloud-platform", 4846 // "https://www.googleapis.com/auth/cloudiot" 4847 // ] 4848 // } 4849 4850 } 4851 4852 // method id "cloudiot.projects.locations.registries.groups.getIamPolicy": 4853 4854 type ProjectsLocationsRegistriesGroupsGetIamPolicyCall struct { 4855 s *Service 4856 resource string 4857 getiampolicyrequest *GetIamPolicyRequest 4858 urlParams_ gensupport.URLParams 4859 ctx_ context.Context 4860 header_ http.Header 4861 } 4862 4863 // GetIamPolicy: Gets the access control policy for a resource. Returns 4864 // an empty policy if the resource exists and does not have a policy 4865 // set. 4866 // 4867 // - resource: REQUIRED: The resource for which the policy is being 4868 // requested. See Resource names 4869 // (https://cloud.google.com/apis/design/resource_names) for the 4870 // appropriate value for this field. 4871 func (r *ProjectsLocationsRegistriesGroupsService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *ProjectsLocationsRegistriesGroupsGetIamPolicyCall { 4872 c := &ProjectsLocationsRegistriesGroupsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4873 c.resource = resource 4874 c.getiampolicyrequest = getiampolicyrequest 4875 return c 4876 } 4877 4878 // Fields allows partial responses to be retrieved. See 4879 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4880 // for more information. 4881 func (c *ProjectsLocationsRegistriesGroupsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGroupsGetIamPolicyCall { 4882 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4883 return c 4884 } 4885 4886 // Context sets the context to be used in this call's Do method. Any 4887 // pending HTTP request will be aborted if the provided context is 4888 // canceled. 4889 func (c *ProjectsLocationsRegistriesGroupsGetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGroupsGetIamPolicyCall { 4890 c.ctx_ = ctx 4891 return c 4892 } 4893 4894 // Header returns an http.Header that can be modified by the caller to 4895 // add HTTP headers to the request. 4896 func (c *ProjectsLocationsRegistriesGroupsGetIamPolicyCall) Header() http.Header { 4897 if c.header_ == nil { 4898 c.header_ = make(http.Header) 4899 } 4900 return c.header_ 4901 } 4902 4903 func (c *ProjectsLocationsRegistriesGroupsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 4904 reqHeaders := make(http.Header) 4905 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 4906 for k, v := range c.header_ { 4907 reqHeaders[k] = v 4908 } 4909 reqHeaders.Set("User-Agent", c.s.userAgent()) 4910 var body io.Reader = nil 4911 body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest) 4912 if err != nil { 4913 return nil, err 4914 } 4915 reqHeaders.Set("Content-Type", "application/json") 4916 c.urlParams_.Set("alt", alt) 4917 c.urlParams_.Set("prettyPrint", "false") 4918 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy") 4919 urls += "?" + c.urlParams_.Encode() 4920 req, err := http.NewRequest("POST", urls, body) 4921 if err != nil { 4922 return nil, err 4923 } 4924 req.Header = reqHeaders 4925 googleapi.Expand(req.URL, map[string]string{ 4926 "resource": c.resource, 4927 }) 4928 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4929 } 4930 4931 // Do executes the "cloudiot.projects.locations.registries.groups.getIamPolicy" call. 4932 // Exactly one of *Policy or error will be non-nil. Any non-2xx status 4933 // code is an error. Response headers are in either 4934 // *Policy.ServerResponse.Header or (if a response was returned at all) 4935 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4936 // check whether the returned error was because http.StatusNotModified 4937 // was returned. 4938 func (c *ProjectsLocationsRegistriesGroupsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 4939 gensupport.SetOptions(c.urlParams_, opts...) 4940 res, err := c.doRequest("json") 4941 if res != nil && res.StatusCode == http.StatusNotModified { 4942 if res.Body != nil { 4943 res.Body.Close() 4944 } 4945 return nil, gensupport.WrapError(&googleapi.Error{ 4946 Code: res.StatusCode, 4947 Header: res.Header, 4948 }) 4949 } 4950 if err != nil { 4951 return nil, err 4952 } 4953 defer googleapi.CloseBody(res) 4954 if err := googleapi.CheckResponse(res); err != nil { 4955 return nil, gensupport.WrapError(err) 4956 } 4957 ret := &Policy{ 4958 ServerResponse: googleapi.ServerResponse{ 4959 Header: res.Header, 4960 HTTPStatusCode: res.StatusCode, 4961 }, 4962 } 4963 target := &ret 4964 if err := gensupport.DecodeResponse(target, res); err != nil { 4965 return nil, err 4966 } 4967 return ret, nil 4968 // { 4969 // "description": "Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.", 4970 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/groups/{groupsId}:getIamPolicy", 4971 // "httpMethod": "POST", 4972 // "id": "cloudiot.projects.locations.registries.groups.getIamPolicy", 4973 // "parameterOrder": [ 4974 // "resource" 4975 // ], 4976 // "parameters": { 4977 // "resource": { 4978 // "description": "REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.", 4979 // "location": "path", 4980 // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/groups/[^/]+$", 4981 // "required": true, 4982 // "type": "string" 4983 // } 4984 // }, 4985 // "path": "v1/{+resource}:getIamPolicy", 4986 // "request": { 4987 // "$ref": "GetIamPolicyRequest" 4988 // }, 4989 // "response": { 4990 // "$ref": "Policy" 4991 // }, 4992 // "scopes": [ 4993 // "https://www.googleapis.com/auth/cloud-platform", 4994 // "https://www.googleapis.com/auth/cloudiot" 4995 // ] 4996 // } 4997 4998 } 4999 5000 // method id "cloudiot.projects.locations.registries.groups.setIamPolicy": 5001 5002 type ProjectsLocationsRegistriesGroupsSetIamPolicyCall struct { 5003 s *Service 5004 resource string 5005 setiampolicyrequest *SetIamPolicyRequest 5006 urlParams_ gensupport.URLParams 5007 ctx_ context.Context 5008 header_ http.Header 5009 } 5010 5011 // SetIamPolicy: Sets the access control policy on the specified 5012 // resource. Replaces any existing policy. 5013 // 5014 // - resource: REQUIRED: The resource for which the policy is being 5015 // specified. See Resource names 5016 // (https://cloud.google.com/apis/design/resource_names) for the 5017 // appropriate value for this field. 5018 func (r *ProjectsLocationsRegistriesGroupsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsLocationsRegistriesGroupsSetIamPolicyCall { 5019 c := &ProjectsLocationsRegistriesGroupsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5020 c.resource = resource 5021 c.setiampolicyrequest = setiampolicyrequest 5022 return c 5023 } 5024 5025 // Fields allows partial responses to be retrieved. See 5026 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5027 // for more information. 5028 func (c *ProjectsLocationsRegistriesGroupsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGroupsSetIamPolicyCall { 5029 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5030 return c 5031 } 5032 5033 // Context sets the context to be used in this call's Do method. Any 5034 // pending HTTP request will be aborted if the provided context is 5035 // canceled. 5036 func (c *ProjectsLocationsRegistriesGroupsSetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGroupsSetIamPolicyCall { 5037 c.ctx_ = ctx 5038 return c 5039 } 5040 5041 // Header returns an http.Header that can be modified by the caller to 5042 // add HTTP headers to the request. 5043 func (c *ProjectsLocationsRegistriesGroupsSetIamPolicyCall) Header() http.Header { 5044 if c.header_ == nil { 5045 c.header_ = make(http.Header) 5046 } 5047 return c.header_ 5048 } 5049 5050 func (c *ProjectsLocationsRegistriesGroupsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 5051 reqHeaders := make(http.Header) 5052 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 5053 for k, v := range c.header_ { 5054 reqHeaders[k] = v 5055 } 5056 reqHeaders.Set("User-Agent", c.s.userAgent()) 5057 var body io.Reader = nil 5058 body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest) 5059 if err != nil { 5060 return nil, err 5061 } 5062 reqHeaders.Set("Content-Type", "application/json") 5063 c.urlParams_.Set("alt", alt) 5064 c.urlParams_.Set("prettyPrint", "false") 5065 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy") 5066 urls += "?" + c.urlParams_.Encode() 5067 req, err := http.NewRequest("POST", urls, body) 5068 if err != nil { 5069 return nil, err 5070 } 5071 req.Header = reqHeaders 5072 googleapi.Expand(req.URL, map[string]string{ 5073 "resource": c.resource, 5074 }) 5075 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5076 } 5077 5078 // Do executes the "cloudiot.projects.locations.registries.groups.setIamPolicy" call. 5079 // Exactly one of *Policy or error will be non-nil. Any non-2xx status 5080 // code is an error. Response headers are in either 5081 // *Policy.ServerResponse.Header or (if a response was returned at all) 5082 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 5083 // check whether the returned error was because http.StatusNotModified 5084 // was returned. 5085 func (c *ProjectsLocationsRegistriesGroupsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 5086 gensupport.SetOptions(c.urlParams_, opts...) 5087 res, err := c.doRequest("json") 5088 if res != nil && res.StatusCode == http.StatusNotModified { 5089 if res.Body != nil { 5090 res.Body.Close() 5091 } 5092 return nil, gensupport.WrapError(&googleapi.Error{ 5093 Code: res.StatusCode, 5094 Header: res.Header, 5095 }) 5096 } 5097 if err != nil { 5098 return nil, err 5099 } 5100 defer googleapi.CloseBody(res) 5101 if err := googleapi.CheckResponse(res); err != nil { 5102 return nil, gensupport.WrapError(err) 5103 } 5104 ret := &Policy{ 5105 ServerResponse: googleapi.ServerResponse{ 5106 Header: res.Header, 5107 HTTPStatusCode: res.StatusCode, 5108 }, 5109 } 5110 target := &ret 5111 if err := gensupport.DecodeResponse(target, res); err != nil { 5112 return nil, err 5113 } 5114 return ret, nil 5115 // { 5116 // "description": "Sets the access control policy on the specified resource. Replaces any existing policy.", 5117 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/groups/{groupsId}:setIamPolicy", 5118 // "httpMethod": "POST", 5119 // "id": "cloudiot.projects.locations.registries.groups.setIamPolicy", 5120 // "parameterOrder": [ 5121 // "resource" 5122 // ], 5123 // "parameters": { 5124 // "resource": { 5125 // "description": "REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.", 5126 // "location": "path", 5127 // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/groups/[^/]+$", 5128 // "required": true, 5129 // "type": "string" 5130 // } 5131 // }, 5132 // "path": "v1/{+resource}:setIamPolicy", 5133 // "request": { 5134 // "$ref": "SetIamPolicyRequest" 5135 // }, 5136 // "response": { 5137 // "$ref": "Policy" 5138 // }, 5139 // "scopes": [ 5140 // "https://www.googleapis.com/auth/cloud-platform", 5141 // "https://www.googleapis.com/auth/cloudiot" 5142 // ] 5143 // } 5144 5145 } 5146 5147 // method id "cloudiot.projects.locations.registries.groups.testIamPermissions": 5148 5149 type ProjectsLocationsRegistriesGroupsTestIamPermissionsCall struct { 5150 s *Service 5151 resource string 5152 testiampermissionsrequest *TestIamPermissionsRequest 5153 urlParams_ gensupport.URLParams 5154 ctx_ context.Context 5155 header_ http.Header 5156 } 5157 5158 // TestIamPermissions: Returns permissions that a caller has on the 5159 // specified resource. If the resource does not exist, this will return 5160 // an empty set of permissions, not a NOT_FOUND error. 5161 // 5162 // - resource: REQUIRED: The resource for which the policy detail is 5163 // being requested. See Resource names 5164 // (https://cloud.google.com/apis/design/resource_names) for the 5165 // appropriate value for this field. 5166 func (r *ProjectsLocationsRegistriesGroupsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsLocationsRegistriesGroupsTestIamPermissionsCall { 5167 c := &ProjectsLocationsRegistriesGroupsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5168 c.resource = resource 5169 c.testiampermissionsrequest = testiampermissionsrequest 5170 return c 5171 } 5172 5173 // Fields allows partial responses to be retrieved. See 5174 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5175 // for more information. 5176 func (c *ProjectsLocationsRegistriesGroupsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGroupsTestIamPermissionsCall { 5177 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5178 return c 5179 } 5180 5181 // Context sets the context to be used in this call's Do method. Any 5182 // pending HTTP request will be aborted if the provided context is 5183 // canceled. 5184 func (c *ProjectsLocationsRegistriesGroupsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGroupsTestIamPermissionsCall { 5185 c.ctx_ = ctx 5186 return c 5187 } 5188 5189 // Header returns an http.Header that can be modified by the caller to 5190 // add HTTP headers to the request. 5191 func (c *ProjectsLocationsRegistriesGroupsTestIamPermissionsCall) Header() http.Header { 5192 if c.header_ == nil { 5193 c.header_ = make(http.Header) 5194 } 5195 return c.header_ 5196 } 5197 5198 func (c *ProjectsLocationsRegistriesGroupsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) { 5199 reqHeaders := make(http.Header) 5200 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 5201 for k, v := range c.header_ { 5202 reqHeaders[k] = v 5203 } 5204 reqHeaders.Set("User-Agent", c.s.userAgent()) 5205 var body io.Reader = nil 5206 body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest) 5207 if err != nil { 5208 return nil, err 5209 } 5210 reqHeaders.Set("Content-Type", "application/json") 5211 c.urlParams_.Set("alt", alt) 5212 c.urlParams_.Set("prettyPrint", "false") 5213 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions") 5214 urls += "?" + c.urlParams_.Encode() 5215 req, err := http.NewRequest("POST", urls, body) 5216 if err != nil { 5217 return nil, err 5218 } 5219 req.Header = reqHeaders 5220 googleapi.Expand(req.URL, map[string]string{ 5221 "resource": c.resource, 5222 }) 5223 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5224 } 5225 5226 // Do executes the "cloudiot.projects.locations.registries.groups.testIamPermissions" call. 5227 // Exactly one of *TestIamPermissionsResponse or error will be non-nil. 5228 // Any non-2xx status code is an error. Response headers are in either 5229 // *TestIamPermissionsResponse.ServerResponse.Header or (if a response 5230 // was returned at all) in error.(*googleapi.Error).Header. Use 5231 // googleapi.IsNotModified to check whether the returned error was 5232 // because http.StatusNotModified was returned. 5233 func (c *ProjectsLocationsRegistriesGroupsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) { 5234 gensupport.SetOptions(c.urlParams_, opts...) 5235 res, err := c.doRequest("json") 5236 if res != nil && res.StatusCode == http.StatusNotModified { 5237 if res.Body != nil { 5238 res.Body.Close() 5239 } 5240 return nil, gensupport.WrapError(&googleapi.Error{ 5241 Code: res.StatusCode, 5242 Header: res.Header, 5243 }) 5244 } 5245 if err != nil { 5246 return nil, err 5247 } 5248 defer googleapi.CloseBody(res) 5249 if err := googleapi.CheckResponse(res); err != nil { 5250 return nil, gensupport.WrapError(err) 5251 } 5252 ret := &TestIamPermissionsResponse{ 5253 ServerResponse: googleapi.ServerResponse{ 5254 Header: res.Header, 5255 HTTPStatusCode: res.StatusCode, 5256 }, 5257 } 5258 target := &ret 5259 if err := gensupport.DecodeResponse(target, res); err != nil { 5260 return nil, err 5261 } 5262 return ret, nil 5263 // { 5264 // "description": "Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.", 5265 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/groups/{groupsId}:testIamPermissions", 5266 // "httpMethod": "POST", 5267 // "id": "cloudiot.projects.locations.registries.groups.testIamPermissions", 5268 // "parameterOrder": [ 5269 // "resource" 5270 // ], 5271 // "parameters": { 5272 // "resource": { 5273 // "description": "REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.", 5274 // "location": "path", 5275 // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/groups/[^/]+$", 5276 // "required": true, 5277 // "type": "string" 5278 // } 5279 // }, 5280 // "path": "v1/{+resource}:testIamPermissions", 5281 // "request": { 5282 // "$ref": "TestIamPermissionsRequest" 5283 // }, 5284 // "response": { 5285 // "$ref": "TestIamPermissionsResponse" 5286 // }, 5287 // "scopes": [ 5288 // "https://www.googleapis.com/auth/cloud-platform", 5289 // "https://www.googleapis.com/auth/cloudiot" 5290 // ] 5291 // } 5292 5293 } 5294 5295 // method id "cloudiot.projects.locations.registries.groups.devices.list": 5296 5297 type ProjectsLocationsRegistriesGroupsDevicesListCall struct { 5298 s *Service 5299 parent string 5300 urlParams_ gensupport.URLParams 5301 ifNoneMatch_ string 5302 ctx_ context.Context 5303 header_ http.Header 5304 } 5305 5306 // List: List devices in a device registry. 5307 // 5308 // - parent: The device registry path. Required. For example, 5309 // `projects/my-project/locations/us-central1/registries/my-registry`. 5310 func (r *ProjectsLocationsRegistriesGroupsDevicesService) List(parent string) *ProjectsLocationsRegistriesGroupsDevicesListCall { 5311 c := &ProjectsLocationsRegistriesGroupsDevicesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5312 c.parent = parent 5313 return c 5314 } 5315 5316 // DeviceIds sets the optional parameter "deviceIds": A list of device 5317 // string IDs. For example, `['device0', 'device12']`. If empty, this 5318 // field is ignored. Maximum IDs: 10,000 5319 func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) DeviceIds(deviceIds ...string) *ProjectsLocationsRegistriesGroupsDevicesListCall { 5320 c.urlParams_.SetMulti("deviceIds", append([]string{}, deviceIds...)) 5321 return c 5322 } 5323 5324 // DeviceNumIds sets the optional parameter "deviceNumIds": A list of 5325 // device numeric IDs. If empty, this field is ignored. Maximum IDs: 5326 // 10,000. 5327 func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) DeviceNumIds(deviceNumIds ...uint64) *ProjectsLocationsRegistriesGroupsDevicesListCall { 5328 var deviceNumIds_ []string 5329 for _, v := range deviceNumIds { 5330 deviceNumIds_ = append(deviceNumIds_, fmt.Sprint(v)) 5331 } 5332 c.urlParams_.SetMulti("deviceNumIds", deviceNumIds_) 5333 return c 5334 } 5335 5336 // FieldMask sets the optional parameter "fieldMask": The fields of the 5337 // `Device` resource to be returned in the response. The fields `id` and 5338 // `num_id` are always returned, along with any other fields specified 5339 // in snake_case format, for example: `last_heartbeat_time`. 5340 func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) FieldMask(fieldMask string) *ProjectsLocationsRegistriesGroupsDevicesListCall { 5341 c.urlParams_.Set("fieldMask", fieldMask) 5342 return c 5343 } 5344 5345 // GatewayListOptionsAssociationsDeviceId sets the optional parameter 5346 // "gatewayListOptions.associationsDeviceId": If set, returns only the 5347 // gateways with which the specified device is associated. The device ID 5348 // can be numeric (`num_id`) or the user-defined string (`id`). For 5349 // example, if `456` is specified, returns only the gateways to which 5350 // the device with `num_id` 456 is bound. 5351 func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) GatewayListOptionsAssociationsDeviceId(gatewayListOptionsAssociationsDeviceId string) *ProjectsLocationsRegistriesGroupsDevicesListCall { 5352 c.urlParams_.Set("gatewayListOptions.associationsDeviceId", gatewayListOptionsAssociationsDeviceId) 5353 return c 5354 } 5355 5356 // GatewayListOptionsAssociationsGatewayId sets the optional parameter 5357 // "gatewayListOptions.associationsGatewayId": If set, only devices 5358 // associated with the specified gateway are returned. The gateway ID 5359 // can be numeric (`num_id`) or the user-defined string (`id`). For 5360 // example, if `123` is specified, only devices bound to the gateway 5361 // with `num_id` 123 are returned. 5362 func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) GatewayListOptionsAssociationsGatewayId(gatewayListOptionsAssociationsGatewayId string) *ProjectsLocationsRegistriesGroupsDevicesListCall { 5363 c.urlParams_.Set("gatewayListOptions.associationsGatewayId", gatewayListOptionsAssociationsGatewayId) 5364 return c 5365 } 5366 5367 // GatewayListOptionsGatewayType sets the optional parameter 5368 // "gatewayListOptions.gatewayType": If `GATEWAY` is specified, only 5369 // gateways are returned. If `NON_GATEWAY` is specified, only 5370 // non-gateway devices are returned. If `GATEWAY_TYPE_UNSPECIFIED` is 5371 // specified, all devices are returned. 5372 // 5373 // Possible values: 5374 // 5375 // "GATEWAY_TYPE_UNSPECIFIED" - If unspecified, the device is 5376 // 5377 // considered a non-gateway device. 5378 // 5379 // "GATEWAY" - The device is a gateway. 5380 // "NON_GATEWAY" - The device is not a gateway. 5381 func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) GatewayListOptionsGatewayType(gatewayListOptionsGatewayType string) *ProjectsLocationsRegistriesGroupsDevicesListCall { 5382 c.urlParams_.Set("gatewayListOptions.gatewayType", gatewayListOptionsGatewayType) 5383 return c 5384 } 5385 5386 // PageSize sets the optional parameter "pageSize": The maximum number 5387 // of devices to return in the response. If this value is zero, the 5388 // service will select a default size. A call may return fewer objects 5389 // than requested. A non-empty `next_page_token` in the response 5390 // indicates that more data is available. 5391 func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) PageSize(pageSize int64) *ProjectsLocationsRegistriesGroupsDevicesListCall { 5392 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 5393 return c 5394 } 5395 5396 // PageToken sets the optional parameter "pageToken": The value returned 5397 // by the last `ListDevicesResponse`; indicates that this is a 5398 // continuation of a prior `ListDevices` call and the system should 5399 // return the next page of data. 5400 func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) PageToken(pageToken string) *ProjectsLocationsRegistriesGroupsDevicesListCall { 5401 c.urlParams_.Set("pageToken", pageToken) 5402 return c 5403 } 5404 5405 // Fields allows partial responses to be retrieved. See 5406 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5407 // for more information. 5408 func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGroupsDevicesListCall { 5409 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5410 return c 5411 } 5412 5413 // IfNoneMatch sets the optional parameter which makes the operation 5414 // fail if the object's ETag matches the given value. This is useful for 5415 // getting updates only after the object has changed since the last 5416 // request. Use googleapi.IsNotModified to check whether the response 5417 // error from Do is the result of In-None-Match. 5418 func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesGroupsDevicesListCall { 5419 c.ifNoneMatch_ = entityTag 5420 return c 5421 } 5422 5423 // Context sets the context to be used in this call's Do method. Any 5424 // pending HTTP request will be aborted if the provided context is 5425 // canceled. 5426 func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGroupsDevicesListCall { 5427 c.ctx_ = ctx 5428 return c 5429 } 5430 5431 // Header returns an http.Header that can be modified by the caller to 5432 // add HTTP headers to the request. 5433 func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) Header() http.Header { 5434 if c.header_ == nil { 5435 c.header_ = make(http.Header) 5436 } 5437 return c.header_ 5438 } 5439 5440 func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) doRequest(alt string) (*http.Response, error) { 5441 reqHeaders := make(http.Header) 5442 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 5443 for k, v := range c.header_ { 5444 reqHeaders[k] = v 5445 } 5446 reqHeaders.Set("User-Agent", c.s.userAgent()) 5447 if c.ifNoneMatch_ != "" { 5448 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 5449 } 5450 var body io.Reader = nil 5451 c.urlParams_.Set("alt", alt) 5452 c.urlParams_.Set("prettyPrint", "false") 5453 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/devices") 5454 urls += "?" + c.urlParams_.Encode() 5455 req, err := http.NewRequest("GET", urls, body) 5456 if err != nil { 5457 return nil, err 5458 } 5459 req.Header = reqHeaders 5460 googleapi.Expand(req.URL, map[string]string{ 5461 "parent": c.parent, 5462 }) 5463 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5464 } 5465 5466 // Do executes the "cloudiot.projects.locations.registries.groups.devices.list" call. 5467 // Exactly one of *ListDevicesResponse or error will be non-nil. Any 5468 // non-2xx status code is an error. Response headers are in either 5469 // *ListDevicesResponse.ServerResponse.Header or (if a response was 5470 // returned at all) in error.(*googleapi.Error).Header. Use 5471 // googleapi.IsNotModified to check whether the returned error was 5472 // because http.StatusNotModified was returned. 5473 func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) Do(opts ...googleapi.CallOption) (*ListDevicesResponse, error) { 5474 gensupport.SetOptions(c.urlParams_, opts...) 5475 res, err := c.doRequest("json") 5476 if res != nil && res.StatusCode == http.StatusNotModified { 5477 if res.Body != nil { 5478 res.Body.Close() 5479 } 5480 return nil, gensupport.WrapError(&googleapi.Error{ 5481 Code: res.StatusCode, 5482 Header: res.Header, 5483 }) 5484 } 5485 if err != nil { 5486 return nil, err 5487 } 5488 defer googleapi.CloseBody(res) 5489 if err := googleapi.CheckResponse(res); err != nil { 5490 return nil, gensupport.WrapError(err) 5491 } 5492 ret := &ListDevicesResponse{ 5493 ServerResponse: googleapi.ServerResponse{ 5494 Header: res.Header, 5495 HTTPStatusCode: res.StatusCode, 5496 }, 5497 } 5498 target := &ret 5499 if err := gensupport.DecodeResponse(target, res); err != nil { 5500 return nil, err 5501 } 5502 return ret, nil 5503 // { 5504 // "description": "List devices in a device registry.", 5505 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/groups/{groupsId}/devices", 5506 // "httpMethod": "GET", 5507 // "id": "cloudiot.projects.locations.registries.groups.devices.list", 5508 // "parameterOrder": [ 5509 // "parent" 5510 // ], 5511 // "parameters": { 5512 // "deviceIds": { 5513 // "description": "A list of device string IDs. For example, `['device0', 'device12']`. If empty, this field is ignored. Maximum IDs: 10,000", 5514 // "location": "query", 5515 // "repeated": true, 5516 // "type": "string" 5517 // }, 5518 // "deviceNumIds": { 5519 // "description": "A list of device numeric IDs. If empty, this field is ignored. Maximum IDs: 10,000.", 5520 // "format": "uint64", 5521 // "location": "query", 5522 // "repeated": true, 5523 // "type": "string" 5524 // }, 5525 // "fieldMask": { 5526 // "description": "The fields of the `Device` resource to be returned in the response. The fields `id` and `num_id` are always returned, along with any other fields specified in snake_case format, for example: `last_heartbeat_time`.", 5527 // "format": "google-fieldmask", 5528 // "location": "query", 5529 // "type": "string" 5530 // }, 5531 // "gatewayListOptions.associationsDeviceId": { 5532 // "description": "If set, returns only the gateways with which the specified device is associated. The device ID can be numeric (`num_id`) or the user-defined string (`id`). For example, if `456` is specified, returns only the gateways to which the device with `num_id` 456 is bound.", 5533 // "location": "query", 5534 // "type": "string" 5535 // }, 5536 // "gatewayListOptions.associationsGatewayId": { 5537 // "description": "If set, only devices associated with the specified gateway are returned. The gateway ID can be numeric (`num_id`) or the user-defined string (`id`). For example, if `123` is specified, only devices bound to the gateway with `num_id` 123 are returned.", 5538 // "location": "query", 5539 // "type": "string" 5540 // }, 5541 // "gatewayListOptions.gatewayType": { 5542 // "description": "If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY` is specified, only non-gateway devices are returned. If `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned.", 5543 // "enum": [ 5544 // "GATEWAY_TYPE_UNSPECIFIED", 5545 // "GATEWAY", 5546 // "NON_GATEWAY" 5547 // ], 5548 // "enumDescriptions": [ 5549 // "If unspecified, the device is considered a non-gateway device.", 5550 // "The device is a gateway.", 5551 // "The device is not a gateway." 5552 // ], 5553 // "location": "query", 5554 // "type": "string" 5555 // }, 5556 // "pageSize": { 5557 // "description": "The maximum number of devices to return in the response. If this value is zero, the service will select a default size. A call may return fewer objects than requested. A non-empty `next_page_token` in the response indicates that more data is available.", 5558 // "format": "int32", 5559 // "location": "query", 5560 // "type": "integer" 5561 // }, 5562 // "pageToken": { 5563 // "description": "The value returned by the last `ListDevicesResponse`; indicates that this is a continuation of a prior `ListDevices` call and the system should return the next page of data.", 5564 // "location": "query", 5565 // "type": "string" 5566 // }, 5567 // "parent": { 5568 // "description": "Required. The device registry path. Required. For example, `projects/my-project/locations/us-central1/registries/my-registry`.", 5569 // "location": "path", 5570 // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/groups/[^/]+$", 5571 // "required": true, 5572 // "type": "string" 5573 // } 5574 // }, 5575 // "path": "v1/{+parent}/devices", 5576 // "response": { 5577 // "$ref": "ListDevicesResponse" 5578 // }, 5579 // "scopes": [ 5580 // "https://www.googleapis.com/auth/cloud-platform", 5581 // "https://www.googleapis.com/auth/cloudiot" 5582 // ] 5583 // } 5584 5585 } 5586 5587 // Pages invokes f for each page of results. 5588 // A non-nil error returned from f will halt the iteration. 5589 // The provided context supersedes any context provided to the Context method. 5590 func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) Pages(ctx context.Context, f func(*ListDevicesResponse) error) error { 5591 c.ctx_ = ctx 5592 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 5593 for { 5594 x, err := c.Do() 5595 if err != nil { 5596 return err 5597 } 5598 if err := f(x); err != nil { 5599 return err 5600 } 5601 if x.NextPageToken == "" { 5602 return nil 5603 } 5604 c.PageToken(x.NextPageToken) 5605 } 5606 } 5607