Class: Google::Apis::CloudiotV1::Device

Inherits:
Object
  • Object
show all
Includes:
Google::Apis::Core::Hashable, Google::Apis::Core::JsonObjectSupport
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

Instance Method Summary collapse

Methods included from Google::Apis::Core::JsonObjectSupport

#to_json

Methods included from Google::Apis::Core::Hashable

process_value, #to_h

Constructor Details

#initialize(**args) ⇒ Device

Returns a new instance of Device.



280
281
282
# File 'generated/google/apis/cloudiot_v1/classes.rb', line 280

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#blockedBoolean 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

Returns:

  • (Boolean)


158
159
160
# File 'generated/google/apis/cloudiot_v1/classes.rb', line 158

def blocked
  @blocked
end

#configGoogle::Apis::CloudiotV1::DeviceConfig

The device configuration. Eventually delivered to devices. Corresponds to the JSON property config



164
165
166
# File 'generated/google/apis/cloudiot_v1/classes.rb', line 164

def config
  @config
end

#credentialsArray<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



174
175
176
# File 'generated/google/apis/cloudiot_v1/classes.rb', line 174

def credentials
  @credentials
end

#gateway_configGoogle::Apis::CloudiotV1::GatewayConfig

Gateway-related configuration and state. Corresponds to the JSON property gatewayConfig



179
180
181
# File 'generated/google/apis/cloudiot_v1/classes.rb', line 179

def gateway_config
  @gateway_config
end

#idString

The user-defined device identifier. The device ID must be unique within a device registry. Corresponds to the JSON property id

Returns:

  • (String)


185
186
187
# File 'generated/google/apis/cloudiot_v1/classes.rb', line 185

def id
  @id
end

#last_config_ack_timeString

[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

Returns:

  • (String)


192
193
194
# File 'generated/google/apis/cloudiot_v1/classes.rb', line 192

def last_config_ack_time
  @last_config_ack_time
end

#last_config_send_timeString

[Output only] The last time a cloud-to-device config version was sent to the device. Corresponds to the JSON property lastConfigSendTime

Returns:

  • (String)


198
199
200
# File 'generated/google/apis/cloudiot_v1/classes.rb', line 198

def last_config_send_time
  @last_config_send_time
end

#last_error_statusGoogle::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. Each Status message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the API Design Guide. Corresponds to the JSON property lastErrorStatus



208
209
210
# File 'generated/google/apis/cloudiot_v1/classes.rb', line 208

def last_error_status
  @last_error_status
end

#last_error_timeString

[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

Returns:

  • (String)


215
216
217
# File 'generated/google/apis/cloudiot_v1/classes.rb', line 215

def last_error_time
  @last_error_time
end

#last_event_timeString

[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

Returns:

  • (String)


222
223
224
# File 'generated/google/apis/cloudiot_v1/classes.rb', line 222

def last_event_time
  @last_event_time
end

#last_heartbeat_timeString

[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

Returns:

  • (String)


231
232
233
# File 'generated/google/apis/cloudiot_v1/classes.rb', line 231

def last_heartbeat_time
  @last_heartbeat_time
end

#last_state_timeString

[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

Returns:

  • (String)


238
239
240
# File 'generated/google/apis/cloudiot_v1/classes.rb', line 238

def last_state_time
  @last_state_time
end

#log_levelString

Beta Feature The logging verbosity for device activity. If unspecified, DeviceRegistry.log_level will be used. Corresponds to the JSON property logLevel

Returns:

  • (String)


245
246
247
# File 'generated/google/apis/cloudiot_v1/classes.rb', line 245

def log_level
  @log_level
end

#metadataHash<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

Returns:

  • (Hash<String,String>)


258
259
260
# File 'generated/google/apis/cloudiot_v1/classes.rb', line 258

def 
  @metadata
end

#nameString

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`

Returns:

  • (String)


267
268
269
# File 'generated/google/apis/cloudiot_v1/classes.rb', line 267

def name
  @name
end

#num_idFixnum

[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

Returns:

  • (Fixnum)


273
274
275
# File 'generated/google/apis/cloudiot_v1/classes.rb', line 273

def num_id
  @num_id
end

#stateGoogle::Apis::CloudiotV1::DeviceState

The device state, as reported by the device. Corresponds to the JSON property state



278
279
280
# File 'generated/google/apis/cloudiot_v1/classes.rb', line 278

def state
  @state
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'generated/google/apis/cloudiot_v1/classes.rb', line 285

def update!(**args)
  @blocked = args[:blocked] if args.key?(:blocked)
  @config = args[:config] if args.key?(:config)
  @credentials = args[:credentials] if args.key?(:credentials)
  @gateway_config = args[:gateway_config] if args.key?(:gateway_config)
  @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)
  @log_level = args[:log_level] if args.key?(:log_level)
  @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