Skip to main content

GetByName

import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";

const DeviceView = cloudApi.iot.devices_device.DeviceView;
const GetByNameDeviceRequest =
cloudApi.iot.devices_device_service.GetByNameDeviceRequest;

(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.DeviceServiceClient);

const result = await client.getByName(
GetByNameDeviceRequest.fromPartial({
registryId: "registryId",
deviceName: "deviceName",
// deviceView: DeviceView.FULL
})
);
console.log(result);
})();

GetByNameDeviceRequest

registryId : string

ID of the registry to get device.

To get a registry ID make a yandex.cloud.iot.devices.v1.RegistryService.List request.

deviceName : string

Name of the device to return.

To get a device name make a DeviceService.List request.

deviceView : DeviceView

Specifies which parts of the device resource should be returned in the response.

Device

A device. For more information, see Device.

Status

  • STATUS_UNSPECIFIED

  • CREATING

    Device is being created.

  • ACTIVE

    Device is ready to use.

  • DELETING

    Device is being deleted.

id : string

ID of the device.

registryId : string

ID of the registry that the device belongs to.

createdAt : google.protobuf.Timestamp

Creation timestamp.

name : string

Name of the device. The name is unique within the registry.

description : string

Description of the device. 0-256 characters long.

topicAliases : string

Alias of a device topic.

Alias is an alternate name of a device topic assigned by the user. Map alias to canonical topic name prefix, e.g. my/custom/alias match to $device/abcdef/events.

status : Status

Status of the device.

monitoringData : DeviceMonitoringData

Device monitoring data, returns if FULL view specified.

DeviceMonitoringData

lastAuthIp : string
lastAuthTime : google.protobuf.Timestamp
lastPubActivityTime : google.protobuf.Timestamp
lastSubActivityTime : google.protobuf.Timestamp
lastOnlineTime : google.protobuf.Timestamp