Smart Device Management API v1

PiperOrigin-RevId: 334409362
This commit is contained in:
Google APIs 2020-09-29 10:29:23 -07:00 committed by Copybara-Service
parent f446e123bc
commit 8862d0f861
7 changed files with 821 additions and 0 deletions

View File

@ -0,0 +1,372 @@
# This file was automatically generated by BuildFileGenerator
# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
# Most of the manual changes to this file will be overwritten.
# It's **only** allowed to change the following rule attribute values:
# - names of *_gapic_assembly_* rules
# - certain parameters of *_gapic_library rules, including but not limited to:
# * extra_protoc_parameters
# * extra_protoc_file_parameters
# The complete list of preserved parameters can be found in the source code.
# This is an API workspace, having public visibility by default makes perfect sense.
package(default_visibility = ["//visibility:public"])
##############################################################################
# Common
##############################################################################
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
proto_library(
name = "sdm_proto",
srcs = [
"device.proto",
"site.proto",
"smart_device_management_service.proto",
],
deps = [
"//google/api:annotations_proto",
"//google/api:client_proto",
"//google/api:field_behavior_proto",
"//google/api:resource_proto",
"@com_google_protobuf//:struct_proto",
],
)
proto_library_with_info(
name = "sdm_proto_with_info",
deps = [
":sdm_proto",
"//google/cloud:common_resources_proto",
],
)
##############################################################################
# Java
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"java_gapic_assembly_gradle_pkg",
"java_gapic_library",
"java_gapic_test",
"java_grpc_library",
"java_proto_library",
)
java_proto_library(
name = "sdm_java_proto",
deps = [":sdm_proto"],
)
java_grpc_library(
name = "sdm_java_grpc",
srcs = [":sdm_proto"],
deps = [":sdm_java_proto"],
)
java_gapic_library(
name = "sdm_java_gapic",
src = ":sdm_proto_with_info",
gapic_yaml = "smartdevicemanagement_gapic.yaml",
grpc_service_config = "smart_device_management_grpc_service_config.json",
package = "google.home.enterprise.sdm.v1",
service_yaml = "smartdevicemanagement_v1.yaml",
test_deps = [
":sdm_java_grpc",
],
deps = [
":sdm_java_proto",
],
)
java_gapic_test(
name = "sdm_java_gapic_test_suite",
test_classes = [
"com.google.home.enterprise.sdm.v1.SmartDeviceManagementServiceClientTest",
],
runtime_deps = [":sdm_java_gapic_test"],
)
# Open Source Packages
java_gapic_assembly_gradle_pkg(
name = "google-cloud-enterprise-sdm-v1-java",
deps = [
":sdm_java_gapic",
":sdm_java_grpc",
":sdm_java_proto",
":sdm_proto",
],
)
##############################################################################
# Go
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"go_gapic_assembly_pkg",
"go_gapic_library",
"go_proto_library",
"go_test",
)
go_proto_library(
name = "sdm_go_proto",
compilers = ["@io_bazel_rules_go//proto:go_grpc"],
importpath = "google.golang.org/genproto/googleapis/home/enterprise/sdm/v1",
protos = [":sdm_proto"],
deps = [
"//google/api:annotations_go_proto",
],
)
go_gapic_library(
name = "sdm_go_gapic",
srcs = [":sdm_proto_with_info"],
grpc_service_config = "smart_device_management_grpc_service_config.json",
importpath = "google.golang.org/google/home/enterprise/sdm/v1;sdm",
service_yaml = "smartdevicemanagement_v1.yaml",
deps = [
":sdm_go_proto",
],
)
go_test(
name = "sdm_go_gapic_test",
srcs = [":sdm_go_gapic_srcjar_test"],
embed = [":sdm_go_gapic"],
importpath = "google.golang.org/google/home/enterprise/sdm/v1",
)
# Open Source Packages
go_gapic_assembly_pkg(
name = "gapi-cloud-enterprise-sdm-v1-go",
deps = [
":sdm_go_gapic",
":sdm_go_gapic_srcjar-test.srcjar",
":sdm_go_proto",
],
)
##############################################################################
# Python
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"moved_proto_library",
"py_gapic_assembly_pkg",
"py_gapic_library",
"py_grpc_library",
"py_proto_library",
)
moved_proto_library(
name = "sdm_moved_proto",
srcs = [":sdm_proto"],
deps = [
"//google/api:annotations_proto",
"//google/api:client_proto",
"//google/api:field_behavior_proto",
"//google/api:resource_proto",
"@com_google_protobuf//:struct_proto",
],
)
py_proto_library(
name = "sdm_py_proto",
plugin = "@protoc_docs_plugin//:docs_plugin",
deps = [":sdm_moved_proto"],
)
py_grpc_library(
name = "sdm_py_grpc",
srcs = [":sdm_moved_proto"],
deps = [":sdm_py_proto"],
)
py_gapic_library(
name = "sdm_py_gapic",
src = ":sdm_proto_with_info",
gapic_yaml = "smartdevicemanagement_gapic.yaml",
grpc_service_config = "smart_device_management_grpc_service_config.json",
package = "google.home.enterprise.sdm.v1",
service_yaml = "smartdevicemanagement_v1.yaml",
deps = [
":sdm_py_grpc",
":sdm_py_proto",
],
)
# Open Source Packages
py_gapic_assembly_pkg(
name = "enterprise-sdm-v1-py",
deps = [
":sdm_py_gapic",
":sdm_py_grpc",
":sdm_py_proto",
],
)
##############################################################################
# PHP
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"php_gapic_assembly_pkg",
"php_gapic_library",
"php_grpc_library",
"php_proto_library",
)
php_proto_library(
name = "sdm_php_proto",
deps = [":sdm_proto"],
)
php_grpc_library(
name = "sdm_php_grpc",
srcs = [":sdm_proto"],
deps = [":sdm_php_proto"],
)
php_gapic_library(
name = "sdm_php_gapic",
src = ":sdm_proto_with_info",
gapic_yaml = "smartdevicemanagement_gapic.yaml",
grpc_service_config = "smart_device_management_grpc_service_config.json",
package = "google.home.enterprise.sdm.v1",
service_yaml = "smartdevicemanagement_v1.yaml",
deps = [
":sdm_php_grpc",
":sdm_php_proto",
],
)
# Open Source Packages
php_gapic_assembly_pkg(
name = "google-cloud-enterprise-sdm-v1-php",
deps = [
":sdm_php_gapic",
":sdm_php_grpc",
":sdm_php_proto",
],
)
##############################################################################
# Node.js
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"nodejs_gapic_assembly_pkg",
"nodejs_gapic_library",
)
nodejs_gapic_library(
name = "sdm_nodejs_gapic",
src = ":sdm_proto_with_info",
grpc_service_config = "smart_device_management_grpc_service_config.json",
package = "google.home.enterprise.sdm.v1",
service_yaml = "smartdevicemanagement_v1.yaml",
deps = [],
)
nodejs_gapic_assembly_pkg(
name = "enterprise-sdm-v1-nodejs",
deps = [
":sdm_nodejs_gapic",
":sdm_proto",
],
)
##############################################################################
# Ruby
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"ruby_gapic_assembly_pkg",
"ruby_gapic_library",
"ruby_grpc_library",
"ruby_proto_library",
)
ruby_proto_library(
name = "sdm_ruby_proto",
deps = [":sdm_proto"],
)
ruby_grpc_library(
name = "sdm_ruby_grpc",
srcs = [":sdm_proto"],
deps = [":sdm_ruby_proto"],
)
ruby_gapic_library(
name = "sdm_ruby_gapic",
src = ":sdm_proto_with_info",
gapic_yaml = "smartdevicemanagement_gapic.yaml",
grpc_service_config = "smart_device_management_grpc_service_config.json",
package = "google.home.enterprise.sdm.v1",
service_yaml = "smartdevicemanagement_v1.yaml",
deps = [
":sdm_ruby_grpc",
":sdm_ruby_proto",
],
)
# Open Source Packages
ruby_gapic_assembly_pkg(
name = "google-cloud-enterprise-sdm-v1-ruby",
deps = [
":sdm_ruby_gapic",
":sdm_ruby_grpc",
":sdm_ruby_proto",
],
)
##############################################################################
# C#
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"csharp_gapic_assembly_pkg",
"csharp_gapic_library",
"csharp_grpc_library",
"csharp_proto_library",
)
csharp_proto_library(
name = "sdm_csharp_proto",
deps = [":sdm_proto"],
)
csharp_grpc_library(
name = "sdm_csharp_grpc",
srcs = [":sdm_proto"],
deps = [":sdm_csharp_proto"],
)
csharp_gapic_library(
name = "sdm_csharp_gapic",
srcs = [":sdm_proto_with_info"],
grpc_service_config = "smart_device_management_grpc_service_config.json",
common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
deps = [
":sdm_csharp_grpc",
":sdm_csharp_proto",
],
)
# Open Source Packages
csharp_gapic_assembly_pkg(
name = "google-cloud-enterprise-sdm-v1-csharp",
deps = [
":sdm_csharp_gapic",
":sdm_csharp_grpc",
":sdm_csharp_proto",
],
)
##############################################################################
# C++
##############################################################################
# Put your C++ rules here

