You've already forked npm-viz-sdk
202 lines
8.5 KiB
TypeScript
202 lines
8.5 KiB
TypeScript
// @generated by protobuf-ts 2.9.6 with parameter use_proto_field_name
|
|
// @generated from protobuf file "visibility.proto" (package "google.api", syntax proto3)
|
|
// tslint:disable
|
|
//
|
|
// Copyright 2021 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 type { BinaryWriteOptions } from "@protobuf-ts/runtime";
|
|
import type { IBinaryWriter } from "@protobuf-ts/runtime";
|
|
import { WireType } from "@protobuf-ts/runtime";
|
|
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
|
|
import type { IBinaryReader } from "@protobuf-ts/runtime";
|
|
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
|
|
import type { PartialMessage } from "@protobuf-ts/runtime";
|
|
import { reflectionMergePartial } from "@protobuf-ts/runtime";
|
|
import { MessageType } from "@protobuf-ts/runtime";
|
|
/**
|
|
* `Visibility` defines restrictions for the visibility of service
|
|
* elements. Restrictions are specified using visibility labels
|
|
* (e.g., PREVIEW) that are elsewhere linked to users and projects.
|
|
*
|
|
* Users and projects can have access to more than one visibility label. The
|
|
* effective visibility for multiple labels is the union of each label's
|
|
* elements, plus any unrestricted elements.
|
|
*
|
|
* If an element and its parents have no restrictions, visibility is
|
|
* unconditionally granted.
|
|
*
|
|
* Example:
|
|
*
|
|
* visibility:
|
|
* rules:
|
|
* - selector: google.calendar.Calendar.EnhancedSearch
|
|
* restriction: PREVIEW
|
|
* - selector: google.calendar.Calendar.Delegate
|
|
* restriction: INTERNAL
|
|
*
|
|
* Here, all methods are publicly visible except for the restricted methods
|
|
* EnhancedSearch and Delegate.
|
|
*
|
|
* @generated from protobuf message google.api.Visibility
|
|
*/
|
|
export interface Visibility {
|
|
/**
|
|
* A list of visibility rules that apply to individual API elements.
|
|
*
|
|
* **NOTE:** All service configuration rules follow "last one wins" order.
|
|
*
|
|
* @generated from protobuf field: repeated google.api.VisibilityRule rules = 1;
|
|
*/
|
|
rules: VisibilityRule[];
|
|
}
|
|
/**
|
|
* A visibility rule provides visibility configuration for an individual API
|
|
* element.
|
|
*
|
|
* @generated from protobuf message google.api.VisibilityRule
|
|
*/
|
|
export interface VisibilityRule {
|
|
/**
|
|
* Selects methods, messages, fields, enums, etc. to which this rule applies.
|
|
*
|
|
* Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
|
|
*
|
|
* @generated from protobuf field: string selector = 1;
|
|
*/
|
|
selector: string;
|
|
/**
|
|
* A comma-separated list of visibility labels that apply to the `selector`.
|
|
* Any of the listed labels can be used to grant the visibility.
|
|
*
|
|
* If a rule has multiple labels, removing one of the labels but not all of
|
|
* them can break clients.
|
|
*
|
|
* Example:
|
|
*
|
|
* visibility:
|
|
* rules:
|
|
* - selector: google.calendar.Calendar.EnhancedSearch
|
|
* restriction: INTERNAL, PREVIEW
|
|
*
|
|
* Removing INTERNAL from this restriction will break clients that rely on
|
|
* this method and only had access to it through INTERNAL.
|
|
*
|
|
* @generated from protobuf field: string restriction = 2;
|
|
*/
|
|
restriction: string;
|
|
}
|
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
class Visibility$Type extends MessageType<Visibility> {
|
|
constructor() {
|
|
super("google.api.Visibility", [
|
|
{ no: 1, name: "rules", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => VisibilityRule }
|
|
]);
|
|
}
|
|
create(value?: PartialMessage<Visibility>): Visibility {
|
|
const message = globalThis.Object.create((this.messagePrototype!));
|
|
message.rules = [];
|
|
if (value !== undefined)
|
|
reflectionMergePartial<Visibility>(this, message, value);
|
|
return message;
|
|
}
|
|
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Visibility): Visibility {
|
|
let message = target ?? this.create(), end = reader.pos + length;
|
|
while (reader.pos < end) {
|
|
let [fieldNo, wireType] = reader.tag();
|
|
switch (fieldNo) {
|
|
case /* repeated google.api.VisibilityRule rules */ 1:
|
|
message.rules.push(VisibilityRule.internalBinaryRead(reader, reader.uint32(), options));
|
|
break;
|
|
default:
|
|
let u = options.readUnknownField;
|
|
if (u === "throw")
|
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
let d = reader.skip(wireType);
|
|
if (u !== false)
|
|
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
}
|
|
}
|
|
return message;
|
|
}
|
|
internalBinaryWrite(message: Visibility, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
/* repeated google.api.VisibilityRule rules = 1; */
|
|
for (let i = 0; i < message.rules.length; i++)
|
|
VisibilityRule.internalBinaryWrite(message.rules[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join();
|
|
let u = options.writeUnknownFields;
|
|
if (u !== false)
|
|
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
return writer;
|
|
}
|
|
}
|
|
/**
|
|
* @generated MessageType for protobuf message google.api.Visibility
|
|
*/
|
|
export const Visibility = new Visibility$Type();
|
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
class VisibilityRule$Type extends MessageType<VisibilityRule> {
|
|
constructor() {
|
|
super("google.api.VisibilityRule", [
|
|
{ no: 1, name: "selector", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
{ no: 2, name: "restriction", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
]);
|
|
}
|
|
create(value?: PartialMessage<VisibilityRule>): VisibilityRule {
|
|
const message = globalThis.Object.create((this.messagePrototype!));
|
|
message.selector = "";
|
|
message.restriction = "";
|
|
if (value !== undefined)
|
|
reflectionMergePartial<VisibilityRule>(this, message, value);
|
|
return message;
|
|
}
|
|
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: VisibilityRule): VisibilityRule {
|
|
let message = target ?? this.create(), end = reader.pos + length;
|
|
while (reader.pos < end) {
|
|
let [fieldNo, wireType] = reader.tag();
|
|
switch (fieldNo) {
|
|
case /* string selector */ 1:
|
|
message.selector = reader.string();
|
|
break;
|
|
case /* string restriction */ 2:
|
|
message.restriction = reader.string();
|
|
break;
|
|
default:
|
|
let u = options.readUnknownField;
|
|
if (u === "throw")
|
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
let d = reader.skip(wireType);
|
|
if (u !== false)
|
|
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
}
|
|
}
|
|
return message;
|
|
}
|
|
internalBinaryWrite(message: VisibilityRule, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
/* string selector = 1; */
|
|
if (message.selector !== "")
|
|
writer.tag(1, WireType.LengthDelimited).string(message.selector);
|
|
/* string restriction = 2; */
|
|
if (message.restriction !== "")
|
|
writer.tag(2, WireType.LengthDelimited).string(message.restriction);
|
|
let u = options.writeUnknownFields;
|
|
if (u !== false)
|
|
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
return writer;
|
|
}
|
|
}
|
|
/**
|
|
* @generated MessageType for protobuf message google.api.VisibilityRule
|
|
*/
|
|
export const VisibilityRule = new VisibilityRule$Type();
|