Skip to content

Commit

Permalink
feat: add singular and plural resource descriptors (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and JustinBeckwith committed Nov 20, 2019
1 parent 30e4917 commit 30d2ee8
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 12 deletions.
30 changes: 30 additions & 0 deletions packages/google-cloud-iot/protos/protos.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
// Copyright 2019 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.

import * as Long from "long";
import * as $protobuf from "protobufjs";
/** Namespace google. */
export namespace google {
Expand Down Expand Up @@ -4669,6 +4684,12 @@ export namespace google {

/** ResourceDescriptor history */
history?: (google.api.ResourceDescriptor.History|null);

/** ResourceDescriptor plural */
plural?: (string|null);

/** ResourceDescriptor singular */
singular?: (string|null);
}

/** Represents a ResourceDescriptor. */
Expand All @@ -4692,6 +4713,12 @@ export namespace google {
/** ResourceDescriptor history. */
public history: google.api.ResourceDescriptor.History;

/** ResourceDescriptor plural. */
public plural: string;

/** ResourceDescriptor singular. */
public singular: string;

/**
* Creates a new ResourceDescriptor instance using the specified properties.
* @param [properties] Properties to set
Expand Down Expand Up @@ -6428,6 +6455,9 @@ export namespace google {

/** FileOptions uninterpretedOption */
uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null);

/** FileOptions .google.api.resourceDefinition */
".google.api.resourceDefinition"?: (google.api.IResourceDescriptor[]|null);
}

/** Represents a FileOptions. */
Expand Down
104 changes: 103 additions & 1 deletion packages/google-cloud-iot/protos/protos.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2019 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.

/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
(function(global, factory) { /* global define, require, module */

Expand Down Expand Up @@ -11034,6 +11048,8 @@
* @property {Array.<string>|null} [pattern] ResourceDescriptor pattern
* @property {string|null} [nameField] ResourceDescriptor nameField
* @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history
* @property {string|null} [plural] ResourceDescriptor plural
* @property {string|null} [singular] ResourceDescriptor singular
*/

/**
Expand Down Expand Up @@ -11084,6 +11100,22 @@
*/
ResourceDescriptor.prototype.history = 0;

/**
* ResourceDescriptor plural.
* @member {string} plural
* @memberof google.api.ResourceDescriptor
* @instance
*/
ResourceDescriptor.prototype.plural = "";

/**
* ResourceDescriptor singular.
* @member {string} singular
* @memberof google.api.ResourceDescriptor
* @instance
*/
ResourceDescriptor.prototype.singular = "";

/**
* Creates a new ResourceDescriptor instance using the specified properties.
* @function create
Expand Down Expand Up @@ -11117,6 +11149,10 @@
writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField);
if (message.history != null && message.hasOwnProperty("history"))
writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history);
if (message.plural != null && message.hasOwnProperty("plural"))
writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural);
if (message.singular != null && message.hasOwnProperty("singular"))
writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular);
return writer;
};

Expand Down Expand Up @@ -11165,6 +11201,12 @@
case 4:
message.history = reader.int32();
break;
case 5:
message.plural = reader.string();
break;
case 6:
message.singular = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
Expand Down Expand Up @@ -11222,6 +11264,12 @@
case 2:
break;
}
if (message.plural != null && message.hasOwnProperty("plural"))
if (!$util.isString(message.plural))
return "plural: string expected";
if (message.singular != null && message.hasOwnProperty("singular"))
if (!$util.isString(message.singular))
return "singular: string expected";
return null;
};

Expand Down Expand Up @@ -11262,6 +11310,10 @@
message.history = 2;
break;
}
if (object.plural != null)
message.plural = String(object.plural);
if (object.singular != null)
message.singular = String(object.singular);
return message;
};

Expand All @@ -11284,6 +11336,8 @@
object.type = "";
object.nameField = "";
object.history = options.enums === String ? "HISTORY_UNSPECIFIED" : 0;
object.plural = "";
object.singular = "";
}
if (message.type != null && message.hasOwnProperty("type"))
object.type = message.type;
Expand All @@ -11296,6 +11350,10 @@
object.nameField = message.nameField;
if (message.history != null && message.hasOwnProperty("history"))
object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] : message.history;
if (message.plural != null && message.hasOwnProperty("plural"))
object.plural = message.plural;
if (message.singular != null && message.hasOwnProperty("singular"))
object.singular = message.singular;
return object;
};

Expand Down Expand Up @@ -15710,6 +15768,7 @@
* @property {string|null} [phpMetadataNamespace] FileOptions phpMetadataNamespace
* @property {string|null} [rubyPackage] FileOptions rubyPackage
* @property {Array.<google.protobuf.IUninterpretedOption>|null} [uninterpretedOption] FileOptions uninterpretedOption
* @property {Array.<google.api.IResourceDescriptor>|null} [".google.api.resourceDefinition"] FileOptions .google.api.resourceDefinition
*/

/**
Expand All @@ -15722,6 +15781,7 @@
*/
function FileOptions(properties) {
this.uninterpretedOption = [];
this[".google.api.resourceDefinition"] = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
Expand Down Expand Up @@ -15896,6 +15956,14 @@
*/
FileOptions.prototype.uninterpretedOption = $util.emptyArray;

/**
* FileOptions .google.api.resourceDefinition.
* @member {Array.<google.api.IResourceDescriptor>} .google.api.resourceDefinition
* @memberof google.protobuf.FileOptions
* @instance
*/
FileOptions.prototype[".google.api.resourceDefinition"] = $util.emptyArray;

/**
* Creates a new FileOptions instance using the specified properties.
* @function create
Expand Down Expand Up @@ -15963,6 +16031,9 @@
if (message.uninterpretedOption != null && message.uninterpretedOption.length)
for (var i = 0; i < message.uninterpretedOption.length; ++i)
$root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim();
if (message[".google.api.resourceDefinition"] != null && message[".google.api.resourceDefinition"].length)
for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i)
$root.google.api.ResourceDescriptor.encode(message[".google.api.resourceDefinition"][i], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim();
return writer;
};

Expand Down Expand Up @@ -16062,6 +16133,11 @@
message.uninterpretedOption = [];
message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32()));
break;
case 1053:
if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length))
message[".google.api.resourceDefinition"] = [];
message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
Expand Down Expand Up @@ -16172,6 +16248,15 @@
return "uninterpretedOption." + error;
}
}
if (message[".google.api.resourceDefinition"] != null && message.hasOwnProperty(".google.api.resourceDefinition")) {
if (!Array.isArray(message[".google.api.resourceDefinition"]))
return ".google.api.resourceDefinition: array expected";
for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) {
var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resourceDefinition"][i]);
if (error)
return ".google.api.resourceDefinition." + error;
}
}
return null;
};

Expand Down Expand Up @@ -16249,6 +16334,16 @@
message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]);
}
}
if (object[".google.api.resourceDefinition"]) {
if (!Array.isArray(object[".google.api.resourceDefinition"]))
throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: array expected");
message[".google.api.resourceDefinition"] = [];
for (var i = 0; i < object[".google.api.resourceDefinition"].length; ++i) {
if (typeof object[".google.api.resourceDefinition"][i] !== "object")
throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: object expected");
message[".google.api.resourceDefinition"][i] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resourceDefinition"][i]);
}
}
return message;
};

Expand All @@ -16265,8 +16360,10 @@
if (!options)
options = {};
var object = {};
if (options.arrays || options.defaults)
if (options.arrays || options.defaults) {
object.uninterpretedOption = [];
object[".google.api.resourceDefinition"] = [];
}
if (options.defaults) {
object.javaPackage = "";
object.javaOuterClassname = "";
Expand Down Expand Up @@ -16334,6 +16431,11 @@
for (var j = 0; j < message.uninterpretedOption.length; ++j)
object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options);
}
if (message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length) {
object[".google.api.resourceDefinition"] = [];
for (var j = 0; j < message[".google.api.resourceDefinition"].length; ++j)
object[".google.api.resourceDefinition"][j] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resourceDefinition"][j], options);
}
return object;
};

Expand Down
44 changes: 38 additions & 6 deletions packages/google-cloud-iot/protos/protos.json
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,12 @@
"id": 1055,
"extend": "google.protobuf.FieldOptions"
},
"resourceDefinition": {
"rule": "repeated",
"type": "google.api.ResourceDescriptor",
"id": 1053,
"extend": "google.protobuf.FileOptions"
},
"resource": {
"type": "google.api.ResourceDescriptor",
"id": 1053,
Expand All @@ -1112,6 +1118,14 @@
"history": {
"type": "History",
"id": 4
},
"plural": {
"type": "string",
"id": 5
},
"singular": {
"type": "string",
"id": 6
}
},
"nested": {
Expand Down Expand Up @@ -2143,22 +2157,33 @@
"fields": {
"resource": {
"type": "string",
"id": 1
"id": 1,
"options": {
"(google.api.field_behavior)": "REQUIRED",
"(google.api.resource_reference).type": "*"
}
},
"policy": {
"type": "Policy",
"id": 2
"id": 2,
"options": {
"(google.api.field_behavior)": "REQUIRED"
}
}
}
},
"GetIamPolicyRequest": {
"fields": {
"resource": {
"type": "string",
"id": 1
"id": 1,
"options": {
"(google.api.field_behavior)": "REQUIRED",
"(google.api.resource_reference).type": "*"
}
},
"options": {
"type": "google.iam.v1.GetPolicyOptions",
"type": "GetPolicyOptions",
"id": 2
}
}
Expand All @@ -2167,12 +2192,19 @@
"fields": {
"resource": {
"type": "string",
"id": 1
"id": 1,
"options": {
"(google.api.field_behavior)": "REQUIRED",
"(google.api.resource_reference).type": "*"
}
},
"permissions": {
"rule": "repeated",
"type": "string",
"id": 2
"id": 2,
"options": {
"(google.api.field_behavior)": "REQUIRED"
}
}
}
},
Expand Down
10 changes: 5 additions & 5 deletions packages/google-cloud-iot/synth.metadata
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"updateTime": "2019-11-14T12:17:35.275146Z",
"updateTime": "2019-11-19T12:19:00.663698Z",
"sources": [
{
"generator": {
"name": "artman",
"version": "0.41.1",
"dockerImage": "googleapis/artman@sha256:545c758c76c3f779037aa259023ec3d1ef2d57d2c8cd00a222cb187d63ceac5e"
"version": "0.42.1",
"dockerImage": "googleapis/artman@sha256:c773192618c608a7a0415dd95282f841f8e6bcdef7dd760a988c93b77a64bd57"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "4f747bda9b099b4426f495985680d16d0227fa5f",
"internalRef": "280394936"
"sha": "d8dd7fe8d5304f7bd1c52207703d7f27d5328c5a",
"internalRef": "281088257"
}
},
{
Expand Down

0 comments on commit 30d2ee8

Please sign in to comment.