View File

@ -0,0 +1,66 @@
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.home.enterprise.sdm.v1;
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/struct.proto";
option csharp_namespace = "Google.Home.Enterprise.Sdm.V1";
option go_package = "google.golang.org/genproto/googleapis/home/enterprise/sdm/v1;sdm";
option java_multiple_files = true;
option java_package = "com.google.home.enterprise.sdm.v1";
option objc_class_prefix = "GHENTSDM";
option php_namespace = "Google\\Home\\Enterprise\\Sdm\\V1";
// Device resource represents an instance of enterprise managed device in the
// property.
message Device {
option (google.api.resource) = {
type: "smartdevicemanagement.googleapis.com/Device"
pattern: "enterprises/{enterprise}/devices/{device}"
};
// Required. The resource name of the device. For example:
// "enterprises/XYZ/devices/123".
string name = 1;
// Output only. Type of the device for general display purposes.
// For example: "THERMOSTAT". The device type should not be used to deduce or
// infer functionality of the actual device it is assigned to. Instead, use
// the returned traits for the device.
string type = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. Device traits.
google.protobuf.Struct traits = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
// Assignee details of the device.
repeated ParentRelation parent_relations = 5;
}
// Represents device relationships, for instance, structure/room to which the
// device is assigned to. For now this is only filled in the enterprise flow.
message ParentRelation {
// Output only. The name of the relation -- e.g., structure/room where the
// device is assigned to. For example: "enterprises/XYZ/structures/ABC" or
// "enterprises/XYZ/structures/ABC/rooms/123"
string parent = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. The custom name of the relation -- e.g., structure/room where
// the device is assigned to.
string display_name = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
}

