Class: Google::Apis::CloudiotV1::Device
- Inherits:
- 
      Object
      
        - Object
- Google::Apis::CloudiotV1::Device
 
- Defined in:
- generated/google/apis/cloudiot_v1/classes.rb,
 generated/google/apis/cloudiot_v1/representations.rb,
 generated/google/apis/cloudiot_v1/representations.rb
Overview
The device resource.
Instance Attribute Summary collapse
- 
  
    
      #blocked  ⇒ Boolean 
    
    
      (also: #blocked?)
    
  
  
  
  
    
    
  
  
  
  
  
  
    If a device is blocked, connections or requests from this device will fail. 
- 
  
    
      #config  ⇒ Google::Apis::CloudiotV1::DeviceConfig 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    The device configuration. 
- 
  
    
      #credentials  ⇒ Array<Google::Apis::CloudiotV1::DeviceCredential> 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    The credentials used to authenticate this device. 
- 
  
    
      #id  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    The user-defined device identifier. 
- 
  
    
      #last_config_ack_time  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    [Output only] The last time a cloud-to-device config version acknowledgment was received from the device. 
- 
  
    
      #last_config_send_time  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    [Output only] The last time a cloud-to-device config version was sent to the device. 
- 
  
    
      #last_error_status  ⇒ Google::Apis::CloudiotV1::Status 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    The Statustype defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs.
- 
  
    
      #last_error_time  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    [Output only] The time the most recent error occurred, such as a failure to publish to Cloud Pub/Sub. 
- 
  
    
      #last_event_time  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    [Output only] The last time a telemetry event was received. 
- 
  
    
      #last_heartbeat_time  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    [Output only] The last time an MQTT PINGREQwas received.
- 
  
    
      #last_state_time  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    [Output only] The last time a state event was received. 
- 
  
    
      #metadata  ⇒ Hash<String,String> 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    The metadata key-value pairs assigned to the device. 
- 
  
    
      #name  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    The resource path name. 
- 
  
    
      #num_id  ⇒ Fixnum 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    [Output only] A server-defined unique numeric ID for the device. 
- 
  
    
      #state  ⇒ Google::Apis::CloudiotV1::DeviceState 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    The device state, as reported by the device. 
Instance Method Summary collapse
- 
  
    
      #initialize(**args)  ⇒ Device 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Device. 
- 
  
    
      #update!(**args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Update properties of this object. 
Methods included from Google::Apis::Core::JsonObjectSupport
Methods included from Google::Apis::Core::Hashable
Constructor Details
#initialize(**args) ⇒ Device
Returns a new instance of Device
| 217 218 219 | # File 'generated/google/apis/cloudiot_v1/classes.rb', line 217 def initialize(**args) update!(**args) end | 
Instance Attribute Details
#blocked ⇒ Boolean Also known as: blocked?
If a device is blocked, connections or requests from this device will fail.
Can be used to temporarily prevent the device from connecting if, for
example, the sensor is generating bad data and needs maintenance.
Corresponds to the JSON property blocked
| 74 75 76 | # File 'generated/google/apis/cloudiot_v1/classes.rb', line 74 def blocked @blocked end | 
#config ⇒ Google::Apis::CloudiotV1::DeviceConfig
The device configuration. Eventually delivered to devices.
Corresponds to the JSON property config
| 80 81 82 | # File 'generated/google/apis/cloudiot_v1/classes.rb', line 80 def config @config end | 
#credentials ⇒ Array<Google::Apis::CloudiotV1::DeviceCredential>
The credentials used to authenticate this device. To allow credential
rotation without interruption, multiple device credentials can be bound to
this device. No more than 3 credentials can be bound to a single device at
a time. When new credentials are added to a device, they are verified
against the registry credentials. For details, see the description of the
DeviceRegistry.credentials field.
Corresponds to the JSON property credentials
| 90 91 92 | # File 'generated/google/apis/cloudiot_v1/classes.rb', line 90 def credentials @credentials end | 
#id ⇒ String
The user-defined device identifier. The device ID must be unique
within a device registry.
Corresponds to the JSON property id
| 96 97 98 | # File 'generated/google/apis/cloudiot_v1/classes.rb', line 96 def id @id end | 
#last_config_ack_time ⇒ String
[Output only] The last time a cloud-to-device config version acknowledgment
was received from the device. This field is only for configurations
sent through MQTT.
Corresponds to the JSON property lastConfigAckTime
| 103 104 105 | # File 'generated/google/apis/cloudiot_v1/classes.rb', line 103 def last_config_ack_time @last_config_ack_time end | 
#last_config_send_time ⇒ String
[Output only] The last time a cloud-to-device config version was sent to
the device.
Corresponds to the JSON property lastConfigSendTime
| 109 110 111 | # File 'generated/google/apis/cloudiot_v1/classes.rb', line 109 def last_config_send_time @last_config_send_time end | 
#last_error_status ⇒ Google::Apis::CloudiotV1::Status
The Status type defines a logical error model that is suitable for different
programming environments, including REST APIs and RPC APIs. It is used by
gRPC. The error model is designed to be:
- Simple to use and understand for most users
- Flexible enough to meet unexpected needs
# Overview
The Statusmessage contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers understand and resolve the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the packagegoogle.rpcthat can be used for common error conditions. # Language mapping TheStatusmessage is the logical representation of the error model, but it is not necessarily the actual wire format. When theStatusmessage is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C. # Other uses The error model and theStatusmessage can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments. Example uses of this error model include:
- Partial errors. If a service needs to return partial errors to the client,
it may embed the Statusin the normal response to indicate the partial errors.
- Workflow errors. A typical workflow has multiple steps. Each step may
have a Statusmessage for error reporting.
- Batch operations. If a client uses batch request and batch response, the
Statusmessage should be used directly inside batch response, one for each error sub-response.
- Asynchronous operations. If an API call embeds asynchronous operation
results in its response, the status of those operations should be
represented directly using the Statusmessage.
- Logging. If some API errors are stored in logs, the message Statuscould be used directly after any stripping needed for security/privacy reasons. Corresponds to the JSON propertylastErrorStatus
| 152 153 154 | # File 'generated/google/apis/cloudiot_v1/classes.rb', line 152 def last_error_status @last_error_status end | 
#last_error_time ⇒ String
[Output only] The time the most recent error occurred, such as a failure to
publish to Cloud Pub/Sub. This field is the timestamp of
'last_error_status'.
Corresponds to the JSON property lastErrorTime
| 159 160 161 | # File 'generated/google/apis/cloudiot_v1/classes.rb', line 159 def last_error_time @last_error_time end | 
#last_event_time ⇒ String
[Output only] The last time a telemetry event was received. Timestamps are
periodically collected and written to storage; they may be stale by a few
minutes.
Corresponds to the JSON property lastEventTime
| 166 167 168 | # File 'generated/google/apis/cloudiot_v1/classes.rb', line 166 def last_event_time @last_event_time end | 
#last_heartbeat_time ⇒ String
[Output only] The last time an MQTT PINGREQ was received. This field
applies only to devices connecting through MQTT. MQTT clients usually only
send PINGREQ messages if the connection is idle, and no other messages
have been sent. Timestamps are periodically collected and written to
storage; they may be stale by a few minutes.
Corresponds to the JSON property lastHeartbeatTime
| 175 176 177 | # File 'generated/google/apis/cloudiot_v1/classes.rb', line 175 def last_heartbeat_time @last_heartbeat_time end | 
#last_state_time ⇒ String
[Output only] The last time a state event was received. Timestamps are
periodically collected and written to storage; they may be stale by a few
minutes.
Corresponds to the JSON property lastStateTime
| 182 183 184 | # File 'generated/google/apis/cloudiot_v1/classes.rb', line 182 def last_state_time @last_state_time end | 
#metadata ⇒ Hash<String,String>
The metadata key-value pairs assigned to the device. This metadata is not
interpreted or indexed by Cloud IoT Core. It can be used to add contextual
information for the device.
Keys must conform to the regular expression a-zA-Z+ and
be less than 128 bytes in length.
Values are free-form strings. Each value must be less than or equal to 32
KB in size.
The total size of all keys and values must be less than 256 KB, and the
maximum number of key-value pairs is 500.
Corresponds to the JSON property metadata
| 195 196 197 | # File 'generated/google/apis/cloudiot_v1/classes.rb', line 195 def @metadata end | 
#name ⇒ String
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`.
Whennameis populated as a response from the service, it always ends
in the device numeric ID.
Corresponds to the JSON propertyname`
| 204 205 206 | # File 'generated/google/apis/cloudiot_v1/classes.rb', line 204 def name @name end | 
#num_id ⇒ Fixnum
[Output only] A server-defined unique numeric ID for the device. This is a
more compact way to identify devices, and it is globally unique.
Corresponds to the JSON property numId
| 210 211 212 | # File 'generated/google/apis/cloudiot_v1/classes.rb', line 210 def num_id @num_id end | 
#state ⇒ Google::Apis::CloudiotV1::DeviceState
The device state, as reported by the device.
Corresponds to the JSON property state
| 215 216 217 | # File 'generated/google/apis/cloudiot_v1/classes.rb', line 215 def state @state end | 
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
| 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | # File 'generated/google/apis/cloudiot_v1/classes.rb', line 222 def update!(**args) @blocked = args[:blocked] if args.key?(:blocked) @config = args[:config] if args.key?(:config) @credentials = args[:credentials] if args.key?(:credentials) @id = args[:id] if args.key?(:id) @last_config_ack_time = args[:last_config_ack_time] if args.key?(:last_config_ack_time) @last_config_send_time = args[:last_config_send_time] if args.key?(:last_config_send_time) @last_error_status = args[:last_error_status] if args.key?(:last_error_status) @last_error_time = args[:last_error_time] if args.key?(:last_error_time) @last_event_time = args[:last_event_time] if args.key?(:last_event_time) @last_heartbeat_time = args[:last_heartbeat_time] if args.key?(:last_heartbeat_time) @last_state_time = args[:last_state_time] if args.key?(:last_state_time) @metadata = args[:metadata] if args.key?(:metadata) @name = args[:name] if args.key?(:name) @num_id = args[:num_id] if args.key?(:num_id) @state = args[:state] if args.key?(:state) end |