View File

@ -0,0 +1,75 @@
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.home.enterprise.sdm.v1;
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/struct.proto";
option csharp_namespace = "Google.Home.Enterprise.Sdm.V1";
option go_package = "google.golang.org/genproto/googleapis/home/enterprise/sdm/v1;sdm";
option java_multiple_files = true;
option java_package = "com.google.home.enterprise.sdm.v1";
option objc_class_prefix = "GHENTSDM";
option php_namespace = "Google\\Home\\Enterprise\\Sdm\\V1";
// Structure resource represents an instance of enterprise managed home or hotel
// room.
message Structure {
option (google.api.resource) = {
type: "smartdevicemanagement.googleapis.com/Structure"
pattern: "enterprises/{enterprise}/structures/{structure}"
};
// Output only. The resource name of the structure. For example:
// "enterprises/XYZ/structures/ABC".
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
// Structure traits.
google.protobuf.Struct traits = 2;
// Assignee details of the structure.
repeated StructureParentRelation parent_relations = 3;
}
// Room resource represents an instance of sub-space within a structure such as
// rooms in a hotel suite or rental apartment.
message Room {
option (google.api.resource) = {
type: "smartdevicemanagement.googleapis.com/Room"
pattern: "enterprises/{enterprise}/structures/{structure}/rooms/{room}"
};
// Output only. The resource name of the room. For example:
// "enterprises/XYZ/structures/ABC/rooms/123".
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
// Room traits.
google.protobuf.Struct traits = 2;
}
// Represents structure assignee relationships, for instance, group to which the
// structure is assigned to.
message StructureParentRelation {
// Output only. The name of the relation -- e.g., group to which the structure
// is assigned to. For example: "enterprises/XYZ/groups/ABC"
string parent = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. The custom name of the relation -- e.g., group, to which the
// structure is assigned to.
string display_name = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
}

View File

@ -0,0 +1,49 @@
{
"methodConfig": [
{
"name": [
{
"service": "google.home.enterprise.sdm.v1.SmartDeviceManagementService",
"method": "GetDevice"
},
{
"service": "google.home.enterprise.sdm.v1.SmartDeviceManagementService",
"method": "ListDevices"
},
{
"service": "google.home.enterprise.sdm.v1.SmartDeviceManagementService",
"method": "GetStructure"
},
{
"service": "google.home.enterprise.sdm.v1.SmartDeviceManagementService",
"method": "ListStructures"
},
{
"service": "google.home.enterprise.sdm.v1.SmartDeviceManagementService",
"method": "GetRoom"
},
{
"service": "google.home.enterprise.sdm.v1.SmartDeviceManagementService",
"method": "ListRooms"
}
],
"timeout": "60s",
"retryPolicy": {
"maxAttempts": 5,
"initialBackoff": "1s",
"maxBackoff": "10s",
"backoffMultiplier": 1.3,
"retryableStatusCodes": ["UNAVAILABLE"]
}
},
{
"name": [
{
"service": "google.home.enterprise.sdm.v1.SmartDeviceManagementService",
"method": "ExecuteDeviceCommand"
}
],
"timeout": "60s"
}
]
}

View File

@ -0,0 +1,222 @@
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.home.enterprise.sdm.v1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/home/enterprise/sdm/v1/device.proto";
import "google/home/enterprise/sdm/v1/site.proto";
import "google/protobuf/struct.proto";
option csharp_namespace = "Google.Home.Enterprise.Sdm.V1";
option go_package = "google.golang.org/genproto/googleapis/home/enterprise/sdm/v1;sdm";
option java_multiple_files = true;
option java_package = "com.google.home.enterprise.sdm.v1";
option objc_class_prefix = "GHENTSDM";
option php_namespace = "Google\\Home\\Enterprise\\Sdm\\V1";
// core::0122 is getting triggered by adding fields custom_name.
// though, 0122 has exception for such field name as display_name. Due to
// historical reasons we use custom_name for exactly same purpose, so it is
// covered by that exception.
// A service that allows API consumers to provision and manage Google
// Home structures and devices for enterprise use cases.
service SmartDeviceManagementService {
option (google.api.default_host) = "smartdevicemanagement.googleapis.com";
option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/sdm.service";
// Gets a device managed by the enterprise.
rpc GetDevice(GetDeviceRequest) returns (Device) {
option (google.api.http) = {
get: "/v1/{name=enterprises/*/devices/*}"
};
}
// Lists devices managed by the enterprise.
rpc ListDevices(ListDevicesRequest) returns (ListDevicesResponse) {
option (google.api.http) = {
get: "/v1/{parent=enterprises/*}/devices"
};
}
// Executes a command to device managed by the enterprise.
rpc ExecuteDeviceCommand(ExecuteDeviceCommandRequest) returns (ExecuteDeviceCommandResponse) {
option (google.api.http) = {
post: "/v1/{name=enterprises/*/devices/*}:executeCommand"
body: "*"
};
}
// Gets a structure managed by the enterprise.
rpc GetStructure(GetStructureRequest) returns (Structure) {
option (google.api.http) = {
get: "/v1/{name=enterprises/*/structures/*}"
};
}
// Lists structures managed by the enterprise.
rpc ListStructures(ListStructuresRequest) returns (ListStructuresResponse) {
option (google.api.http) = {
get: "/v1/{parent=enterprises/*}/structures"
};
}
// Gets a room managed by the enterprise.
rpc GetRoom(GetRoomRequest) returns (Room) {
option (google.api.http) = {
get: "/v1/{name=enterprises/*/structures/*/rooms/*}"
};
}
// Lists rooms managed by the enterprise.
rpc ListRooms(ListRoomsRequest) returns (ListRoomsResponse) {
option (google.api.http) = {
get: "/v1/{parent=enterprises/*/structures/*}/rooms"
};
}
}
// Request message for SmartDeviceManagementService.GetDevice
message GetDeviceRequest {
// The name of the device requested. For example:
// "enterprises/XYZ/devices/123"
string name = 1;
}
// Request message for SmartDeviceManagementService.ListDevices
message ListDevicesRequest {
// The parent enterprise to list devices under. E.g. "enterprises/XYZ".
string parent = 1;
// Optional requested page size. Server may return fewer devices than
// requested. If unspecified, server will pick an appropriate default.
int32 page_size = 2;
// Optional token of the page to retrieve.
string page_token = 3;
// Optional filter to list devices.
//
// Filters can match the exact assignee (could be a structure or a room).
// E.g. 'assignee=enterprises/XYZ/structures/abc'
// Also could filter by parent (group):
// 'parent=enterprises/XYZ/groups/jkl'
// or filter by device custom name (substring match):
// 'customName=wing'
string filter = 4;
}
// Response message for SmartDeviceManagementService.ListDevices
message ListDevicesResponse {
// The list of devices.
repeated Device devices = 1;
// The pagination token to retrieve the next page of results.
string next_page_token = 2;
}
// Request message for SmartDeviceManagementService.ExecuteDeviceCommand
message ExecuteDeviceCommandRequest {
// The name of the device requested. For example:
// "enterprises/XYZ/devices/123"
string name = 1;
// The command name to execute, represented by the fully qualified protobuf
// message name.
string command = 2;
// The command message to execute, represented as a Struct.
google.protobuf.Struct params = 3;
}
// Response message for SmartDeviceManagementService.ExecuteDeviceCommand
message ExecuteDeviceCommandResponse {
// The results of executing the command.
google.protobuf.Struct results = 1;
}
// Request message for SmartDeviceManagementService.GetStructure
message GetStructureRequest {
// The name of the structure requested. For example:
// "enterprises/XYZ/structures/ABC".
string name = 1;
}
// Request message for SmartDeviceManagementService.ListStructures
message ListStructuresRequest {
// The parent enterprise to list structures under. E.g. "enterprises/XYZ".
string parent = 1;
// Requested page size. Server may return fewer structures than requested.
// If unspecified, server will pick an appropriate default.
int32 page_size = 2;
// The token of the page to retrieve.
string page_token = 3;
// Optional filter to list structures.
//
// Filters can match the exact album assigned to the structure.
// E.g. 'album=enterprises/XYZ/albums/abc'
// It also support filtering by parent (only groups for now):
// E.g. 'parent=enterprises/XYZ/groups/124'
string filter = 4;
}
// Response message for SmartDeviceManagementService.ListStructures
message ListStructuresResponse {
// The list of structures.
repeated Structure structures = 1;
// The pagination token to retrieve the next page of results.
// If this field is omitted, there are no subsequent pages.
string next_page_token = 2;
}
// Request message for SmartDeviceManagementService.GetRoom
message GetRoomRequest {
// The name of the room requested. For example:
// "enterprises/XYZ/structures/ABC/rooms/123".
string name = 1;
}
// Request message for SmartDeviceManagementService.ListRooms
message ListRoomsRequest {
// The parent resource name of the rooms requested. For example:
// "enterprises/XYZ/structures/ABC".
string parent = 1;
// Requested page size. Server may return fewer rooms than requested.
// If unspecified, server will pick an appropriate default.
int32 page_size = 2;
// The token of the page to retrieve.
string page_token = 3;
}
// Response message for SmartDeviceManagementService.ListRooms
message ListRoomsResponse {
// The list of rooms.
repeated Room rooms = 1;
// The pagination token to retrieve the next page of results.
// If this field is omitted, there are no subsequent pages.
string next_page_token = 2;
}

View File

@ -0,0 +1,18 @@
type: com.google.api.codegen.ConfigProto
config_schema_version: 2.0.0
# The settings of generated code in a specific language.
language_settings:
java:
package_name: com.google.home.enterprise.sdm.v1
python:
package_name: google.home.enterprise.sdm_v1.gapic
go:
package_name: google.golang.org/smartdevicemanagement/v1
csharp:
package_name: Google.Home.Enterprise.Sdm.V1
ruby:
package_name: Google::Home::Enterprise::Sdm::V1
php:
package_name: Google\Home\Enterprise\Sdm\V1
nodejs:
package_name: google.home.enterprise.sdm.v1

View File

@ -0,0 +1,19 @@
type: google.api.Service
config_version: 3
name: smartdevicemanagement.googleapis.com
title: Smart Device Management API
apis:
- name: google.home.enterprise.sdm.v1.SmartDeviceManagementService
documentation:
summary: |-
Allow select enterprise partners to access, control, and manage Google and
Nest devices programmatically.
authentication:
rules:
- selector: 'google.home.enterprise.sdm.v1.SmartDeviceManagementService.*'
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/sdm.service