initial commit

This commit is contained in:
2025-04-06 10:25:26 -06:00
commit 05e9970008
225 changed files with 35329 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
local.db

8
.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

62
.idea/codeStyles/Project.xml generated Normal file
View File

@ -0,0 +1,62 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<option name="AUTODETECT_INDENTS" value="false" />
<HTMLCodeStyleSettings>
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
</HTMLCodeStyleSettings>
<JSCodeStyleSettings version="0">
<option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
<option name="FORCE_SEMICOLON_STYLE" value="true" />
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
<option name="USE_DOUBLE_QUOTES" value="false" />
<option name="FORCE_QUOTE_STYlE" value="true" />
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
<option name="SPACES_WITHIN_IMPORTS" value="true" />
</JSCodeStyleSettings>
<TypeScriptCodeStyleSettings version="0">
<option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
<option name="FORCE_SEMICOLON_STYLE" value="true" />
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
<option name="USE_DOUBLE_QUOTES" value="false" />
<option name="FORCE_QUOTE_STYlE" value="true" />
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
<option name="SPACES_WITHIN_IMPORTS" value="true" />
</TypeScriptCodeStyleSettings>
<VueCodeStyleSettings>
<option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
<option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
</VueCodeStyleSettings>
<codeStyleSettings language="HTML">
<option name="SOFT_MARGINS" value="100" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JavaScript">
<option name="SOFT_MARGINS" value="100" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="TypeScript">
<option name="SOFT_MARGINS" value="100" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Vue">
<option name="SOFT_MARGINS" value="100" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

59
.idea/dataSources.xml generated Normal file
View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="local" uuid="dd6941ca-e95e-4328-af8e-a3f0cb2facc4">
<driver-ref>8e1456f3-bb8e-4fa5-9238-52bbf5233932</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:C:\Users\gomas\src\peach\local.db</jdbc-url>
<jdbc-additional-properties>
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
</jdbc-additional-properties>
<working-dir>$ProjectFileDir$</working-dir>
<libraries>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/license.txt</url>
</library>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar</url>
</library>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar.sha1</url>
</library>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.pom</url>
</library>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.pom.sha1</url>
</library>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/slf4j/slf4j-api/1.7.36/_remote.repositories</url>
</library>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/slf4j/slf4j-parent/1.7.36/slf4j-parent-1.7.36.pom</url>
</library>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/slf4j/slf4j-parent/1.7.36/slf4j-parent-1.7.36.pom.sha1</url>
</library>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/slf4j/slf4j-parent/1.7.36/_remote.repositories</url>
</library>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/xerial/sqlite-jdbc/3.45.1.0/sqlite-jdbc-3.45.1.0.jar</url>
</library>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/xerial/sqlite-jdbc/3.45.1.0/sqlite-jdbc-3.45.1.0.jar.sha1</url>
</library>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/xerial/sqlite-jdbc/3.45.1.0/sqlite-jdbc-3.45.1.0.pom</url>
</library>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/xerial/sqlite-jdbc/3.45.1.0/sqlite-jdbc-3.45.1.0.pom.sha1</url>
</library>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/xerial/sqlite-jdbc/3.45.1.0/_remote.repositories</url>
</library>
</libraries>
</data-source>
</component>
</project>

8
.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/peach.iml" filepath="$PROJECT_DIR$/.idea/peach.iml" />
</modules>
</component>
</project>

9
.idea/peach.iml generated Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

12
.idea/protoeditor.xml generated Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProtobufLanguageSettings">
<option name="importPathEntries">
<list>
<ImportPathEntry>
<option name="location" value="file://$USER_HOME$/bin/include" />
</ImportPathEntry>
</list>
</option>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

1255
gen/go/service.pb.go Normal file

File diff suppressed because it is too large Load Diff

1187
gen/go/service.pb.gorm.go Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
package pb
import (
"context"
"fmt"
"gorm.io/gorm"
)
func (r *ListUsersRequest) AfterListUsers(ctx context.Context, resp *ListUsersResponse, db *gorm.DB) error {
fmt.Println("AfterListUsers")
return nil
}

757
gen/go/service.pb.gw.go Normal file
View File

@ -0,0 +1,757 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: proto/service.proto
/*
Package pb is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package pb
import (
"context"
"errors"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var (
_ codes.Code
_ io.Reader
_ status.Status
_ = errors.New
_ = runtime.String
_ = utilities.NewDoubleArray
_ = metadata.Join
)
func request_Peach_CreateUser_0(ctx context.Context, marshaler runtime.Marshaler, client PeachClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq CreateUserRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.CreateUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Peach_CreateUser_0(ctx context.Context, marshaler runtime.Marshaler, server PeachServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq CreateUserRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.CreateUser(ctx, &protoReq)
return msg, metadata, err
}
func request_Peach_ReadUser_0(ctx context.Context, marshaler runtime.Marshaler, client PeachClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ReadUserRequest
metadata runtime.ServerMetadata
err error
)
val, ok := pathParams["id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
}
protoReq.Id, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
}
msg, err := client.ReadUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Peach_ReadUser_0(ctx context.Context, marshaler runtime.Marshaler, server PeachServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ReadUserRequest
metadata runtime.ServerMetadata
err error
)
val, ok := pathParams["id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
}
protoReq.Id, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
}
msg, err := server.ReadUser(ctx, &protoReq)
return msg, metadata, err
}
func request_Peach_ListUsers_0(ctx context.Context, marshaler runtime.Marshaler, client PeachClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ListUsersRequest
metadata runtime.ServerMetadata
)
msg, err := client.ListUsers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Peach_ListUsers_0(ctx context.Context, marshaler runtime.Marshaler, server PeachServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ListUsersRequest
metadata runtime.ServerMetadata
)
msg, err := server.ListUsers(ctx, &protoReq)
return msg, metadata, err
}
func request_Peach_UpdateUser_0(ctx context.Context, marshaler runtime.Marshaler, client PeachClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq UpdateUserRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.UpdateUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Peach_UpdateUser_0(ctx context.Context, marshaler runtime.Marshaler, server PeachServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq UpdateUserRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.UpdateUser(ctx, &protoReq)
return msg, metadata, err
}
func request_Peach_DeleteUser_0(ctx context.Context, marshaler runtime.Marshaler, client PeachClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq DeleteUserRequest
metadata runtime.ServerMetadata
err error
)
val, ok := pathParams["id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
}
protoReq.Id, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
}
msg, err := client.DeleteUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Peach_DeleteUser_0(ctx context.Context, marshaler runtime.Marshaler, server PeachServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq DeleteUserRequest
metadata runtime.ServerMetadata
err error
)
val, ok := pathParams["id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
}
protoReq.Id, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
}
msg, err := server.DeleteUser(ctx, &protoReq)
return msg, metadata, err
}
func request_Peach_CreateProduct_0(ctx context.Context, marshaler runtime.Marshaler, client PeachClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq CreateProductRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.CreateProduct(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Peach_CreateProduct_0(ctx context.Context, marshaler runtime.Marshaler, server PeachServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq CreateProductRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.CreateProduct(ctx, &protoReq)
return msg, metadata, err
}
func request_Peach_ReadProduct_0(ctx context.Context, marshaler runtime.Marshaler, client PeachClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ReadProductRequest
metadata runtime.ServerMetadata
err error
)
val, ok := pathParams["id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
}
protoReq.Id, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
}
msg, err := client.ReadProduct(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Peach_ReadProduct_0(ctx context.Context, marshaler runtime.Marshaler, server PeachServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ReadProductRequest
metadata runtime.ServerMetadata
err error
)
val, ok := pathParams["id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
}
protoReq.Id, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
}
msg, err := server.ReadProduct(ctx, &protoReq)
return msg, metadata, err
}
func request_Peach_ListProducts_0(ctx context.Context, marshaler runtime.Marshaler, client PeachClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ListProductsRequest
metadata runtime.ServerMetadata
)
msg, err := client.ListProducts(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Peach_ListProducts_0(ctx context.Context, marshaler runtime.Marshaler, server PeachServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ListProductsRequest
metadata runtime.ServerMetadata
)
msg, err := server.ListProducts(ctx, &protoReq)
return msg, metadata, err
}
func request_Peach_UpdateProduct_0(ctx context.Context, marshaler runtime.Marshaler, client PeachClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq UpdateProductRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.UpdateProduct(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Peach_UpdateProduct_0(ctx context.Context, marshaler runtime.Marshaler, server PeachServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq UpdateProductRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.UpdateProduct(ctx, &protoReq)
return msg, metadata, err
}
func request_Peach_DeleteProduct_0(ctx context.Context, marshaler runtime.Marshaler, client PeachClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq DeleteProductRequest
metadata runtime.ServerMetadata
err error
)
val, ok := pathParams["id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
}
protoReq.Id, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
}
msg, err := client.DeleteProduct(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Peach_DeleteProduct_0(ctx context.Context, marshaler runtime.Marshaler, server PeachServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq DeleteProductRequest
metadata runtime.ServerMetadata
err error
)
val, ok := pathParams["id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
}
protoReq.Id, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
}
msg, err := server.DeleteProduct(ctx, &protoReq)
return msg, metadata, err
}
// RegisterPeachHandlerServer registers the http handlers for service Peach to "mux".
// UnaryRPC :call PeachServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterPeachHandlerFromEndpoint instead.
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterPeachHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PeachServer) error {
mux.Handle(http.MethodPost, pattern_Peach_CreateUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/peach.Peach/CreateUser", runtime.WithHTTPPathPattern("/v1/users"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Peach_CreateUser_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Peach_CreateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodGet, pattern_Peach_ReadUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/peach.Peach/ReadUser", runtime.WithHTTPPathPattern("/v1/users/{id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Peach_ReadUser_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Peach_ReadUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodGet, pattern_Peach_ListUsers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/peach.Peach/ListUsers", runtime.WithHTTPPathPattern("/v1/users"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Peach_ListUsers_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Peach_ListUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPut, pattern_Peach_UpdateUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/peach.Peach/UpdateUser", runtime.WithHTTPPathPattern("/v1/users"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Peach_UpdateUser_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Peach_UpdateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodDelete, pattern_Peach_DeleteUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/peach.Peach/DeleteUser", runtime.WithHTTPPathPattern("/v1/users/{id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Peach_DeleteUser_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Peach_DeleteUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Peach_CreateProduct_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/peach.Peach/CreateProduct", runtime.WithHTTPPathPattern("/v1/Product"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Peach_CreateProduct_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Peach_CreateProduct_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodGet, pattern_Peach_ReadProduct_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/peach.Peach/ReadProduct", runtime.WithHTTPPathPattern("/v1/Product/{id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Peach_ReadProduct_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Peach_ReadProduct_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodGet, pattern_Peach_ListProducts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/peach.Peach/ListProducts", runtime.WithHTTPPathPattern("/v1/Product"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Peach_ListProducts_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Peach_ListProducts_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPut, pattern_Peach_UpdateProduct_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/peach.Peach/UpdateProduct", runtime.WithHTTPPathPattern("/v1/Product"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Peach_UpdateProduct_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Peach_UpdateProduct_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodDelete, pattern_Peach_DeleteProduct_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/peach.Peach/DeleteProduct", runtime.WithHTTPPathPattern("/v1/Product/{id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Peach_DeleteProduct_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Peach_DeleteProduct_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterPeachHandlerFromEndpoint is same as RegisterPeachHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterPeachHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.NewClient(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterPeachHandler(ctx, mux, conn)
}
// RegisterPeachHandler registers the http handlers for service Peach to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterPeachHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterPeachHandlerClient(ctx, mux, NewPeachClient(conn))
}
// RegisterPeachHandlerClient registers the http handlers for service Peach
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "PeachClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "PeachClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "PeachClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterPeachHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PeachClient) error {
mux.Handle(http.MethodPost, pattern_Peach_CreateUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/peach.Peach/CreateUser", runtime.WithHTTPPathPattern("/v1/users"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Peach_CreateUser_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Peach_CreateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodGet, pattern_Peach_ReadUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/peach.Peach/ReadUser", runtime.WithHTTPPathPattern("/v1/users/{id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Peach_ReadUser_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Peach_ReadUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodGet, pattern_Peach_ListUsers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/peach.Peach/ListUsers", runtime.WithHTTPPathPattern("/v1/users"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Peach_ListUsers_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Peach_ListUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPut, pattern_Peach_UpdateUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/peach.Peach/UpdateUser", runtime.WithHTTPPathPattern("/v1/users"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Peach_UpdateUser_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Peach_UpdateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodDelete, pattern_Peach_DeleteUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/peach.Peach/DeleteUser", runtime.WithHTTPPathPattern("/v1/users/{id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Peach_DeleteUser_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Peach_DeleteUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Peach_CreateProduct_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/peach.Peach/CreateProduct", runtime.WithHTTPPathPattern("/v1/Product"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Peach_CreateProduct_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Peach_CreateProduct_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodGet, pattern_Peach_ReadProduct_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/peach.Peach/ReadProduct", runtime.WithHTTPPathPattern("/v1/Product/{id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Peach_ReadProduct_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Peach_ReadProduct_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodGet, pattern_Peach_ListProducts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/peach.Peach/ListProducts", runtime.WithHTTPPathPattern("/v1/Product"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Peach_ListProducts_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Peach_ListProducts_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPut, pattern_Peach_UpdateProduct_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/peach.Peach/UpdateProduct", runtime.WithHTTPPathPattern("/v1/Product"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Peach_UpdateProduct_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Peach_UpdateProduct_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodDelete, pattern_Peach_DeleteProduct_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/peach.Peach/DeleteProduct", runtime.WithHTTPPathPattern("/v1/Product/{id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Peach_DeleteProduct_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Peach_DeleteProduct_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Peach_CreateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "users"}, ""))
pattern_Peach_ReadUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "users", "id"}, ""))
pattern_Peach_ListUsers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "users"}, ""))
pattern_Peach_UpdateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "users"}, ""))
pattern_Peach_DeleteUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "users", "id"}, ""))
pattern_Peach_CreateProduct_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "Product"}, ""))
pattern_Peach_ReadProduct_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "Product", "id"}, ""))
pattern_Peach_ListProducts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "Product"}, ""))
pattern_Peach_UpdateProduct_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "Product"}, ""))
pattern_Peach_DeleteProduct_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "Product", "id"}, ""))
)
var (
forward_Peach_CreateUser_0 = runtime.ForwardResponseMessage
forward_Peach_ReadUser_0 = runtime.ForwardResponseMessage
forward_Peach_ListUsers_0 = runtime.ForwardResponseMessage
forward_Peach_UpdateUser_0 = runtime.ForwardResponseMessage
forward_Peach_DeleteUser_0 = runtime.ForwardResponseMessage
forward_Peach_CreateProduct_0 = runtime.ForwardResponseMessage
forward_Peach_ReadProduct_0 = runtime.ForwardResponseMessage
forward_Peach_ListProducts_0 = runtime.ForwardResponseMessage
forward_Peach_UpdateProduct_0 = runtime.ForwardResponseMessage
forward_Peach_DeleteProduct_0 = runtime.ForwardResponseMessage
)

View File

@ -0,0 +1,46 @@
package pb
import (
"context"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
var publicMethodMaps = map[string]bool{
// each method that is public will be added here
}
func NewSpartanAuthClient() {
}
// Implements UnaryServerInterceptor for authentication
func SpartanAuthPeachUnaryServerInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error) {
// we will have a function that checks the token and a switch statement that checks if the method is public or not
if ok := publicMethodMaps[info.FullMethod]; ok {
return handler(ctx, req)
}
// check the token
// if the token is valid, return handler(ctx, req)
// if the token is missing or invalid, return an unauthenticated error
if token, ok := ctx.Value("token").(string); ok {
if ok, err := IntrospectToken(ctx, token); ok {
return handler(ctx, req)
} else {
if err != nil {
return nil, status.Errorf(codes.Internal, "error introspecting token: %v", err)
}
return nil, status.Errorf(codes.Unauthenticated, "invalid token")
}
}
return nil, status.Errorf(codes.Unauthenticated, "missing or invalid token")
}
func IntrospectToken(ctx context.Context, token string) (bool, error) {
// this function will call the introspection endpoint with the token and return the result
return false, nil
}

461
gen/go/service_grpc.pb.go Normal file
View File

@ -0,0 +1,461 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v3.19.0
// source: proto/service.proto
package pb
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Peach_CreateUser_FullMethodName = "/peach.Peach/CreateUser"
Peach_ReadUser_FullMethodName = "/peach.Peach/ReadUser"
Peach_ListUsers_FullMethodName = "/peach.Peach/ListUsers"
Peach_UpdateUser_FullMethodName = "/peach.Peach/UpdateUser"
Peach_DeleteUser_FullMethodName = "/peach.Peach/DeleteUser"
Peach_CreateProduct_FullMethodName = "/peach.Peach/CreateProduct"
Peach_ReadProduct_FullMethodName = "/peach.Peach/ReadProduct"
Peach_ListProducts_FullMethodName = "/peach.Peach/ListProducts"
Peach_UpdateProduct_FullMethodName = "/peach.Peach/UpdateProduct"
Peach_DeleteProduct_FullMethodName = "/peach.Peach/DeleteProduct"
)
// PeachClient is the client API for Peach service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type PeachClient interface {
CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error)
ReadUser(ctx context.Context, in *ReadUserRequest, opts ...grpc.CallOption) (*ReadUserResponse, error)
ListUsers(ctx context.Context, in *ListUsersRequest, opts ...grpc.CallOption) (*ListUsersResponse, error)
UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*UpdateUserResponse, error)
DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*DeleteUserResponse, error)
CreateProduct(ctx context.Context, in *CreateProductRequest, opts ...grpc.CallOption) (*CreateProductResponse, error)
ReadProduct(ctx context.Context, in *ReadProductRequest, opts ...grpc.CallOption) (*ReadProductResponse, error)
ListProducts(ctx context.Context, in *ListProductsRequest, opts ...grpc.CallOption) (*ListProductsResponse, error)
UpdateProduct(ctx context.Context, in *UpdateProductRequest, opts ...grpc.CallOption) (*UpdateProductResponse, error)
DeleteProduct(ctx context.Context, in *DeleteProductRequest, opts ...grpc.CallOption) (*DeleteProductResponse, error)
}
type peachClient struct {
cc grpc.ClientConnInterface
}
func NewPeachClient(cc grpc.ClientConnInterface) PeachClient {
return &peachClient{cc}
}
func (c *peachClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CreateUserResponse)
err := c.cc.Invoke(ctx, Peach_CreateUser_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *peachClient) ReadUser(ctx context.Context, in *ReadUserRequest, opts ...grpc.CallOption) (*ReadUserResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ReadUserResponse)
err := c.cc.Invoke(ctx, Peach_ReadUser_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *peachClient) ListUsers(ctx context.Context, in *ListUsersRequest, opts ...grpc.CallOption) (*ListUsersResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListUsersResponse)
err := c.cc.Invoke(ctx, Peach_ListUsers_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *peachClient) UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*UpdateUserResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UpdateUserResponse)
err := c.cc.Invoke(ctx, Peach_UpdateUser_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *peachClient) DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*DeleteUserResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DeleteUserResponse)
err := c.cc.Invoke(ctx, Peach_DeleteUser_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *peachClient) CreateProduct(ctx context.Context, in *CreateProductRequest, opts ...grpc.CallOption) (*CreateProductResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CreateProductResponse)
err := c.cc.Invoke(ctx, Peach_CreateProduct_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *peachClient) ReadProduct(ctx context.Context, in *ReadProductRequest, opts ...grpc.CallOption) (*ReadProductResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ReadProductResponse)
err := c.cc.Invoke(ctx, Peach_ReadProduct_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *peachClient) ListProducts(ctx context.Context, in *ListProductsRequest, opts ...grpc.CallOption) (*ListProductsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListProductsResponse)
err := c.cc.Invoke(ctx, Peach_ListProducts_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *peachClient) UpdateProduct(ctx context.Context, in *UpdateProductRequest, opts ...grpc.CallOption) (*UpdateProductResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UpdateProductResponse)
err := c.cc.Invoke(ctx, Peach_UpdateProduct_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *peachClient) DeleteProduct(ctx context.Context, in *DeleteProductRequest, opts ...grpc.CallOption) (*DeleteProductResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DeleteProductResponse)
err := c.cc.Invoke(ctx, Peach_DeleteProduct_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// PeachServer is the server API for Peach service.
// All implementations should embed UnimplementedPeachServer
// for forward compatibility.
type PeachServer interface {
CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error)
ReadUser(context.Context, *ReadUserRequest) (*ReadUserResponse, error)
ListUsers(context.Context, *ListUsersRequest) (*ListUsersResponse, error)
UpdateUser(context.Context, *UpdateUserRequest) (*UpdateUserResponse, error)
DeleteUser(context.Context, *DeleteUserRequest) (*DeleteUserResponse, error)
CreateProduct(context.Context, *CreateProductRequest) (*CreateProductResponse, error)
ReadProduct(context.Context, *ReadProductRequest) (*ReadProductResponse, error)
ListProducts(context.Context, *ListProductsRequest) (*ListProductsResponse, error)
UpdateProduct(context.Context, *UpdateProductRequest) (*UpdateProductResponse, error)
DeleteProduct(context.Context, *DeleteProductRequest) (*DeleteProductResponse, error)
}
// UnimplementedPeachServer should be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedPeachServer struct{}
func (UnimplementedPeachServer) CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateUser not implemented")
}
func (UnimplementedPeachServer) ReadUser(context.Context, *ReadUserRequest) (*ReadUserResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ReadUser not implemented")
}
func (UnimplementedPeachServer) ListUsers(context.Context, *ListUsersRequest) (*ListUsersResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListUsers not implemented")
}
func (UnimplementedPeachServer) UpdateUser(context.Context, *UpdateUserRequest) (*UpdateUserResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateUser not implemented")
}
func (UnimplementedPeachServer) DeleteUser(context.Context, *DeleteUserRequest) (*DeleteUserResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteUser not implemented")
}
func (UnimplementedPeachServer) CreateProduct(context.Context, *CreateProductRequest) (*CreateProductResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateProduct not implemented")
}
func (UnimplementedPeachServer) ReadProduct(context.Context, *ReadProductRequest) (*ReadProductResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ReadProduct not implemented")
}
func (UnimplementedPeachServer) ListProducts(context.Context, *ListProductsRequest) (*ListProductsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListProducts not implemented")
}
func (UnimplementedPeachServer) UpdateProduct(context.Context, *UpdateProductRequest) (*UpdateProductResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateProduct not implemented")
}
func (UnimplementedPeachServer) DeleteProduct(context.Context, *DeleteProductRequest) (*DeleteProductResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteProduct not implemented")
}
func (UnimplementedPeachServer) testEmbeddedByValue() {}
// UnsafePeachServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PeachServer will
// result in compilation errors.
type UnsafePeachServer interface {
mustEmbedUnimplementedPeachServer()
}
func RegisterPeachServer(s grpc.ServiceRegistrar, srv PeachServer) {
// If the following call pancis, it indicates UnimplementedPeachServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Peach_ServiceDesc, srv)
}
func _Peach_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateUserRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PeachServer).CreateUser(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Peach_CreateUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PeachServer).CreateUser(ctx, req.(*CreateUserRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Peach_ReadUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReadUserRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PeachServer).ReadUser(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Peach_ReadUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PeachServer).ReadUser(ctx, req.(*ReadUserRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Peach_ListUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListUsersRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PeachServer).ListUsers(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Peach_ListUsers_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PeachServer).ListUsers(ctx, req.(*ListUsersRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Peach_UpdateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateUserRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PeachServer).UpdateUser(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Peach_UpdateUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PeachServer).UpdateUser(ctx, req.(*UpdateUserRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Peach_DeleteUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteUserRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PeachServer).DeleteUser(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Peach_DeleteUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PeachServer).DeleteUser(ctx, req.(*DeleteUserRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Peach_CreateProduct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateProductRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PeachServer).CreateProduct(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Peach_CreateProduct_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PeachServer).CreateProduct(ctx, req.(*CreateProductRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Peach_ReadProduct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReadProductRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PeachServer).ReadProduct(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Peach_ReadProduct_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PeachServer).ReadProduct(ctx, req.(*ReadProductRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Peach_ListProducts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListProductsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PeachServer).ListProducts(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Peach_ListProducts_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PeachServer).ListProducts(ctx, req.(*ListProductsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Peach_UpdateProduct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateProductRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PeachServer).UpdateProduct(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Peach_UpdateProduct_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PeachServer).UpdateProduct(ctx, req.(*UpdateProductRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Peach_DeleteProduct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteProductRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PeachServer).DeleteProduct(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Peach_DeleteProduct_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PeachServer).DeleteProduct(ctx, req.(*DeleteProductRequest))
}
return interceptor(ctx, in, info, handler)
}
// Peach_ServiceDesc is the grpc.ServiceDesc for Peach service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Peach_ServiceDesc = grpc.ServiceDesc{
ServiceName: "peach.Peach",
HandlerType: (*PeachServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "CreateUser",
Handler: _Peach_CreateUser_Handler,
},
{
MethodName: "ReadUser",
Handler: _Peach_ReadUser_Handler,
},
{
MethodName: "ListUsers",
Handler: _Peach_ListUsers_Handler,
},
{
MethodName: "UpdateUser",
Handler: _Peach_UpdateUser_Handler,
},
{
MethodName: "DeleteUser",
Handler: _Peach_DeleteUser_Handler,
},
{
MethodName: "CreateProduct",
Handler: _Peach_CreateProduct_Handler,
},
{
MethodName: "ReadProduct",
Handler: _Peach_ReadProduct_Handler,
},
{
MethodName: "ListProducts",
Handler: _Peach_ListProducts_Handler,
},
{
MethodName: "UpdateProduct",
Handler: _Peach_UpdateProduct_Handler,
},
{
MethodName: "DeleteProduct",
Handler: _Peach_DeleteProduct_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "proto/service.proto",
}

View File

@ -0,0 +1,192 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.CreateProductRequest');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.peach.Product');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.CreateProductRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.peach.CreateProductRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.CreateProductRequest.displayName = 'proto.peach.CreateProductRequest';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.CreateProductRequest.prototype.toObject = function(opt_includeInstance) {
return proto.peach.CreateProductRequest.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.CreateProductRequest} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.CreateProductRequest.toObject = function(includeInstance, msg) {
var f, obj = {
payload: (f = msg.getPayload()) && proto.peach.Product.toObject(includeInstance, f)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.CreateProductRequest}
*/
proto.peach.CreateProductRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.CreateProductRequest;
return proto.peach.CreateProductRequest.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.CreateProductRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.CreateProductRequest}
*/
proto.peach.CreateProductRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.peach.Product;
reader.readMessage(value,proto.peach.Product.deserializeBinaryFromReader);
msg.setPayload(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.CreateProductRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.CreateProductRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.CreateProductRequest} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.CreateProductRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getPayload();
if (f != null) {
writer.writeMessage(
1,
f,
proto.peach.Product.serializeBinaryToWriter
);
}
};
/**
* optional Product payload = 1;
* @return {?proto.peach.Product}
*/
proto.peach.CreateProductRequest.prototype.getPayload = function() {
return /** @type{?proto.peach.Product} */ (
jspb.Message.getWrapperField(this, proto.peach.Product, 1));
};
/**
* @param {?proto.peach.Product|undefined} value
* @return {!proto.peach.CreateProductRequest} returns this
*/
proto.peach.CreateProductRequest.prototype.setPayload = function(value) {
return jspb.Message.setWrapperField(this, 1, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.peach.CreateProductRequest} returns this
*/
proto.peach.CreateProductRequest.prototype.clearPayload = function() {
return this.setPayload(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.peach.CreateProductRequest.prototype.hasPayload = function() {
return jspb.Message.getField(this, 1) != null;
};

View File

@ -0,0 +1,192 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.CreateProductResponse');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.peach.Product');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.CreateProductResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.peach.CreateProductResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.CreateProductResponse.displayName = 'proto.peach.CreateProductResponse';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.CreateProductResponse.prototype.toObject = function(opt_includeInstance) {
return proto.peach.CreateProductResponse.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.CreateProductResponse} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.CreateProductResponse.toObject = function(includeInstance, msg) {
var f, obj = {
result: (f = msg.getResult()) && proto.peach.Product.toObject(includeInstance, f)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.CreateProductResponse}
*/
proto.peach.CreateProductResponse.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.CreateProductResponse;
return proto.peach.CreateProductResponse.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.CreateProductResponse} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.CreateProductResponse}
*/
proto.peach.CreateProductResponse.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.peach.Product;
reader.readMessage(value,proto.peach.Product.deserializeBinaryFromReader);
msg.setResult(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.CreateProductResponse.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.CreateProductResponse.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.CreateProductResponse} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.CreateProductResponse.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getResult();
if (f != null) {
writer.writeMessage(
1,
f,
proto.peach.Product.serializeBinaryToWriter
);
}
};
/**
* optional Product result = 1;
* @return {?proto.peach.Product}
*/
proto.peach.CreateProductResponse.prototype.getResult = function() {
return /** @type{?proto.peach.Product} */ (
jspb.Message.getWrapperField(this, proto.peach.Product, 1));
};
/**
* @param {?proto.peach.Product|undefined} value
* @return {!proto.peach.CreateProductResponse} returns this
*/
proto.peach.CreateProductResponse.prototype.setResult = function(value) {
return jspb.Message.setWrapperField(this, 1, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.peach.CreateProductResponse} returns this
*/
proto.peach.CreateProductResponse.prototype.clearResult = function() {
return this.setResult(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.peach.CreateProductResponse.prototype.hasResult = function() {
return jspb.Message.getField(this, 1) != null;
};

192
gen/js/createuserrequest.js Normal file
View File

@ -0,0 +1,192 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.CreateUserRequest');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.peach.User');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.CreateUserRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.peach.CreateUserRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.CreateUserRequest.displayName = 'proto.peach.CreateUserRequest';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.CreateUserRequest.prototype.toObject = function(opt_includeInstance) {
return proto.peach.CreateUserRequest.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.CreateUserRequest} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.CreateUserRequest.toObject = function(includeInstance, msg) {
var f, obj = {
payload: (f = msg.getPayload()) && proto.peach.User.toObject(includeInstance, f)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.CreateUserRequest}
*/
proto.peach.CreateUserRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.CreateUserRequest;
return proto.peach.CreateUserRequest.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.CreateUserRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.CreateUserRequest}
*/
proto.peach.CreateUserRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.peach.User;
reader.readMessage(value,proto.peach.User.deserializeBinaryFromReader);
msg.setPayload(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.CreateUserRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.CreateUserRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.CreateUserRequest} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.CreateUserRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getPayload();
if (f != null) {
writer.writeMessage(
1,
f,
proto.peach.User.serializeBinaryToWriter
);
}
};
/**
* optional User payload = 1;
* @return {?proto.peach.User}
*/
proto.peach.CreateUserRequest.prototype.getPayload = function() {
return /** @type{?proto.peach.User} */ (
jspb.Message.getWrapperField(this, proto.peach.User, 1));
};
/**
* @param {?proto.peach.User|undefined} value
* @return {!proto.peach.CreateUserRequest} returns this
*/
proto.peach.CreateUserRequest.prototype.setPayload = function(value) {
return jspb.Message.setWrapperField(this, 1, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.peach.CreateUserRequest} returns this
*/
proto.peach.CreateUserRequest.prototype.clearPayload = function() {
return this.setPayload(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.peach.CreateUserRequest.prototype.hasPayload = function() {
return jspb.Message.getField(this, 1) != null;
};

View File

@ -0,0 +1,192 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.CreateUserResponse');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.peach.User');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.CreateUserResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.peach.CreateUserResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.CreateUserResponse.displayName = 'proto.peach.CreateUserResponse';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.CreateUserResponse.prototype.toObject = function(opt_includeInstance) {
return proto.peach.CreateUserResponse.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.CreateUserResponse} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.CreateUserResponse.toObject = function(includeInstance, msg) {
var f, obj = {
result: (f = msg.getResult()) && proto.peach.User.toObject(includeInstance, f)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.CreateUserResponse}
*/
proto.peach.CreateUserResponse.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.CreateUserResponse;
return proto.peach.CreateUserResponse.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.CreateUserResponse} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.CreateUserResponse}
*/
proto.peach.CreateUserResponse.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.peach.User;
reader.readMessage(value,proto.peach.User.deserializeBinaryFromReader);
msg.setResult(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.CreateUserResponse.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.CreateUserResponse.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.CreateUserResponse} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.CreateUserResponse.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getResult();
if (f != null) {
writer.writeMessage(
1,
f,
proto.peach.User.serializeBinaryToWriter
);
}
};
/**
* optional User result = 1;
* @return {?proto.peach.User}
*/
proto.peach.CreateUserResponse.prototype.getResult = function() {
return /** @type{?proto.peach.User} */ (
jspb.Message.getWrapperField(this, proto.peach.User, 1));
};
/**
* @param {?proto.peach.User|undefined} value
* @return {!proto.peach.CreateUserResponse} returns this
*/
proto.peach.CreateUserResponse.prototype.setResult = function(value) {
return jspb.Message.setWrapperField(this, 1, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.peach.CreateUserResponse} returns this
*/
proto.peach.CreateUserResponse.prototype.clearResult = function() {
return this.setResult(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.peach.CreateUserResponse.prototype.hasResult = function() {
return jspb.Message.getField(this, 1) != null;
};

View File

@ -0,0 +1,170 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.DeleteProductRequest');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.DeleteProductRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.peach.DeleteProductRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.DeleteProductRequest.displayName = 'proto.peach.DeleteProductRequest';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.DeleteProductRequest.prototype.toObject = function(opt_includeInstance) {
return proto.peach.DeleteProductRequest.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.DeleteProductRequest} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.DeleteProductRequest.toObject = function(includeInstance, msg) {
var f, obj = {
id: jspb.Message.getFieldWithDefault(msg, 1, 0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.DeleteProductRequest}
*/
proto.peach.DeleteProductRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.DeleteProductRequest;
return proto.peach.DeleteProductRequest.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.DeleteProductRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.DeleteProductRequest}
*/
proto.peach.DeleteProductRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readUint64());
msg.setId(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.DeleteProductRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.DeleteProductRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.DeleteProductRequest} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.DeleteProductRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getId();
if (f !== 0) {
writer.writeUint64(
1,
f
);
}
};
/**
* optional uint64 id = 1;
* @return {number}
*/
proto.peach.DeleteProductRequest.prototype.getId = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};
/**
* @param {number} value
* @return {!proto.peach.DeleteProductRequest} returns this
*/
proto.peach.DeleteProductRequest.prototype.setId = function(value) {
return jspb.Message.setProto3IntField(this, 1, value);
};

View File

@ -0,0 +1,141 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.DeleteProductResponse');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.DeleteProductResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.peach.DeleteProductResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.DeleteProductResponse.displayName = 'proto.peach.DeleteProductResponse';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.DeleteProductResponse.prototype.toObject = function(opt_includeInstance) {
return proto.peach.DeleteProductResponse.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.DeleteProductResponse} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.DeleteProductResponse.toObject = function(includeInstance, msg) {
var f, obj = {
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.DeleteProductResponse}
*/
proto.peach.DeleteProductResponse.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.DeleteProductResponse;
return proto.peach.DeleteProductResponse.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.DeleteProductResponse} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.DeleteProductResponse}
*/
proto.peach.DeleteProductResponse.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.DeleteProductResponse.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.DeleteProductResponse.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.DeleteProductResponse} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.DeleteProductResponse.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
};

170
gen/js/deleteuserrequest.js Normal file
View File

@ -0,0 +1,170 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.DeleteUserRequest');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.DeleteUserRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.peach.DeleteUserRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.DeleteUserRequest.displayName = 'proto.peach.DeleteUserRequest';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.DeleteUserRequest.prototype.toObject = function(opt_includeInstance) {
return proto.peach.DeleteUserRequest.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.DeleteUserRequest} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.DeleteUserRequest.toObject = function(includeInstance, msg) {
var f, obj = {
id: jspb.Message.getFieldWithDefault(msg, 1, 0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.DeleteUserRequest}
*/
proto.peach.DeleteUserRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.DeleteUserRequest;
return proto.peach.DeleteUserRequest.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.DeleteUserRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.DeleteUserRequest}
*/
proto.peach.DeleteUserRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readUint64());
msg.setId(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.DeleteUserRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.DeleteUserRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.DeleteUserRequest} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.DeleteUserRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getId();
if (f !== 0) {
writer.writeUint64(
1,
f
);
}
};
/**
* optional uint64 id = 1;
* @return {number}
*/
proto.peach.DeleteUserRequest.prototype.getId = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};
/**
* @param {number} value
* @return {!proto.peach.DeleteUserRequest} returns this
*/
proto.peach.DeleteUserRequest.prototype.setId = function(value) {
return jspb.Message.setProto3IntField(this, 1, value);
};

View File

@ -0,0 +1,141 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.DeleteUserResponse');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.DeleteUserResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.peach.DeleteUserResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.DeleteUserResponse.displayName = 'proto.peach.DeleteUserResponse';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.DeleteUserResponse.prototype.toObject = function(opt_includeInstance) {
return proto.peach.DeleteUserResponse.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.DeleteUserResponse} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.DeleteUserResponse.toObject = function(includeInstance, msg) {
var f, obj = {
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.DeleteUserResponse}
*/
proto.peach.DeleteUserResponse.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.DeleteUserResponse;
return proto.peach.DeleteUserResponse.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.DeleteUserResponse} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.DeleteUserResponse}
*/
proto.peach.DeleteUserResponse.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.DeleteUserResponse.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.DeleteUserResponse.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.DeleteUserResponse} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.DeleteUserResponse.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
};

View File

@ -0,0 +1,141 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.ListProductsRequest');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.ListProductsRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.peach.ListProductsRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.ListProductsRequest.displayName = 'proto.peach.ListProductsRequest';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.ListProductsRequest.prototype.toObject = function(opt_includeInstance) {
return proto.peach.ListProductsRequest.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.ListProductsRequest} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.ListProductsRequest.toObject = function(includeInstance, msg) {
var f, obj = {
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.ListProductsRequest}
*/
proto.peach.ListProductsRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.ListProductsRequest;
return proto.peach.ListProductsRequest.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.ListProductsRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.ListProductsRequest}
*/
proto.peach.ListProductsRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.ListProductsRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.ListProductsRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.ListProductsRequest} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.ListProductsRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
};

View File

@ -0,0 +1,201 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.ListProductsResponse');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.peach.Product');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.ListProductsResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.peach.ListProductsResponse.repeatedFields_, null);
};
goog.inherits(proto.peach.ListProductsResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.ListProductsResponse.displayName = 'proto.peach.ListProductsResponse';
}
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.peach.ListProductsResponse.repeatedFields_ = [1];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.ListProductsResponse.prototype.toObject = function(opt_includeInstance) {
return proto.peach.ListProductsResponse.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.ListProductsResponse} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.ListProductsResponse.toObject = function(includeInstance, msg) {
var f, obj = {
resultsList: jspb.Message.toObjectList(msg.getResultsList(),
proto.peach.Product.toObject, includeInstance)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.ListProductsResponse}
*/
proto.peach.ListProductsResponse.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.ListProductsResponse;
return proto.peach.ListProductsResponse.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.ListProductsResponse} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.ListProductsResponse}
*/
proto.peach.ListProductsResponse.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.peach.Product;
reader.readMessage(value,proto.peach.Product.deserializeBinaryFromReader);
msg.addResults(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.ListProductsResponse.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.ListProductsResponse.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.ListProductsResponse} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.ListProductsResponse.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getResultsList();
if (f.length > 0) {
writer.writeRepeatedMessage(
1,
f,
proto.peach.Product.serializeBinaryToWriter
);
}
};
/**
* repeated Product results = 1;
* @return {!Array<!proto.peach.Product>}
*/
proto.peach.ListProductsResponse.prototype.getResultsList = function() {
return /** @type{!Array<!proto.peach.Product>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.peach.Product, 1));
};
/**
* @param {!Array<!proto.peach.Product>} value
* @return {!proto.peach.ListProductsResponse} returns this
*/
proto.peach.ListProductsResponse.prototype.setResultsList = function(value) {
return jspb.Message.setRepeatedWrapperField(this, 1, value);
};
/**
* @param {!proto.peach.Product=} opt_value
* @param {number=} opt_index
* @return {!proto.peach.Product}
*/
proto.peach.ListProductsResponse.prototype.addResults = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.peach.Product, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.peach.ListProductsResponse} returns this
*/
proto.peach.ListProductsResponse.prototype.clearResultsList = function() {
return this.setResultsList([]);
};

141
gen/js/listusersrequest.js Normal file
View File

@ -0,0 +1,141 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.ListUsersRequest');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.ListUsersRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.peach.ListUsersRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.ListUsersRequest.displayName = 'proto.peach.ListUsersRequest';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.ListUsersRequest.prototype.toObject = function(opt_includeInstance) {
return proto.peach.ListUsersRequest.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.ListUsersRequest} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.ListUsersRequest.toObject = function(includeInstance, msg) {
var f, obj = {
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.ListUsersRequest}
*/
proto.peach.ListUsersRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.ListUsersRequest;
return proto.peach.ListUsersRequest.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.ListUsersRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.ListUsersRequest}
*/
proto.peach.ListUsersRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.ListUsersRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.ListUsersRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.ListUsersRequest} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.ListUsersRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
};

201
gen/js/listusersresponse.js Normal file
View File

@ -0,0 +1,201 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.ListUsersResponse');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.peach.User');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.ListUsersResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.peach.ListUsersResponse.repeatedFields_, null);
};
goog.inherits(proto.peach.ListUsersResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.ListUsersResponse.displayName = 'proto.peach.ListUsersResponse';
}
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.peach.ListUsersResponse.repeatedFields_ = [1];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.ListUsersResponse.prototype.toObject = function(opt_includeInstance) {
return proto.peach.ListUsersResponse.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.ListUsersResponse} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.ListUsersResponse.toObject = function(includeInstance, msg) {
var f, obj = {
resultsList: jspb.Message.toObjectList(msg.getResultsList(),
proto.peach.User.toObject, includeInstance)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.ListUsersResponse}
*/
proto.peach.ListUsersResponse.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.ListUsersResponse;
return proto.peach.ListUsersResponse.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.ListUsersResponse} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.ListUsersResponse}
*/
proto.peach.ListUsersResponse.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.peach.User;
reader.readMessage(value,proto.peach.User.deserializeBinaryFromReader);
msg.addResults(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.ListUsersResponse.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.ListUsersResponse.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.ListUsersResponse} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.ListUsersResponse.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getResultsList();
if (f.length > 0) {
writer.writeRepeatedMessage(
1,
f,
proto.peach.User.serializeBinaryToWriter
);
}
};
/**
* repeated User results = 1;
* @return {!Array<!proto.peach.User>}
*/
proto.peach.ListUsersResponse.prototype.getResultsList = function() {
return /** @type{!Array<!proto.peach.User>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.peach.User, 1));
};
/**
* @param {!Array<!proto.peach.User>} value
* @return {!proto.peach.ListUsersResponse} returns this
*/
proto.peach.ListUsersResponse.prototype.setResultsList = function(value) {
return jspb.Message.setRepeatedWrapperField(this, 1, value);
};
/**
* @param {!proto.peach.User=} opt_value
* @param {number=} opt_index
* @return {!proto.peach.User}
*/
proto.peach.ListUsersResponse.prototype.addResults = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.peach.User, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.peach.ListUsersResponse} returns this
*/
proto.peach.ListUsersResponse.prototype.clearResultsList = function() {
return this.setResultsList([]);
};

170
gen/js/product.js Normal file
View File

@ -0,0 +1,170 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.Product');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.Product = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.peach.Product, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.Product.displayName = 'proto.peach.Product';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.Product.prototype.toObject = function(opt_includeInstance) {
return proto.peach.Product.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.Product} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.Product.toObject = function(includeInstance, msg) {
var f, obj = {
id: jspb.Message.getFieldWithDefault(msg, 1, 0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.Product}
*/
proto.peach.Product.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.Product;
return proto.peach.Product.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.Product} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.Product}
*/
proto.peach.Product.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readUint64());
msg.setId(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.Product.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.Product.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.Product} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.Product.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getId();
if (f !== 0) {
writer.writeUint64(
1,
f
);
}
};
/**
* optional uint64 id = 1;
* @return {number}
*/
proto.peach.Product.prototype.getId = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};
/**
* @param {number} value
* @return {!proto.peach.Product} returns this
*/
proto.peach.Product.prototype.setId = function(value) {
return jspb.Message.setProto3IntField(this, 1, value);
};

View File

@ -0,0 +1,170 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.ReadProductRequest');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.ReadProductRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.peach.ReadProductRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.ReadProductRequest.displayName = 'proto.peach.ReadProductRequest';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.ReadProductRequest.prototype.toObject = function(opt_includeInstance) {
return proto.peach.ReadProductRequest.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.ReadProductRequest} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.ReadProductRequest.toObject = function(includeInstance, msg) {
var f, obj = {
id: jspb.Message.getFieldWithDefault(msg, 1, 0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.ReadProductRequest}
*/
proto.peach.ReadProductRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.ReadProductRequest;
return proto.peach.ReadProductRequest.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.ReadProductRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.ReadProductRequest}
*/
proto.peach.ReadProductRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readUint64());
msg.setId(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.ReadProductRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.ReadProductRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.ReadProductRequest} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.ReadProductRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getId();
if (f !== 0) {
writer.writeUint64(
1,
f
);
}
};
/**
* optional uint64 id = 1;
* @return {number}
*/
proto.peach.ReadProductRequest.prototype.getId = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};
/**
* @param {number} value
* @return {!proto.peach.ReadProductRequest} returns this
*/
proto.peach.ReadProductRequest.prototype.setId = function(value) {
return jspb.Message.setProto3IntField(this, 1, value);
};

View File

@ -0,0 +1,192 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.ReadProductResponse');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.peach.Product');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.ReadProductResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.peach.ReadProductResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.ReadProductResponse.displayName = 'proto.peach.ReadProductResponse';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.ReadProductResponse.prototype.toObject = function(opt_includeInstance) {
return proto.peach.ReadProductResponse.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.ReadProductResponse} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.ReadProductResponse.toObject = function(includeInstance, msg) {
var f, obj = {
result: (f = msg.getResult()) && proto.peach.Product.toObject(includeInstance, f)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.ReadProductResponse}
*/
proto.peach.ReadProductResponse.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.ReadProductResponse;
return proto.peach.ReadProductResponse.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.ReadProductResponse} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.ReadProductResponse}
*/
proto.peach.ReadProductResponse.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.peach.Product;
reader.readMessage(value,proto.peach.Product.deserializeBinaryFromReader);
msg.setResult(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.ReadProductResponse.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.ReadProductResponse.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.ReadProductResponse} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.ReadProductResponse.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getResult();
if (f != null) {
writer.writeMessage(
1,
f,
proto.peach.Product.serializeBinaryToWriter
);
}
};
/**
* optional Product result = 1;
* @return {?proto.peach.Product}
*/
proto.peach.ReadProductResponse.prototype.getResult = function() {
return /** @type{?proto.peach.Product} */ (
jspb.Message.getWrapperField(this, proto.peach.Product, 1));
};
/**
* @param {?proto.peach.Product|undefined} value
* @return {!proto.peach.ReadProductResponse} returns this
*/
proto.peach.ReadProductResponse.prototype.setResult = function(value) {
return jspb.Message.setWrapperField(this, 1, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.peach.ReadProductResponse} returns this
*/
proto.peach.ReadProductResponse.prototype.clearResult = function() {
return this.setResult(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.peach.ReadProductResponse.prototype.hasResult = function() {
return jspb.Message.getField(this, 1) != null;
};

170
gen/js/readuserrequest.js Normal file
View File

@ -0,0 +1,170 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.ReadUserRequest');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.ReadUserRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.peach.ReadUserRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.ReadUserRequest.displayName = 'proto.peach.ReadUserRequest';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.ReadUserRequest.prototype.toObject = function(opt_includeInstance) {
return proto.peach.ReadUserRequest.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.ReadUserRequest} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.ReadUserRequest.toObject = function(includeInstance, msg) {
var f, obj = {
id: jspb.Message.getFieldWithDefault(msg, 1, 0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.ReadUserRequest}
*/
proto.peach.ReadUserRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.ReadUserRequest;
return proto.peach.ReadUserRequest.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.ReadUserRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.ReadUserRequest}
*/
proto.peach.ReadUserRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readUint64());
msg.setId(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.ReadUserRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.ReadUserRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.ReadUserRequest} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.ReadUserRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getId();
if (f !== 0) {
writer.writeUint64(
1,
f
);
}
};
/**
* optional uint64 id = 1;
* @return {number}
*/
proto.peach.ReadUserRequest.prototype.getId = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};
/**
* @param {number} value
* @return {!proto.peach.ReadUserRequest} returns this
*/
proto.peach.ReadUserRequest.prototype.setId = function(value) {
return jspb.Message.setProto3IntField(this, 1, value);
};

192
gen/js/readuserresponse.js Normal file
View File

@ -0,0 +1,192 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.ReadUserResponse');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.peach.User');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.ReadUserResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.peach.ReadUserResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.ReadUserResponse.displayName = 'proto.peach.ReadUserResponse';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.ReadUserResponse.prototype.toObject = function(opt_includeInstance) {
return proto.peach.ReadUserResponse.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.ReadUserResponse} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.ReadUserResponse.toObject = function(includeInstance, msg) {
var f, obj = {
result: (f = msg.getResult()) && proto.peach.User.toObject(includeInstance, f)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.ReadUserResponse}
*/
proto.peach.ReadUserResponse.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.ReadUserResponse;
return proto.peach.ReadUserResponse.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.ReadUserResponse} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.ReadUserResponse}
*/
proto.peach.ReadUserResponse.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.peach.User;
reader.readMessage(value,proto.peach.User.deserializeBinaryFromReader);
msg.setResult(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.ReadUserResponse.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.ReadUserResponse.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.ReadUserResponse} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.ReadUserResponse.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getResult();
if (f != null) {
writer.writeMessage(
1,
f,
proto.peach.User.serializeBinaryToWriter
);
}
};
/**
* optional User result = 1;
* @return {?proto.peach.User}
*/
proto.peach.ReadUserResponse.prototype.getResult = function() {
return /** @type{?proto.peach.User} */ (
jspb.Message.getWrapperField(this, proto.peach.User, 1));
};
/**
* @param {?proto.peach.User|undefined} value
* @return {!proto.peach.ReadUserResponse} returns this
*/
proto.peach.ReadUserResponse.prototype.setResult = function(value) {
return jspb.Message.setWrapperField(this, 1, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.peach.ReadUserResponse} returns this
*/
proto.peach.ReadUserResponse.prototype.clearResult = function() {
return this.setResult(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.peach.ReadUserResponse.prototype.hasResult = function() {
return jspb.Message.getField(this, 1) != null;
};

View File

@ -0,0 +1,192 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.UpdateProductRequest');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.peach.Product');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.UpdateProductRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.peach.UpdateProductRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.UpdateProductRequest.displayName = 'proto.peach.UpdateProductRequest';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.UpdateProductRequest.prototype.toObject = function(opt_includeInstance) {
return proto.peach.UpdateProductRequest.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.UpdateProductRequest} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.UpdateProductRequest.toObject = function(includeInstance, msg) {
var f, obj = {
payload: (f = msg.getPayload()) && proto.peach.Product.toObject(includeInstance, f)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.UpdateProductRequest}
*/
proto.peach.UpdateProductRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.UpdateProductRequest;
return proto.peach.UpdateProductRequest.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.UpdateProductRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.UpdateProductRequest}
*/
proto.peach.UpdateProductRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.peach.Product;
reader.readMessage(value,proto.peach.Product.deserializeBinaryFromReader);
msg.setPayload(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.UpdateProductRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.UpdateProductRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.UpdateProductRequest} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.UpdateProductRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getPayload();
if (f != null) {
writer.writeMessage(
1,
f,
proto.peach.Product.serializeBinaryToWriter
);
}
};
/**
* optional Product payload = 1;
* @return {?proto.peach.Product}
*/
proto.peach.UpdateProductRequest.prototype.getPayload = function() {
return /** @type{?proto.peach.Product} */ (
jspb.Message.getWrapperField(this, proto.peach.Product, 1));
};
/**
* @param {?proto.peach.Product|undefined} value
* @return {!proto.peach.UpdateProductRequest} returns this
*/
proto.peach.UpdateProductRequest.prototype.setPayload = function(value) {
return jspb.Message.setWrapperField(this, 1, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.peach.UpdateProductRequest} returns this
*/
proto.peach.UpdateProductRequest.prototype.clearPayload = function() {
return this.setPayload(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.peach.UpdateProductRequest.prototype.hasPayload = function() {
return jspb.Message.getField(this, 1) != null;
};

View File

@ -0,0 +1,192 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.UpdateProductResponse');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.peach.Product');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.UpdateProductResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.peach.UpdateProductResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.UpdateProductResponse.displayName = 'proto.peach.UpdateProductResponse';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.UpdateProductResponse.prototype.toObject = function(opt_includeInstance) {
return proto.peach.UpdateProductResponse.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.UpdateProductResponse} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.UpdateProductResponse.toObject = function(includeInstance, msg) {
var f, obj = {
result: (f = msg.getResult()) && proto.peach.Product.toObject(includeInstance, f)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.UpdateProductResponse}
*/
proto.peach.UpdateProductResponse.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.UpdateProductResponse;
return proto.peach.UpdateProductResponse.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.UpdateProductResponse} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.UpdateProductResponse}
*/
proto.peach.UpdateProductResponse.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.peach.Product;
reader.readMessage(value,proto.peach.Product.deserializeBinaryFromReader);
msg.setResult(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.UpdateProductResponse.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.UpdateProductResponse.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.UpdateProductResponse} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.UpdateProductResponse.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getResult();
if (f != null) {
writer.writeMessage(
1,
f,
proto.peach.Product.serializeBinaryToWriter
);
}
};
/**
* optional Product result = 1;
* @return {?proto.peach.Product}
*/
proto.peach.UpdateProductResponse.prototype.getResult = function() {
return /** @type{?proto.peach.Product} */ (
jspb.Message.getWrapperField(this, proto.peach.Product, 1));
};
/**
* @param {?proto.peach.Product|undefined} value
* @return {!proto.peach.UpdateProductResponse} returns this
*/
proto.peach.UpdateProductResponse.prototype.setResult = function(value) {
return jspb.Message.setWrapperField(this, 1, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.peach.UpdateProductResponse} returns this
*/
proto.peach.UpdateProductResponse.prototype.clearResult = function() {
return this.setResult(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.peach.UpdateProductResponse.prototype.hasResult = function() {
return jspb.Message.getField(this, 1) != null;
};

192
gen/js/updateuserrequest.js Normal file
View File

@ -0,0 +1,192 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.UpdateUserRequest');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.peach.User');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.UpdateUserRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.peach.UpdateUserRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.UpdateUserRequest.displayName = 'proto.peach.UpdateUserRequest';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.UpdateUserRequest.prototype.toObject = function(opt_includeInstance) {
return proto.peach.UpdateUserRequest.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.UpdateUserRequest} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.UpdateUserRequest.toObject = function(includeInstance, msg) {
var f, obj = {
payload: (f = msg.getPayload()) && proto.peach.User.toObject(includeInstance, f)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.UpdateUserRequest}
*/
proto.peach.UpdateUserRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.UpdateUserRequest;
return proto.peach.UpdateUserRequest.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.UpdateUserRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.UpdateUserRequest}
*/
proto.peach.UpdateUserRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.peach.User;
reader.readMessage(value,proto.peach.User.deserializeBinaryFromReader);
msg.setPayload(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.UpdateUserRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.UpdateUserRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.UpdateUserRequest} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.UpdateUserRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getPayload();
if (f != null) {
writer.writeMessage(
1,
f,
proto.peach.User.serializeBinaryToWriter
);
}
};
/**
* optional User payload = 1;
* @return {?proto.peach.User}
*/
proto.peach.UpdateUserRequest.prototype.getPayload = function() {
return /** @type{?proto.peach.User} */ (
jspb.Message.getWrapperField(this, proto.peach.User, 1));
};
/**
* @param {?proto.peach.User|undefined} value
* @return {!proto.peach.UpdateUserRequest} returns this
*/
proto.peach.UpdateUserRequest.prototype.setPayload = function(value) {
return jspb.Message.setWrapperField(this, 1, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.peach.UpdateUserRequest} returns this
*/
proto.peach.UpdateUserRequest.prototype.clearPayload = function() {
return this.setPayload(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.peach.UpdateUserRequest.prototype.hasPayload = function() {
return jspb.Message.getField(this, 1) != null;
};

View File

@ -0,0 +1,192 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.UpdateUserResponse');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.peach.User');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.UpdateUserResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.peach.UpdateUserResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.UpdateUserResponse.displayName = 'proto.peach.UpdateUserResponse';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.UpdateUserResponse.prototype.toObject = function(opt_includeInstance) {
return proto.peach.UpdateUserResponse.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.UpdateUserResponse} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.UpdateUserResponse.toObject = function(includeInstance, msg) {
var f, obj = {
result: (f = msg.getResult()) && proto.peach.User.toObject(includeInstance, f)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.UpdateUserResponse}
*/
proto.peach.UpdateUserResponse.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.UpdateUserResponse;
return proto.peach.UpdateUserResponse.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.UpdateUserResponse} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.UpdateUserResponse}
*/
proto.peach.UpdateUserResponse.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.peach.User;
reader.readMessage(value,proto.peach.User.deserializeBinaryFromReader);
msg.setResult(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.UpdateUserResponse.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.UpdateUserResponse.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.UpdateUserResponse} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.UpdateUserResponse.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getResult();
if (f != null) {
writer.writeMessage(
1,
f,
proto.peach.User.serializeBinaryToWriter
);
}
};
/**
* optional User result = 1;
* @return {?proto.peach.User}
*/
proto.peach.UpdateUserResponse.prototype.getResult = function() {
return /** @type{?proto.peach.User} */ (
jspb.Message.getWrapperField(this, proto.peach.User, 1));
};
/**
* @param {?proto.peach.User|undefined} value
* @return {!proto.peach.UpdateUserResponse} returns this
*/
proto.peach.UpdateUserResponse.prototype.setResult = function(value) {
return jspb.Message.setWrapperField(this, 1, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.peach.UpdateUserResponse} returns this
*/
proto.peach.UpdateUserResponse.prototype.clearResult = function() {
return this.setResult(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.peach.UpdateUserResponse.prototype.hasResult = function() {
return jspb.Message.getField(this, 1) != null;
};

170
gen/js/user.js Normal file
View File

@ -0,0 +1,170 @@
// source: proto/service.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
goog.provide('proto.peach.User');
goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.peach.User = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.peach.User, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.peach.User.displayName = 'proto.peach.User';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.peach.User.prototype.toObject = function(opt_includeInstance) {
return proto.peach.User.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.peach.User} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.User.toObject = function(includeInstance, msg) {
var f, obj = {
id: jspb.Message.getFieldWithDefault(msg, 1, 0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.peach.User}
*/
proto.peach.User.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.peach.User;
return proto.peach.User.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.peach.User} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.peach.User}
*/
proto.peach.User.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readUint64());
msg.setId(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.peach.User.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.peach.User.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.peach.User} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.peach.User.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getId();
if (f !== 0) {
writer.writeUint64(
1,
f
);
}
};
/**
* optional uint64 id = 1;
* @return {number}
*/
proto.peach.User.prototype.getId = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};
/**
* @param {number} value
* @return {!proto.peach.User} returns this
*/
proto.peach.User.prototype.setId = function(value) {
return jspb.Message.setProto3IntField(this, 1, value);
};

View File

@ -0,0 +1,480 @@
{
"swagger": "2.0",
"info": {
"title": "Your API Title",
"description": "Your API description",
"version": "v1.0"
},
"tags": [
{
"name": "Peach"
}
],
"host": "localhost:8080",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/v1/Product": {
"get": {
"operationId": "Peach_ListProducts",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/peachListProductsResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"tags": [
"Peach"
]
},
"post": {
"operationId": "Peach_CreateProduct",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/peachCreateProductResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/peachCreateProductRequest"
}
}
],
"tags": [
"Peach"
]
},
"put": {
"operationId": "Peach_UpdateProduct",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/peachUpdateProductResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/peachUpdateProductRequest"
}
}
],
"tags": [
"Peach"
]
}
},
"/v1/Product/{id}": {
"get": {
"operationId": "Peach_ReadProduct",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/peachReadProductResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string",
"format": "uint64"
}
],
"tags": [
"Peach"
]
},
"delete": {
"operationId": "Peach_DeleteProduct",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/peachDeleteProductResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string",
"format": "uint64"
}
],
"tags": [
"Peach"
]
}
},
"/v1/users": {
"get": {
"operationId": "Peach_ListUsers",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/peachListUsersResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"tags": [
"Peach"
]
},
"post": {
"operationId": "Peach_CreateUser",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/peachCreateUserResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/peachCreateUserRequest"
}
}
],
"tags": [
"Peach"
]
},
"put": {
"operationId": "Peach_UpdateUser",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/peachUpdateUserResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/peachUpdateUserRequest"
}
}
],
"tags": [
"Peach"
]
}
},
"/v1/users/{id}": {
"get": {
"operationId": "Peach_ReadUser",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/peachReadUserResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string",
"format": "uint64"
}
],
"tags": [
"Peach"
]
},
"delete": {
"operationId": "Peach_DeleteUser",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/peachDeleteUserResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string",
"format": "uint64"
}
],
"tags": [
"Peach"
]
}
}
},
"definitions": {
"peachCreateProductRequest": {
"type": "object",
"properties": {
"payload": {
"$ref": "#/definitions/peachProduct"
}
}
},
"peachCreateProductResponse": {
"type": "object",
"properties": {
"result": {
"$ref": "#/definitions/peachProduct"
}
}
},
"peachCreateUserRequest": {
"type": "object",
"properties": {
"payload": {
"$ref": "#/definitions/peachUser"
}
}
},
"peachCreateUserResponse": {
"type": "object",
"properties": {
"result": {
"$ref": "#/definitions/peachUser"
}
}
},
"peachDeleteProductResponse": {
"type": "object"
},
"peachDeleteUserResponse": {
"type": "object"
},
"peachListProductsResponse": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/peachProduct"
}
}
}
},
"peachListUsersResponse": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/peachUser"
}
}
}
},
"peachProduct": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uint64"
},
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"price": {
"type": "number",
"format": "float"
}
}
},
"peachReadProductResponse": {
"type": "object",
"properties": {
"result": {
"$ref": "#/definitions/peachProduct"
}
}
},
"peachReadUserResponse": {
"type": "object",
"properties": {
"result": {
"$ref": "#/definitions/peachUser"
}
}
},
"peachUpdateProductRequest": {
"type": "object",
"properties": {
"payload": {
"$ref": "#/definitions/peachProduct"
}
}
},
"peachUpdateProductResponse": {
"type": "object",
"properties": {
"result": {
"$ref": "#/definitions/peachProduct"
}
}
},
"peachUpdateUserRequest": {
"type": "object",
"properties": {
"payload": {
"$ref": "#/definitions/peachUser"
}
}
},
"peachUpdateUserResponse": {
"type": "object",
"properties": {
"result": {
"$ref": "#/definitions/peachUser"
}
}
},
"peachUser": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uint64"
},
"username": {
"type": "string"
},
"bio": {
"type": "string"
}
}
},
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"type": "string"
}
},
"additionalProperties": {}
},
"rpcStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
}
}
}
}

36
go.mod Normal file
View File

@ -0,0 +1,36 @@
module peach
go 1.22.7
toolchain go1.23.0
require (
github.com/grpc-ecosystem/grpc-gateway/v2 v2.5.0
github.com/infobloxopen/protoc-gen-gorm v1.1.4
github.com/payne8/go-libsql-dual-driver v0.2.3
github.com/rs/cors v1.11.1
google.golang.org/genproto v0.0.0-20250212204824-5a70512c5d8b
google.golang.org/genproto/googleapis/api v0.0.0-20250124145028-65684f501c47
google.golang.org/grpc v1.69.4
google.golang.org/protobuf v1.36.5
gorm.io/driver/sqlite v1.5.7
gorm.io/gorm v1.25.12
)
require (
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/libsql/sqlite-antlr4-parser v0.0.0-20240327125255-dbf53b6cbf06 // indirect
github.com/mattn/go-sqlite3 v1.14.22 // indirect
github.com/tursodatabase/go-libsql v0.0.0-20240429120401-651096bbee0b // indirect
github.com/tursodatabase/libsql-client-go v0.0.0-20240628122535-1c47b26184e8 // indirect
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/text v0.21.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250124145028-65684f501c47 // indirect
nhooyr.io/websocket v1.8.10 // indirect
)

460
go.sum Normal file
View File

@ -0,0 +1,460 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=
cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=
cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=
cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=
cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk=
cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=
cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=
cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI=
github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/glog v0.0.0-20210429001901-424d2337a529/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/glog v1.2.2 h1:1+mZ9upx1Dh6FmUTFR1naJ77miKiXgALjWOZ3NVFPmY=
github.com/golang/glog v1.2.2/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.5.0 h1:ajue7SzQMywqRjg2fK7dcpc0QhFGpTR2plWfV4EZWR4=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.5.0/go.mod h1:r1hZAcvfFXuYmcKyCJI9wlyOPIZUJl6FCB8Cpca/NLE=
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/infobloxopen/protoc-gen-gorm v1.1.4 h1:FGQzz247gqUz/gHidhyqoI2c/iXsSIqhISL90KPHH7g=
github.com/infobloxopen/protoc-gen-gorm v1.1.4/go.mod h1:iKp+grVWZdVtbyfDq7te6jtXpBWa1T759lGroL617IQ=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/libsql/sqlite-antlr4-parser v0.0.0-20240327125255-dbf53b6cbf06 h1:JLvn7D+wXjH9g4Jsjo+VqmzTUpl/LX7vfr6VOfSWTdM=
github.com/libsql/sqlite-antlr4-parser v0.0.0-20240327125255-dbf53b6cbf06/go.mod h1:FUkZ5OHjlGPjnM2UyGJz9TypXQFgYqw6AFNO1UiROTM=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/payne8/go-libsql-dual-driver v0.2.3 h1:ea19rrdn3QQqvDrHNZ5gqqj2Nn7DbhGDVvDL4UDYZ68=
github.com/payne8/go-libsql-dual-driver v0.2.3/go.mod h1:fhe8WdGtBLvGZ5drN9We0uWEedXeCCTvWaTLExrGW9M=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA=
github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/tursodatabase/go-libsql v0.0.0-20240429120401-651096bbee0b h1:R7hev4b96zgXjKbS2ZNbHBnDvyFZhH+LlMqtKH6hIkU=
github.com/tursodatabase/go-libsql v0.0.0-20240429120401-651096bbee0b/go.mod h1:TjsB2miB8RW2Sse8sdxzVTdeGlx74GloD5zJYUC38d8=
github.com/tursodatabase/libsql-client-go v0.0.0-20240628122535-1c47b26184e8 h1:XM3aeBrpNrkvi48EiKCtMNAgsiaAaAOCHAW9SaIWouo=
github.com/tursodatabase/libsql-client-go v0.0.0-20240628122535-1c47b26184e8/go.mod h1:fblU7nZYWAROzJzkpln8teKFDtdRvAOmZHeIpahY4jk=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY=
go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE=
go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE=
go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY=
go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk=
go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0=
go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc=
go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8=
go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys=
go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 h1:aAcj0Da7eBAtrTp03QXWvm88pSyOt+UgdZw2BFZ+lEw=
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8/go.mod h1:CQ1k9gNrJ50XIzaKCRR2hssIjF07kZFEiieALBM/ARQ=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24=
google.golang.org/genproto v0.0.0-20250212204824-5a70512c5d8b h1:TdBaFxGAABTI8sz9jYHPtjje677pS4XXup9vJMlj8hQ=
google.golang.org/genproto v0.0.0-20250212204824-5a70512c5d8b/go.mod h1:0TrvLFkilZy+XULmuoWfiTbTRXLWXJ1S44jQTW3lWwE=
google.golang.org/genproto/googleapis/api v0.0.0-20250124145028-65684f501c47 h1:5iw9XJTD4thFidQmFVvx0wi4g5yOHk76rNRUxz1ZG5g=
google.golang.org/genproto/googleapis/api v0.0.0-20250124145028-65684f501c47/go.mod h1:AfA77qWLcidQWywD0YgqfpJzf50w2VjzBml3TybHeJU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250124145028-65684f501c47 h1:91mG8dNTpkC0uChJUQ9zCiRqx3GEEFOWaRZ0mI6Oj2I=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250124145028-65684f501c47/go.mod h1:+2Yz8+CLJbIfL9z73EW45avw8Lmge3xVElCP9zEKi50=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
google.golang.org/grpc v1.69.4 h1:MF5TftSMkd8GLw/m0KM6V8CMOCY6NZ1NQDPGFgbTt4A=
google.golang.org/grpc v1.69.4/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gorm.io/driver/sqlite v1.5.7 h1:8NvsrhP0ifM7LX9G4zPB97NwovUakUxc+2V2uuf3Z1I=
gorm.io/driver/sqlite v1.5.7/go.mod h1:U+J8craQU6Fzkcvu8oLeAQmi50TkwPEhHDEjQZXDah4=
gorm.io/gorm v1.25.12 h1:I0u8i2hWQItBq1WfE0o2+WuL9+8L21K9e2HHSTE/0f8=
gorm.io/gorm v1.25.12/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ=
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
nhooyr.io/websocket v1.8.10 h1:mv4p+MnGrLDcPlBoWsvPP7XCzTYMXP9F9eIGoKbgx7Q=
nhooyr.io/websocket v1.8.10/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=

144
main.go Normal file
View File

@ -0,0 +1,144 @@
package main
import (
"context"
"log"
"net"
"net/http"
"os"
"time"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/rs/cors"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/reflection"
"gorm.io/gorm"
pb "peach/gen/go"
// the following line is used for the local database
"gorm.io/driver/sqlite"
// uncomment the following lines to switch to a production ready remote database
//libsqldb "github.com/payne8/go-libsql-dual-driver"
//sqlite "github.com/ytsruh/gorm-libsql"
)
func main() {
logger := log.New(os.Stdout, "peach ", log.LstdFlags)
// instantiate the grom ORM
/*
uncomment the following code to switch to a production ready remote database
you will need to set the environment variables
*/
// --------------------- start of remote database code ---------------------
//primaryUrl := os.Getenv("LIBSQL_DATABASE_URL")
//authToken := os.Getenv("LIBSQL_AUTH_TOKEN")
//tdb, err := libsqldb.NewLibSqlDB(
// primaryUrl,
// //libsqldb.WithMigrationFiles(migrationFiles),
// libsqldb.WithAuthToken(authToken),
// libsqldb.WithLocalDBName("local.db"), // will not be used for remote-only
//)
//if err != nil {
// logger.Printf("failed to open db %s: %s", primaryUrl, err)
// log.Fatalln(err)
// return
//}
//gormDB, err := gorm.Open(sqlite.New(sqlite.Config{Conn: tdb.DB}), &gorm.Config{})
//if err != nil {
// logger.Printf("failed to open gorm db %s: %s", primaryUrl, err)
// log.Fatalln(err)
// return
//}
// --------------------- end of remote database code ---------------------
// -- start of local database code --
gormDB, err := gorm.Open(sqlite.Open("local.db"), &gorm.Config{})
if err != nil {
logger.Printf("failed to open gorm db: %s", err)
log.Fatalln(err)
return
}
// -- end of local database code --
err = gormDB.AutoMigrate(&pb.UserORM{}) // TODO: figure out how to automate this part
if err != nil {
logger.Printf("failed to migrate user: %s", err)
log.Fatalln(err)
return
}
err = gormDB.AutoMigrate(&pb.ProductORM{}) // TODO: figure out how to automate this part
if err != nil {
logger.Printf("failed to migrate product: %s", err)
log.Fatalln(err)
return
}
handlers := pb.PeachDefaultServer{
DB: gormDB,
}
grpcServer := grpc.NewServer(grpc.ChainUnaryInterceptor(
func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error) {
// TODO: this is an example of a middleware - we will use this for authentication
// we will have a function that checks the token and a switch statement that checks if the method is public or not
logger.Printf("request: %s", info.FullMethod)
return handler(ctx, req)
},
))
pb.RegisterPeachServer(grpcServer, &handlers)
reflection.Register(grpcServer)
// Start the gRPC server on port 9000
grpcAddr := ":9000"
lis, err := net.Listen("tcp", grpcAddr)
if err != nil {
logger.Fatalf("failed to listen on %s: %v", grpcAddr, err)
}
go func() {
logger.Printf("gRPC server listening on %s", grpcAddr)
if err := grpcServer.Serve(lis); err != nil {
logger.Fatalf("failed to serve gRPC: %v", err)
}
}()
// Set up the grpc-gateway mux
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
gwmux := runtime.NewServeMux()
opts := []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())}
grpcEndpoint := "localhost" + grpcAddr
err = pb.RegisterPeachHandlerFromEndpoint(ctx, gwmux, grpcEndpoint, opts)
if err != nil {
logger.Fatalf("failed to register gateway: %v", err)
}
withCors := cors.New(cors.Options{
AllowedOrigins: []string{"http://localhost:*"}, // TODO: change this to the actual domain
AllowedMethods: []string{"GET", "POST", "PATCH", "PUT", "DELETE", "OPTIONS"},
AllowedHeaders: []string{"ACCEPT", "Authorization", "Content-Type", "X-CSRF-Token"},
ExposedHeaders: []string{"Link"},
AllowCredentials: true,
MaxAge: 300,
}).Handler(gwmux)
// Start the HTTP gateway on port 8080
httpAddr := ":8080"
logger.Printf("HTTP gateway listening on %s", httpAddr)
server := &http.Server{
Addr: httpAddr,
Handler: withCors,
ReadTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second,
}
if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed {
logger.Fatalf("failed to serve HTTP gateway: %v", err)
}
}

127
proto/service.proto Normal file
View File

@ -0,0 +1,127 @@
syntax = "proto3";
package peach;
import "gorm/options/gorm.proto";
//import "gorm/types/types.proto";
import "google/api/annotations.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
option go_package = "./;pb";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
title: "Your API Title"
version: "v1.0"
description: "Your API description"
}
host: "localhost:8080" // Set the server host
};
service Peach {
option (gorm.server).autogen = true;
// Add your service methods here
rpc CreateUser (CreateUserRequest) returns (CreateUserResponse) {
option (google.api.http) = {
post: "/v1/users"
body: "*"
};
}
rpc ReadUser (ReadUserRequest) returns (ReadUserResponse) {
option (google.api.http) = {
get: "/v1/users/{id}"
};
}
rpc ListUsers (ListUsersRequest) returns (ListUsersResponse) {
option (google.api.http) = {
get: "/v1/users"
};
}
rpc UpdateUser (UpdateUserRequest) returns (UpdateUserResponse) {
option (google.api.http) = {
put: "/v1/users"
body: "*"
};
}
rpc DeleteUser (DeleteUserRequest) returns (DeleteUserResponse) {
option (gorm.method).object_type = "User";
option (google.api.http) = {
delete: "/v1/users/{id}"
};
}
rpc CreateProduct (CreateProductRequest) returns (CreateProductResponse) {
option (google.api.http) = {
post: "/v1/Product"
body: "*"
};
}
rpc ReadProduct (ReadProductRequest) returns (ReadProductResponse) {
option (google.api.http) = {
get: "/v1/Product/{id}"
};
}
rpc ListProducts (ListProductsRequest) returns (ListProductsResponse) {
option (google.api.http) = {
get: "/v1/Product"
};
}
rpc UpdateProduct (UpdateProductRequest) returns (UpdateProductResponse) {
option (google.api.http) = {
put: "/v1/Product"
body: "*"
};
}
rpc DeleteProduct (DeleteProductRequest) returns (DeleteProductResponse) {
option (gorm.method).object_type = "Product";
option (google.api.http) = {
delete: "/v1/Product/{id}"
};
}
}
message CreateUserRequest { User payload=1; }
message CreateUserResponse { User result=1; }
message ReadUserRequest { uint64 id=1; }
message ReadUserResponse { User result=1; }
message ListUsersRequest {}
message ListUsersResponse { repeated User results=1; }
message UpdateUserRequest { User payload=1; }
message UpdateUserResponse { User result=1; }
message DeleteUserRequest { uint64 id=1; }
message DeleteUserResponse {}
message User {
option (gorm.opts).ormable = true;
uint64 id = 1;
string username = 2;
string bio = 3;
}
message CreateProductRequest { Product payload=1; }
message CreateProductResponse { Product result=1; }
message ReadProductRequest { uint64 id=1; }
message ReadProductResponse { Product result=1; }
message ListProductsRequest {}
message ListProductsResponse { repeated Product results=1; }
message UpdateProductRequest { Product payload=1; }
message UpdateProductResponse { Product result=1; }
message DeleteProductRequest { uint64 id=1; }
message DeleteProductResponse {}
message Product {
option (gorm.opts).ormable = true;
uint64 id = 1;
string name = 2;
string description = 3;
float price = 4;
}

View File

@ -0,0 +1,729 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
# This is an API workspace, having public visibility by default makes perfect sense.
package(default_visibility = ["//visibility:public"])
##############################################################################
# Common
##############################################################################
proto_library(
name = "annotations_proto",
srcs = ["annotations.proto"],
deps = [
":http_proto",
"@com_google_protobuf//:descriptor_proto",
],
)
proto_library(
name = "auth_proto",
srcs = ["auth.proto"],
deps = [":annotations_proto"],
)
proto_library(
name = "backend_proto",
srcs = ["backend.proto"],
visibility = ["//visibility:public"],
)
proto_library(
name = "billing_proto",
srcs = ["billing.proto"],
deps = [
":annotations_proto",
":metric_proto",
],
)
proto_library(
name = "client_proto",
srcs = ["client.proto"],
deps = [
"@com_google_protobuf//:descriptor_proto",
],
)
proto_library(
name = "config_change_proto",
srcs = ["config_change.proto"],
visibility = ["//visibility:public"],
)
proto_library(
name = "consumer_proto",
srcs = ["consumer.proto"],
visibility = ["//visibility:public"],
)
proto_library(
name = "context_proto",
srcs = ["context.proto"],
visibility = ["//visibility:public"],
)
proto_library(
name = "control_proto",
srcs = ["control.proto"],
visibility = ["//visibility:public"],
)
proto_library(
name = "distribution_proto",
srcs = ["distribution.proto"],
deps = [
":annotations_proto",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:timestamp_proto",
],
)
proto_library(
name = "documentation_proto",
srcs = ["documentation.proto"],
visibility = ["//visibility:public"],
)
proto_library(
name = "endpoint_proto",
srcs = ["endpoint.proto"],
deps = [":annotations_proto"],
)
proto_library(
name = "error_reason_proto",
srcs = ["error_reason.proto"],
)
proto_library(
name = "field_behavior_proto",
srcs = ["field_behavior.proto"],
deps = [
"@com_google_protobuf//:descriptor_proto",
],
)
proto_library(
name = "http_proto",
srcs = ["http.proto"],
visibility = ["//visibility:public"],
)
proto_library(
name = "httpbody_proto",
srcs = ["httpbody.proto"],
deps = ["@com_google_protobuf//:any_proto"],
)
proto_library(
name = "label_proto",
srcs = ["label.proto"],
visibility = ["//visibility:public"],
)
proto_library(
name = "launch_stage_proto",
srcs = ["launch_stage.proto"],
)
proto_library(
name = "log_proto",
srcs = ["log.proto"],
deps = [":label_proto"],
)
proto_library(
name = "logging_proto",
srcs = ["logging.proto"],
deps = [
":annotations_proto",
":label_proto",
],
)
proto_library(
name = "metric_proto",
srcs = ["metric.proto"],
deps = [
":label_proto",
":launch_stage_proto",
"@com_google_protobuf//:duration_proto",
],
)
proto_library(
name = "monitored_resource_proto",
srcs = ["monitored_resource.proto"],
deps = [
":label_proto",
":launch_stage_proto",
"@com_google_protobuf//:struct_proto",
],
)
proto_library(
name = "monitoring_proto",
srcs = ["monitoring.proto"],
deps = [":annotations_proto"],
)
proto_library(
name = "quota_proto",
srcs = ["quota.proto"],
deps = [":annotations_proto"],
)
proto_library(
name = "resource_proto",
srcs = ["resource.proto"],
deps = [
"@com_google_protobuf//:descriptor_proto",
],
)
proto_library(
name = "routing_proto",
srcs = ["routing.proto"],
deps = [
"@com_google_protobuf//:descriptor_proto",
],
)
proto_library(
name = "service_proto",
srcs = ["service.proto"],
deps = [
":annotations_proto",
":auth_proto",
":backend_proto",
":billing_proto",
":context_proto",
":control_proto",
":documentation_proto",
":endpoint_proto",
":http_proto",
":label_proto",
":log_proto",
":logging_proto",
":metric_proto",
":monitored_resource_proto",
":monitoring_proto",
":quota_proto",
":resource_proto",
":source_info_proto",
":system_parameter_proto",
":usage_proto",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:api_proto",
"@com_google_protobuf//:type_proto",
"@com_google_protobuf//:wrappers_proto",
],
)
proto_library(
name = "source_info_proto",
srcs = ["source_info.proto"],
deps = ["@com_google_protobuf//:any_proto"],
)
proto_library(
name = "system_parameter_proto",
srcs = ["system_parameter.proto"],
visibility = ["//visibility:public"],
)
proto_library(
name = "usage_proto",
srcs = ["usage.proto"],
deps = [
":annotations_proto",
":visibility_proto",
],
)
proto_library(
name = "visibility_proto",
srcs = ["visibility.proto"],
deps = ["@com_google_protobuf//:descriptor_proto"],
visibility = ["//visibility:public"],
)
##############################################################################
# Java
##############################################################################
load("@com_google_googleapis_imports//:imports.bzl", "java_proto_library")
java_proto_library(
name = "api_java_proto",
deps = [
"annotations_proto",
"auth_proto",
"backend_proto",
"billing_proto",
"client_proto",
"config_change_proto",
"consumer_proto",
"context_proto",
"control_proto",
"distribution_proto",
"documentation_proto",
"endpoint_proto",
"error_reason_proto",
"field_behavior_proto",
"http_proto",
"httpbody_proto",
"label_proto",
"launch_stage_proto",
"log_proto",
"logging_proto",
"metric_proto",
"monitored_resource_proto",
"monitoring_proto",
"quota_proto",
"resource_proto",
"routing_proto",
"service_proto",
"source_info_proto",
"system_parameter_proto",
"usage_proto",
"visibility_proto",
],
)
##############################################################################
# Go
##############################################################################
load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library")
go_proto_library(
name = "annotations_go_proto",
importpath = "google.golang.org/genproto/googleapis/api/annotations",
protos = [
":annotations_proto",
":http_proto",
],
)
go_proto_library(
name = "client_go_proto",
importpath = "google.golang.org/genproto/googleapis/api/annotations;annotations",
protos = [":client_proto"],
)
go_proto_library(
name = "configchange_go_proto",
importpath = "google.golang.org/genproto/googleapis/api/configchange",
protos = [":config_change_proto"],
)
go_proto_library(
name = "distribution_go_proto",
importpath = "google.golang.org/genproto/googleapis/api/distribution",
protos = [":distribution_proto"],
)
go_proto_library(
name = "field_behavior_go_proto",
importpath = "google.golang.org/genproto/googleapis/api/annotations;annotations",
protos = [":field_behavior_proto"],
)
go_proto_library(
name = "httpbody_go_proto",
importpath = "google.golang.org/genproto/googleapis/api/httpbody",
protos = [":httpbody_proto"],
)
go_proto_library(
name = "label_go_proto",
importpath = "google.golang.org/genproto/googleapis/api/label",
protos = [":label_proto"],
)
go_proto_library(
name = "api_go_proto",
importpath = "google.golang.org/genproto/googleapis/api",
protos = [
":launch_stage_proto",
],
deps = [
":annotations_go_proto",
],
)
go_proto_library(
name = "metric_go_proto",
importpath = "google.golang.org/genproto/googleapis/api/metric",
protos = [":metric_proto"],
deps = [
":api_go_proto",
":label_go_proto",
],
)
go_proto_library(
name = "monitoredres_go_proto",
importpath = "google.golang.org/genproto/googleapis/api/monitoredres",
protos = [":monitored_resource_proto"],
deps = [
":api_go_proto",
":label_go_proto",
],
)
go_proto_library(
name = "resource_go_proto",
importpath = "google.golang.org/genproto/googleapis/api/annotations;annotations",
protos = [":resource_proto"],
)
go_proto_library(
name = "routing_go_proto",
importpath = "google.golang.org/genproto/googleapis/api/annotations;annotations",
protos = [":routing_proto"],
)
go_proto_library(
name = "serviceconfig_go_proto",
importpath = "google.golang.org/genproto/googleapis/api/serviceconfig",
protos = [
":auth_proto",
":backend_proto",
":billing_proto",
":context_proto",
":control_proto",
":documentation_proto",
":endpoint_proto",
":log_proto",
":logging_proto",
":monitoring_proto",
":quota_proto",
":service_proto",
":source_info_proto",
":system_parameter_proto",
":usage_proto",
],
deps = [
":annotations_go_proto",
":api_go_proto",
":label_go_proto",
":metric_go_proto",
":monitoredres_go_proto",
],
)
go_proto_library(
name = "visibility_go_proto",
importpath = "google.golang.org/genproto/googleapis/api/visibility;visibility",
protos = [":visibility_proto"],
)
##############################################################################
# C++
##############################################################################
load("@com_google_googleapis_imports//:imports.bzl", "cc_proto_library")
cc_proto_library(
name = "annotations_cc_proto",
deps = [":annotations_proto"],
)
cc_proto_library(
name = "auth_cc_proto",
deps = [":auth_proto"],
)
cc_proto_library(
name = "backend_cc_proto",
deps = [":backend_proto"],
)
cc_proto_library(
name = "billing_cc_proto",
deps = [":billing_proto"],
)
cc_proto_library(
name = "client_cc_proto",
deps = [":client_proto"],
)
cc_proto_library(
name = "config_change_cc_proto",
deps = [":config_change_proto"],
)
cc_proto_library(
name = "consumer_cc_proto",
deps = [":consumer_proto"],
)
cc_proto_library(
name = "context_cc_proto",
deps = [":context_proto"],
)
cc_proto_library(
name = "control_cc_proto",
deps = [":control_proto"],
)
cc_proto_library(
name = "distribution_cc_proto",
deps = [":distribution_proto"],
)
cc_proto_library(
name = "documentation_cc_proto",
deps = [":documentation_proto"],
)
cc_proto_library(
name = "endpoint_cc_proto",
deps = [":endpoint_proto"],
)
cc_proto_library(
name = "field_behavior_cc_proto",
deps = [":field_behavior_proto"],
)
cc_proto_library(
name = "http_cc_proto",
deps = [":http_proto"],
)
cc_proto_library(
name = "httpbody_cc_proto",
deps = [":httpbody_proto"],
)
cc_proto_library(
name = "label_cc_proto",
deps = [":label_proto"],
)
cc_proto_library(
name = "launch_stage_cc_proto",
deps = [":launch_stage_proto"],
)
cc_proto_library(
name = "log_cc_proto",
deps = [":log_proto"],
)
cc_proto_library(
name = "logging_cc_proto",
deps = [":logging_proto"],
)
cc_proto_library(
name = "metric_cc_proto",
deps = [":metric_proto"],
)
cc_proto_library(
name = "monitored_resource_cc_proto",
deps = [":monitored_resource_proto"],
)
cc_proto_library(
name = "monitoring_cc_proto",
deps = ["monitoring_proto"],
)
cc_proto_library(
name = "quota_cc_proto",
deps = ["quota_proto"],
)
cc_proto_library(
name = "resource_cc_proto",
deps = [":resource_proto"],
)
cc_proto_library(
name = "routing_cc_proto",
deps = [":routing_proto"],
)
cc_proto_library(
name = "service_cc_proto",
deps = [":service_proto"],
)
cc_proto_library(
name = "source_info_cc_proto",
deps = [":source_info_proto"],
)
cc_proto_library(
name = "system_parameter_cc_proto",
deps = [":system_parameter_proto"],
)
cc_proto_library(
name = "usage_cc_proto",
deps = [":usage_proto"],
)
cc_proto_library(
name = "visibility_cc_proto",
deps = [":visibility_proto"],
)
##############################################################################
# Python
##############################################################################
load("@com_google_googleapis_imports//:imports.bzl", "py_proto_library")
py_proto_library(
name = "annotations_py_proto",
deps = [":annotations_proto"],
)
py_proto_library(
name = "auth_py_proto",
deps = [":auth_proto"],
)
py_proto_library(
name = "backend_py_proto",
deps = [":backend_proto"],
)
py_proto_library(
name = "billing_py_proto",
deps = [":billing_proto"],
)
py_proto_library(
name = "client_py_proto",
deps = [":client_proto"],
)
py_proto_library(
name = "config_change_py_proto",
deps = [":config_change_proto"],
)
py_proto_library(
name = "consumer_py_proto",
deps = [":consumer_proto"],
)
py_proto_library(
name = "context_py_proto",
deps = [":context_proto"],
)
py_proto_library(
name = "control_py_proto",
deps = [":control_proto"],
)
py_proto_library(
name = "distribution_py_proto",
deps = [":distribution_proto"],
)
py_proto_library(
name = "documentation_py_proto",
deps = [":documentation_proto"],
)
py_proto_library(
name = "endpoint_py_proto",
deps = [":endpoint_proto"],
)
py_proto_library(
name = "field_behavior_py_proto",
deps = [":field_behavior_proto"],
)
py_proto_library(
name = "http_py_proto",
deps = [":http_proto"],
)
py_proto_library(
name = "httpbody_py_proto",
deps = [":httpbody_proto"],
)
py_proto_library(
name = "label_py_proto",
deps = [":label_proto"],
)
py_proto_library(
name = "launch_stage_py_proto",
deps = [":launch_stage_proto"],
)
py_proto_library(
name = "log_py_proto",
deps = [":log_proto"],
)
py_proto_library(
name = "logging_py_proto",
deps = [":logging_proto"],
)
py_proto_library(
name = "metric_py_proto",
deps = [":metric_proto"],
)
py_proto_library(
name = "monitored_resource_py_proto",
deps = [":monitored_resource_proto"],
)
py_proto_library(
name = "monitoring_py_proto",
deps = ["monitoring_proto"],
)
py_proto_library(
name = "quota_py_proto",
deps = ["quota_proto"],
)
py_proto_library(
name = "resource_py_proto",
deps = [":resource_proto"],
)
py_proto_library(
name = "routing_py_proto",
deps = [":routing_proto"],
)
py_proto_library(
name = "service_py_proto",
deps = [":service_proto"],
)
py_proto_library(
name = "source_info_py_proto",
deps = [":source_info_proto"],
)
py_proto_library(
name = "system_parameter_py_proto",
deps = [":system_parameter_proto"],
)
py_proto_library(
name = "usage_py_proto",
deps = [":usage_proto"],
)
py_proto_library(
name = "visibility_py_proto",
deps = ["visibility_proto"],
)

View File

@ -0,0 +1,5 @@
This folder contains the schema of the configuration model for the API services
platform.
**Note**: Protos under this directory are in Alpha status, and therefore are
subject to breaking changes.

View File

@ -0,0 +1,31 @@
// Copyright 2015 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.api;
import "google/api/http.proto";
import "google/protobuf/descriptor.proto";
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "AnnotationsProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.MethodOptions {
// See `HttpRule`.
HttpRule http = 72295728;
}

View File

@ -0,0 +1,232 @@
// Copyright 2015 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.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "AuthProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// `Authentication` defines the authentication configuration for API methods
// provided by an API service.
//
// Example:
//
// name: calendar.googleapis.com
// authentication:
// providers:
// - id: google_calendar_auth
// jwks_uri: https://www.googleapis.com/oauth2/v1/certs
// issuer: https://securetoken.google.com
// rules:
// - selector: "*"
// requirements:
// provider_id: google_calendar_auth
// - selector: google.calendar.Delegate
// oauth:
// canonical_scopes: https://www.googleapis.com/auth/calendar.read
message Authentication {
// A list of authentication rules that apply to individual API methods.
//
// **NOTE:** All service configuration rules follow "last one wins" order.
repeated AuthenticationRule rules = 3;
// Defines a set of authentication providers that a service supports.
repeated AuthProvider providers = 4;
}
// Authentication rules for the service.
//
// By default, if a method has any authentication requirements, every request
// must include a valid credential matching one of the requirements.
// It's an error to include more than one kind of credential in a single
// request.
//
// If a method doesn't have any auth requirements, request credentials will be
// ignored.
message AuthenticationRule {
// Selects the methods to which this rule applies.
//
// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
string selector = 1;
// The requirements for OAuth credentials.
OAuthRequirements oauth = 2;
// If true, the service accepts API keys without any other credential.
// This flag only applies to HTTP and gRPC requests.
bool allow_without_credential = 5;
// Requirements for additional authentication providers.
repeated AuthRequirement requirements = 7;
}
// Specifies a location to extract JWT from an API request.
message JwtLocation {
oneof in {
// Specifies HTTP header name to extract JWT token.
string header = 1;
// Specifies URL query parameter name to extract JWT token.
string query = 2;
}
// The value prefix. The value format is "value_prefix{token}"
// Only applies to "in" header type. Must be empty for "in" query type.
// If not empty, the header value has to match (case sensitive) this prefix.
// If not matched, JWT will not be extracted. If matched, JWT will be
// extracted after the prefix is removed.
//
// For example, for "Authorization: Bearer {JWT}",
// value_prefix="Bearer " with a space at the end.
string value_prefix = 3;
}
// Configuration for an authentication provider, including support for
// [JSON Web Token
// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
message AuthProvider {
// The unique identifier of the auth provider. It will be referred to by
// `AuthRequirement.provider_id`.
//
// Example: "bookstore_auth".
string id = 1;
// Identifies the principal that issued the JWT. See
// https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1
// Usually a URL or an email address.
//
// Example: https://securetoken.google.com
// Example: 1234567-compute@developer.gserviceaccount.com
string issuer = 2;
// URL of the provider's public key set to validate signature of the JWT. See
// [OpenID
// Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata).
// Optional if the key set document:
// - can be retrieved from
// [OpenID
// Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html)
// of the issuer.
// - can be inferred from the email domain of the issuer (e.g. a Google
// service account).
//
// Example: https://www.googleapis.com/oauth2/v1/certs
string jwks_uri = 3;
// The list of JWT
// [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
// that are allowed to access. A JWT containing any of these audiences will
// be accepted. When this setting is absent, JWTs with audiences:
// - "https://[service.name]/[google.protobuf.Api.name]"
// - "https://[service.name]/"
// will be accepted.
// For example, if no audiences are in the setting, LibraryService API will
// accept JWTs with the following audiences:
// -
// https://library-example.googleapis.com/google.example.library.v1.LibraryService
// - https://library-example.googleapis.com/
//
// Example:
//
// audiences: bookstore_android.apps.googleusercontent.com,
// bookstore_web.apps.googleusercontent.com
string audiences = 4;
// Redirect URL if JWT token is required but not present or is expired.
// Implement authorizationUrl of securityDefinitions in OpenAPI spec.
string authorization_url = 5;
// Defines the locations to extract the JWT.
//
// JWT locations can be either from HTTP headers or URL query parameters.
// The rule is that the first match wins. The checking order is: checking
// all headers first, then URL query parameters.
//
// If not specified, default to use following 3 locations:
// 1) Authorization: Bearer
// 2) x-goog-iap-jwt-assertion
// 3) access_token query parameter
//
// Default locations can be specified as followings:
// jwt_locations:
// - header: Authorization
// value_prefix: "Bearer "
// - header: x-goog-iap-jwt-assertion
// - query: access_token
repeated JwtLocation jwt_locations = 6;
}
// OAuth scopes are a way to define data and permissions on data. For example,
// there are scopes defined for "Read-only access to Google Calendar" and
// "Access to Cloud Platform". Users can consent to a scope for an application,
// giving it permission to access that data on their behalf.
//
// OAuth scope specifications should be fairly coarse grained; a user will need
// to see and understand the text description of what your scope means.
//
// In most cases: use one or at most two OAuth scopes for an entire family of
// products. If your product has multiple APIs, you should probably be sharing
// the OAuth scope across all of those APIs.
//
// When you need finer grained OAuth consent screens: talk with your product
// management about how developers will use them in practice.
//
// Please note that even though each of the canonical scopes is enough for a
// request to be accepted and passed to the backend, a request can still fail
// due to the backend requiring additional scopes or permissions.
message OAuthRequirements {
// The list of publicly documented OAuth scopes that are allowed access. An
// OAuth token containing any of these scopes will be accepted.
//
// Example:
//
// canonical_scopes: https://www.googleapis.com/auth/calendar,
// https://www.googleapis.com/auth/calendar.read
string canonical_scopes = 1;
}
// User-defined authentication requirements, including support for
// [JSON Web Token
// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
message AuthRequirement {
// [id][google.api.AuthProvider.id] from authentication provider.
//
// Example:
//
// provider_id: bookstore_auth
string provider_id = 1;
// NOTE: This will be deprecated soon, once AuthProvider.audiences is
// implemented and accepted in all the runtime components.
//
// The list of JWT
// [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3).
// that are allowed to access. A JWT containing any of these audiences will
// be accepted. When this setting is absent, only JWTs with audience
// "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]"
// will be accepted. For example, if no audiences are in the setting,
// LibraryService API will only accept JWTs with the following audience
// "https://library-example.googleapis.com/google.example.library.v1.LibraryService".
//
// Example:
//
// audiences: bookstore_android.apps.googleusercontent.com,
// bookstore_web.apps.googleusercontent.com
string audiences = 2;
}

View File

@ -0,0 +1,182 @@
// Copyright 2015 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.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "BackendProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// `Backend` defines the backend configuration for a service.
message Backend {
// A list of API backend rules that apply to individual API methods.
//
// **NOTE:** All service configuration rules follow "last one wins" order.
repeated BackendRule rules = 1;
}
// A backend rule provides configuration for an individual API element.
message BackendRule {
// Path Translation specifies how to combine the backend address with the
// request path in order to produce the appropriate forwarding URL for the
// request.
//
// Path Translation is applicable only to HTTP-based backends. Backends which
// do not accept requests over HTTP/HTTPS should leave `path_translation`
// unspecified.
enum PathTranslation {
PATH_TRANSLATION_UNSPECIFIED = 0;
// Use the backend address as-is, with no modification to the path. If the
// URL pattern contains variables, the variable names and values will be
// appended to the query string. If a query string parameter and a URL
// pattern variable have the same name, this may result in duplicate keys in
// the query string.
//
// # Examples
//
// Given the following operation config:
//
// Method path: /api/company/{cid}/user/{uid}
// Backend address: https://example.cloudfunctions.net/getUser
//
// Requests to the following request paths will call the backend at the
// translated path:
//
// Request path: /api/company/widgetworks/user/johndoe
// Translated:
// https://example.cloudfunctions.net/getUser?cid=widgetworks&uid=johndoe
//
// Request path: /api/company/widgetworks/user/johndoe?timezone=EST
// Translated:
// https://example.cloudfunctions.net/getUser?timezone=EST&cid=widgetworks&uid=johndoe
CONSTANT_ADDRESS = 1;
// The request path will be appended to the backend address.
//
// # Examples
//
// Given the following operation config:
//
// Method path: /api/company/{cid}/user/{uid}
// Backend address: https://example.appspot.com
//
// Requests to the following request paths will call the backend at the
// translated path:
//
// Request path: /api/company/widgetworks/user/johndoe
// Translated:
// https://example.appspot.com/api/company/widgetworks/user/johndoe
//
// Request path: /api/company/widgetworks/user/johndoe?timezone=EST
// Translated:
// https://example.appspot.com/api/company/widgetworks/user/johndoe?timezone=EST
APPEND_PATH_TO_ADDRESS = 2;
}
// Selects the methods to which this rule applies.
//
// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
string selector = 1;
// The address of the API backend.
//
// The scheme is used to determine the backend protocol and security.
// The following schemes are accepted:
//
// SCHEME PROTOCOL SECURITY
// http:// HTTP None
// https:// HTTP TLS
// grpc:// gRPC None
// grpcs:// gRPC TLS
//
// It is recommended to explicitly include a scheme. Leaving out the scheme
// may cause constrasting behaviors across platforms.
//
// If the port is unspecified, the default is:
// - 80 for schemes without TLS
// - 443 for schemes with TLS
//
// For HTTP backends, use [protocol][google.api.BackendRule.protocol]
// to specify the protocol version.
string address = 2;
// The number of seconds to wait for a response from a request. The default
// varies based on the request protocol and deployment environment.
double deadline = 3;
// Minimum deadline in seconds needed for this method. Calls having deadline
// value lower than this will be rejected.
double min_deadline = 4;
// The number of seconds to wait for the completion of a long running
// operation. The default is no deadline.
double operation_deadline = 5;
PathTranslation path_translation = 6;
// Authentication settings used by the backend.
//
// These are typically used to provide service management functionality to
// a backend served on a publicly-routable URL. The `authentication`
// details should match the authentication behavior used by the backend.
//
// For example, specifying `jwt_audience` implies that the backend expects
// authentication via a JWT.
//
// When authentication is unspecified, the resulting behavior is the same
// as `disable_auth` set to `true`.
//
// Refer to https://developers.google.com/identity/protocols/OpenIDConnect for
// JWT ID token.
oneof authentication {
// The JWT audience is used when generating a JWT ID token for the backend.
// This ID token will be added in the HTTP "authorization" header, and sent
// to the backend.
string jwt_audience = 7;
// When disable_auth is true, a JWT ID token won't be generated and the
// original "Authorization" HTTP header will be preserved. If the header is
// used to carry the original token and is expected by the backend, this
// field must be set to true to preserve the header.
bool disable_auth = 8;
}
// The protocol used for sending a request to the backend.
// The supported values are "http/1.1" and "h2".
//
// The default value is inferred from the scheme in the
// [address][google.api.BackendRule.address] field:
//
// SCHEME PROTOCOL
// http:// http/1.1
// https:// http/1.1
// grpc:// h2
// grpcs:// h2
//
// For secure HTTP backends (https://) that support HTTP/2, set this field
// to "h2" for improved performance.
//
// Configuring this field to non-default values is only supported for secure
// HTTP backends. This field will be ignored for all other backends.
//
// See
// https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids
// for more details on the supported values.
string protocol = 9;
}

View File

@ -0,0 +1,77 @@
// Copyright 2015 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.api;
import "google/api/metric.proto";
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "BillingProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Billing related configuration of the service.
//
// The following example shows how to configure monitored resources and metrics
// for billing, `consumer_destinations` is the only supported destination and
// the monitored resources need at least one label key
// `cloud.googleapis.com/location` to indicate the location of the billing
// usage, using different monitored resources between monitoring and billing is
// recommended so they can be evolved independently:
//
//
// monitored_resources:
// - type: library.googleapis.com/billing_branch
// labels:
// - key: cloud.googleapis.com/location
// description: |
// Predefined label to support billing location restriction.
// - key: city
// description: |
// Custom label to define the city where the library branch is located
// in.
// - key: name
// description: Custom label to define the name of the library branch.
// metrics:
// - name: library.googleapis.com/book/borrowed_count
// metric_kind: DELTA
// value_type: INT64
// unit: "1"
// billing:
// consumer_destinations:
// - monitored_resource: library.googleapis.com/billing_branch
// metrics:
// - library.googleapis.com/book/borrowed_count
message Billing {
// Configuration of a specific billing destination (Currently only support
// bill against consumer project).
message BillingDestination {
// The monitored resource type. The type must be defined in
// [Service.monitored_resources][google.api.Service.monitored_resources] section.
string monitored_resource = 1;
// Names of the metrics to report to this billing destination.
// Each name must be defined in [Service.metrics][google.api.Service.metrics] section.
repeated string metrics = 2;
}
// Billing configurations for sending metrics to the consumer project.
// There can be multiple consumer destinations per service, each one must have
// a different monitored resource type. A metric can be used in at most
// one consumer destination.
repeated BillingDestination consumer_destinations = 8;
}

View File

@ -0,0 +1,99 @@
// Copyright 2018 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.api;
import "google/protobuf/descriptor.proto";
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "ClientProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.MethodOptions {
// A definition of a client library method signature.
//
// In client libraries, each proto RPC corresponds to one or more methods
// which the end user is able to call, and calls the underlying RPC.
// Normally, this method receives a single argument (a struct or instance
// corresponding to the RPC request object). Defining this field will
// add one or more overloads providing flattened or simpler method signatures
// in some languages.
//
// The fields on the method signature are provided as a comma-separated
// string.
//
// For example, the proto RPC and annotation:
//
// rpc CreateSubscription(CreateSubscriptionRequest)
// returns (Subscription) {
// option (google.api.method_signature) = "name,topic";
// }
//
// Would add the following Java overload (in addition to the method accepting
// the request object):
//
// public final Subscription createSubscription(String name, String topic)
//
// The following backwards-compatibility guidelines apply:
//
// * Adding this annotation to an unannotated method is backwards
// compatible.
// * Adding this annotation to a method which already has existing
// method signature annotations is backwards compatible if and only if
// the new method signature annotation is last in the sequence.
// * Modifying or removing an existing method signature annotation is
// a breaking change.
// * Re-ordering existing method signature annotations is a breaking
// change.
repeated string method_signature = 1051;
}
extend google.protobuf.ServiceOptions {
// The hostname for this service.
// This should be specified with no prefix or protocol.
//
// Example:
//
// service Foo {
// option (google.api.default_host) = "foo.googleapi.com";
// ...
// }
string default_host = 1049;
// OAuth scopes needed for the client.
//
// Example:
//
// service Foo {
// option (google.api.oauth_scopes) = \
// "https://www.googleapis.com/auth/cloud-platform";
// ...
// }
//
// If there is more than one scope, use a comma-separated string:
//
// Example:
//
// service Foo {
// option (google.api.oauth_scopes) = \
// "https://www.googleapis.com/auth/cloud-platform,"
// "https://www.googleapis.com/auth/monitoring";
// ...
// }
string oauth_scopes = 1050;
}

View File

@ -0,0 +1,84 @@
// Copyright 2015 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.api;
option go_package = "google.golang.org/genproto/googleapis/api/configchange;configchange";
option java_multiple_files = true;
option java_outer_classname = "ConfigChangeProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Output generated from semantically comparing two versions of a service
// configuration.
//
// Includes detailed information about a field that have changed with
// applicable advice about potential consequences for the change, such as
// backwards-incompatibility.
message ConfigChange {
// Object hierarchy path to the change, with levels separated by a '.'
// character. For repeated fields, an applicable unique identifier field is
// used for the index (usually selector, name, or id). For maps, the term
// 'key' is used. If the field has no unique identifier, the numeric index
// is used.
// Examples:
// - visibility.rules[selector=="google.LibraryService.ListBooks"].restriction
// - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value
// - logging.producer_destinations[0]
string element = 1;
// Value of the changed object in the old Service configuration,
// in JSON format. This field will not be populated if ChangeType == ADDED.
string old_value = 2;
// Value of the changed object in the new Service configuration,
// in JSON format. This field will not be populated if ChangeType == REMOVED.
string new_value = 3;
// The type for this change, either ADDED, REMOVED, or MODIFIED.
ChangeType change_type = 4;
// Collection of advice provided for this change, useful for determining the
// possible impact of this change.
repeated Advice advices = 5;
}
// Generated advice about this change, used for providing more
// information about how a change will affect the existing service.
message Advice {
// Useful description for why this advice was applied and what actions should
// be taken to mitigate any implied risks.
string description = 2;
}
// Classifies set of possible modifications to an object in the service
// configuration.
enum ChangeType {
// No value was provided.
CHANGE_TYPE_UNSPECIFIED = 0;
// The changed object exists in the 'new' service configuration, but not
// in the 'old' service configuration.
ADDED = 1;
// The changed object exists in the 'old' service configuration, but not
// in the 'new' service configuration.
REMOVED = 2;
// The changed object exists in both service configurations, but its value
// is different.
MODIFIED = 3;
}

View File

@ -0,0 +1,82 @@
// Copyright 2016 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.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "ConsumerProto";
option java_package = "com.google.api";
// A descriptor for defining project properties for a service. One service may
// have many consumer projects, and the service may want to behave differently
// depending on some properties on the project. For example, a project may be
// associated with a school, or a business, or a government agency, a business
// type property on the project may affect how a service responds to the client.
// This descriptor defines which properties are allowed to be set on a project.
//
// Example:
//
// project_properties:
// properties:
// - name: NO_WATERMARK
// type: BOOL
// description: Allows usage of the API without watermarks.
// - name: EXTENDED_TILE_CACHE_PERIOD
// type: INT64
message ProjectProperties {
// List of per consumer project-specific properties.
repeated Property properties = 1;
}
// Defines project properties.
//
// API services can define properties that can be assigned to consumer projects
// so that backends can perform response customization without having to make
// additional calls or maintain additional storage. For example, Maps API
// defines properties that controls map tile cache period, or whether to embed a
// watermark in a result.
//
// These values can be set via API producer console. Only API providers can
// define and set these properties.
message Property {
// Supported data type of the property values
enum PropertyType {
// The type is unspecified, and will result in an error.
UNSPECIFIED = 0;
// The type is `int64`.
INT64 = 1;
// The type is `bool`.
BOOL = 2;
// The type is `string`.
STRING = 3;
// The type is 'double'.
DOUBLE = 4;
}
// The name of the property (a.k.a key).
string name = 1;
// The type of this property.
PropertyType type = 2;
// The description of the property
string description = 3;
}

View File

@ -0,0 +1,89 @@
// Copyright 2015 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.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "ContextProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// `Context` defines which contexts an API requests.
//
// Example:
//
// context:
// rules:
// - selector: "*"
// requested:
// - google.rpc.context.ProjectContext
// - google.rpc.context.OriginContext
//
// The above specifies that all methods in the API request
// `google.rpc.context.ProjectContext` and
// `google.rpc.context.OriginContext`.
//
// Available context types are defined in package
// `google.rpc.context`.
//
// This also provides mechanism to allowlist any protobuf message extension that
// can be sent in grpc metadata using “x-goog-ext-<extension_id>-bin” and
// “x-goog-ext-<extension_id>-jspb” format. For example, list any service
// specific protobuf types that can appear in grpc metadata as follows in your
// yaml file:
//
// Example:
//
// context:
// rules:
// - selector: "google.example.library.v1.LibraryService.CreateBook"
// allowed_request_extensions:
// - google.foo.v1.NewExtension
// allowed_response_extensions:
// - google.foo.v1.NewExtension
//
// You can also specify extension ID instead of fully qualified extension name
// here.
message Context {
// A list of RPC context rules that apply to individual API methods.
//
// **NOTE:** All service configuration rules follow "last one wins" order.
repeated ContextRule rules = 1;
}
// A context rule provides information about the context for an individual API
// element.
message ContextRule {
// Selects the methods to which this rule applies.
//
// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
string selector = 1;
// A list of full type names of requested contexts.
repeated string requested = 2;
// A list of full type names of provided contexts.
repeated string provided = 3;
// A list of full type names or extension IDs of extensions allowed in grpc
// side channel from client to backend.
repeated string allowed_request_extensions = 4;
// A list of full type names or extension IDs of extensions allowed in grpc
// side channel from backend to client.
repeated string allowed_response_extensions = 5;
}

View File

@ -0,0 +1,32 @@
// Copyright 2015 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.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "ControlProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Selects and configures the service controller used by the service. The
// service controller handles features like abuse, quota, billing, logging,
// monitoring, etc.
message Control {
// The service control environment to use. If empty, no control plane
// feature (like quota and billing) will be enabled.
string environment = 1;
}

View File

@ -0,0 +1,211 @@
// Copyright 2015 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.api;
import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";
option go_package = "google.golang.org/genproto/googleapis/api/distribution;distribution";
option java_multiple_files = true;
option java_outer_classname = "DistributionProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// `Distribution` contains summary statistics for a population of values. It
// optionally contains a histogram representing the distribution of those values
// across a set of buckets.
//
// The summary statistics are the count, mean, sum of the squared deviation from
// the mean, the minimum, and the maximum of the set of population of values.
// The histogram is based on a sequence of buckets and gives a count of values
// that fall into each bucket. The boundaries of the buckets are given either
// explicitly or by formulas for buckets of fixed or exponentially increasing
// widths.
//
// Although it is not forbidden, it is generally a bad idea to include
// non-finite values (infinities or NaNs) in the population of values, as this
// will render the `mean` and `sum_of_squared_deviation` fields meaningless.
message Distribution {
// The range of the population values.
message Range {
// The minimum of the population values.
double min = 1;
// The maximum of the population values.
double max = 2;
}
// `BucketOptions` describes the bucket boundaries used to create a histogram
// for the distribution. The buckets can be in a linear sequence, an
// exponential sequence, or each bucket can be specified explicitly.
// `BucketOptions` does not include the number of values in each bucket.
//
// A bucket has an inclusive lower bound and exclusive upper bound for the
// values that are counted for that bucket. The upper bound of a bucket must
// be strictly greater than the lower bound. The sequence of N buckets for a
// distribution consists of an underflow bucket (number 0), zero or more
// finite buckets (number 1 through N - 2) and an overflow bucket (number N -
// 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the
// same as the upper bound of bucket i - 1. The buckets span the whole range
// of finite values: lower bound of the underflow bucket is -infinity and the
// upper bound of the overflow bucket is +infinity. The finite buckets are
// so-called because both bounds are finite.
message BucketOptions {
// Specifies a linear sequence of buckets that all have the same width
// (except overflow and underflow). Each bucket represents a constant
// absolute uncertainty on the specific value in the bucket.
//
// There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
// following boundaries:
//
// Upper bound (0 <= i < N-1): offset + (width * i).
// Lower bound (1 <= i < N): offset + (width * (i - 1)).
message Linear {
// Must be greater than 0.
int32 num_finite_buckets = 1;
// Must be greater than 0.
double width = 2;
// Lower bound of the first bucket.
double offset = 3;
}
// Specifies an exponential sequence of buckets that have a width that is
// proportional to the value of the lower bound. Each bucket represents a
// constant relative uncertainty on a specific value in the bucket.
//
// There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
// following boundaries:
//
// Upper bound (0 <= i < N-1): scale * (growth_factor ^ i).
// Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)).
message Exponential {
// Must be greater than 0.
int32 num_finite_buckets = 1;
// Must be greater than 1.
double growth_factor = 2;
// Must be greater than 0.
double scale = 3;
}
// Specifies a set of buckets with arbitrary widths.
//
// There are `size(bounds) + 1` (= N) buckets. Bucket `i` has the following
// boundaries:
//
// Upper bound (0 <= i < N-1): bounds[i]
// Lower bound (1 <= i < N); bounds[i - 1]
//
// The `bounds` field must contain at least one element. If `bounds` has
// only one element, then there are no finite buckets, and that single
// element is the common boundary of the overflow and underflow buckets.
message Explicit {
// The values must be monotonically increasing.
repeated double bounds = 1;
}
// Exactly one of these three fields must be set.
oneof options {
// The linear bucket.
Linear linear_buckets = 1;
// The exponential buckets.
Exponential exponential_buckets = 2;
// The explicit buckets.
Explicit explicit_buckets = 3;
}
}
// Exemplars are example points that may be used to annotate aggregated
// distribution values. They are metadata that gives information about a
// particular value added to a Distribution bucket, such as a trace ID that
// was active when a value was added. They may contain further information,
// such as a example values and timestamps, origin, etc.
message Exemplar {
// Value of the exemplar point. This value determines to which bucket the
// exemplar belongs.
double value = 1;
// The observation (sampling) time of the above value.
google.protobuf.Timestamp timestamp = 2;
// Contextual information about the example value. Examples are:
//
// Trace: type.googleapis.com/google.monitoring.v3.SpanContext
//
// Literal string: type.googleapis.com/google.protobuf.StringValue
//
// Labels dropped during aggregation:
// type.googleapis.com/google.monitoring.v3.DroppedLabels
//
// There may be only a single attachment of any given message type in a
// single exemplar, and this is enforced by the system.
repeated google.protobuf.Any attachments = 3;
}
// The number of values in the population. Must be non-negative. This value
// must equal the sum of the values in `bucket_counts` if a histogram is
// provided.
int64 count = 1;
// The arithmetic mean of the values in the population. If `count` is zero
// then this field must be zero.
double mean = 2;
// The sum of squared deviations from the mean of the values in the
// population. For values x_i this is:
//
// Sum[i=1..n]((x_i - mean)^2)
//
// Knuth, "The Art of Computer Programming", Vol. 2, page 232, 3rd edition
// describes Welford's method for accumulating this sum in one pass.
//
// If `count` is zero then this field must be zero.
double sum_of_squared_deviation = 3;
// If specified, contains the range of the population values. The field
// must not be present if the `count` is zero.
Range range = 4;
// Defines the histogram bucket boundaries. If the distribution does not
// contain a histogram, then omit this field.
BucketOptions bucket_options = 6;
// The number of values in each bucket of the histogram, as described in
// `bucket_options`. If the distribution does not have a histogram, then omit
// this field. If there is a histogram, then the sum of the values in
// `bucket_counts` must equal the value in the `count` field of the
// distribution.
//
// If present, `bucket_counts` should contain N values, where N is the number
// of buckets specified in `bucket_options`. If you supply fewer than N
// values, the remaining values are assumed to be 0.
//
// The order of the values in `bucket_counts` follows the bucket numbering
// schemes described for the three bucket types. The first value must be the
// count for the underflow bucket (number 0). The next N-2 values are the
// counts for the finite buckets (number 1 through N-2). The N'th value in
// `bucket_counts` is the count for the overflow bucket (number N-1).
repeated int64 bucket_counts = 7;
// Must be in increasing order of `value` field.
repeated Exemplar exemplars = 10;
}

View File

@ -0,0 +1,162 @@
// Copyright 2015 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.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "DocumentationProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// `Documentation` provides the information for describing a service.
//
// Example:
// <pre><code>documentation:
// summary: >
// The Google Calendar API gives access
// to most calendar features.
// pages:
// - name: Overview
// content: &#40;== include google/foo/overview.md ==&#41;
// - name: Tutorial
// content: &#40;== include google/foo/tutorial.md ==&#41;
// subpages;
// - name: Java
// content: &#40;== include google/foo/tutorial_java.md ==&#41;
// rules:
// - selector: google.calendar.Calendar.Get
// description: >
// ...
// - selector: google.calendar.Calendar.Put
// description: >
// ...
// </code></pre>
// Documentation is provided in markdown syntax. In addition to
// standard markdown features, definition lists, tables and fenced
// code blocks are supported. Section headers can be provided and are
// interpreted relative to the section nesting of the context where
// a documentation fragment is embedded.
//
// Documentation from the IDL is merged with documentation defined
// via the config at normalization time, where documentation provided
// by config rules overrides IDL provided.
//
// A number of constructs specific to the API platform are supported
// in documentation text.
//
// In order to reference a proto element, the following
// notation can be used:
// <pre><code>&#91;fully.qualified.proto.name]&#91;]</code></pre>
// To override the display text used for the link, this can be used:
// <pre><code>&#91;display text]&#91;fully.qualified.proto.name]</code></pre>
// Text can be excluded from doc using the following notation:
// <pre><code>&#40;-- internal comment --&#41;</code></pre>
//
// A few directives are available in documentation. Note that
// directives must appear on a single line to be properly
// identified. The `include` directive includes a markdown file from
// an external source:
// <pre><code>&#40;== include path/to/file ==&#41;</code></pre>
// The `resource_for` directive marks a message to be the resource of
// a collection in REST view. If it is not specified, tools attempt
// to infer the resource from the operations in a collection:
// <pre><code>&#40;== resource_for v1.shelves.books ==&#41;</code></pre>
// The directive `suppress_warning` does not directly affect documentation
// and is documented together with service config validation.
message Documentation {
// A short summary of what the service does. Can only be provided by
// plain text.
string summary = 1;
// The top level pages for the documentation set.
repeated Page pages = 5;
// A list of documentation rules that apply to individual API elements.
//
// **NOTE:** All service configuration rules follow "last one wins" order.
repeated DocumentationRule rules = 3;
// The URL to the root of documentation.
string documentation_root_url = 4;
// Specifies the service root url if the default one (the service name
// from the yaml file) is not suitable. This can be seen in any fully
// specified service urls as well as sections that show a base that other
// urls are relative to.
string service_root_url = 6;
// Declares a single overview page. For example:
// <pre><code>documentation:
// summary: ...
// overview: &#40;== include overview.md ==&#41;
// </code></pre>
// This is a shortcut for the following declaration (using pages style):
// <pre><code>documentation:
// summary: ...
// pages:
// - name: Overview
// content: &#40;== include overview.md ==&#41;
// </code></pre>
// Note: you cannot specify both `overview` field and `pages` field.
string overview = 2;
}
// A documentation rule provides information about individual API elements.
message DocumentationRule {
// The selector is a comma-separated list of patterns. Each pattern is a
// qualified name of the element which may end in "*", indicating a wildcard.
// Wildcards are only allowed at the end and for a whole component of the
// qualified name, i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". A
// wildcard will match one or more components. To specify a default for all
// applicable elements, the whole pattern "*" is used.
string selector = 1;
// Description of the selected API(s).
string description = 2;
// Deprecation description of the selected element(s). It can be provided if
// an element is marked as `deprecated`.
string deprecation_description = 3;
}
// Represents a documentation page. A page can contain subpages to represent
// nested documentation set structure.
message Page {
// The name of the page. It will be used as an identity of the page to
// generate URI of the page, text of the link to this page in navigation,
// etc. The full page name (start from the root page name to this page
// concatenated with `.`) can be used as reference to the page in your
// documentation. For example:
// <pre><code>pages:
// - name: Tutorial
// content: &#40;== include tutorial.md ==&#41;
// subpages:
// - name: Java
// content: &#40;== include tutorial_java.md ==&#41;
// </code></pre>
// You can reference `Java` page using Markdown reference link syntax:
// `[Java][Tutorial.Java]`.
string name = 1;
// The Markdown content of the page. You can use <code>&#40;== include {path}
// ==&#41;</code> to include content from a Markdown file.
string content = 2;
// Subpages of this page. The order of subpages specified here will be
// honored in the generated docset.
repeated Page subpages = 3;
}

View File

@ -0,0 +1,68 @@
// Copyright 2015 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.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "EndpointProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// `Endpoint` describes a network endpoint of a service that serves a set of
// APIs. It is commonly known as a service endpoint. A service may expose
// any number of service endpoints, and all service endpoints share the same
// service definition, such as quota limits and monitoring metrics.
//
// Example service configuration:
//
// name: library-example.googleapis.com
// endpoints:
// # Below entry makes 'google.example.library.v1.Library'
// # API be served from endpoint address library-example.googleapis.com.
// # It also allows HTTP OPTIONS calls to be passed to the backend, for
// # it to decide whether the subsequent cross-origin request is
// # allowed to proceed.
// - name: library-example.googleapis.com
// allow_cors: true
message Endpoint {
// The canonical name of this endpoint.
string name = 1;
// Unimplemented. Dot not use.
//
// DEPRECATED: This field is no longer supported. Instead of using aliases,
// please specify multiple [google.api.Endpoint][google.api.Endpoint] for each of the intended
// aliases.
//
// Additional names that this endpoint will be hosted on.
repeated string aliases = 2 [deprecated = true];
// The specification of an Internet routable address of API frontend that will
// handle requests to this [API
// Endpoint](https://cloud.google.com/apis/design/glossary). It should be
// either a valid IPv4 address or a fully-qualified domain name. For example,
// "8.8.8.8" or "myservice.appspot.com".
string target = 101;
// Allowing
// [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka
// cross-domain traffic, would allow the backends served from this endpoint to
// receive and respond to HTTP OPTIONS requests. The response will be used by
// the browser to determine whether the subsequent cross-origin request is
// allowed to proceed.
bool allow_cors = 5;
}

View File

@ -0,0 +1,397 @@
// 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.api;
option go_package = "google.golang.org/genproto/googleapis/api/error_reason;error_reason";
option java_multiple_files = true;
option java_outer_classname = "ErrorReasonProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Defines the supported values for `google.rpc.ErrorInfo.reason` for the
// `googleapis.com` error domain. This error domain is reserved for [Service
// Infrastructure](https://cloud.google.com/service-infrastructure/docs/overview).
// For each error info of this domain, the metadata key "service" refers to the
// logical identifier of an API service, such as "pubsub.googleapis.com". The
// "consumer" refers to the entity that consumes an API Service. It typically is
// a Google project that owns the client application or the server resource,
// such as "projects/123". Other metadata keys are specific to each error
// reason. For more information, see the definition of the specific error
// reason.
enum ErrorReason {
// Do not use this default value.
ERROR_REASON_UNSPECIFIED = 0;
// The request is calling a disabled service for a consumer.
//
// Example of an ErrorInfo when the consumer "projects/123" contacting
// "pubsub.googleapis.com" service which is disabled:
//
// { "reason": "SERVICE_DISABLED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "pubsub.googleapis.com"
// }
// }
//
// This response indicates the "pubsub.googleapis.com" has been disabled in
// "projects/123".
SERVICE_DISABLED = 1;
// The request whose associated billing account is disabled.
//
// Example of an ErrorInfo when the consumer "projects/123" fails to contact
// "pubsub.googleapis.com" service because the associated billing account is
// disabled:
//
// { "reason": "BILLING_DISABLED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "pubsub.googleapis.com"
// }
// }
//
// This response indicates the billing account associated has been disabled.
BILLING_DISABLED = 2;
// The request is denied because the provided [API
// key](https://cloud.google.com/docs/authentication/api-keys) is invalid. It
// may be in a bad format, cannot be found, or has been expired).
//
// Example of an ErrorInfo when the request is contacting
// "storage.googleapis.com" service with an invalid API key:
//
// { "reason": "API_KEY_INVALID",
// "domain": "googleapis.com",
// "metadata": {
// "service": "storage.googleapis.com",
// }
// }
API_KEY_INVALID = 3;
// The request is denied because it violates [API key API
// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_api_restrictions).
//
// Example of an ErrorInfo when the consumer "projects/123" fails to call the
// "storage.googleapis.com" service because this service is restricted in the
// API key:
//
// { "reason": "API_KEY_SERVICE_BLOCKED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "storage.googleapis.com"
// }
// }
API_KEY_SERVICE_BLOCKED = 4;
// The request is denied because it violates [API key HTTP
// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_http_restrictions).
//
// Example of an ErrorInfo when the consumer "projects/123" fails to call
// "storage.googleapis.com" service because the http referrer of the request
// violates API key HTTP restrictions:
//
// { "reason": "API_KEY_HTTP_REFERRER_BLOCKED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "storage.googleapis.com",
// }
// }
API_KEY_HTTP_REFERRER_BLOCKED = 7;
// The request is denied because it violates [API key IP address
// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
//
// Example of an ErrorInfo when the consumer "projects/123" fails to call
// "storage.googleapis.com" service because the caller IP of the request
// violates API key IP address restrictions:
//
// { "reason": "API_KEY_IP_ADDRESS_BLOCKED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "storage.googleapis.com",
// }
// }
API_KEY_IP_ADDRESS_BLOCKED = 8;
// The request is denied because it violates [API key Android application
// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
//
// Example of an ErrorInfo when the consumer "projects/123" fails to call
// "storage.googleapis.com" service because the request from the Android apps
// violates the API key Android application restrictions:
//
// { "reason": "API_KEY_ANDROID_APP_BLOCKED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "storage.googleapis.com"
// }
// }
API_KEY_ANDROID_APP_BLOCKED = 9;
// The request is denied because it violates [API key iOS application
// restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions).
//
// Example of an ErrorInfo when the consumer "projects/123" fails to call
// "storage.googleapis.com" service because the request from the iOS apps
// violates the API key iOS application restrictions:
//
// { "reason": "API_KEY_IOS_APP_BLOCKED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "storage.googleapis.com"
// }
// }
API_KEY_IOS_APP_BLOCKED = 13;
// The request is denied because there is not enough rate quota for the
// consumer.
//
// Example of an ErrorInfo when the consumer "projects/123" fails to contact
// "pubsub.googleapis.com" service because consumer's rate quota usage has
// reached the maximum value set for the quota limit
// "ReadsPerMinutePerProject" on the quota metric
// "pubsub.googleapis.com/read_requests":
//
// { "reason": "RATE_LIMIT_EXCEEDED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "pubsub.googleapis.com",
// "quota_metric": "pubsub.googleapis.com/read_requests",
// "quota_limit": "ReadsPerMinutePerProject"
// }
// }
//
// Example of an ErrorInfo when the consumer "projects/123" checks quota on
// the service "dataflow.googleapis.com" and hits the organization quota
// limit "DefaultRequestsPerMinutePerOrganization" on the metric
// "dataflow.googleapis.com/default_requests".
//
// { "reason": "RATE_LIMIT_EXCEEDED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "dataflow.googleapis.com",
// "quota_metric": "dataflow.googleapis.com/default_requests",
// "quota_limit": "DefaultRequestsPerMinutePerOrganization"
// }
// }
RATE_LIMIT_EXCEEDED = 5;
// The request is denied because there is not enough resource quota for the
// consumer.
//
// Example of an ErrorInfo when the consumer "projects/123" fails to contact
// "compute.googleapis.com" service because consumer's resource quota usage
// has reached the maximum value set for the quota limit "VMsPerProject"
// on the quota metric "compute.googleapis.com/vms":
//
// { "reason": "RESOURCE_QUOTA_EXCEEDED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "compute.googleapis.com",
// "quota_metric": "compute.googleapis.com/vms",
// "quota_limit": "VMsPerProject"
// }
// }
//
// Example of an ErrorInfo when the consumer "projects/123" checks resource
// quota on the service "dataflow.googleapis.com" and hits the organization
// quota limit "jobs-per-organization" on the metric
// "dataflow.googleapis.com/job_count".
//
// { "reason": "RESOURCE_QUOTA_EXCEEDED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "dataflow.googleapis.com",
// "quota_metric": "dataflow.googleapis.com/job_count",
// "quota_limit": "jobs-per-organization"
// }
// }
RESOURCE_QUOTA_EXCEEDED = 6;
// The request whose associated billing account address is in a tax restricted
// location, violates the local tax restrictions when creating resources in
// the restricted region.
//
// Example of an ErrorInfo when creating the Cloud Storage Bucket in the
// container "projects/123" under a tax restricted region
// "locations/asia-northeast3":
//
// { "reason": "LOCATION_TAX_POLICY_VIOLATED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "storage.googleapis.com",
// "location": "locations/asia-northeast3"
// }
// }
//
// This response indicates creating the Cloud Storage Bucket in
// "locations/asia-northeast3" violates the location tax restriction.
LOCATION_TAX_POLICY_VIOLATED = 10;
// The request is denied because the caller does not have required permission
// on the user project "projects/123" or the user project is invalid. For more
// information, check the [userProject System
// Parameters](https://cloud.google.com/apis/docs/system-parameters).
//
// Example of an ErrorInfo when the caller is calling Cloud Storage service
// with insufficient permissions on the user project:
//
// { "reason": "USER_PROJECT_DENIED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "storage.googleapis.com"
// }
// }
USER_PROJECT_DENIED = 11;
// The request is denied because the consumer "projects/123" is suspended due
// to Terms of Service(Tos) violations. Check [Project suspension
// guidelines](https://cloud.google.com/resource-manager/docs/project-suspension-guidelines)
// for more information.
//
// Example of an ErrorInfo when calling Cloud Storage service with the
// suspended consumer "projects/123":
//
// { "reason": "CONSUMER_SUSPENDED",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "storage.googleapis.com"
// }
// }
CONSUMER_SUSPENDED = 12;
// The request is denied because the associated consumer is invalid. It may be
// in a bad format, cannot be found, or have been deleted.
//
// Example of an ErrorInfo when calling Cloud Storage service with the
// invalid consumer "projects/123":
//
// { "reason": "CONSUMER_INVALID",
// "domain": "googleapis.com",
// "metadata": {
// "consumer": "projects/123",
// "service": "storage.googleapis.com"
// }
// }
CONSUMER_INVALID = 14;
// The request is denied because it violates [VPC Service
// Controls](https://cloud.google.com/vpc-service-controls/docs/overview).
// The 'uid' field is a random generated identifier that customer can use it
// to search the audit log for a request rejected by VPC Service Controls. For
// more information, please refer [VPC Service Controls
// Troubleshooting](https://cloud.google.com/vpc-service-controls/docs/troubleshooting#unique-id)
//
// Example of an ErrorInfo when the consumer "projects/123" fails to call
// Cloud Storage service because the request is prohibited by the VPC Service
// Controls.
//
// { "reason": "SECURITY_POLICY_VIOLATED",
// "domain": "googleapis.com",
// "metadata": {
// "uid": "123456789abcde",
// "consumer": "projects/123",
// "service": "storage.googleapis.com"
// }
// }
SECURITY_POLICY_VIOLATED = 15;
// The request is denied because the provided access token has expired.
//
// Example of an ErrorInfo when the request is calling Cloud Storage service
// with an expired access token:
//
// { "reason": "ACCESS_TOKEN_EXPIRED",
// "domain": "googleapis.com",
// "metadata": {
// "service": "storage.googleapis.com",
// "method": "google.storage.v1.Storage.GetObject"
// }
// }
ACCESS_TOKEN_EXPIRED = 16;
// The request is denied because the provided access token doesn't have at
// least one of the acceptable scopes required for the API. Please check
// [OAuth 2.0 Scopes for Google
// APIs](https://developers.google.com/identity/protocols/oauth2/scopes) for
// the list of the OAuth 2.0 scopes that you might need to request to access
// the API.
//
// Example of an ErrorInfo when the request is calling Cloud Storage service
// with an access token that is missing required scopes:
//
// { "reason": "ACCESS_TOKEN_SCOPE_INSUFFICIENT",
// "domain": "googleapis.com",
// "metadata": {
// "service": "storage.googleapis.com",
// "method": "google.storage.v1.Storage.GetObject"
// }
// }
ACCESS_TOKEN_SCOPE_INSUFFICIENT = 17;
// The request is denied because the account associated with the provided
// access token is in an invalid state, such as disabled or deleted.
// For more information, see https://cloud.google.com/docs/authentication.
//
// Warning: For privacy reasons, the server may not be able to disclose the
// email address for some accounts. The client MUST NOT depend on the
// availability of the `email` attribute.
//
// Example of an ErrorInfo when the request is to the Cloud Storage API with
// an access token that is associated with a disabled or deleted [service
// account](http://cloud/iam/docs/service-accounts):
//
// { "reason": "ACCOUNT_STATE_INVALID",
// "domain": "googleapis.com",
// "metadata": {
// "service": "storage.googleapis.com",
// "method": "google.storage.v1.Storage.GetObject",
// "email": "user@123.iam.gserviceaccount.com"
// }
// }
ACCOUNT_STATE_INVALID = 18;
// The request is denied because the type of the provided access token is not
// supported by the API being called.
//
// Example of an ErrorInfo when the request is to the Cloud Storage API with
// an unsupported token type.
//
// { "reason": "ACCESS_TOKEN_TYPE_UNSUPPORTED",
// "domain": "googleapis.com",
// "metadata": {
// "service": "storage.googleapis.com",
// "method": "google.storage.v1.Storage.GetObject"
// }
// }
ACCESS_TOKEN_TYPE_UNSUPPORTED = 19;
}

View File

@ -0,0 +1 @@
exports_files(glob(["*.yaml"]))

View File

@ -0,0 +1,61 @@
type: google.api.Service
config_version: 3
name: cel.googleapis.com
title: Common Expression Language
apis:
- name: google.api.expr.v1alpha1.ConformanceService
- name: google.api.expr.v1alpha1.CelService
documentation:
summary: Defines common types for the Common Expression Language.
overview: |-
# Common Expression Language
The Common Expression Language (CEL) implements common semantics for
expression evaluation, enabling different applications to more easily
interoperate.
Key Applications
* Security policy: organization have complex infrastructure and need
common tooling to reason about the system as a whole * Protocols:
expressions are a useful data type and require interoperability across
programming languages and platforms.
Guiding philosophy:
1. Keep it small & fast. * CEL evaluates in linear time, is mutation
free, and not Turing-complete. This limitation is a feature of the language
design, which allows the implementation to evaluate orders of magnitude
faster than equivalently sandboxed JavaScript. 2. Make it extensible. *
CEL is designed to be embedded in applications, and allows for extensibility
via its context which allows for functions and data to be provided by the
software that embeds it. 3. Developer-friendly * The language is
approachable to developers. The initial spec was based on the experience of
developing Firebase Rules and usability testing many prior iterations. *
The library itself and accompanying toolings should be easy to adopt by
teams that seek to integrate CEL into their platforms.
The required components of a system that supports CEL are:
* The textual representation of an expression as written by a developer.
It is of similar syntax of expressions in C/C++/Java/JavaScript * A binary
representation of an expression. It is an abstract syntax tree (AST). * A
compiler library that converts the textual representation to the binary
representation. This can be done ahead of time (in the control plane) or
just before evaluation (in the data plane). * A context containing one or
more typed variables, often protobuf messages. Most use-case will use
attribute_context.proto * An evaluator library that takes the binary
format in the context and produces a result, usually a Boolean.
Example of boolean conditions and object construction:
``` c // Condition account.balance >= transaction.withdrawal ||
(account.overdraftProtection && account.overdraftLimit >=
transaction.withdrawal - account.balance)
// Object construction common.GeoPoint{ latitude: 10.0, longitude: -5.5 }
```

View File

@ -0,0 +1,178 @@
# This file was automatically generated by BuildFileGenerator
# 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")
proto_library(
name = "conformance_proto",
srcs = [
"conformance_service.proto",
],
deps = [
"//google/api/expr/v1alpha1:checked_proto",
"//google/api/expr/v1alpha1:eval_proto",
"//google/api/expr/v1alpha1:syntax_proto",
"//google/api:client_proto",
"//google/rpc:status_proto",
],
)
##############################################################################
# Java
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"java_grpc_library",
"java_proto_library",
)
java_proto_library(
name = "conformance_java_proto",
deps = [":conformance_proto"],
)
java_grpc_library(
name = "conformance_java_grpc",
srcs = [":conformance_proto"],
deps = [":conformance_java_proto"],
)
##############################################################################
# Go
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"go_proto_library",
)
go_proto_library(
name = "conformance_go_proto",
compilers = ["@io_bazel_rules_go//proto:go_grpc"],
importpath = "google.golang.org/genproto/googleapis/api/expr/conformance/v1alpha1",
protos = [":conformance_proto"],
deps = [
"//google/api/expr/v1alpha1:expr_go_proto",
"//google/api:annotations_go_proto",
"//google/rpc:status_go_proto",
],
)
##############################################################################
# Python
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"moved_proto_library",
"py_grpc_library",
"py_proto_library",
)
moved_proto_library(
name = "conformance_moved_proto",
srcs = [":conformance_proto"],
deps = [
"//google/api/expr/v1alpha1:checked_proto",
"//google/api/expr/v1alpha1:eval_proto",
"//google/api/expr/v1alpha1:syntax_proto",
"//google/api:client_proto",
"//google/rpc:status_proto",
],
)
py_proto_library(
name = "conformance_py_proto",
deps = [":conformance_moved_proto"],
)
py_grpc_library(
name = "conformance_py_grpc",
srcs = [":conformance_moved_proto"],
deps = [":conformance_py_proto"],
)
##############################################################################
# PHP
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"php_grpc_library",
"php_proto_library",
)
php_proto_library(
name = "conformance_php_proto",
deps = [":conformance_proto"],
)
php_grpc_library(
name = "conformance_php_grpc",
srcs = [":conformance_proto"],
deps = [":conformance_php_proto"],
)
##############################################################################
# Ruby
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"ruby_grpc_library",
"ruby_proto_library",
)
ruby_proto_library(
name = "conformance_ruby_proto",
deps = [":conformance_proto"],
)
ruby_grpc_library(
name = "conformance_ruby_grpc",
srcs = [":conformance_proto"],
deps = [":conformance_ruby_proto"],
)
##############################################################################
# C#
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"csharp_grpc_library",
"csharp_proto_library",
)
csharp_proto_library(
name = "conformance_csharp_proto",
deps = [":conformance_proto"],
)
csharp_grpc_library(
name = "conformance_csharp_grpc",
srcs = [":conformance_proto"],
deps = [":conformance_csharp_proto"],
)
##############################################################################
# C++
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"cc_grpc_library",
"cc_proto_library",
)
cc_proto_library(
name = "conformance_cc_proto",
deps = [":conformance_proto"],
)
cc_grpc_library(
name = "conformance_cc_grpc",
srcs = [":conformance_proto"],
generate_mocks = True,
grpc_only = True,
deps = [":conformance_cc_proto"],
)

View File

@ -0,0 +1,166 @@
// 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.
syntax = "proto3";
package google.api.expr.conformance.v1alpha1;
import "google/api/expr/v1alpha1/checked.proto";
import "google/api/expr/v1alpha1/eval.proto";
import "google/api/expr/v1alpha1/syntax.proto";
import "google/rpc/status.proto";
import "google/api/client.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/conformance/v1alpha1;confpb";
option java_multiple_files = true;
option java_outer_classname = "ConformanceServiceProto";
option java_package = "com.google.api.expr.conformance.v1alpha1";
// Access a CEL implementation from another process or machine.
// A CEL implementation is decomposed as a parser, a static checker,
// and an evaluator. Every CEL implementation is expected to provide
// a server for this API. The API will be used for conformance testing
// and other utilities.
service ConformanceService {
option (google.api.default_host) = "cel.googleapis.com";
// Transforms CEL source text into a parsed representation.
rpc Parse(ParseRequest) returns (ParseResponse) {
}
// Runs static checks on a parsed CEL representation and return
// an annotated representation, or a set of issues.
rpc Check(CheckRequest) returns (CheckResponse) {
}
// Evaluates a parsed or annotation CEL representation given
// values of external bindings.
rpc Eval(EvalRequest) returns (EvalResponse) {
}
}
// Request message for the Parse method.
message ParseRequest {
// Required. Source text in CEL syntax.
string cel_source = 1;
// Tag for version of CEL syntax, for future use.
string syntax_version = 2;
// File or resource for source text, used in [SourceInfo][google.api.SourceInfo].
string source_location = 3;
// Prevent macro expansion. See "Macros" in Language Defiinition.
bool disable_macros = 4;
}
// Response message for the Parse method.
message ParseResponse {
// The parsed representation, or unset if parsing failed.
google.api.expr.v1alpha1.ParsedExpr parsed_expr = 1;
// Any number of issues with [StatusDetails][] as the details.
repeated google.rpc.Status issues = 2;
}
// Request message for the Check method.
message CheckRequest {
// Required. The parsed representation of the CEL program.
google.api.expr.v1alpha1.ParsedExpr parsed_expr = 1;
// Declarations of types for external variables and functions.
// Required if program uses external variables or functions
// not in the default environment.
repeated google.api.expr.v1alpha1.Decl type_env = 2;
// The protocol buffer context. See "Name Resolution" in the
// Language Definition.
string container = 3;
// If true, use only the declarations in [type_env][google.api.expr.conformance.v1alpha1.CheckRequest.type_env]. If false (default),
// add declarations for the standard definitions to the type environment. See
// "Standard Definitions" in the Language Definition.
bool no_std_env = 4;
}
// Response message for the Check method.
message CheckResponse {
// The annotated representation, or unset if checking failed.
google.api.expr.v1alpha1.CheckedExpr checked_expr = 1;
// Any number of issues with [StatusDetails][] as the details.
repeated google.rpc.Status issues = 2;
}
// Request message for the Eval method.
message EvalRequest {
// Required. Either the parsed or annotated representation of the CEL program.
oneof expr_kind {
// Evaluate based on the parsed representation.
google.api.expr.v1alpha1.ParsedExpr parsed_expr = 1;
// Evaluate based on the checked representation.
google.api.expr.v1alpha1.CheckedExpr checked_expr = 2;
}
// Bindings for the external variables. The types SHOULD be compatible
// with the type environment in [CheckRequest][google.api.expr.conformance.v1alpha1.CheckRequest], if checked.
map<string, google.api.expr.v1alpha1.ExprValue> bindings = 3;
// SHOULD be the same container as used in [CheckRequest][google.api.expr.conformance.v1alpha1.CheckRequest], if checked.
string container = 4;
}
// Response message for the Eval method.
message EvalResponse {
// The execution result, or unset if execution couldn't start.
google.api.expr.v1alpha1.ExprValue result = 1;
// Any number of issues with [StatusDetails][] as the details.
// Note that CEL execution errors are reified into [ExprValue][].
// Nevertheless, we'll allow out-of-band issues to be raised,
// which also makes the replies more regular.
repeated google.rpc.Status issues = 2;
}
// Warnings or errors in service execution are represented by
// [google.rpc.Status][google.rpc.Status] messages, with the following message
// in the details field.
message IssueDetails {
// Severities of issues.
enum Severity {
// An unspecified severity.
SEVERITY_UNSPECIFIED = 0;
// Deprecation issue for statements and method that may no longer be
// supported or maintained.
DEPRECATION = 1;
// Warnings such as: unused variables.
WARNING = 2;
// Errors such as: unmatched curly braces or variable redefinition.
ERROR = 3;
}
// The severity of the issue.
Severity severity = 1;
// Position in the source, if known.
google.api.expr.v1alpha1.SourcePosition position = 2;
// Expression ID from [Expr][], 0 if unknown.
int64 id = 3;
}

View File

@ -0,0 +1,240 @@
# This file was automatically generated by BuildFileGenerator
# 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")
proto_library(
name = "expr_proto",
srcs = [
"checked.proto",
"eval.proto",
"explain.proto",
"syntax.proto",
"value.proto",
],
deps = [
"//google/rpc:status_proto",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:struct_proto",
"@com_google_protobuf//:timestamp_proto",
],
)
proto_library(
name = "checked_proto",
srcs = ["checked.proto"],
deps = [
":syntax_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:struct_proto",
],
)
proto_library(
name = "eval_proto",
srcs = ["eval.proto"],
deps = [
":value_proto",
"//google/rpc:status_proto",
],
)
proto_library(
name = "explain_proto",
srcs = ["explain.proto"],
deps = [
":value_proto",
],
)
proto_library(
name = "syntax_proto",
srcs = ["syntax.proto"],
deps = [
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:struct_proto",
"@com_google_protobuf//:timestamp_proto",
],
)
proto_library(
name = "value_proto",
srcs = ["value.proto"],
deps = [
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:struct_proto",
],
)
##############################################################################
# Java
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"java_grpc_library",
"java_proto_library",
)
java_proto_library(
name = "expr_java_proto",
deps = [":expr_proto"],
)
java_grpc_library(
name = "expr_java_grpc",
srcs = [":expr_proto"],
deps = [":expr_java_proto"],
)
##############################################################################
# Go
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"go_proto_library",
)
go_proto_library(
name = "expr_go_proto",
compilers = ["@io_bazel_rules_go//proto:go_grpc"],
importpath = "google.golang.org/genproto/googleapis/api/expr/v1alpha1",
protos = [":expr_proto"],
deps = [
"//google/rpc:status_go_proto",
],
)
##############################################################################
# Python
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"moved_proto_library",
"py_grpc_library",
"py_proto_library",
)
moved_proto_library(
name = "expr_moved_proto",
srcs = [":expr_proto"],
deps = [
"//google/rpc:status_proto",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:struct_proto",
"@com_google_protobuf//:timestamp_proto",
],
)
py_proto_library(
name = "expr_py_proto",
deps = [":expr_moved_proto"],
)
py_grpc_library(
name = "expr_py_grpc",
srcs = [":expr_moved_proto"],
deps = [":expr_py_proto"],
)
##############################################################################
# PHP
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"php_grpc_library",
"php_proto_library",
)
php_proto_library(
name = "expr_php_proto",
deps = [":expr_proto"],
)
php_grpc_library(
name = "expr_php_grpc",
srcs = [":expr_proto"],
deps = [":expr_php_proto"],
)
##############################################################################
# Ruby
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"ruby_grpc_library",
"ruby_proto_library",
)
ruby_proto_library(
name = "expr_ruby_proto",
deps = [":expr_proto"],
)
ruby_grpc_library(
name = "expr_ruby_grpc",
srcs = [":expr_proto"],
deps = [":expr_ruby_proto"],
)
##############################################################################
# C#
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"csharp_grpc_library",
"csharp_proto_library",
)
csharp_proto_library(
name = "expr_csharp_proto",
deps = [":expr_proto"],
)
csharp_grpc_library(
name = "expr_csharp_grpc",
srcs = [":expr_proto"],
deps = [":expr_csharp_proto"],
)
##############################################################################
# C++
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"cc_proto_library",
)
cc_proto_library(
name = "checked_cc_proto",
deps = [":checked_proto"],
)
cc_proto_library(
name = "eval_cc_proto",
deps = [":eval_proto"],
)
cc_proto_library(
name = "explain_cc_proto",
deps = [":explain_proto"],
)
cc_proto_library(
name = "syntax_cc_proto",
deps = [":syntax_proto"],
)
cc_proto_library(
name = "value_cc_proto",
deps = [":value_proto"],
)

View File

@ -0,0 +1,338 @@
// 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.
syntax = "proto3";
package google.api.expr.v1alpha1;
import "google/api/expr/v1alpha1/syntax.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/struct.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr";
option java_multiple_files = true;
option java_outer_classname = "DeclProto";
option java_package = "com.google.api.expr.v1alpha1";
// Protos for representing CEL declarations and typed checked expressions.
// A CEL expression which has been successfully type checked.
message CheckedExpr {
// A map from expression ids to resolved references.
//
// The following entries are in this table:
//
// - An Ident or Select expression is represented here if it resolves to a
// declaration. For instance, if `a.b.c` is represented by
// `select(select(id(a), b), c)`, and `a.b` resolves to a declaration,
// while `c` is a field selection, then the reference is attached to the
// nested select expression (but not to the id or or the outer select).
// In turn, if `a` resolves to a declaration and `b.c` are field selections,
// the reference is attached to the ident expression.
// - Every Call expression has an entry here, identifying the function being
// called.
// - Every CreateStruct expression for a message has an entry, identifying
// the message.
map<int64, Reference> reference_map = 2;
// A map from expression ids to types.
//
// Every expression node which has a type different than DYN has a mapping
// here. If an expression has type DYN, it is omitted from this map to save
// space.
map<int64, Type> type_map = 3;
// The source info derived from input that generated the parsed `expr` and
// any optimizations made during the type-checking pass.
SourceInfo source_info = 5;
// The expr version indicates the major / minor version number of the `expr`
// representation.
//
// The most common reason for a version change will be to indicate to the CEL
// runtimes that transformations have been performed on the expr during static
// analysis. In some cases, this will save the runtime the work of applying
// the same or similar transformations prior to evaluation.
string expr_version = 6;
// The checked expression. Semantically equivalent to the parsed `expr`, but
// may have structural differences.
Expr expr = 4;
}
// Represents a CEL type.
message Type {
// List type with typed elements, e.g. `list<example.proto.MyMessage>`.
message ListType {
// The element type.
Type elem_type = 1;
}
// Map type with parameterized key and value types, e.g. `map<string, int>`.
message MapType {
// The type of the key.
Type key_type = 1;
// The type of the value.
Type value_type = 2;
}
// Function type with result and arg types.
message FunctionType {
// Result type of the function.
Type result_type = 1;
// Argument types of the function.
repeated Type arg_types = 2;
}
// Application defined abstract type.
message AbstractType {
// The fully qualified name of this abstract type.
string name = 1;
// Parameter types for this abstract type.
repeated Type parameter_types = 2;
}
// CEL primitive types.
enum PrimitiveType {
// Unspecified type.
PRIMITIVE_TYPE_UNSPECIFIED = 0;
// Boolean type.
BOOL = 1;
// Int64 type.
//
// Proto-based integer values are widened to int64.
INT64 = 2;
// Uint64 type.
//
// Proto-based unsigned integer values are widened to uint64.
UINT64 = 3;
// Double type.
//
// Proto-based float values are widened to double values.
DOUBLE = 4;
// String type.
STRING = 5;
// Bytes type.
BYTES = 6;
}
// Well-known protobuf types treated with first-class support in CEL.
enum WellKnownType {
// Unspecified type.
WELL_KNOWN_TYPE_UNSPECIFIED = 0;
// Well-known protobuf.Any type.
//
// Any types are a polymorphic message type. During type-checking they are
// treated like `DYN` types, but at runtime they are resolved to a specific
// message type specified at evaluation time.
ANY = 1;
// Well-known protobuf.Timestamp type, internally referenced as `timestamp`.
TIMESTAMP = 2;
// Well-known protobuf.Duration type, internally referenced as `duration`.
DURATION = 3;
}
// The kind of type.
oneof type_kind {
// Dynamic type.
google.protobuf.Empty dyn = 1;
// Null value.
google.protobuf.NullValue null = 2;
// Primitive types: `true`, `1u`, `-2.0`, `'string'`, `b'bytes'`.
PrimitiveType primitive = 3;
// Wrapper of a primitive type, e.g. `google.protobuf.Int64Value`.
PrimitiveType wrapper = 4;
// Well-known protobuf type such as `google.protobuf.Timestamp`.
WellKnownType well_known = 5;
// Parameterized list with elements of `list_type`, e.g. `list<timestamp>`.
ListType list_type = 6;
// Parameterized map with typed keys and values.
MapType map_type = 7;
// Function type.
FunctionType function = 8;
// Protocol buffer message type.
//
// The `message_type` string specifies the qualified message type name. For
// example, `google.plus.Profile`.
string message_type = 9;
// Type param type.
//
// The `type_param` string specifies the type parameter name, e.g. `list<E>`
// would be a `list_type` whose element type was a `type_param` type
// named `E`.
string type_param = 10;
// Type type.
//
// The `type` value specifies the target type. e.g. int is type with a
// target type of `Primitive.INT`.
Type type = 11;
// Error type.
//
// During type-checking if an expression is an error, its type is propagated
// as the `ERROR` type. This permits the type-checker to discover other
// errors present in the expression.
google.protobuf.Empty error = 12;
// Abstract, application defined type.
AbstractType abstract_type = 14;
}
}
// Represents a declaration of a named value or function.
//
// A declaration is part of the contract between the expression, the agent
// evaluating that expression, and the caller requesting evaluation.
message Decl {
// Identifier declaration which specifies its type and optional `Expr` value.
//
// An identifier without a value is a declaration that must be provided at
// evaluation time. An identifier with a value should resolve to a constant,
// but may be used in conjunction with other identifiers bound at evaluation
// time.
message IdentDecl {
// Required. The type of the identifier.
Type type = 1;
// The constant value of the identifier. If not specified, the identifier
// must be supplied at evaluation time.
Constant value = 2;
// Documentation string for the identifier.
string doc = 3;
}
// Function declaration specifies one or more overloads which indicate the
// function's parameter types and return type.
//
// Functions have no observable side-effects (there may be side-effects like
// logging which are not observable from CEL).
message FunctionDecl {
// An overload indicates a function's parameter types and return type, and
// may optionally include a function body described in terms of [Expr][google.api.expr.v1alpha1.Expr]
// values.
//
// Functions overloads are declared in either a function or method
// call-style. For methods, the `params[0]` is the expected type of the
// target receiver.
//
// Overloads must have non-overlapping argument types after erasure of all
// parameterized type variables (similar as type erasure in Java).
message Overload {
// Required. Globally unique overload name of the function which reflects
// the function name and argument types.
//
// This will be used by a [Reference][google.api.expr.v1alpha1.Reference] to indicate the `overload_id` that
// was resolved for the function `name`.
string overload_id = 1;
// List of function parameter [Type][google.api.expr.v1alpha1.Type] values.
//
// Param types are disjoint after generic type parameters have been
// replaced with the type `DYN`. Since the `DYN` type is compatible with
// any other type, this means that if `A` is a type parameter, the
// function types `int<A>` and `int<int>` are not disjoint. Likewise,
// `map<string, string>` is not disjoint from `map<K, V>`.
//
// When the `result_type` of a function is a generic type param, the
// type param name also appears as the `type` of on at least one params.
repeated Type params = 2;
// The type param names associated with the function declaration.
//
// For example, `function ex<K,V>(K key, map<K, V> map) : V` would yield
// the type params of `K, V`.
repeated string type_params = 3;
// Required. The result type of the function. For example, the operator
// `string.isEmpty()` would have `result_type` of `kind: BOOL`.
Type result_type = 4;
// Whether the function is to be used in a method call-style `x.f(...)`
// of a function call-style `f(x, ...)`.
//
// For methods, the first parameter declaration, `params[0]` is the
// expected type of the target receiver.
bool is_instance_function = 5;
// Documentation string for the overload.
string doc = 6;
}
// Required. List of function overloads, must contain at least one overload.
repeated Overload overloads = 1;
}
// The fully qualified name of the declaration.
//
// Declarations are organized in containers and this represents the full path
// to the declaration in its container, as in `google.api.expr.Decl`.
//
// Declarations used as [FunctionDecl.Overload][google.api.expr.v1alpha1.Decl.FunctionDecl.Overload] parameters may or may not
// have a name depending on whether the overload is function declaration or a
// function definition containing a result [Expr][google.api.expr.v1alpha1.Expr].
string name = 1;
// Required. The declaration kind.
oneof decl_kind {
// Identifier declaration.
IdentDecl ident = 2;
// Function declaration.
FunctionDecl function = 3;
}
}
// Describes a resolved reference to a declaration.
message Reference {
// The fully qualified name of the declaration.
string name = 1;
// For references to functions, this is a list of `Overload.overload_id`
// values which match according to typing rules.
//
// If the list has more than one element, overload resolution among the
// presented candidates must happen at runtime because of dynamic types. The
// type checker attempts to narrow down this list as much as possible.
//
// Empty if this is not a reference to a [Decl.FunctionDecl][google.api.expr.v1alpha1.Decl.FunctionDecl].
repeated string overload_id = 3;
// For references to constants, this may contain the value of the
// constant if known at compile time.
Constant value = 4;
}

View File

@ -0,0 +1,118 @@
// 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.
syntax = "proto3";
package google.api.expr.v1alpha1;
import "google/api/expr/v1alpha1/value.proto";
import "google/rpc/status.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr";
option java_multiple_files = true;
option java_outer_classname = "EvalProto";
option java_package = "com.google.api.expr.v1alpha1";
// The state of an evaluation.
//
// Can represent an inital, partial, or completed state of evaluation.
message EvalState {
// A single evalution result.
message Result {
// The id of the expression this result if for.
int64 expr = 1;
// The index in `values` of the resulting value.
int64 value = 2;
}
// The unique values referenced in this message.
repeated ExprValue values = 1;
// An ordered list of results.
//
// Tracks the flow of evaluation through the expression.
// May be sparse.
repeated Result results = 3;
}
// The value of an evaluated expression.
message ExprValue {
// An expression can resolve to a value, error or unknown.
oneof kind {
// A concrete value.
Value value = 1;
// The set of errors in the critical path of evalution.
//
// Only errors in the critical path are included. For example,
// `(<error1> || true) && <error2>` will only result in `<error2>`,
// while `<error1> || <error2>` will result in both `<error1>` and
// `<error2>`.
//
// Errors cause by the presence of other errors are not included in the
// set. For example `<error1>.foo`, `foo(<error1>)`, and `<error1> + 1` will
// only result in `<error1>`.
//
// Multiple errors *might* be included when evaluation could result
// in different errors. For example `<error1> + <error2>` and
// `foo(<error1>, <error2>)` may result in `<error1>`, `<error2>` or both.
// The exact subset of errors included for this case is unspecified and
// depends on the implementation details of the evaluator.
ErrorSet error = 2;
// The set of unknowns in the critical path of evaluation.
//
// Unknown behaves identically to Error with regards to propagation.
// Specifically, only unknowns in the critical path are included, unknowns
// caused by the presence of other unknowns are not included, and multiple
// unknowns *might* be included included when evaluation could result in
// different unknowns. For example:
//
// (<unknown[1]> || true) && <unknown[2]> -> <unknown[2]>
// <unknown[1]> || <unknown[2]> -> <unknown[1,2]>
// <unknown[1]>.foo -> <unknown[1]>
// foo(<unknown[1]>) -> <unknown[1]>
// <unknown[1]> + <unknown[2]> -> <unknown[1]> or <unknown[2[>
//
// Unknown takes precidence over Error in cases where a `Value` can short
// circuit the result:
//
// <error> || <unknown> -> <unknown>
// <error> && <unknown> -> <unknown>
//
// Errors take precidence in all other cases:
//
// <unknown> + <error> -> <error>
// foo(<unknown>, <error>) -> <error>
UnknownSet unknown = 3;
}
}
// A set of errors.
//
// The errors included depend on the context. See `ExprValue.error`.
message ErrorSet {
// The errors in the set.
repeated google.rpc.Status errors = 1;
}
// A set of expressions for which the value is unknown.
//
// The unknowns included depend on the context. See `ExprValue.unknown`.
message UnknownSet {
// The ids of the expressions with unknown values.
repeated int64 exprs = 1;
}

View File

@ -0,0 +1,53 @@
// 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.
syntax = "proto3";
package google.api.expr.v1alpha1;
import "google/api/expr/v1alpha1/value.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr";
option java_multiple_files = true;
option java_outer_classname = "ExplainProto";
option java_package = "com.google.api.expr.v1alpha1";
// Values of intermediate expressions produced when evaluating expression.
// Deprecated, use `EvalState` instead.
message Explain {
option deprecated = true;
// ID and value index of one step.
message ExprStep {
// ID of corresponding Expr node.
int64 id = 1;
// Index of the value in the values list.
int32 value_index = 2;
}
// All of the observed values.
//
// The field value_index is an index in the values list.
// Separating values from steps is needed to remove redundant values.
repeated Value values = 1;
// List of steps.
//
// Repeated evaluations of the same expression generate new ExprStep
// instances. The order of such ExprStep instances matches the order of
// elements returned by Comprehension.iter_range.
repeated ExprStep expr_steps = 2;
}

View File

@ -0,0 +1,328 @@
// 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.
syntax = "proto3";
package google.api.expr.v1alpha1;
import "google/protobuf/duration.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr";
option java_multiple_files = true;
option java_outer_classname = "SyntaxProto";
option java_package = "com.google.api.expr.v1alpha1";
// A representation of the abstract syntax of the Common Expression Language.
// An expression together with source information as returned by the parser.
message ParsedExpr {
// The parsed expression.
Expr expr = 2;
// The source info derived from input that generated the parsed `expr`.
SourceInfo source_info = 3;
}
// An abstract representation of a common expression.
//
// Expressions are abstractly represented as a collection of identifiers,
// select statements, function calls, literals, and comprehensions. All
// operators with the exception of the '.' operator are modelled as function
// calls. This makes it easy to represent new operators into the existing AST.
//
// All references within expressions must resolve to a [Decl][google.api.expr.v1alpha1.Decl] provided at
// type-check for an expression to be valid. A reference may either be a bare
// identifier `name` or a qualified identifier `google.api.name`. References
// may either refer to a value or a function declaration.
//
// For example, the expression `google.api.name.startsWith('expr')` references
// the declaration `google.api.name` within a [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression, and
// the function declaration `startsWith`.
message Expr {
// An identifier expression. e.g. `request`.
message Ident {
// Required. Holds a single, unqualified identifier, possibly preceded by a
// '.'.
//
// Qualified names are represented by the [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression.
string name = 1;
}
// A field selection expression. e.g. `request.auth`.
message Select {
// Required. The target of the selection expression.
//
// For example, in the select expression `request.auth`, the `request`
// portion of the expression is the `operand`.
Expr operand = 1;
// Required. The name of the field to select.
//
// For example, in the select expression `request.auth`, the `auth` portion
// of the expression would be the `field`.
string field = 2;
// Whether the select is to be interpreted as a field presence test.
//
// This results from the macro `has(request.auth)`.
bool test_only = 3;
}
// A call expression, including calls to predefined functions and operators.
//
// For example, `value == 10`, `size(map_value)`.
message Call {
// The target of an method call-style expression. For example, `x` in
// `x.f()`.
Expr target = 1;
// Required. The name of the function or method being called.
string function = 2;
// The arguments.
repeated Expr args = 3;
}
// A list creation expression.
//
// Lists may either be homogenous, e.g. `[1, 2, 3]`, or heterogeneous, e.g.
// `dyn([1, 'hello', 2.0])`
message CreateList {
// The elements part of the list.
repeated Expr elements = 1;
}
// A map or message creation expression.
//
// Maps are constructed as `{'key_name': 'value'}`. Message construction is
// similar, but prefixed with a type name and composed of field ids:
// `types.MyType{field_id: 'value'}`.
message CreateStruct {
// Represents an entry.
message Entry {
// Required. An id assigned to this node by the parser which is unique
// in a given expression tree. This is used to associate type
// information and other attributes to the node.
int64 id = 1;
// The `Entry` key kinds.
oneof key_kind {
// The field key for a message creator statement.
string field_key = 2;
// The key expression for a map creation statement.
Expr map_key = 3;
}
// Required. The value assigned to the key.
Expr value = 4;
}
// The type name of the message to be created, empty when creating map
// literals.
string message_name = 1;
// The entries in the creation expression.
repeated Entry entries = 2;
}
// A comprehension expression applied to a list or map.
//
// Comprehensions are not part of the core syntax, but enabled with macros.
// A macro matches a specific call signature within a parsed AST and replaces
// the call with an alternate AST block. Macro expansion happens at parse
// time.
//
// The following macros are supported within CEL:
//
// Aggregate type macros may be applied to all elements in a list or all keys
// in a map:
//
// * `all`, `exists`, `exists_one` - test a predicate expression against
// the inputs and return `true` if the predicate is satisfied for all,
// any, or only one value `list.all(x, x < 10)`.
// * `filter` - test a predicate expression against the inputs and return
// the subset of elements which satisfy the predicate:
// `payments.filter(p, p > 1000)`.
// * `map` - apply an expression to all elements in the input and return the
// output aggregate type: `[1, 2, 3].map(i, i * i)`.
//
// The `has(m.x)` macro tests whether the property `x` is present in struct
// `m`. The semantics of this macro depend on the type of `m`. For proto2
// messages `has(m.x)` is defined as 'defined, but not set`. For proto3, the
// macro tests whether the property is set to its default. For map and struct
// types, the macro tests whether the property `x` is defined on `m`.
message Comprehension {
// The name of the iteration variable.
string iter_var = 1;
// The range over which var iterates.
Expr iter_range = 2;
// The name of the variable used for accumulation of the result.
string accu_var = 3;
// The initial value of the accumulator.
Expr accu_init = 4;
// An expression which can contain iter_var and accu_var.
//
// Returns false when the result has been computed and may be used as
// a hint to short-circuit the remainder of the comprehension.
Expr loop_condition = 5;
// An expression which can contain iter_var and accu_var.
//
// Computes the next value of accu_var.
Expr loop_step = 6;
// An expression which can contain accu_var.
//
// Computes the result.
Expr result = 7;
}
// Required. An id assigned to this node by the parser which is unique in a
// given expression tree. This is used to associate type information and other
// attributes to a node in the parse tree.
int64 id = 2;
// Required. Variants of expressions.
oneof expr_kind {
// A literal expression.
Constant const_expr = 3;
// An identifier expression.
Ident ident_expr = 4;
// A field selection expression, e.g. `request.auth`.
Select select_expr = 5;
// A call expression, including calls to predefined functions and operators.
Call call_expr = 6;
// A list creation expression.
CreateList list_expr = 7;
// A map or message creation expression.
CreateStruct struct_expr = 8;
// A comprehension expression.
Comprehension comprehension_expr = 9;
}
}
// Represents a primitive literal.
//
// Named 'Constant' here for backwards compatibility.
//
// This is similar as the primitives supported in the well-known type
// `google.protobuf.Value`, but richer so it can represent CEL's full range of
// primitives.
//
// Lists and structs are not included as constants as these aggregate types may
// contain [Expr][google.api.expr.v1alpha1.Expr] elements which require evaluation and are thus not constant.
//
// Examples of literals include: `"hello"`, `b'bytes'`, `1u`, `4.2`, `-2`,
// `true`, `null`.
message Constant {
// Required. The valid constant kinds.
oneof constant_kind {
// null value.
google.protobuf.NullValue null_value = 1;
// boolean value.
bool bool_value = 2;
// int64 value.
int64 int64_value = 3;
// uint64 value.
uint64 uint64_value = 4;
// double value.
double double_value = 5;
// string value.
string string_value = 6;
// bytes value.
bytes bytes_value = 7;
// protobuf.Duration value.
//
// Deprecated: duration is no longer considered a builtin cel type.
google.protobuf.Duration duration_value = 8 [deprecated = true];
// protobuf.Timestamp value.
//
// Deprecated: timestamp is no longer considered a builtin cel type.
google.protobuf.Timestamp timestamp_value = 9 [deprecated = true];
}
}
// Source information collected at parse time.
message SourceInfo {
// The syntax version of the source, e.g. `cel1`.
string syntax_version = 1;
// The location name. All position information attached to an expression is
// relative to this location.
//
// The location could be a file, UI element, or similar. For example,
// `acme/app/AnvilPolicy.cel`.
string location = 2;
// Monotonically increasing list of code point offsets where newlines
// `\n` appear.
//
// The line number of a given position is the index `i` where for a given
// `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The
// column may be derivd from `id_positions[id] - line_offsets[i]`.
repeated int32 line_offsets = 3;
// A map from the parse node id (e.g. `Expr.id`) to the code point offset
// within the source.
map<int64, int32> positions = 4;
// A map from the parse node id where a macro replacement was made to the
// call `Expr` that resulted in a macro expansion.
//
// For example, `has(value.field)` is a function call that is replaced by a
// `test_only` field selection in the AST. Likewise, the call
// `list.exists(e, e > 10)` translates to a comprehension expression. The key
// in the map corresponds to the expression id of the expanded macro, and the
// value is the call `Expr` that was replaced.
map<int64, Expr> macro_calls = 5;
}
// A specific position in source.
message SourcePosition {
// The soucre location name (e.g. file name).
string location = 1;
// The UTF-8 code unit offset.
int32 offset = 2;
// The 1-based index of the starting line in the source text
// where the issue occurs, or 0 if unknown.
int32 line = 3;
// The 0-based index of the starting position within the line of source text
// where the issue occurs. Only meaningful if line is nonzero.
int32 column = 4;
}

View File

@ -0,0 +1,115 @@
// 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.
syntax = "proto3";
package google.api.expr.v1alpha1;
import "google/protobuf/any.proto";
import "google/protobuf/struct.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr";
option java_multiple_files = true;
option java_outer_classname = "ValueProto";
option java_package = "com.google.api.expr.v1alpha1";
// Contains representations for CEL runtime values.
// Represents a CEL value.
//
// This is similar to `google.protobuf.Value`, but can represent CEL's full
// range of values.
message Value {
// Required. The valid kinds of values.
oneof kind {
// Null value.
google.protobuf.NullValue null_value = 1;
// Boolean value.
bool bool_value = 2;
// Signed integer value.
int64 int64_value = 3;
// Unsigned integer value.
uint64 uint64_value = 4;
// Floating point value.
double double_value = 5;
// UTF-8 string value.
string string_value = 6;
// Byte string value.
bytes bytes_value = 7;
// An enum value.
EnumValue enum_value = 9;
// The proto message backing an object value.
google.protobuf.Any object_value = 10;
// Map value.
MapValue map_value = 11;
// List value.
ListValue list_value = 12;
// Type value.
string type_value = 15;
}
}
// An enum value.
message EnumValue {
// The fully qualified name of the enum type.
string type = 1;
// The value of the enum.
int32 value = 2;
}
// A list.
//
// Wrapped in a message so 'not set' and empty can be differentiated, which is
// required for use in a 'oneof'.
message ListValue {
// The ordered values in the list.
repeated Value values = 1;
}
// A map.
//
// Wrapped in a message so 'not set' and empty can be differentiated, which is
// required for use in a 'oneof'.
message MapValue {
// An entry in the map.
message Entry {
// The key.
//
// Must be unique with in the map.
// Currently only boolean, int, uint, and string values can be keys.
Value key = 1;
// The value.
Value value = 2;
}
// The set of map entries.
//
// CEL has fewer restrictions on keys, so a protobuf map represenation
// cannot be used.
repeated Entry entries = 1;
}

View File

@ -0,0 +1,91 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
# This is an API workspace, having public visibility by default makes perfect sense.
package(default_visibility = ["//visibility:public"])
proto_library(
name = "decl_proto",
srcs = ["decl.proto"],
deps = [
":expr_proto",
],
)
proto_library(
name = "eval_proto",
srcs = ["eval.proto"],
deps = [
":value_proto",
"//google/rpc:status_proto",
],
)
proto_library(
name = "expr_proto",
srcs = ["expr.proto"],
deps = [
":source_proto",
"@com_google_protobuf//:struct_proto",
],
)
proto_library(
name = "source_proto",
srcs = ["source.proto"],
)
proto_library(
name = "value_proto",
srcs = ["value.proto"],
deps = [
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:struct_proto",
],
)
proto_library(
name = "cel_proto",
deps = [
":decl_proto",
":eval_proto",
":expr_proto",
":source_proto",
":value_proto",
"//google/rpc:status_proto",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:struct_proto",
],
)
##############################################################################
# C++
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"cc_proto_library",
)
cc_proto_library(
name = "decl_cc_proto",
deps = [":decl_proto"],
)
cc_proto_library(
name = "eval_cc_proto",
deps = [":eval_proto"],
)
cc_proto_library(
name = "expr_cc_proto",
deps = [":expr_proto"],
)
cc_proto_library(
name = "source_cc_proto",
deps = [":source_proto"],
)
cc_proto_library(
name = "value_cc_proto",
deps = [":value_proto"],
)

View File

@ -0,0 +1,84 @@
// 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.
//
syntax = "proto3";
package google.api.expr.v1beta1;
import "google/api/expr/v1beta1/expr.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr";
option java_multiple_files = true;
option java_outer_classname = "DeclProto";
option java_package = "com.google.api.expr.v1beta1";
// A declaration.
message Decl {
// The id of the declaration.
int32 id = 1;
// The name of the declaration.
string name = 2;
// The documentation string for the declaration.
string doc = 3;
// The kind of declaration.
oneof kind {
// An identifier declaration.
IdentDecl ident = 4;
// A function declaration.
FunctionDecl function = 5;
}
}
// The declared type of a variable.
//
// Extends runtime type values with extra information used for type checking
// and dispatching.
message DeclType {
// The expression id of the declared type, if applicable.
int32 id = 1;
// The type name, e.g. 'int', 'my.type.Type' or 'T'
string type = 2;
// An ordered list of type parameters, e.g. `<string, int>`.
// Only applies to a subset of types, e.g. `map`, `list`.
repeated DeclType type_params = 4;
}
// An identifier declaration.
message IdentDecl {
// Optional type of the identifier.
DeclType type = 3;
// Optional value of the identifier.
Expr value = 4;
}
// A function declaration.
message FunctionDecl {
// The function arguments.
repeated IdentDecl args = 1;
// Optional declared return type.
DeclType return_type = 2;
// If the first argument of the function is the receiver.
bool receiver_function = 3;
}

View File

@ -0,0 +1,125 @@
// 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.
//
syntax = "proto3";
package google.api.expr.v1beta1;
import "google/api/expr/v1beta1/value.proto";
import "google/rpc/status.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr";
option java_multiple_files = true;
option java_outer_classname = "EvalProto";
option java_package = "com.google.api.expr.v1beta1";
// The state of an evaluation.
//
// Can represent an initial, partial, or completed state of evaluation.
message EvalState {
// A single evaluation result.
message Result {
// The expression this result is for.
IdRef expr = 1;
// The index in `values` of the resulting value.
int32 value = 2;
}
// The unique values referenced in this message.
repeated ExprValue values = 1;
// An ordered list of results.
//
// Tracks the flow of evaluation through the expression.
// May be sparse.
repeated Result results = 3;
}
// The value of an evaluated expression.
message ExprValue {
// An expression can resolve to a value, error or unknown.
oneof kind {
// A concrete value.
Value value = 1;
// The set of errors in the critical path of evalution.
//
// Only errors in the critical path are included. For example,
// `(<error1> || true) && <error2>` will only result in `<error2>`,
// while `<error1> || <error2>` will result in both `<error1>` and
// `<error2>`.
//
// Errors cause by the presence of other errors are not included in the
// set. For example `<error1>.foo`, `foo(<error1>)`, and `<error1> + 1` will
// only result in `<error1>`.
//
// Multiple errors *might* be included when evaluation could result
// in different errors. For example `<error1> + <error2>` and
// `foo(<error1>, <error2>)` may result in `<error1>`, `<error2>` or both.
// The exact subset of errors included for this case is unspecified and
// depends on the implementation details of the evaluator.
ErrorSet error = 2;
// The set of unknowns in the critical path of evaluation.
//
// Unknown behaves identically to Error with regards to propagation.
// Specifically, only unknowns in the critical path are included, unknowns
// caused by the presence of other unknowns are not included, and multiple
// unknowns *might* be included included when evaluation could result in
// different unknowns. For example:
//
// (<unknown[1]> || true) && <unknown[2]> -> <unknown[2]>
// <unknown[1]> || <unknown[2]> -> <unknown[1,2]>
// <unknown[1]>.foo -> <unknown[1]>
// foo(<unknown[1]>) -> <unknown[1]>
// <unknown[1]> + <unknown[2]> -> <unknown[1]> or <unknown[2[>
//
// Unknown takes precidence over Error in cases where a `Value` can short
// circuit the result:
//
// <error> || <unknown> -> <unknown>
// <error> && <unknown> -> <unknown>
//
// Errors take precidence in all other cases:
//
// <unknown> + <error> -> <error>
// foo(<unknown>, <error>) -> <error>
UnknownSet unknown = 3;
}
}
// A set of errors.
//
// The errors included depend on the context. See `ExprValue.error`.
message ErrorSet {
// The errors in the set.
repeated google.rpc.Status errors = 1;
}
// A set of expressions for which the value is unknown.
//
// The unknowns included depend on the context. See `ExprValue.unknown`.
message UnknownSet {
// The ids of the expressions with unknown values.
repeated IdRef exprs = 1;
}
// A reference to an expression id.
message IdRef {
// The expression id.
int32 id = 1;
}

View File

@ -0,0 +1,265 @@
// 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.
//
syntax = "proto3";
package google.api.expr.v1beta1;
import "google/api/expr/v1beta1/source.proto";
import "google/protobuf/struct.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr";
option java_multiple_files = true;
option java_outer_classname = "ExprProto";
option java_package = "com.google.api.expr.v1beta1";
// An expression together with source information as returned by the parser.
message ParsedExpr {
// The parsed expression.
Expr expr = 2;
// The source info derived from input that generated the parsed `expr`.
SourceInfo source_info = 3;
// The syntax version of the source, e.g. `cel1`.
string syntax_version = 4;
}
// An abstract representation of a common expression.
//
// Expressions are abstractly represented as a collection of identifiers,
// select statements, function calls, literals, and comprehensions. All
// operators with the exception of the '.' operator are modelled as function
// calls. This makes it easy to represent new operators into the existing AST.
//
// All references within expressions must resolve to a [Decl][google.api.expr.v1beta1.Decl] provided at
// type-check for an expression to be valid. A reference may either be a bare
// identifier `name` or a qualified identifier `google.api.name`. References
// may either refer to a value or a function declaration.
//
// For example, the expression `google.api.name.startsWith('expr')` references
// the declaration `google.api.name` within a [Expr.Select][google.api.expr.v1beta1.Expr.Select] expression, and
// the function declaration `startsWith`.
message Expr {
// An identifier expression. e.g. `request`.
message Ident {
// Required. Holds a single, unqualified identifier, possibly preceded by a
// '.'.
//
// Qualified names are represented by the [Expr.Select][google.api.expr.v1beta1.Expr.Select] expression.
string name = 1;
}
// A field selection expression. e.g. `request.auth`.
message Select {
// Required. The target of the selection expression.
//
// For example, in the select expression `request.auth`, the `request`
// portion of the expression is the `operand`.
Expr operand = 1;
// Required. The name of the field to select.
//
// For example, in the select expression `request.auth`, the `auth` portion
// of the expression would be the `field`.
string field = 2;
// Whether the select is to be interpreted as a field presence test.
//
// This results from the macro `has(request.auth)`.
bool test_only = 3;
}
// A call expression, including calls to predefined functions and operators.
//
// For example, `value == 10`, `size(map_value)`.
message Call {
// The target of an method call-style expression. For example, `x` in
// `x.f()`.
Expr target = 1;
// Required. The name of the function or method being called.
string function = 2;
// The arguments.
repeated Expr args = 3;
}
// A list creation expression.
//
// Lists may either be homogenous, e.g. `[1, 2, 3]`, or heterogenous, e.g.
// `dyn([1, 'hello', 2.0])`
message CreateList {
// The elements part of the list.
repeated Expr elements = 1;
}
// A map or message creation expression.
//
// Maps are constructed as `{'key_name': 'value'}`. Message construction is
// similar, but prefixed with a type name and composed of field ids:
// `types.MyType{field_id: 'value'}`.
message CreateStruct {
// Represents an entry.
message Entry {
// Required. An id assigned to this node by the parser which is unique
// in a given expression tree. This is used to associate type
// information and other attributes to the node.
int32 id = 1;
// The `Entry` key kinds.
oneof key_kind {
// The field key for a message creator statement.
string field_key = 2;
// The key expression for a map creation statement.
Expr map_key = 3;
}
// Required. The value assigned to the key.
Expr value = 4;
}
// The type name of the message to be created, empty when creating map
// literals.
string type = 1;
// The entries in the creation expression.
repeated Entry entries = 2;
}
// A comprehension expression applied to a list or map.
//
// Comprehensions are not part of the core syntax, but enabled with macros.
// A macro matches a specific call signature within a parsed AST and replaces
// the call with an alternate AST block. Macro expansion happens at parse
// time.
//
// The following macros are supported within CEL:
//
// Aggregate type macros may be applied to all elements in a list or all keys
// in a map:
//
// * `all`, `exists`, `exists_one` - test a predicate expression against
// the inputs and return `true` if the predicate is satisfied for all,
// any, or only one value `list.all(x, x < 10)`.
// * `filter` - test a predicate expression against the inputs and return
// the subset of elements which satisfy the predicate:
// `payments.filter(p, p > 1000)`.
// * `map` - apply an expression to all elements in the input and return the
// output aggregate type: `[1, 2, 3].map(i, i * i)`.
//
// The `has(m.x)` macro tests whether the property `x` is present in struct
// `m`. The semantics of this macro depend on the type of `m`. For proto2
// messages `has(m.x)` is defined as 'defined, but not set`. For proto3, the
// macro tests whether the property is set to its default. For map and struct
// types, the macro tests whether the property `x` is defined on `m`.
message Comprehension {
// The name of the iteration variable.
string iter_var = 1;
// The range over which var iterates.
Expr iter_range = 2;
// The name of the variable used for accumulation of the result.
string accu_var = 3;
// The initial value of the accumulator.
Expr accu_init = 4;
// An expression which can contain iter_var and accu_var.
//
// Returns false when the result has been computed and may be used as
// a hint to short-circuit the remainder of the comprehension.
Expr loop_condition = 5;
// An expression which can contain iter_var and accu_var.
//
// Computes the next value of accu_var.
Expr loop_step = 6;
// An expression which can contain accu_var.
//
// Computes the result.
Expr result = 7;
}
// Required. An id assigned to this node by the parser which is unique in a
// given expression tree. This is used to associate type information and other
// attributes to a node in the parse tree.
int32 id = 2;
// Required. Variants of expressions.
oneof expr_kind {
// A literal expression.
Literal literal_expr = 3;
// An identifier expression.
Ident ident_expr = 4;
// A field selection expression, e.g. `request.auth`.
Select select_expr = 5;
// A call expression, including calls to predefined functions and operators.
Call call_expr = 6;
// A list creation expression.
CreateList list_expr = 7;
// A map or object creation expression.
CreateStruct struct_expr = 8;
// A comprehension expression.
Comprehension comprehension_expr = 9;
}
}
// Represents a primitive literal.
//
// This is similar to the primitives supported in the well-known type
// `google.protobuf.Value`, but richer so it can represent CEL's full range of
// primitives.
//
// Lists and structs are not included as constants as these aggregate types may
// contain [Expr][google.api.expr.v1beta1.Expr] elements which require evaluation and are thus not constant.
//
// Examples of literals include: `"hello"`, `b'bytes'`, `1u`, `4.2`, `-2`,
// `true`, `null`.
message Literal {
// Required. The valid constant kinds.
oneof constant_kind {
// null value.
google.protobuf.NullValue null_value = 1;
// boolean value.
bool bool_value = 2;
// int64 value.
int64 int64_value = 3;
// uint64 value.
uint64 uint64_value = 4;
// double value.
double double_value = 5;
// string value.
string string_value = 6;
// bytes value.
bytes bytes_value = 7;
}
}

View File

@ -0,0 +1,62 @@
// 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.
//
syntax = "proto3";
package google.api.expr.v1beta1;
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr";
option java_multiple_files = true;
option java_outer_classname = "SourceProto";
option java_package = "com.google.api.expr.v1beta1";
// Source information collected at parse time.
message SourceInfo {
// The location name. All position information attached to an expression is
// relative to this location.
//
// The location could be a file, UI element, or similar. For example,
// `acme/app/AnvilPolicy.cel`.
string location = 2;
// Monotonically increasing list of character offsets where newlines appear.
//
// The line number of a given position is the index `i` where for a given
// `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The
// column may be derivd from `id_positions[id] - line_offsets[i]`.
repeated int32 line_offsets = 3;
// A map from the parse node id (e.g. `Expr.id`) to the character offset
// within source.
map<int32, int32> positions = 4;
}
// A specific position in source.
message SourcePosition {
// The soucre location name (e.g. file name).
string location = 1;
// The character offset.
int32 offset = 2;
// The 1-based index of the starting line in the source text
// where the issue occurs, or 0 if unknown.
int32 line = 3;
// The 0-based index of the starting position within the line of source text
// where the issue occurs. Only meaningful if line is nonzer..
int32 column = 4;
}

View File

@ -0,0 +1,114 @@
// 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.
//
syntax = "proto3";
package google.api.expr.v1beta1;
import "google/protobuf/any.proto";
import "google/protobuf/struct.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr";
option java_multiple_files = true;
option java_outer_classname = "ValueProto";
option java_package = "com.google.api.expr.v1beta1";
// Represents a CEL value.
//
// This is similar to `google.protobuf.Value`, but can represent CEL's full
// range of values.
message Value {
// Required. The valid kinds of values.
oneof kind {
// Null value.
google.protobuf.NullValue null_value = 1;
// Boolean value.
bool bool_value = 2;
// Signed integer value.
int64 int64_value = 3;
// Unsigned integer value.
uint64 uint64_value = 4;
// Floating point value.
double double_value = 5;
// UTF-8 string value.
string string_value = 6;
// Byte string value.
bytes bytes_value = 7;
// An enum value.
EnumValue enum_value = 9;
// The proto message backing an object value.
google.protobuf.Any object_value = 10;
// Map value.
MapValue map_value = 11;
// List value.
ListValue list_value = 12;
// A Type value represented by the fully qualified name of the type.
string type_value = 15;
}
}
// An enum value.
message EnumValue {
// The fully qualified name of the enum type.
string type = 1;
// The value of the enum.
int32 value = 2;
}
// A list.
//
// Wrapped in a message so 'not set' and empty can be differentiated, which is
// required for use in a 'oneof'.
message ListValue {
// The ordered values in the list.
repeated Value values = 1;
}
// A map.
//
// Wrapped in a message so 'not set' and empty can be differentiated, which is
// required for use in a 'oneof'.
message MapValue {
// An entry in the map.
message Entry {
// The key.
//
// Must be unique with in the map.
// Currently only boolean, int, uint, and string values can be keys.
Value key = 1;
// The value.
Value value = 2;
}
// The set of map entries.
//
// CEL has fewer restrictions on keys, so a protobuf map represenation
// cannot be used.
repeated Entry entries = 1;
}

View File

@ -0,0 +1,90 @@
// Copyright 2018 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.api;
import "google/protobuf/descriptor.proto";
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "FieldBehaviorProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.FieldOptions {
// A designation of a specific field behavior (required, output only, etc.)
// in protobuf messages.
//
// Examples:
//
// string name = 1 [(google.api.field_behavior) = REQUIRED];
// State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
// google.protobuf.Duration ttl = 1
// [(google.api.field_behavior) = INPUT_ONLY];
// google.protobuf.Timestamp expire_time = 1
// [(google.api.field_behavior) = OUTPUT_ONLY,
// (google.api.field_behavior) = IMMUTABLE];
repeated google.api.FieldBehavior field_behavior = 1052;
}
// An indicator of the behavior of a given field (for example, that a field
// is required in requests, or given as output but ignored as input).
// This **does not** change the behavior in protocol buffers itself; it only
// denotes the behavior and may affect how API tooling handles the field.
//
// Note: This enum **may** receive new values in the future.
enum FieldBehavior {
// Conventional default for enums. Do not use this.
FIELD_BEHAVIOR_UNSPECIFIED = 0;
// Specifically denotes a field as optional.
// While all fields in protocol buffers are optional, this may be specified
// for emphasis if appropriate.
OPTIONAL = 1;
// Denotes a field as required.
// This indicates that the field **must** be provided as part of the request,
// and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
REQUIRED = 2;
// Denotes a field as output only.
// This indicates that the field is provided in responses, but including the
// field in a request does nothing (the server *must* ignore it and
// *must not* throw an error as a result of the field's presence).
OUTPUT_ONLY = 3;
// Denotes a field as input only.
// This indicates that the field is provided in requests, and the
// corresponding field is not included in output.
INPUT_ONLY = 4;
// Denotes a field as immutable.
// This indicates that the field may be set once in a request to create a
// resource, but may not be changed thereafter.
IMMUTABLE = 5;
// Denotes that a (repeated) field is an unordered list.
// This indicates that the service may provide the elements of the list
// in any arbitrary order, rather than the order the user originally
// provided. Additionally, the list's order may or may not be stable.
UNORDERED_LIST = 6;
// Denotes that this field returns a non-empty default value if not set.
// This indicates that if the user provides the empty value in a request,
// a non-empty value will be returned. The user will not be aware of what
// non-empty value to expect.
NON_EMPTY_DEFAULT = 7;
}

View File

@ -0,0 +1,375 @@
// Copyright 2015 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.api;
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "HttpProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Defines the HTTP configuration for an API service. It contains a list of
// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
// to one or more HTTP REST API methods.
message Http {
// A list of HTTP configuration rules that apply to individual API methods.
//
// **NOTE:** All service configuration rules follow "last one wins" order.
repeated HttpRule rules = 1;
// When set to true, URL path parameters will be fully URI-decoded except in
// cases of single segment matches in reserved expansion, where "%2F" will be
// left encoded.
//
// The default behavior is to not decode RFC 6570 reserved characters in multi
// segment matches.
bool fully_decode_reserved_expansion = 2;
}
// # gRPC Transcoding
//
// gRPC Transcoding is a feature for mapping between a gRPC method and one or
// more HTTP REST endpoints. It allows developers to build a single API service
// that supports both gRPC APIs and REST APIs. Many systems, including [Google
// APIs](https://github.com/googleapis/googleapis),
// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC
// Gateway](https://github.com/grpc-ecosystem/grpc-gateway),
// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature
// and use it for large scale production services.
//
// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
// how different portions of the gRPC request message are mapped to the URL
// path, URL query parameters, and HTTP request body. It also controls how the
// gRPC response message is mapped to the HTTP response body. `HttpRule` is
// typically specified as an `google.api.http` annotation on the gRPC method.
//
// Each mapping specifies a URL path template and an HTTP method. The path
// template may refer to one or more fields in the gRPC request message, as long
// as each field is a non-repeated field with a primitive (non-message) type.
// The path template controls how fields of the request message are mapped to
// the URL path.
//
// Example:
//
// service Messaging {
// rpc GetMessage(GetMessageRequest) returns (Message) {
// option (google.api.http) = {
// get: "/v1/{name=messages/*}"
// };
// }
// }
// message GetMessageRequest {
// string name = 1; // Mapped to URL path.
// }
// message Message {
// string text = 1; // The resource content.
// }
//
// This enables an HTTP REST to gRPC mapping as below:
//
// HTTP | gRPC
// -----|-----
// `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")`
//
// Any fields in the request message which are not bound by the path template
// automatically become HTTP query parameters if there is no HTTP request body.
// For example:
//
// service Messaging {
// rpc GetMessage(GetMessageRequest) returns (Message) {
// option (google.api.http) = {
// get:"/v1/messages/{message_id}"
// };
// }
// }
// message GetMessageRequest {
// message SubMessage {
// string subfield = 1;
// }
// string message_id = 1; // Mapped to URL path.
// int64 revision = 2; // Mapped to URL query parameter `revision`.
// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`.
// }
//
// This enables a HTTP JSON to RPC mapping as below:
//
// HTTP | gRPC
// -----|-----
// `GET /v1/messages/123456?revision=2&sub.subfield=foo` |
// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield:
// "foo"))`
//
// Note that fields which are mapped to URL query parameters must have a
// primitive type or a repeated primitive type or a non-repeated message type.
// In the case of a repeated type, the parameter can be repeated in the URL
// as `...?param=A&param=B`. In the case of a message type, each field of the
// message is mapped to a separate parameter, such as
// `...?foo.a=A&foo.b=B&foo.c=C`.
//
// For HTTP methods that allow a request body, the `body` field
// specifies the mapping. Consider a REST update method on the
// message resource collection:
//
// service Messaging {
// rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
// option (google.api.http) = {
// patch: "/v1/messages/{message_id}"
// body: "message"
// };
// }
// }
// message UpdateMessageRequest {
// string message_id = 1; // mapped to the URL
// Message message = 2; // mapped to the body
// }
//
// The following HTTP JSON to RPC mapping is enabled, where the
// representation of the JSON in the request body is determined by
// protos JSON encoding:
//
// HTTP | gRPC
// -----|-----
// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
// "123456" message { text: "Hi!" })`
//
// The special name `*` can be used in the body mapping to define that
// every field not bound by the path template should be mapped to the
// request body. This enables the following alternative definition of
// the update method:
//
// service Messaging {
// rpc UpdateMessage(Message) returns (Message) {
// option (google.api.http) = {
// patch: "/v1/messages/{message_id}"
// body: "*"
// };
// }
// }
// message Message {
// string message_id = 1;
// string text = 2;
// }
//
//
// The following HTTP JSON to RPC mapping is enabled:
//
// HTTP | gRPC
// -----|-----
// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
// "123456" text: "Hi!")`
//
// Note that when using `*` in the body mapping, it is not possible to
// have HTTP parameters, as all fields not bound by the path end in
// the body. This makes this option more rarely used in practice when
// defining REST APIs. The common usage of `*` is in custom methods
// which don't use the URL at all for transferring data.
//
// It is possible to define multiple HTTP methods for one RPC by using
// the `additional_bindings` option. Example:
//
// service Messaging {
// rpc GetMessage(GetMessageRequest) returns (Message) {
// option (google.api.http) = {
// get: "/v1/messages/{message_id}"
// additional_bindings {
// get: "/v1/users/{user_id}/messages/{message_id}"
// }
// };
// }
// }
// message GetMessageRequest {
// string message_id = 1;
// string user_id = 2;
// }
//
// This enables the following two alternative HTTP JSON to RPC mappings:
//
// HTTP | gRPC
// -----|-----
// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id:
// "123456")`
//
// ## Rules for HTTP mapping
//
// 1. Leaf request fields (recursive expansion nested messages in the request
// message) are classified into three categories:
// - Fields referred by the path template. They are passed via the URL path.
// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP
// request body.
// - All other fields are passed via the URL query parameters, and the
// parameter name is the field path in the request message. A repeated
// field can be represented as multiple query parameters under the same
// name.
// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields
// are passed via URL path and HTTP request body.
// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all
// fields are passed via URL path and URL query parameters.
//
// ### Path template syntax
//
// Template = "/" Segments [ Verb ] ;
// Segments = Segment { "/" Segment } ;
// Segment = "*" | "**" | LITERAL | Variable ;
// Variable = "{" FieldPath [ "=" Segments ] "}" ;
// FieldPath = IDENT { "." IDENT } ;
// Verb = ":" LITERAL ;
//
// The syntax `*` matches a single URL path segment. The syntax `**` matches
// zero or more URL path segments, which must be the last part of the URL path
// except the `Verb`.
//
// The syntax `Variable` matches part of the URL path as specified by its
// template. A variable template must not contain other variables. If a variable
// matches a single path segment, its template may be omitted, e.g. `{var}`
// is equivalent to `{var=*}`.
//
// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`
// contains any reserved character, such characters should be percent-encoded
// before the matching.
//
// If a variable contains exactly one path segment, such as `"{var}"` or
// `"{var=*}"`, when such a variable is expanded into a URL path on the client
// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The
// server side does the reverse decoding. Such variables show up in the
// [Discovery
// Document](https://developers.google.com/discovery/v1/reference/apis) as
// `{var}`.
//
// If a variable contains multiple path segments, such as `"{var=foo/*}"`
// or `"{var=**}"`, when such a variable is expanded into a URL path on the
// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.
// The server side does the reverse decoding, except "%2F" and "%2f" are left
// unchanged. Such variables show up in the
// [Discovery
// Document](https://developers.google.com/discovery/v1/reference/apis) as
// `{+var}`.
//
// ## Using gRPC API Service Configuration
//
// gRPC API Service Configuration (service config) is a configuration language
// for configuring a gRPC service to become a user-facing product. The
// service config is simply the YAML representation of the `google.api.Service`
// proto message.
//
// As an alternative to annotating your proto file, you can configure gRPC
// transcoding in your service config YAML files. You do this by specifying a
// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same
// effect as the proto annotation. This can be particularly useful if you
// have a proto that is reused in multiple services. Note that any transcoding
// specified in the service config will override any matching transcoding
// configuration in the proto.
//
// Example:
//
// http:
// rules:
// # Selects a gRPC method and applies HttpRule to it.
// - selector: example.v1.Messaging.GetMessage
// get: /v1/messages/{message_id}/{sub.subfield}
//
// ## Special notes
//
// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
// proto to JSON conversion must follow the [proto3
// specification](https://developers.google.com/protocol-buffers/docs/proto3#json).
//
// While the single segment variable follows the semantics of
// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
// Expansion, the multi segment variable **does not** follow RFC 6570 Section
// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion
// does not expand special characters like `?` and `#`, which would lead
// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding
// for multi segment variables.
//
// The path variables **must not** refer to any repeated or mapped field,
// because client libraries are not capable of handling such variable expansion.
//
// The path variables **must not** capture the leading "/" character. The reason
// is that the most common use case "{var}" does not capture the leading "/"
// character. For consistency, all path variables must share the same behavior.
//
// Repeated message fields must not be mapped to URL query parameters, because
// no client library can support such complicated mapping.
//
// If an API needs to use a JSON array for request or response body, it can map
// the request or response body to a repeated field. However, some gRPC
// Transcoding implementations may not support this feature.
message HttpRule {
// Selects a method to which this rule applies.
//
// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
string selector = 1;
// Determines the URL pattern is matched by this rules. This pattern can be
// used with any of the {get|put|post|delete|patch} methods. A custom method
// can be defined using the 'custom' field.
oneof pattern {
// Maps to HTTP GET. Used for listing and getting information about
// resources.
string get = 2;
// Maps to HTTP PUT. Used for replacing a resource.
string put = 3;
// Maps to HTTP POST. Used for creating a resource or performing an action.
string post = 4;
// Maps to HTTP DELETE. Used for deleting a resource.
string delete = 5;
// Maps to HTTP PATCH. Used for updating a resource.
string patch = 6;
// The custom pattern is used for specifying an HTTP method that is not
// included in the `pattern` field, such as HEAD, or "*" to leave the
// HTTP method unspecified for this rule. The wild-card rule is useful
// for services that provide content to Web (HTML) clients.
CustomHttpPattern custom = 8;
}
// The name of the request field whose value is mapped to the HTTP request
// body, or `*` for mapping all request fields not captured by the path
// pattern to the HTTP body, or omitted for not having any HTTP request body.
//
// NOTE: the referred field must be present at the top-level of the request
// message type.
string body = 7;
// Optional. The name of the response field whose value is mapped to the HTTP
// response body. When omitted, the entire response message will be used
// as the HTTP response body.
//
// NOTE: The referred field must be present at the top-level of the response
// message type.
string response_body = 12;
// Additional HTTP bindings for the selector. Nested bindings must
// not contain an `additional_bindings` field themselves (that is,
// the nesting may only be one level deep).
repeated HttpRule additional_bindings = 11;
}
// A custom pattern is used for defining custom HTTP verb.
message CustomHttpPattern {
// The name of this custom HTTP verb.
string kind = 1;
// The path matched by this custom verb.
string path = 2;
}

View File

@ -0,0 +1,81 @@
// Copyright 2015 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.api;
import "google/protobuf/any.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody";
option java_multiple_files = true;
option java_outer_classname = "HttpBodyProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Message that represents an arbitrary HTTP body. It should only be used for
// payload formats that can't be represented as JSON, such as raw binary or
// an HTML page.
//
//
// This message can be used both in streaming and non-streaming API methods in
// the request as well as the response.
//
// It can be used as a top-level request field, which is convenient if one
// wants to extract parameters from either the URL or HTTP template into the
// request fields and also want access to the raw HTTP body.
//
// Example:
//
// message GetResourceRequest {
// // A unique request id.
// string request_id = 1;
//
// // The raw HTTP body is bound to this field.
// google.api.HttpBody http_body = 2;
//
// }
//
// service ResourceService {
// rpc GetResource(GetResourceRequest)
// returns (google.api.HttpBody);
// rpc UpdateResource(google.api.HttpBody)
// returns (google.protobuf.Empty);
//
// }
//
// Example with streaming methods:
//
// service CaldavService {
// rpc GetCalendar(stream google.api.HttpBody)
// returns (stream google.api.HttpBody);
// rpc UpdateCalendar(stream google.api.HttpBody)
// returns (stream google.api.HttpBody);
//
// }
//
// Use of this type only changes how the request and response bodies are
// handled, all other features will continue to work unchanged.
message HttpBody {
// The HTTP Content-Type header value specifying the content type of the body.
string content_type = 1;
// The HTTP request/response body as raw binary.
bytes data = 2;
// Application specific response metadata. Must be set in the first response
// for streaming APIs.
repeated google.protobuf.Any extensions = 3;
}

View File

@ -0,0 +1,48 @@
// Copyright 2015 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.api;
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/label;label";
option java_multiple_files = true;
option java_outer_classname = "LabelProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// A description of a label.
message LabelDescriptor {
// Value types that can be used as label values.
enum ValueType {
// A variable-length string. This is the default.
STRING = 0;
// Boolean; true or false.
BOOL = 1;
// A 64-bit signed integer.
INT64 = 2;
}
// The label key.
string key = 1;
// The type of data that can be assigned to the label.
ValueType value_type = 2;
// A human-readable description for the label.
string description = 3;
}

View File

@ -0,0 +1,72 @@
// Copyright 2015 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.api;
option go_package = "google.golang.org/genproto/googleapis/api;api";
option java_multiple_files = true;
option java_outer_classname = "LaunchStageProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// The launch stage as defined by [Google Cloud Platform
// Launch Stages](http://cloud.google.com/terms/launch-stages).
enum LaunchStage {
// Do not use this default value.
LAUNCH_STAGE_UNSPECIFIED = 0;
// The feature is not yet implemented. Users can not use it.
UNIMPLEMENTED = 6;
// Prelaunch features are hidden from users and are only visible internally.
PRELAUNCH = 7;
// Early Access features are limited to a closed group of testers. To use
// these features, you must sign up in advance and sign a Trusted Tester
// agreement (which includes confidentiality provisions). These features may
// be unstable, changed in backward-incompatible ways, and are not
// guaranteed to be released.
EARLY_ACCESS = 1;
// Alpha is a limited availability test for releases before they are cleared
// for widespread use. By Alpha, all significant design issues are resolved
// and we are in the process of verifying functionality. Alpha customers
// need to apply for access, agree to applicable terms, and have their
// projects allowlisted. Alpha releases dont have to be feature complete,
// no SLAs are provided, and there are no technical support obligations, but
// they will be far enough along that customers can actually use them in
// test environments or for limited-use tests -- just like they would in
// normal production cases.
ALPHA = 2;
// Beta is the point at which we are ready to open a release for any
// customer to use. There are no SLA or technical support obligations in a
// Beta release. Products will be complete from a feature perspective, but
// may have some open outstanding issues. Beta releases are suitable for
// limited production use cases.
BETA = 3;
// GA features are open to all developers and are considered stable and
// fully qualified for production use.
GA = 4;
// Deprecated features are scheduled to be shut down and removed. For more
// information, see the “Deprecation Policy” section of our [Terms of
// Service](https://cloud.google.com/terms/)
// and the [Google Cloud Platform Subject to the Deprecation
// Policy](https://cloud.google.com/terms/deprecation) documentation.
DEPRECATED = 5;
}

View File

@ -0,0 +1,54 @@
// Copyright 2015 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.api;
import "google/api/label.proto";
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "LogProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// A description of a log type. Example in YAML format:
//
// - name: library.googleapis.com/activity_history
// description: The history of borrowing and returning library items.
// display_name: Activity
// labels:
// - key: /customer_id
// description: Identifier of a library customer
message LogDescriptor {
// The name of the log. It must be less than 512 characters long and can
// include the following characters: upper- and lower-case alphanumeric
// characters [A-Za-z0-9], and punctuation characters including
// slash, underscore, hyphen, period [/_-.].
string name = 1;
// The set of labels that are available to describe a specific log entry.
// Runtime requests that contain labels not specified here are
// considered invalid.
repeated LabelDescriptor labels = 2;
// A human-readable description of this log. This information appears in
// the documentation and can contain details.
string description = 3;
// The human-readable name for this log. This information appears on
// the user interface and should be concise.
string display_name = 4;
}

View File

@ -0,0 +1,80 @@
// Copyright 2015 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.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "LoggingProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Logging configuration of the service.
//
// The following example shows how to configure logs to be sent to the
// producer and consumer projects. In the example, the `activity_history`
// log is sent to both the producer and consumer projects, whereas the
// `purchase_history` log is only sent to the producer project.
//
// monitored_resources:
// - type: library.googleapis.com/branch
// labels:
// - key: /city
// description: The city where the library branch is located in.
// - key: /name
// description: The name of the branch.
// logs:
// - name: activity_history
// labels:
// - key: /customer_id
// - name: purchase_history
// logging:
// producer_destinations:
// - monitored_resource: library.googleapis.com/branch
// logs:
// - activity_history
// - purchase_history
// consumer_destinations:
// - monitored_resource: library.googleapis.com/branch
// logs:
// - activity_history
message Logging {
// Configuration of a specific logging destination (the producer project
// or the consumer project).
message LoggingDestination {
// The monitored resource type. The type must be defined in the
// [Service.monitored_resources][google.api.Service.monitored_resources] section.
string monitored_resource = 3;
// Names of the logs to be sent to this destination. Each name must
// be defined in the [Service.logs][google.api.Service.logs] section. If the log name is
// not a domain scoped name, it will be automatically prefixed with
// the service name followed by "/".
repeated string logs = 1;
}
// Logging configurations for sending logs to the producer project.
// There can be multiple producer destinations, each one must have a
// different monitored resource type. A log can be used in at most
// one producer destination.
repeated LoggingDestination producer_destinations = 1;
// Logging configurations for sending logs to the consumer project.
// There can be multiple consumer destinations, each one must have a
// different monitored resource type. A log can be used in at most
// one consumer destination.
repeated LoggingDestination consumer_destinations = 2;
}

View File

@ -0,0 +1,264 @@
// Copyright 2015 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.api;
import "google/api/label.proto";
import "google/api/launch_stage.proto";
import "google/protobuf/duration.proto";
option go_package = "google.golang.org/genproto/googleapis/api/metric;metric";
option java_multiple_files = true;
option java_outer_classname = "MetricProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Defines a metric type and its schema. Once a metric descriptor is created,
// deleting or altering it stops data collection and makes the metric type's
// existing data unusable.
//
message MetricDescriptor {
// Additional annotations that can be used to guide the usage of a metric.
message MetricDescriptorMetadata {
// Deprecated. Must use the [MetricDescriptor.launch_stage][google.api.MetricDescriptor.launch_stage] instead.
LaunchStage launch_stage = 1 [deprecated = true];
// The sampling period of metric data points. For metrics which are written
// periodically, consecutive data points are stored at this time interval,
// excluding data loss due to errors. Metrics with a higher granularity have
// a smaller sampling period.
google.protobuf.Duration sample_period = 2;
// The delay of data points caused by ingestion. Data points older than this
// age are guaranteed to be ingested and available to be read, excluding
// data loss due to errors.
google.protobuf.Duration ingest_delay = 3;
}
// The kind of measurement. It describes how the data is reported.
// For information on setting the start time and end time based on
// the MetricKind, see [TimeInterval][google.monitoring.v3.TimeInterval].
enum MetricKind {
// Do not use this default value.
METRIC_KIND_UNSPECIFIED = 0;
// An instantaneous measurement of a value.
GAUGE = 1;
// The change in a value during a time interval.
DELTA = 2;
// A value accumulated over a time interval. Cumulative
// measurements in a time series should have the same start time
// and increasing end times, until an event resets the cumulative
// value to zero and sets a new start time for the following
// points.
CUMULATIVE = 3;
}
// The value type of a metric.
enum ValueType {
// Do not use this default value.
VALUE_TYPE_UNSPECIFIED = 0;
// The value is a boolean.
// This value type can be used only if the metric kind is `GAUGE`.
BOOL = 1;
// The value is a signed 64-bit integer.
INT64 = 2;
// The value is a double precision floating point number.
DOUBLE = 3;
// The value is a text string.
// This value type can be used only if the metric kind is `GAUGE`.
STRING = 4;
// The value is a [`Distribution`][google.api.Distribution].
DISTRIBUTION = 5;
// The value is money.
MONEY = 6;
}
// The resource name of the metric descriptor.
string name = 1;
// The metric type, including its DNS name prefix. The type is not
// URL-encoded. All user-defined metric types have the DNS name
// `custom.googleapis.com` or `external.googleapis.com`. Metric types should
// use a natural hierarchical grouping. For example:
//
// "custom.googleapis.com/invoice/paid/amount"
// "external.googleapis.com/prometheus/up"
// "appengine.googleapis.com/http/server/response_latencies"
string type = 8;
// The set of labels that can be used to describe a specific
// instance of this metric type. For example, the
// `appengine.googleapis.com/http/server/response_latencies` metric
// type has a label for the HTTP response code, `response_code`, so
// you can look at latencies for successful responses or just
// for responses that failed.
repeated LabelDescriptor labels = 2;
// Whether the metric records instantaneous values, changes to a value, etc.
// Some combinations of `metric_kind` and `value_type` might not be supported.
MetricKind metric_kind = 3;
// Whether the measurement is an integer, a floating-point number, etc.
// Some combinations of `metric_kind` and `value_type` might not be supported.
ValueType value_type = 4;
// The units in which the metric value is reported. It is only applicable
// if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit`
// defines the representation of the stored metric values.
//
// Different systems might scale the values to be more easily displayed (so a
// value of `0.02kBy` _might_ be displayed as `20By`, and a value of
// `3523kBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is
// `kBy`, then the value of the metric is always in thousands of bytes, no
// matter how it might be displayed.
//
// If you want a custom metric to record the exact number of CPU-seconds used
// by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is
// `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005
// CPU-seconds, then the value is written as `12005`.
//
// Alternatively, if you want a custom metric to record data in a more
// granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is
// `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`),
// or use `Kis{CPU}` and write `11.723` (which is `12005/1024`).
//
// The supported units are a subset of [The Unified Code for Units of
// Measure](https://unitsofmeasure.org/ucum.html) standard:
//
// **Basic units (UNIT)**
//
// * `bit` bit
// * `By` byte
// * `s` second
// * `min` minute
// * `h` hour
// * `d` day
// * `1` dimensionless
//
// **Prefixes (PREFIX)**
//
// * `k` kilo (10^3)
// * `M` mega (10^6)
// * `G` giga (10^9)
// * `T` tera (10^12)
// * `P` peta (10^15)
// * `E` exa (10^18)
// * `Z` zetta (10^21)
// * `Y` yotta (10^24)
//
// * `m` milli (10^-3)
// * `u` micro (10^-6)
// * `n` nano (10^-9)
// * `p` pico (10^-12)
// * `f` femto (10^-15)
// * `a` atto (10^-18)
// * `z` zepto (10^-21)
// * `y` yocto (10^-24)
//
// * `Ki` kibi (2^10)
// * `Mi` mebi (2^20)
// * `Gi` gibi (2^30)
// * `Ti` tebi (2^40)
// * `Pi` pebi (2^50)
//
// **Grammar**
//
// The grammar also includes these connectors:
//
// * `/` division or ratio (as an infix operator). For examples,
// `kBy/{email}` or `MiBy/10ms` (although you should almost never
// have `/s` in a metric `unit`; rates should always be computed at
// query time from the underlying cumulative or delta value).
// * `.` multiplication or composition (as an infix operator). For
// examples, `GBy.d` or `k{watt}.h`.
//
// The grammar for a unit is as follows:
//
// Expression = Component { "." Component } { "/" Component } ;
//
// Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
// | Annotation
// | "1"
// ;
//
// Annotation = "{" NAME "}" ;
//
// Notes:
//
// * `Annotation` is just a comment if it follows a `UNIT`. If the annotation
// is used alone, then the unit is equivalent to `1`. For examples,
// `{request}/s == 1/s`, `By{transmitted}/s == By/s`.
// * `NAME` is a sequence of non-blank printable ASCII characters not
// containing `{` or `}`.
// * `1` represents a unitary [dimensionless
// unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such
// as in `1/s`. It is typically used when none of the basic units are
// appropriate. For example, "new users per day" can be represented as
// `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new
// users). Alternatively, "thousands of page views per day" would be
// represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric
// value of `5.3` would mean "5300 page views per day").
// * `%` represents dimensionless value of 1/100, and annotates values giving
// a percentage (so the metric values are typically in the range of 0..100,
// and a metric value `3` means "3 percent").
// * `10^2.%` indicates a metric contains a ratio, typically in the range
// 0..1, that will be multiplied by 100 and displayed as a percentage
// (so a metric value `0.03` means "3 percent").
string unit = 5;
// A detailed description of the metric, which can be used in documentation.
string description = 6;
// A concise name for the metric, which can be displayed in user interfaces.
// Use sentence case without an ending period, for example "Request count".
// This field is optional but it is recommended to be set for any metrics
// associated with user-visible concepts, such as Quota.
string display_name = 7;
// Optional. Metadata which can be used to guide usage of the metric.
MetricDescriptorMetadata metadata = 10;
// Optional. The launch stage of the metric definition.
LaunchStage launch_stage = 12;
// Read-only. If present, then a [time
// series][google.monitoring.v3.TimeSeries], which is identified partially by
// a metric type and a [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor], that is associated
// with this metric type can only be associated with one of the monitored
// resource types listed here.
repeated string monitored_resource_types = 13;
}
// A specific metric, identified by specifying values for all of the
// labels of a [`MetricDescriptor`][google.api.MetricDescriptor].
message Metric {
// An existing metric type, see [google.api.MetricDescriptor][google.api.MetricDescriptor].
// For example, `custom.googleapis.com/invoice/paid/amount`.
string type = 3;
// The set of label values that uniquely identify this metric. All
// labels listed in the `MetricDescriptor` must be assigned values.
map<string, string> labels = 2;
}

View File

@ -0,0 +1,118 @@
// Copyright 2015 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.api;
import "google/api/label.proto";
import "google/api/launch_stage.proto";
import "google/protobuf/struct.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/monitoredres;monitoredres";
option java_multiple_files = true;
option java_outer_classname = "MonitoredResourceProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// An object that describes the schema of a [MonitoredResource][google.api.MonitoredResource] object using a
// type name and a set of labels. For example, the monitored resource
// descriptor for Google Compute Engine VM instances has a type of
// `"gce_instance"` and specifies the use of the labels `"instance_id"` and
// `"zone"` to identify particular VM instances.
//
// Different APIs can support different monitored resource types. APIs generally
// provide a `list` method that returns the monitored resource descriptors used
// by the API.
//
message MonitoredResourceDescriptor {
// Optional. The resource name of the monitored resource descriptor:
// `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where
// {type} is the value of the `type` field in this object and
// {project_id} is a project ID that provides API-specific context for
// accessing the type. APIs that do not use project information can use the
// resource name format `"monitoredResourceDescriptors/{type}"`.
string name = 5;
// Required. The monitored resource type. For example, the type
// `"cloudsql_database"` represents databases in Google Cloud SQL.
string type = 1;
// Optional. A concise name for the monitored resource type that might be
// displayed in user interfaces. It should be a Title Cased Noun Phrase,
// without any article or other determiners. For example,
// `"Google Cloud SQL Database"`.
string display_name = 2;
// Optional. A detailed description of the monitored resource type that might
// be used in documentation.
string description = 3;
// Required. A set of labels used to describe instances of this monitored
// resource type. For example, an individual Google Cloud SQL database is
// identified by values for the labels `"database_id"` and `"zone"`.
repeated LabelDescriptor labels = 4;
// Optional. The launch stage of the monitored resource definition.
LaunchStage launch_stage = 7;
}
// An object representing a resource that can be used for monitoring, logging,
// billing, or other purposes. Examples include virtual machine instances,
// databases, and storage devices such as disks. The `type` field identifies a
// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object that describes the resource's
// schema. Information in the `labels` field identifies the actual resource and
// its attributes according to the schema. For example, a particular Compute
// Engine VM instance could be represented by the following object, because the
// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for `"gce_instance"` has labels
// `"instance_id"` and `"zone"`:
//
// { "type": "gce_instance",
// "labels": { "instance_id": "12345678901234",
// "zone": "us-central1-a" }}
message MonitoredResource {
// Required. The monitored resource type. This field must match
// the `type` field of a [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object. For
// example, the type of a Compute Engine VM instance is `gce_instance`.
string type = 1;
// Required. Values for all of the labels listed in the associated monitored
// resource descriptor. For example, Compute Engine VM instances use the
// labels `"project_id"`, `"instance_id"`, and `"zone"`.
map<string, string> labels = 2;
}
// Auxiliary metadata for a [MonitoredResource][google.api.MonitoredResource] object.
// [MonitoredResource][google.api.MonitoredResource] objects contain the minimum set of information to
// uniquely identify a monitored resource instance. There is some other useful
// auxiliary metadata. Monitoring and Logging use an ingestion
// pipeline to extract metadata for cloud resources of all types, and store
// the metadata in this message.
message MonitoredResourceMetadata {
// Output only. Values for predefined system metadata labels.
// System labels are a kind of metadata extracted by Google, including
// "machine_image", "vpc", "subnet_id",
// "security_group", "name", etc.
// System label values can be only strings, Boolean values, or a list of
// strings. For example:
//
// { "name": "my-test-instance",
// "security_group": ["a", "b", "c"],
// "spot_instance": false }
google.protobuf.Struct system_labels = 1;
// Output only. A map of user-defined metadata labels.
map<string, string> user_labels = 2;
}

View File

@ -0,0 +1,105 @@
// Copyright 2015 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.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "MonitoringProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Monitoring configuration of the service.
//
// The example below shows how to configure monitored resources and metrics
// for monitoring. In the example, a monitored resource and two metrics are
// defined. The `library.googleapis.com/book/returned_count` metric is sent
// to both producer and consumer projects, whereas the
// `library.googleapis.com/book/num_overdue` metric is only sent to the
// consumer project.
//
// monitored_resources:
// - type: library.googleapis.com/Branch
// display_name: "Library Branch"
// description: "A branch of a library."
// launch_stage: GA
// labels:
// - key: resource_container
// description: "The Cloud container (ie. project id) for the Branch."
// - key: location
// description: "The location of the library branch."
// - key: branch_id
// description: "The id of the branch."
// metrics:
// - name: library.googleapis.com/book/returned_count
// display_name: "Books Returned"
// description: "The count of books that have been returned."
// launch_stage: GA
// metric_kind: DELTA
// value_type: INT64
// unit: "1"
// labels:
// - key: customer_id
// description: "The id of the customer."
// - name: library.googleapis.com/book/num_overdue
// display_name: "Books Overdue"
// description: "The current number of overdue books."
// launch_stage: GA
// metric_kind: GAUGE
// value_type: INT64
// unit: "1"
// labels:
// - key: customer_id
// description: "The id of the customer."
// monitoring:
// producer_destinations:
// - monitored_resource: library.googleapis.com/Branch
// metrics:
// - library.googleapis.com/book/returned_count
// consumer_destinations:
// - monitored_resource: library.googleapis.com/Branch
// metrics:
// - library.googleapis.com/book/returned_count
// - library.googleapis.com/book/num_overdue
message Monitoring {
// Configuration of a specific monitoring destination (the producer project
// or the consumer project).
message MonitoringDestination {
// The monitored resource type. The type must be defined in
// [Service.monitored_resources][google.api.Service.monitored_resources] section.
string monitored_resource = 1;
// Types of the metrics to report to this monitoring destination.
// Each type must be defined in [Service.metrics][google.api.Service.metrics] section.
repeated string metrics = 2;
}
// Monitoring configurations for sending metrics to the producer project.
// There can be multiple producer destinations. A monitored resource type may
// appear in multiple monitoring destinations if different aggregations are
// needed for different sets of metrics associated with that monitored
// resource type. A monitored resource and metric pair may only be used once
// in the Monitoring configuration.
repeated MonitoringDestination producer_destinations = 1;
// Monitoring configurations for sending metrics to the consumer project.
// There can be multiple consumer destinations. A monitored resource type may
// appear in multiple monitoring destinations if different aggregations are
// needed for different sets of metrics associated with that monitored
// resource type. A monitored resource and metric pair may only be used once
// in the Monitoring configuration.
repeated MonitoringDestination consumer_destinations = 2;
}

View File

@ -0,0 +1,183 @@
// Copyright 2015 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.api;
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "QuotaProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Quota configuration helps to achieve fairness and budgeting in service
// usage.
//
// The metric based quota configuration works this way:
// - The service configuration defines a set of metrics.
// - For API calls, the quota.metric_rules maps methods to metrics with
// corresponding costs.
// - The quota.limits defines limits on the metrics, which will be used for
// quota checks at runtime.
//
// An example quota configuration in yaml format:
//
// quota:
// limits:
//
// - name: apiWriteQpsPerProject
// metric: library.googleapis.com/write_calls
// unit: "1/min/{project}" # rate limit for consumer projects
// values:
// STANDARD: 10000
//
//
// # The metric rules bind all methods to the read_calls metric,
// # except for the UpdateBook and DeleteBook methods. These two methods
// # are mapped to the write_calls metric, with the UpdateBook method
// # consuming at twice rate as the DeleteBook method.
// metric_rules:
// - selector: "*"
// metric_costs:
// library.googleapis.com/read_calls: 1
// - selector: google.example.library.v1.LibraryService.UpdateBook
// metric_costs:
// library.googleapis.com/write_calls: 2
// - selector: google.example.library.v1.LibraryService.DeleteBook
// metric_costs:
// library.googleapis.com/write_calls: 1
//
// Corresponding Metric definition:
//
// metrics:
// - name: library.googleapis.com/read_calls
// display_name: Read requests
// metric_kind: DELTA
// value_type: INT64
//
// - name: library.googleapis.com/write_calls
// display_name: Write requests
// metric_kind: DELTA
// value_type: INT64
//
//
message Quota {
// List of `QuotaLimit` definitions for the service.
repeated QuotaLimit limits = 3;
// List of `MetricRule` definitions, each one mapping a selected method to one
// or more metrics.
repeated MetricRule metric_rules = 4;
}
// Bind API methods to metrics. Binding a method to a metric causes that
// metric's configured quota behaviors to apply to the method call.
message MetricRule {
// Selects the methods to which this rule applies.
//
// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
string selector = 1;
// Metrics to update when the selected methods are called, and the associated
// cost applied to each metric.
//
// The key of the map is the metric name, and the values are the amount
// increased for the metric against which the quota limits are defined.
// The value must not be negative.
map<string, int64> metric_costs = 2;
}
// `QuotaLimit` defines a specific limit that applies over a specified duration
// for a limit type. There can be at most one limit for a duration and limit
// type combination defined within a `QuotaGroup`.
message QuotaLimit {
// Name of the quota limit.
//
// The name must be provided, and it must be unique within the service. The
// name can only include alphanumeric characters as well as '-'.
//
// The maximum length of the limit name is 64 characters.
string name = 6;
// Optional. User-visible, extended description for this quota limit.
// Should be used only when more context is needed to understand this limit
// than provided by the limit's display name (see: `display_name`).
string description = 2;
// Default number of tokens that can be consumed during the specified
// duration. This is the number of tokens assigned when a client
// application developer activates the service for his/her project.
//
// Specifying a value of 0 will block all requests. This can be used if you
// are provisioning quota to selected consumers and blocking others.
// Similarly, a value of -1 will indicate an unlimited quota. No other
// negative values are allowed.
//
// Used by group-based quotas only.
int64 default_limit = 3;
// Maximum number of tokens that can be consumed during the specified
// duration. Client application developers can override the default limit up
// to this maximum. If specified, this value cannot be set to a value less
// than the default limit. If not specified, it is set to the default limit.
//
// To allow clients to apply overrides with no upper bound, set this to -1,
// indicating unlimited maximum quota.
//
// Used by group-based quotas only.
int64 max_limit = 4;
// Free tier value displayed in the Developers Console for this limit.
// The free tier is the number of tokens that will be subtracted from the
// billed amount when billing is enabled.
// This field can only be set on a limit with duration "1d", in a billable
// group; it is invalid on any other limit. If this field is not set, it
// defaults to 0, indicating that there is no free tier for this service.
//
// Used by group-based quotas only.
int64 free_tier = 7;
// Duration of this limit in textual notation. Must be "100s" or "1d".
//
// Used by group-based quotas only.
string duration = 5;
// The name of the metric this quota limit applies to. The quota limits with
// the same metric will be checked together during runtime. The metric must be
// defined within the service config.
string metric = 8;
// Specify the unit of the quota limit. It uses the same syntax as
// [Metric.unit][]. The supported unit kinds are determined by the quota
// backend system.
//
// Here are some examples:
// * "1/min/{project}" for quota per minute per project.
//
// Note: the order of unit components is insignificant.
// The "1" at the beginning is required to follow the metric unit syntax.
string unit = 9;
// Tiered limit values. You must specify this as a key:value pair, with an
// integer value that is the maximum number of requests allowed for the
// specified unit. Currently only STANDARD is supported.
map<string, int64> values = 10;
// User-visible display name for this limit.
// Optional. If not set, the UI will provide a default display name based on
// the quota configuration. This field can be used to override the default
// display name generated from the configuration.
string display_name = 12;
}

View File

@ -0,0 +1,299 @@
// Copyright 2018 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.api;
import "google/protobuf/descriptor.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "ResourceProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.FieldOptions {
// An annotation that describes a resource reference, see
// [ResourceReference][].
google.api.ResourceReference resource_reference = 1055;
}
extend google.protobuf.FileOptions {
// An annotation that describes a resource definition without a corresponding
// message; see [ResourceDescriptor][].
repeated google.api.ResourceDescriptor resource_definition = 1053;
}
extend google.protobuf.MessageOptions {
// An annotation that describes a resource definition, see
// [ResourceDescriptor][].
google.api.ResourceDescriptor resource = 1053;
}
// A simple descriptor of a resource type.
//
// ResourceDescriptor annotates a resource message (either by means of a
// protobuf annotation or use in the service config), and associates the
// resource's schema, the resource type, and the pattern of the resource name.
//
// Example:
//
// message Topic {
// // Indicates this message defines a resource schema.
// // Declares the resource type in the format of {service}/{kind}.
// // For Kubernetes resources, the format is {api group}/{kind}.
// option (google.api.resource) = {
// type: "pubsub.googleapis.com/Topic"
// name_descriptor: {
// pattern: "projects/{project}/topics/{topic}"
// parent_type: "cloudresourcemanager.googleapis.com/Project"
// parent_name_extractor: "projects/{project}"
// }
// };
// }
//
// The ResourceDescriptor Yaml config will look like:
//
// resources:
// - type: "pubsub.googleapis.com/Topic"
// name_descriptor:
// - pattern: "projects/{project}/topics/{topic}"
// parent_type: "cloudresourcemanager.googleapis.com/Project"
// parent_name_extractor: "projects/{project}"
//
// Sometimes, resources have multiple patterns, typically because they can
// live under multiple parents.
//
// Example:
//
// message LogEntry {
// option (google.api.resource) = {
// type: "logging.googleapis.com/LogEntry"
// name_descriptor: {
// pattern: "projects/{project}/logs/{log}"
// parent_type: "cloudresourcemanager.googleapis.com/Project"
// parent_name_extractor: "projects/{project}"
// }
// name_descriptor: {
// pattern: "folders/{folder}/logs/{log}"
// parent_type: "cloudresourcemanager.googleapis.com/Folder"
// parent_name_extractor: "folders/{folder}"
// }
// name_descriptor: {
// pattern: "organizations/{organization}/logs/{log}"
// parent_type: "cloudresourcemanager.googleapis.com/Organization"
// parent_name_extractor: "organizations/{organization}"
// }
// name_descriptor: {
// pattern: "billingAccounts/{billing_account}/logs/{log}"
// parent_type: "billing.googleapis.com/BillingAccount"
// parent_name_extractor: "billingAccounts/{billing_account}"
// }
// };
// }
//
// The ResourceDescriptor Yaml config will look like:
//
// resources:
// - type: 'logging.googleapis.com/LogEntry'
// name_descriptor:
// - pattern: "projects/{project}/logs/{log}"
// parent_type: "cloudresourcemanager.googleapis.com/Project"
// parent_name_extractor: "projects/{project}"
// - pattern: "folders/{folder}/logs/{log}"
// parent_type: "cloudresourcemanager.googleapis.com/Folder"
// parent_name_extractor: "folders/{folder}"
// - pattern: "organizations/{organization}/logs/{log}"
// parent_type: "cloudresourcemanager.googleapis.com/Organization"
// parent_name_extractor: "organizations/{organization}"
// - pattern: "billingAccounts/{billing_account}/logs/{log}"
// parent_type: "billing.googleapis.com/BillingAccount"
// parent_name_extractor: "billingAccounts/{billing_account}"
//
// For flexible resources, the resource name doesn't contain parent names, but
// the resource itself has parents for policy evaluation.
//
// Example:
//
// message Shelf {
// option (google.api.resource) = {
// type: "library.googleapis.com/Shelf"
// name_descriptor: {
// pattern: "shelves/{shelf}"
// parent_type: "cloudresourcemanager.googleapis.com/Project"
// }
// name_descriptor: {
// pattern: "shelves/{shelf}"
// parent_type: "cloudresourcemanager.googleapis.com/Folder"
// }
// };
// }
//
// The ResourceDescriptor Yaml config will look like:
//
// resources:
// - type: 'library.googleapis.com/Shelf'
// name_descriptor:
// - pattern: "shelves/{shelf}"
// parent_type: "cloudresourcemanager.googleapis.com/Project"
// - pattern: "shelves/{shelf}"
// parent_type: "cloudresourcemanager.googleapis.com/Folder"
message ResourceDescriptor {
// A description of the historical or future-looking state of the
// resource pattern.
enum History {
// The "unset" value.
HISTORY_UNSPECIFIED = 0;
// The resource originally had one pattern and launched as such, and
// additional patterns were added later.
ORIGINALLY_SINGLE_PATTERN = 1;
// The resource has one pattern, but the API owner expects to add more
// later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents
// that from being necessary once there are multiple patterns.)
FUTURE_MULTI_PATTERN = 2;
}
// A flag representing a specific style that a resource claims to conform to.
enum Style {
// The unspecified value. Do not use.
STYLE_UNSPECIFIED = 0;
// This resource is intended to be "declarative-friendly".
//
// Declarative-friendly resources must be more strictly consistent, and
// setting this to true communicates to tools that this resource should
// adhere to declarative-friendly expectations.
//
// Note: This is used by the API linter (linter.aip.dev) to enable
// additional checks.
DECLARATIVE_FRIENDLY = 1;
}
// The resource type. It must be in the format of
// {service_name}/{resource_type_kind}. The `resource_type_kind` must be
// singular and must not include version numbers.
//
// Example: `storage.googleapis.com/Bucket`
//
// The value of the resource_type_kind must follow the regular expression
// /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and
// should use PascalCase (UpperCamelCase). The maximum number of
// characters allowed for the `resource_type_kind` is 100.
string type = 1;
// Optional. The relative resource name pattern associated with this resource
// type. The DNS prefix of the full resource name shouldn't be specified here.
//
// The path pattern must follow the syntax, which aligns with HTTP binding
// syntax:
//
// Template = Segment { "/" Segment } ;
// Segment = LITERAL | Variable ;
// Variable = "{" LITERAL "}" ;
//
// Examples:
//
// - "projects/{project}/topics/{topic}"
// - "projects/{project}/knowledgeBases/{knowledge_base}"
//
// The components in braces correspond to the IDs for each resource in the
// hierarchy. It is expected that, if multiple patterns are provided,
// the same component name (e.g. "project") refers to IDs of the same
// type of resource.
repeated string pattern = 2;
// Optional. The field on the resource that designates the resource name
// field. If omitted, this is assumed to be "name".
string name_field = 3;
// Optional. The historical or future-looking state of the resource pattern.
//
// Example:
//
// // The InspectTemplate message originally only supported resource
// // names with organization, and project was added later.
// message InspectTemplate {
// option (google.api.resource) = {
// type: "dlp.googleapis.com/InspectTemplate"
// pattern:
// "organizations/{organization}/inspectTemplates/{inspect_template}"
// pattern: "projects/{project}/inspectTemplates/{inspect_template}"
// history: ORIGINALLY_SINGLE_PATTERN
// };
// }
History history = 4;
// The plural name used in the resource name and permission names, such as
// 'projects' for the resource name of 'projects/{project}' and the permission
// name of 'cloudresourcemanager.googleapis.com/projects.get'. It is the same
// concept of the `plural` field in k8s CRD spec
// https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
//
// Note: The plural form is required even for singleton resources. See
// https://aip.dev/156
string plural = 5;
// The same concept of the `singular` field in k8s CRD spec
// https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
// Such as "project" for the `resourcemanager.googleapis.com/Project` type.
string singular = 6;
// Style flag(s) for this resource.
// These indicate that a resource is expected to conform to a given
// style. See the specific style flags for additional information.
repeated Style style = 10;
}
// Defines a proto annotation that describes a string field that refers to
// an API resource.
message ResourceReference {
// The resource type that the annotated field references.
//
// Example:
//
// message Subscription {
// string topic = 2 [(google.api.resource_reference) = {
// type: "pubsub.googleapis.com/Topic"
// }];
// }
//
// Occasionally, a field may reference an arbitrary resource. In this case,
// APIs use the special value * in their resource reference.
//
// Example:
//
// message GetIamPolicyRequest {
// string resource = 2 [(google.api.resource_reference) = {
// type: "*"
// }];
// }
string type = 1;
// The resource type of a child collection that the annotated field
// references. This is useful for annotating the `parent` field that
// doesn't have a fixed resource type.
//
// Example:
//
// message ListLogEntriesRequest {
// string parent = 1 [(google.api.resource_reference) = {
// child_type: "logging.googleapis.com/LogEntry"
// };
// }
string child_type = 2;
}

View File

@ -0,0 +1,461 @@
// 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.
syntax = "proto3";
package google.api;
import "google/protobuf/descriptor.proto";
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "RoutingProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.MethodOptions {
// See RoutingRule.
google.api.RoutingRule routing = 72295729;
}
// Specifies the routing information that should be sent along with the request
// in the form of routing header.
// **NOTE:** All service configuration rules follow the "last one wins" order.
//
// The examples below will apply to an RPC which has the following request type:
//
// Message Definition:
//
// message Request {
// // The name of the Table
// // Values can be of the following formats:
// // - `projects/<project>/tables/<table>`
// // - `projects/<project>/instances/<instance>/tables/<table>`
// // - `region/<region>/zones/<zone>/tables/<table>`
// string table_name = 1;
//
// // This value specifies routing for replication.
// // It can be in the following formats:
// // - `profiles/<profile_id>`
// // - a legacy `profile_id` that can be any string
// string app_profile_id = 2;
// }
//
// Example message:
//
// {
// table_name: projects/proj_foo/instances/instance_bar/table/table_baz,
// app_profile_id: profiles/prof_qux
// }
//
// The routing header consists of one or multiple key-value pairs. Every key
// and value must be percent-encoded, and joined together in the format of
// `key1=value1&key2=value2`.
// In the examples below I am skipping the percent-encoding for readablity.
//
// Example 1
//
// Extracting a field from the request to put into the routing header
// unchanged, with the key equal to the field name.
//
// annotation:
//
// option (google.api.routing) = {
// // Take the `app_profile_id`.
// routing_parameters {
// field: "app_profile_id"
// }
// };
//
// result:
//
// x-goog-request-params: app_profile_id=profiles/prof_qux
//
// Example 2
//
// Extracting a field from the request to put into the routing header
// unchanged, with the key different from the field name.
//
// annotation:
//
// option (google.api.routing) = {
// // Take the `app_profile_id`, but name it `routing_id` in the header.
// routing_parameters {
// field: "app_profile_id"
// path_template: "{routing_id=**}"
// }
// };
//
// result:
//
// x-goog-request-params: routing_id=profiles/prof_qux
//
// Example 3
//
// Extracting a field from the request to put into the routing
// header, while matching a path template syntax on the field's value.
//
// NB: it is more useful to send nothing than to send garbage for the purpose
// of dynamic routing, since garbage pollutes cache. Thus the matching.
//
// Sub-example 3a
//
// The field matches the template.
//
// annotation:
//
// option (google.api.routing) = {
// // Take the `table_name`, if it's well-formed (with project-based
// // syntax).
// routing_parameters {
// field: "table_name"
// path_template: "{table_name=projects/*/instances/*/**}"
// }
// };
//
// result:
//
// x-goog-request-params:
// table_name=projects/proj_foo/instances/instance_bar/table/table_baz
//
// Sub-example 3b
//
// The field does not match the template.
//
// annotation:
//
// option (google.api.routing) = {
// // Take the `table_name`, if it's well-formed (with region-based
// // syntax).
// routing_parameters {
// field: "table_name"
// path_template: "{table_name=regions/*/zones/*/**}"
// }
// };
//
// result:
//
// <no routing header will be sent>
//
// Sub-example 3c
//
// Multiple alternative conflictingly named path templates are
// specified. The one that matches is used to construct the header.
//
// annotation:
//
// option (google.api.routing) = {
// // Take the `table_name`, if it's well-formed, whether
// // using the region- or projects-based syntax.
//
// routing_parameters {
// field: "table_name"
// path_template: "{table_name=regions/*/zones/*/**}"
// }
// routing_parameters {
// field: "table_name"
// path_template: "{table_name=projects/*/instances/*/**}"
// }
// };
//
// result:
//
// x-goog-request-params:
// table_name=projects/proj_foo/instances/instance_bar/table/table_baz
//
// Example 4
//
// Extracting a single routing header key-value pair by matching a
// template syntax on (a part of) a single request field.
//
// annotation:
//
// option (google.api.routing) = {
// // Take just the project id from the `table_name` field.
// routing_parameters {
// field: "table_name"
// path_template: "{routing_id=projects/*}/**"
// }
// };
//
// result:
//
// x-goog-request-params: routing_id=projects/proj_foo
//
// Example 5
//
// Extracting a single routing header key-value pair by matching
// several conflictingly named path templates on (parts of) a single request
// field. The last template to match "wins" the conflict.
//
// annotation:
//
// option (google.api.routing) = {
// // If the `table_name` does not have instances information,
// // take just the project id for routing.
// // Otherwise take project + instance.
//
// routing_parameters {
// field: "table_name"
// path_template: "{routing_id=projects/*}/**"
// }
// routing_parameters {
// field: "table_name"
// path_template: "{routing_id=projects/*/instances/*}/**"
// }
// };
//
// result:
//
// x-goog-request-params:
// routing_id=projects/proj_foo/instances/instance_bar
//
// Example 6
//
// Extracting multiple routing header key-value pairs by matching
// several non-conflicting path templates on (parts of) a single request field.
//
// Sub-example 6a
//
// Make the templates strict, so that if the `table_name` does not
// have an instance information, nothing is sent.
//
// annotation:
//
// option (google.api.routing) = {
// // The routing code needs two keys instead of one composite
// // but works only for the tables with the "project-instance" name
// // syntax.
//
// routing_parameters {
// field: "table_name"
// path_template: "{project_id=projects/*}/instances/*/**"
// }
// routing_parameters {
// field: "table_name"
// path_template: "projects/*/{instance_id=instances/*}/**"
// }
// };
//
// result:
//
// x-goog-request-params:
// project_id=projects/proj_foo&instance_id=instances/instance_bar
//
// Sub-example 6b
//
// Make the templates loose, so that if the `table_name` does not
// have an instance information, just the project id part is sent.
//
// annotation:
//
// option (google.api.routing) = {
// // The routing code wants two keys instead of one composite
// // but will work with just the `project_id` for tables without
// // an instance in the `table_name`.
//
// routing_parameters {
// field: "table_name"
// path_template: "{project_id=projects/*}/**"
// }
// routing_parameters {
// field: "table_name"
// path_template: "projects/*/{instance_id=instances/*}/**"
// }
// };
//
// result (is the same as 6a for our example message because it has the instance
// information):
//
// x-goog-request-params:
// project_id=projects/proj_foo&instance_id=instances/instance_bar
//
// Example 7
//
// Extracting multiple routing header key-value pairs by matching
// several path templates on multiple request fields.
//
// NB: note that here there is no way to specify sending nothing if one of the
// fields does not match its template. E.g. if the `table_name` is in the wrong
// format, the `project_id` will not be sent, but the `routing_id` will be.
// The backend routing code has to be aware of that and be prepared to not
// receive a full complement of keys if it expects multiple.
//
// annotation:
//
// option (google.api.routing) = {
// // The routing needs both `project_id` and `routing_id`
// // (from the `app_profile_id` field) for routing.
//
// routing_parameters {
// field: "table_name"
// path_template: "{project_id=projects/*}/**"
// }
// routing_parameters {
// field: "app_profile_id"
// path_template: "{routing_id=**}"
// }
// };
//
// result:
//
// x-goog-request-params:
// project_id=projects/proj_foo&routing_id=profiles/prof_qux
//
// Example 8
//
// Extracting a single routing header key-value pair by matching
// several conflictingly named path templates on several request fields. The
// last template to match "wins" the conflict.
//
// annotation:
//
// option (google.api.routing) = {
// // The `routing_id` can be a project id or a region id depending on
// // the table name format, but only if the `app_profile_id` is not set.
// // If `app_profile_id` is set it should be used instead.
//
// routing_parameters {
// field: "table_name"
// path_template: "{routing_id=projects/*}/**"
// }
// routing_parameters {
// field: "table_name"
// path_template: "{routing_id=regions/*}/**"
// }
// routing_parameters {
// field: "app_profile_id"
// path_template: "{routing_id=**}"
// }
// };
//
// result:
//
// x-goog-request-params: routing_id=profiles/prof_qux
//
// Example 9
//
// Bringing it all together.
//
// annotation:
//
// option (google.api.routing) = {
// // For routing both `table_location` and a `routing_id` are needed.
// //
// // table_location can be either an instance id or a region+zone id.
// //
// // For `routing_id`, take the value of `app_profile_id`
// // - If it's in the format `profiles/<profile_id>`, send
// // just the `<profile_id>` part.
// // - If it's any other literal, send it as is.
// // If the `app_profile_id` is empty, and the `table_name` starts with
// // the project_id, send that instead.
//
// routing_parameters {
// field: "table_name"
// path_template: "projects/*/{table_location=instances/*}/tables/*"
// }
// routing_parameters {
// field: "table_name"
// path_template: "{table_location=regions/*/zones/*}/tables/*"
// }
// routing_parameters {
// field: "table_name"
// path_template: "{routing_id=projects/*}/**"
// }
// routing_parameters {
// field: "app_profile_id"
// path_template: "{routing_id=**}"
// }
// routing_parameters {
// field: "app_profile_id"
// path_template: "profiles/{routing_id=*}"
// }
// };
//
// result:
//
// x-goog-request-params:
// table_location=instances/instance_bar&routing_id=prof_qux
message RoutingRule {
// A collection of Routing Parameter specifications.
// **NOTE:** If multiple Routing Parameters describe the same key
// (via the `path_template` field or via the `field` field when
// `path_template` is not provided), "last one wins" rule
// determines which Parameter gets used.
// See the examples for more details.
repeated RoutingParameter routing_parameters = 2;
}
// A projection from an input message to the GRPC or REST header.
message RoutingParameter {
// A request field to extract the header key-value pair from.
string field = 1;
// A pattern matching the key-value field. Optional.
// If not specified, the whole field specified in the `field` field will be
// taken as value, and its name used as key. If specified, it MUST contain
// exactly one named segment (along with any number of unnamed segments) The
// pattern will be matched over the field specified in the `field` field, then
// if the match is successful:
// - the name of the single named segment will be used as a header name,
// - the match value of the segment will be used as a header value;
// if the match is NOT successful, nothing will be sent.
//
// Example:
//
// -- This is a field in the request message
// | that the header value will be extracted from.
// |
// | -- This is the key name in the
// | | routing header.
// V |
// field: "table_name" v
// path_template: "projects/*/{table_location=instances/*}/tables/*"
// ^ ^
// | |
// In the {} brackets is the pattern that -- |
// specifies what to extract from the |
// field as a value to be sent. |
// |
// The string in the field must match the whole pattern --
// before brackets, inside brackets, after brackets.
//
// When looking at this specific example, we can see that:
// - A key-value pair with the key `table_location`
// and the value matching `instances/*` should be added
// to the x-goog-request-params routing header.
// - The value is extracted from the request message's `table_name` field
// if it matches the full pattern specified:
// `projects/*/instances/*/tables/*`.
//
// **NB:** If the `path_template` field is not provided, the key name is
// equal to the field name, and the whole field should be sent as a value.
// This makes the pattern for the field and the value functionally equivalent
// to `**`, and the configuration
//
// {
// field: "table_name"
// }
//
// is a functionally equivalent shorthand to:
//
// {
// field: "table_name"
// path_template: "{table_name=**}"
// }
//
// See Example 1 for more details.
string path_template = 2;
}

View File

@ -0,0 +1,175 @@
// Copyright 2015 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.api;
import "google/api/auth.proto";
import "google/api/backend.proto";
import "google/api/billing.proto";
import "google/api/context.proto";
import "google/api/control.proto";
import "google/api/documentation.proto";
import "google/api/endpoint.proto";
import "google/api/http.proto";
import "google/api/label.proto";
import "google/api/log.proto";
import "google/api/logging.proto";
import "google/api/metric.proto";
import "google/api/monitored_resource.proto";
import "google/api/monitoring.proto";
import "google/api/quota.proto";
import "google/api/resource.proto";
import "google/api/source_info.proto";
import "google/api/system_parameter.proto";
import "google/api/usage.proto";
import "google/protobuf/any.proto";
import "google/protobuf/api.proto";
import "google/protobuf/type.proto";
import "google/protobuf/wrappers.proto";
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
option java_multiple_files = true;
option java_outer_classname = "ServiceProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// `Service` is the root object of Google service configuration schema. It
// describes basic information about a service, such as the name and the
// title, and delegates other aspects to sub-sections. Each sub-section is
// either a proto message or a repeated proto message that configures a
// specific aspect, such as auth. See each proto message definition for details.
//
// Example:
//
// type: google.api.Service
// name: calendar.googleapis.com
// title: Google Calendar API
// apis:
// - name: google.calendar.v3.Calendar
// authentication:
// providers:
// - id: google_calendar_auth
// jwks_uri: https://www.googleapis.com/oauth2/v1/certs
// issuer: https://securetoken.google.com
// rules:
// - selector: "*"
// requirements:
// provider_id: google_calendar_auth
message Service {
// The service name, which is a DNS-like logical identifier for the
// service, such as `calendar.googleapis.com`. The service name
// typically goes through DNS verification to make sure the owner
// of the service also owns the DNS name.
string name = 1;
// The product title for this service.
string title = 2;
// The Google project that owns this service.
string producer_project_id = 22;
// A unique ID for a specific instance of this message, typically assigned
// by the client for tracking purpose. Must be no longer than 63 characters
// and only lower case letters, digits, '.', '_' and '-' are allowed. If
// empty, the server may choose to generate one instead.
string id = 33;
// A list of API interfaces exported by this service. Only the `name` field
// of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by the configuration
// author, as the remaining fields will be derived from the IDL during the
// normalization process. It is an error to specify an API interface here
// which cannot be resolved against the associated IDL files.
repeated google.protobuf.Api apis = 3;
// A list of all proto message types included in this API service.
// Types referenced directly or indirectly by the `apis` are
// automatically included. Messages which are not referenced but
// shall be included, such as types used by the `google.protobuf.Any` type,
// should be listed here by name. Example:
//
// types:
// - name: google.protobuf.Int32
repeated google.protobuf.Type types = 4;
// A list of all enum types included in this API service. Enums
// referenced directly or indirectly by the `apis` are automatically
// included. Enums which are not referenced but shall be included
// should be listed here by name. Example:
//
// enums:
// - name: google.someapi.v1.SomeEnum
repeated google.protobuf.Enum enums = 5;
// Additional API documentation.
Documentation documentation = 6;
// API backend configuration.
Backend backend = 8;
// HTTP configuration.
Http http = 9;
// Quota configuration.
Quota quota = 10;
// Auth configuration.
Authentication authentication = 11;
// Context configuration.
Context context = 12;
// Configuration controlling usage of this service.
Usage usage = 15;
// Configuration for network endpoints. If this is empty, then an endpoint
// with the same name as the service is automatically generated to service all
// defined APIs.
repeated Endpoint endpoints = 18;
// Configuration for the service control plane.
Control control = 21;
// Defines the logs used by this service.
repeated LogDescriptor logs = 23;
// Defines the metrics used by this service.
repeated MetricDescriptor metrics = 24;
// Defines the monitored resources used by this service. This is required
// by the [Service.monitoring][google.api.Service.monitoring] and [Service.logging][google.api.Service.logging] configurations.
repeated MonitoredResourceDescriptor monitored_resources = 25;
// Billing configuration.
Billing billing = 26;
// Logging configuration.
Logging logging = 27;
// Monitoring configuration.
Monitoring monitoring = 28;
// System parameter configuration.
SystemParameters system_parameters = 29;
// Output only. The source information for this configuration if available.
SourceInfo source_info = 37;
// Obsolete. Do not use.
//
// This field has no semantic meaning. The service config compiler always
// sets this field to `3`.
google.protobuf.UInt32Value config_version = 20 [deprecated = true];
}

View File

@ -0,0 +1,26 @@
type: google.api.Service
config_version: 3
name: serviceconfig.googleapis.com
title: Service Config API
types:
- name: google.api.ConfigChange
- name: google.api.Distribution
- name: google.api.DocumentationRule
- name: google.api.HttpBody
- name: google.api.LabelDescriptor
- name: google.api.Metric
- name: google.api.MonitoredResource
- name: google.api.MonitoredResourceDescriptor
- name: google.api.MonitoredResourceMetadata
- name: google.api.ResourceDescriptor
- name: google.api.ResourceReference
- name: google.api.Service
- name: google.api.Visibility
enums:
- name: google.api.ErrorReason
- name: google.api.FieldBehavior
documentation:
summary: Lets you define and config your API service.

View File

@ -0,0 +1,126 @@
Google Service Control provides control plane functionality to managed services,
such as logging, monitoring, and status checks. This page provides an overview
of what it does and how it works.
## Why use Service Control?
When you develop a cloud service, you typically start with the business
requirements and the architecture design, then proceed with API definition
and implementation. Before you put your service into production, you
need to deal with many control plane issues:
* How to control access to your service.
* How to send logging and monitoring data to both consumers and producers.
* How to create and manage dashboards to visualize this data.
* How to automatically scale the control plane components with your service.
Service Control is a mature and feature-rich control plane provider
that addresses these needs with high efficiency, high scalability,
and high availability. It provides a simple public API that can be accessed
from anywhere using JSON REST and gRPC clients, so when you move your service
from on-premise to a cloud provider, or from one cloud provider to another,
you don't need to change the control plane provider.
Services built using Google Cloud Endpoints already take advantage of
Service Control. Cloud Endpoints sends logging and monitoring data
through Google Service Control for every request arriving at its
proxy. If you need to report any additional logging and monitoring data for
your Cloud Endpoints service, you can call the Service Control API directly
from your service.
The Service Control API definition is open sourced and available on
[GitHub](https://github.com/googleapis/googleapis/tree/master/google/api/servicecontrol).
By changing the DNS name, you can easily use alternative implementations of
the Service Control API.
## Architecture
Google Service Control works with a set of *managed services* and their
*operations* (activities), *checks* whether an operation is allowed to proceed,
and *reports* completed operations. Behind the scenes, it leverages other
Google Cloud services, such as
[Google Service Management](/service-management),
[Stackdriver Logging](/logging), and [Stackdriver Monitoring](/monitoring),
while hiding their complexity from service producers. It enables service
producers to send telemetry data to their consumers. It uses caching,
batching, aggregation, and retries to deliver higher performance and
availability than the individual backend systems it encapsulates.
<figure id="fig-arch" class="center">
<div style="width: 70%;margin: auto">
<img src="/service-control/images/arch.svg"
alt="The overall architecture of a service that uses Google Service Control.">
</div>
<figcaption><b>Figure 1</b>: Using Google Service Control.</figcaption>
</figure>
The Service Control API provides two methods:
* [`services.check`](/service-control/reference/rest/v1/services/check), used for:
* Ensuring valid consumer status
* Validating API keys
* [`services.report`](/service-control/reference/rest/v1/services/report), used for:
* Sending logs to Stackdriver Logging
* Sending metrics to Stackdriver Monitoring
Well look at these in more detail in the rest of this overview.
## Managed services
A [managed service](/service-management/reference/rest/v1/services) is
a network service managed by
[Google Service Management](/service-management). Each managed service has a
unique name, such as `example.googleapis.com`, which must be a valid
fully-qualified DNS name, as per RFC 1035.
For example:
* Google Cloud Pub/Sub (`pubsub.googleapis.com`)
* Google Cloud Vision (`vision.googleapis.com`)
* Google Cloud Bigtable (`bigtable.googleapis.com`)
* Google Cloud Datastore (`datastore.googleapis.com`)
Google Service Management manages the lifecycle of each services
configuration, which is used to customize Google Service Control's behavior.
Service configurations are also used by Google Cloud Console
for displaying APIs and their settings, enabling/disabling APIs, and more.
## Operations
Google Service Control uses the generic concept of an *operation*
to represent the
activities of a managed service, such as API calls and resource usage. Each
operation is associated with a managed service and a specific service
consumer, and has a set of properties that describe the operation, such as
the API method name and resource usage amount. For more information, see the
[Operation definition](/service-control/rest/v1/Operation).
## Check
The [`services.check`](/service-control/reference/rest/v1/services/check)
method determines whether an operation should be allowed to proceed
for a managed service.
For example:
* Check if the consumer is still active.
* Check if the consumer has enabled the service.
* Check if the API key is still valid.
By performing multiple checks within a single method call, it provides
better performance, higher reliability, and reduced development cost to
service producers compared to checking with multiple backend systems.
## Report
The [`services.report`](/service-control/reference/rest/v1/services/report)
method reports completed operations for
a managed service to backend systems, such as logging and monitoring. The
reported data can be seen in Google API Console and Google Cloud Console,
and retrieved with appropriate APIs, such as the Stackdriver Logging and
Stackdriver Monitoring APIs.
## Next steps
* Read our [Getting Started guide](/service-control/getting-started) to find out
how to set up and use the Google Service Control API.

View File

@ -0,0 +1,362 @@
# This file was automatically generated by BuildFileGenerator
# https://github.com/googleapis/rules_gapic/tree/master/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 = "servicecontrol_proto",
srcs = [
"check_error.proto",
"distribution.proto",
"http_request.proto",
"log_entry.proto",
"metric_value.proto",
"operation.proto",
"quota_controller.proto",
"service_controller.proto",
],
deps = [
"//google/api:annotations_proto",
"//google/api:client_proto",
"//google/api:distribution_proto",
"//google/logging/type:type_proto",
"//google/rpc:status_proto",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:struct_proto",
"@com_google_protobuf//:timestamp_proto",
],
)
proto_library_with_info(
name = "servicecontrol_proto_with_info",
deps = [
":servicecontrol_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 = "servicecontrol_java_proto",
deps = [":servicecontrol_proto"],
)
java_grpc_library(
name = "servicecontrol_java_grpc",
srcs = [":servicecontrol_proto"],
deps = [":servicecontrol_java_proto"],
)
java_gapic_library(
name = "servicecontrol_java_gapic",
srcs = [":servicecontrol_proto_with_info"],
grpc_service_config = "servicecontrol_grpc_service_config.json",
test_deps = [
":servicecontrol_java_grpc",
],
deps = [
":servicecontrol_java_proto",
],
)
java_gapic_test(
name = "servicecontrol_java_gapic_test_suite",
test_classes = [
"com.google.api.servicecontrol.v1.QuotaControllerClientTest",
"com.google.api.servicecontrol.v1.ServiceControllerClientTest",
],
runtime_deps = [":servicecontrol_java_gapic_test"],
)
# Open Source Packages
java_gapic_assembly_gradle_pkg(
name = "google-cloud-api-servicecontrol-v1-java",
deps = [
":servicecontrol_java_gapic",
":servicecontrol_java_grpc",
":servicecontrol_java_proto",
":servicecontrol_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 = "servicecontrol_go_proto",
compilers = ["@io_bazel_rules_go//proto:go_grpc"],
importpath = "google.golang.org/genproto/googleapis/api/servicecontrol/v1",
protos = [":servicecontrol_proto"],
deps = [
"//google/api:annotations_go_proto",
"//google/api:distribution_go_proto",
"//google/logging/type:type_go_proto",
"//google/rpc:status_go_proto",
],
)
go_gapic_library(
name = "servicecontrol_go_gapic",
srcs = [":servicecontrol_proto_with_info"],
grpc_service_config = "servicecontrol_grpc_service_config.json",
importpath = "cloud.google.com/go/api/servicecontrol/apiv1;servicecontrol",
metadata = True,
service_yaml = "servicecontrol.yaml",
deps = [
":servicecontrol_go_proto",
"@io_bazel_rules_go//proto/wkt:duration_go_proto",
],
)
go_test(
name = "servicecontrol_go_gapic_test",
srcs = [":servicecontrol_go_gapic_srcjar_test"],
embed = [":servicecontrol_go_gapic"],
importpath = "cloud.google.com/go/api/servicecontrol/apiv1",
)
# Open Source Packages
go_gapic_assembly_pkg(
name = "gapi-cloud-api-servicecontrol-v1-go",
deps = [
":servicecontrol_go_gapic",
":servicecontrol_go_gapic_srcjar-metadata.srcjar",
":servicecontrol_go_gapic_srcjar-test.srcjar",
":servicecontrol_go_proto",
],
)
##############################################################################
# Python
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"py_gapic_assembly_pkg",
"py_gapic_library",
)
py_gapic_library(
name = "servicecontrol_py_gapic",
srcs = [":servicecontrol_proto"],
grpc_service_config = "servicecontrol_grpc_service_config.json",
opt_args = [
"python-gapic-name=servicecontrol",
"python-gapic-namespace=google.cloud",
"warehouse-package-name=google-cloud-service-control",
],
)
# Open Source Packages
py_gapic_assembly_pkg(
name = "google-cloud-servicecontrol-v1-py",
deps = [
":servicecontrol_py_gapic",
],
)
##############################################################################
# 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 = "servicecontrol_php_proto",
deps = [":servicecontrol_proto"],
)
php_grpc_library(
name = "servicecontrol_php_grpc",
srcs = [":servicecontrol_proto"],
deps = [":servicecontrol_php_proto"],
)
php_gapic_library(
name = "servicecontrol_php_gapic",
srcs = [":servicecontrol_proto_with_info"],
grpc_service_config = "servicecontrol_grpc_service_config.json",
service_yaml = "servicecontrol.yaml",
deps = [
":servicecontrol_php_grpc",
":servicecontrol_php_proto",
],
)
# Open Source Packages
php_gapic_assembly_pkg(
name = "google-cloud-api-servicecontrol-v1-php",
deps = [
":servicecontrol_php_gapic",
":servicecontrol_php_grpc",
":servicecontrol_php_proto",
],
)
##############################################################################
# Node.js
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"nodejs_gapic_assembly_pkg",
"nodejs_gapic_library",
)
nodejs_gapic_library(
name = "servicecontrol_nodejs_gapic",
package_name = "@google-cloud/service-control",
src = ":servicecontrol_proto_with_info",
extra_protoc_parameters = ["metadata"],
grpc_service_config = "servicecontrol_grpc_service_config.json",
package = "google.api.servicecontrol.v1",
service_yaml = "servicecontrol.yaml",
deps = [],
)
nodejs_gapic_assembly_pkg(
name = "api-servicecontrol-v1-nodejs",
deps = [
":servicecontrol_nodejs_gapic",
":servicecontrol_proto",
## DO NOT CHANGE: Owlbot add dependency logging type protos.
"//google/logging/type:type_proto",
],
)
##############################################################################
# Ruby
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"ruby_cloud_gapic_library",
"ruby_gapic_assembly_pkg",
"ruby_grpc_library",
"ruby_proto_library",
)
ruby_proto_library(
name = "servicecontrol_ruby_proto",
deps = [":servicecontrol_proto"],
)
ruby_grpc_library(
name = "servicecontrol_ruby_grpc",
srcs = [":servicecontrol_proto"],
deps = [":servicecontrol_ruby_proto"],
)
ruby_cloud_gapic_library(
name = "servicecontrol_ruby_gapic",
srcs = [":servicecontrol_proto_with_info"],
extra_protoc_parameters = [
"ruby-cloud-api-id=servicecontrol.googleapis.com",
"ruby-cloud-api-shortname=servicecontrol",
"ruby-cloud-env-prefix=SERVICE_CONTROL",
"ruby-cloud-gem-name=google-cloud-service_control-v1",
"ruby-cloud-product-url=https://cloud.google.com/service-infrastructure/docs/overview/",
],
grpc_service_config = "servicecontrol_grpc_service_config.json",
ruby_cloud_description = "The Service Control API provides control plane functionality to managed services, such as logging, monitoring, and status checks.",
ruby_cloud_title = "Service Control API V1",
deps = [
":servicecontrol_ruby_grpc",
":servicecontrol_ruby_proto",
],
)
# Open Source Packages
ruby_gapic_assembly_pkg(
name = "google-cloud-api-servicecontrol-v1-ruby",
deps = [
":servicecontrol_ruby_gapic",
":servicecontrol_ruby_grpc",
":servicecontrol_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 = "servicecontrol_csharp_proto",
deps = [":servicecontrol_proto"],
)
csharp_grpc_library(
name = "servicecontrol_csharp_grpc",
srcs = [":servicecontrol_proto"],
deps = [":servicecontrol_csharp_proto"],
)
csharp_gapic_library(
name = "servicecontrol_csharp_gapic",
srcs = [":servicecontrol_proto_with_info"],
common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
grpc_service_config = "servicecontrol_grpc_service_config.json",
deps = [
":servicecontrol_csharp_grpc",
":servicecontrol_csharp_proto",
],
)
# Open Source Packages
csharp_gapic_assembly_pkg(
name = "google-cloud-api-servicecontrol-v1-csharp",
deps = [
":servicecontrol_csharp_gapic",
":servicecontrol_csharp_grpc",
":servicecontrol_csharp_proto",
],
)
##############################################################################
# C++
##############################################################################
# Put your C++ rules here

View File

@ -0,0 +1,124 @@
// 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.
syntax = "proto3";
package google.api.servicecontrol.v1;
import "google/rpc/status.proto";
option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.ServiceControl.V1";
option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol";
option java_multiple_files = true;
option java_outer_classname = "CheckErrorProto";
option java_package = "com.google.api.servicecontrol.v1";
option php_namespace = "Google\\Cloud\\ServiceControl\\V1";
option ruby_package = "Google::Cloud::ServiceControl::V1";
// Defines the errors to be returned in
// [google.api.servicecontrol.v1.CheckResponse.check_errors][google.api.servicecontrol.v1.CheckResponse.check_errors].
message CheckError {
// Error codes for Check responses.
enum Code {
// This is never used in `CheckResponse`.
ERROR_CODE_UNSPECIFIED = 0;
// The consumer's project id, network container, or resource container was
// not found. Same as [google.rpc.Code.NOT_FOUND][google.rpc.Code.NOT_FOUND].
NOT_FOUND = 5;
// The consumer doesn't have access to the specified resource.
// Same as [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED].
PERMISSION_DENIED = 7;
// Quota check failed. Same as [google.rpc.Code.RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED].
RESOURCE_EXHAUSTED = 8;
// The consumer hasn't activated the service.
SERVICE_NOT_ACTIVATED = 104;
// The consumer cannot access the service because billing is disabled.
BILLING_DISABLED = 107;
// The consumer's project has been marked as deleted (soft deletion).
PROJECT_DELETED = 108;
// The consumer's project number or id does not represent a valid project.
PROJECT_INVALID = 114;
// The input consumer info does not represent a valid consumer folder or
// organization.
CONSUMER_INVALID = 125;
// The IP address of the consumer is invalid for the specific consumer
// project.
IP_ADDRESS_BLOCKED = 109;
// The referer address of the consumer request is invalid for the specific
// consumer project.
REFERER_BLOCKED = 110;
// The client application of the consumer request is invalid for the
// specific consumer project.
CLIENT_APP_BLOCKED = 111;
// The API targeted by this request is invalid for the specified consumer
// project.
API_TARGET_BLOCKED = 122;
// The consumer's API key is invalid.
API_KEY_INVALID = 105;
// The consumer's API Key has expired.
API_KEY_EXPIRED = 112;
// The consumer's API Key was not found in config record.
API_KEY_NOT_FOUND = 113;
// The credential in the request can not be verified.
INVALID_CREDENTIAL = 123;
// The backend server for looking up project id/number is unavailable.
NAMESPACE_LOOKUP_UNAVAILABLE = 300;
// The backend server for checking service status is unavailable.
SERVICE_STATUS_UNAVAILABLE = 301;
// The backend server for checking billing status is unavailable.
BILLING_STATUS_UNAVAILABLE = 302;
// Cloud Resource Manager backend server is unavailable.
CLOUD_RESOURCE_MANAGER_BACKEND_UNAVAILABLE = 305;
}
// The error code.
Code code = 1;
// Subject to whom this error applies. See the specific code enum for more
// details on this field. For example:
//
// - "project:<project-id or project-number>"
// - "folder:<folder-id>"
// - "organization:<organization-id>"
string subject = 4;
// Free-form text providing details on the error cause of the error.
string detail = 2;
// Contains public information about the check error. If available,
// `status.code` will be non zero and client can propagate it out as public
// error.
google.rpc.Status status = 3;
}

View File

@ -0,0 +1,166 @@
// 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.
syntax = "proto3";
package google.api.servicecontrol.v1;
import "google/api/distribution.proto";
option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.ServiceControl.V1";
option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol";
option java_multiple_files = true;
option java_outer_classname = "DistributionProto";
option java_package = "com.google.api.servicecontrol.v1";
option php_namespace = "Google\\Cloud\\ServiceControl\\V1";
option ruby_package = "Google::Cloud::ServiceControl::V1";
// Distribution represents a frequency distribution of double-valued sample
// points. It contains the size of the population of sample points plus
// additional optional information:
//
// * the arithmetic mean of the samples
// * the minimum and maximum of the samples
// * the sum-squared-deviation of the samples, used to compute variance
// * a histogram of the values of the sample points
message Distribution {
// Describing buckets with constant width.
message LinearBuckets {
// The number of finite buckets. With the underflow and overflow buckets,
// the total number of buckets is `num_finite_buckets` + 2.
// See comments on `bucket_options` for details.
int32 num_finite_buckets = 1;
// The i'th linear bucket covers the interval
// [offset + (i-1) * width, offset + i * width)
// where i ranges from 1 to num_finite_buckets, inclusive.
// Must be strictly positive.
double width = 2;
// The i'th linear bucket covers the interval
// [offset + (i-1) * width, offset + i * width)
// where i ranges from 1 to num_finite_buckets, inclusive.
double offset = 3;
}
// Describing buckets with exponentially growing width.
message ExponentialBuckets {
// The number of finite buckets. With the underflow and overflow buckets,
// the total number of buckets is `num_finite_buckets` + 2.
// See comments on `bucket_options` for details.
int32 num_finite_buckets = 1;
// The i'th exponential bucket covers the interval
// [scale * growth_factor^(i-1), scale * growth_factor^i)
// where i ranges from 1 to num_finite_buckets inclusive.
// Must be larger than 1.0.
double growth_factor = 2;
// The i'th exponential bucket covers the interval
// [scale * growth_factor^(i-1), scale * growth_factor^i)
// where i ranges from 1 to num_finite_buckets inclusive.
// Must be > 0.
double scale = 3;
}
// Describing buckets with arbitrary user-provided width.
message ExplicitBuckets {
// 'bound' is a list of strictly increasing boundaries between
// buckets. Note that a list of length N-1 defines N buckets because
// of fenceposting. See comments on `bucket_options` for details.
//
// The i'th finite bucket covers the interval
// [bound[i-1], bound[i])
// where i ranges from 1 to bound_size() - 1. Note that there are no
// finite buckets at all if 'bound' only contains a single element; in
// that special case the single bound defines the boundary between the
// underflow and overflow buckets.
//
// bucket number lower bound upper bound
// i == 0 (underflow) -inf bound[i]
// 0 < i < bound_size() bound[i-1] bound[i]
// i == bound_size() (overflow) bound[i-1] +inf
repeated double bounds = 1;
}
// The total number of samples in the distribution. Must be >= 0.
int64 count = 1;
// The arithmetic mean of the samples in the distribution. If `count` is
// zero then this field must be zero.
double mean = 2;
// The minimum of the population of values. Ignored if `count` is zero.
double minimum = 3;
// The maximum of the population of values. Ignored if `count` is zero.
double maximum = 4;
// The sum of squared deviations from the mean:
// Sum[i=1..count]((x_i - mean)^2)
// where each x_i is a sample values. If `count` is zero then this field
// must be zero, otherwise validation of the request fails.
double sum_of_squared_deviation = 5;
// The number of samples in each histogram bucket. `bucket_counts` are
// optional. If present, they must sum to the `count` value.
//
// The buckets are defined below in `bucket_option`. There are N buckets.
// `bucket_counts[0]` is the number of samples in the underflow bucket.
// `bucket_counts[1]` to `bucket_counts[N-1]` are the numbers of samples
// in each of the finite buckets. And `bucket_counts[N] is the number
// of samples in the overflow bucket. See the comments of `bucket_option`
// below for more details.
//
// Any suffix of trailing zeros may be omitted.
repeated int64 bucket_counts = 6;
// Defines the buckets in the histogram. `bucket_option` and `bucket_counts`
// must be both set, or both unset.
//
// Buckets are numbered in the range of [0, N], with a total of N+1 buckets.
// There must be at least two buckets (a single-bucket histogram gives
// no information that isn't already provided by `count`).
//
// The first bucket is the underflow bucket which has a lower bound
// of -inf. The last bucket is the overflow bucket which has an
// upper bound of +inf. All other buckets (if any) are called "finite"
// buckets because they have finite lower and upper bounds. As described
// below, there are three ways to define the finite buckets.
//
// (1) Buckets with constant width.
// (2) Buckets with exponentially growing widths.
// (3) Buckets with arbitrary user-provided widths.
//
// In all cases, the buckets cover the entire real number line (-inf,
// +inf). Bucket upper bounds are exclusive and lower bounds are
// inclusive. The upper bound of the underflow bucket is equal to the
// lower bound of the smallest finite bucket; the lower bound of the
// overflow bucket is equal to the upper bound of the largest finite
// bucket.
oneof bucket_option {
// Buckets with constant width.
LinearBuckets linear_buckets = 7;
// Buckets with exponentially growing width.
ExponentialBuckets exponential_buckets = 8;
// Buckets with arbitrary user-provided width.
ExplicitBuckets explicit_buckets = 9;
}
// Example points. Must be in increasing order of `value` field.
repeated google.api.Distribution.Exemplar exemplars = 10;
}

View File

@ -0,0 +1,93 @@
// 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.
syntax = "proto3";
package google.api.servicecontrol.v1;
import "google/protobuf/duration.proto";
option csharp_namespace = "Google.Cloud.ServiceControl.V1";
option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol";
option java_multiple_files = true;
option java_outer_classname = "HttpRequestProto";
option java_package = "com.google.api.servicecontrol.v1";
option php_namespace = "Google\\Cloud\\ServiceControl\\V1";
option ruby_package = "Google::Cloud::ServiceControl::V1";
// A common proto for logging HTTP requests. Only contains semantics
// defined by the HTTP specification. Product-specific logging
// information MUST be defined in a separate message.
message HttpRequest {
// The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`.
string request_method = 1;
// The scheme (http, https), the host name, the path, and the query
// portion of the URL that was requested.
// Example: `"http://example.com/some/info?color=red"`.
string request_url = 2;
// The size of the HTTP request message in bytes, including the request
// headers and the request body.
int64 request_size = 3;
// The response code indicating the status of the response.
// Examples: 200, 404.
int32 status = 4;
// The size of the HTTP response message sent back to the client, in bytes,
// including the response headers and the response body.
int64 response_size = 5;
// The user agent sent by the client. Example:
// `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET
// CLR 1.0.3705)"`.
string user_agent = 6;
// The IP address (IPv4 or IPv6) of the client that issued the HTTP
// request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`.
string remote_ip = 7;
// The IP address (IPv4 or IPv6) of the origin server that the request was
// sent to.
string server_ip = 13;
// The referer URL of the request, as defined in
// [HTTP/1.1 Header Field
// Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
string referer = 8;
// The request processing latency on the server, from the time the request was
// received until the response was sent.
google.protobuf.Duration latency = 14;
// Whether or not a cache lookup was attempted.
bool cache_lookup = 11;
// Whether or not an entity was served from cache
// (with or without validation).
bool cache_hit = 9;
// Whether or not the response was validated with the origin server before
// being served from cache. This field is only meaningful if `cache_hit` is
// True.
bool cache_validated_with_origin_server = 10;
// The number of HTTP response bytes inserted into cache. Set only when a
// cache fill was attempted.
int64 cache_fill_bytes = 12;
// Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket"
string protocol = 15;
}

View File

@ -0,0 +1,126 @@
// 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.
syntax = "proto3";
package google.api.servicecontrol.v1;
import "google/api/servicecontrol/v1/http_request.proto";
import "google/logging/type/log_severity.proto";
import "google/protobuf/any.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "Google.Cloud.ServiceControl.V1";
option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol";
option java_multiple_files = true;
option java_outer_classname = "LogEntryProto";
option java_package = "com.google.api.servicecontrol.v1";
option php_namespace = "Google\\Cloud\\ServiceControl\\V1";
option ruby_package = "Google::Cloud::ServiceControl::V1";
// An individual log entry.
message LogEntry {
// Required. The log to which this log entry belongs. Examples: `"syslog"`,
// `"book_log"`.
string name = 10;
// The time the event described by the log entry occurred. If
// omitted, defaults to operation start time.
google.protobuf.Timestamp timestamp = 11;
// The severity of the log entry. The default value is
// `LogSeverity.DEFAULT`.
google.logging.type.LogSeverity severity = 12;
// Optional. Information about the HTTP request associated with this
// log entry, if applicable.
HttpRequest http_request = 14;
// Optional. Resource name of the trace associated with the log entry, if any.
// If this field contains a relative resource name, you can assume the name is
// relative to `//tracing.googleapis.com`. Example:
// `projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824`
string trace = 15;
// A unique ID for the log entry used for deduplication. If omitted,
// the implementation will generate one based on operation_id.
string insert_id = 4;
// A set of user-defined (key, value) data that provides additional
// information about the log entry.
map<string, string> labels = 13;
// The log entry payload, which can be one of multiple types.
oneof payload {
// The log entry payload, represented as a protocol buffer that is
// expressed as a JSON object. The only accepted type currently is
// [AuditLog][google.cloud.audit.AuditLog].
google.protobuf.Any proto_payload = 2;
// The log entry payload, represented as a Unicode string (UTF-8).
string text_payload = 3;
// The log entry payload, represented as a structure that
// is expressed as a JSON object.
google.protobuf.Struct struct_payload = 6;
}
// Optional. Information about an operation associated with the log entry, if
// applicable.
LogEntryOperation operation = 16;
// Optional. Source code location information associated with the log entry,
// if any.
LogEntrySourceLocation source_location = 17;
}
// Additional information about a potentially long-running operation with which
// a log entry is associated.
message LogEntryOperation {
// Optional. An arbitrary operation identifier. Log entries with the
// same identifier are assumed to be part of the same operation.
string id = 1;
// Optional. An arbitrary producer identifier. The combination of
// `id` and `producer` must be globally unique. Examples for `producer`:
// `"MyDivision.MyBigCompany.com"`, `"github.com/MyProject/MyApplication"`.
string producer = 2;
// Optional. Set this to True if this is the first log entry in the operation.
bool first = 3;
// Optional. Set this to True if this is the last log entry in the operation.
bool last = 4;
}
// Additional information about the source code location that produced the log
// entry.
message LogEntrySourceLocation {
// Optional. Source file name. Depending on the runtime environment, this
// might be a simple name or a fully-qualified name.
string file = 1;
// Optional. Line within the source file. 1-based; 0 indicates no line number
// available.
int64 line = 2;
// Optional. Human-readable name of the function or method being invoked, with
// optional context such as the class or package name. This information may be
// used in contexts such as the logs viewer, where a file and line number are
// less meaningful. The format can vary by language. For example:
// `qual.if.ied.Class.method` (Java), `dir/package.func` (Go), `function`
// (Python).
string function = 3;
}

View File

@ -0,0 +1,81 @@
// 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.
syntax = "proto3";
package google.api.servicecontrol.v1;
import "google/api/servicecontrol/v1/distribution.proto";
import "google/protobuf/timestamp.proto";
option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.ServiceControl.V1";
option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol";
option java_multiple_files = true;
option java_outer_classname = "MetricValueSetProto";
option java_package = "com.google.api.servicecontrol.v1";
option php_namespace = "Google\\Cloud\\ServiceControl\\V1";
option ruby_package = "Google::Cloud::ServiceControl::V1";
// Represents a single metric value.
message MetricValue {
// The labels describing the metric value.
// See comments on [google.api.servicecontrol.v1.Operation.labels][google.api.servicecontrol.v1.Operation.labels] for
// the overriding relationship.
// Note that this map must not contain monitored resource labels.
map<string, string> labels = 1;
// The start of the time period over which this metric value's measurement
// applies. The time period has different semantics for different metric
// types (cumulative, delta, and gauge). See the metric definition
// documentation in the service configuration for details. If not specified,
// [google.api.servicecontrol.v1.Operation.start_time][google.api.servicecontrol.v1.Operation.start_time] will be used.
google.protobuf.Timestamp start_time = 2;
// The end of the time period over which this metric value's measurement
// applies. If not specified,
// [google.api.servicecontrol.v1.Operation.end_time][google.api.servicecontrol.v1.Operation.end_time] will be used.
google.protobuf.Timestamp end_time = 3;
// The value. The type of value used in the request must
// agree with the metric definition in the service configuration, otherwise
// the MetricValue is rejected.
oneof value {
// A boolean value.
bool bool_value = 4;
// A signed 64-bit integer value.
int64 int64_value = 5;
// A double precision floating point value.
double double_value = 6;
// A text string value.
string string_value = 7;
// A distribution value.
Distribution distribution_value = 8;
}
}
// Represents a set of metric values in the same metric.
// Each metric value in the set should have a unique combination of start time,
// end time, and label values.
message MetricValueSet {
// The metric name defined in the service configuration.
string metric_name = 1;
// The values in this metric.
repeated MetricValue metric_values = 2;
}

View File

@ -0,0 +1,123 @@
// 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.
syntax = "proto3";
package google.api.servicecontrol.v1;
import "google/api/servicecontrol/v1/log_entry.proto";
import "google/api/servicecontrol/v1/metric_value.proto";
import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";
option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.ServiceControl.V1";
option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol";
option java_multiple_files = true;
option java_outer_classname = "OperationProto";
option java_package = "com.google.api.servicecontrol.v1";
option php_namespace = "Google\\Cloud\\ServiceControl\\V1";
option ruby_package = "Google::Cloud::ServiceControl::V1";
// Represents information regarding an operation.
message Operation {
// Defines the importance of the data contained in the operation.
enum Importance {
// Allows data caching, batching, and aggregation. It provides
// higher performance with higher data loss risk.
LOW = 0;
// Disables data aggregation to minimize data loss. It is for operations
// that contains significant monetary value or audit trail. This feature
// only applies to the client libraries.
HIGH = 1;
}
// Identity of the operation. This must be unique within the scope of the
// service that generated the operation. If the service calls
// Check() and Report() on the same operation, the two calls should carry
// the same id.
//
// UUID version 4 is recommended, though not required.
// In scenarios where an operation is computed from existing information
// and an idempotent id is desirable for deduplication purpose, UUID version 5
// is recommended. See RFC 4122 for details.
string operation_id = 1;
// Fully qualified name of the operation. Reserved for future use.
string operation_name = 2;
// Identity of the consumer who is using the service.
// This field should be filled in for the operations initiated by a
// consumer, but not for service-initiated operations that are
// not related to a specific consumer.
//
// - This can be in one of the following formats:
// - project:PROJECT_ID,
// - project`_`number:PROJECT_NUMBER,
// - projects/PROJECT_ID or PROJECT_NUMBER,
// - folders/FOLDER_NUMBER,
// - organizations/ORGANIZATION_NUMBER,
// - api`_`key:API_KEY.
string consumer_id = 3;
// Required. Start time of the operation.
google.protobuf.Timestamp start_time = 4;
// End time of the operation.
// Required when the operation is used in
// [ServiceController.Report][google.api.servicecontrol.v1.ServiceController.Report],
// but optional when the operation is used in
// [ServiceController.Check][google.api.servicecontrol.v1.ServiceController.Check].
google.protobuf.Timestamp end_time = 5;
// Labels describing the operation. Only the following labels are allowed:
//
// - Labels describing monitored resources as defined in
// the service configuration.
// - Default labels of metric values. When specified, labels defined in the
// metric value override these default.
// - The following labels defined by Google Cloud Platform:
// - `cloud.googleapis.com/location` describing the location where the
// operation happened,
// - `servicecontrol.googleapis.com/user_agent` describing the user agent
// of the API request,
// - `servicecontrol.googleapis.com/service_agent` describing the service
// used to handle the API request (e.g. ESP),
// - `servicecontrol.googleapis.com/platform` describing the platform
// where the API is served, such as App Engine, Compute Engine, or
// Kubernetes Engine.
map<string, string> labels = 6;
// Represents information about this operation. Each MetricValueSet
// corresponds to a metric defined in the service configuration.
// The data type used in the MetricValueSet must agree with
// the data type specified in the metric definition.
//
// Within a single operation, it is not allowed to have more than one
// MetricValue instances that have the same metric names and identical
// label value combinations. If a request has such duplicated MetricValue
// instances, the entire request is rejected with
// an invalid argument error.
repeated MetricValueSet metric_value_sets = 7;
// Represents information to be logged.
repeated LogEntry log_entries = 8;
// DO NOT USE. This is an experimental field.
Importance importance = 11;
// Unimplemented.
repeated google.protobuf.Any extensions = 16;
}

View File

@ -0,0 +1,245 @@
// 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.
syntax = "proto3";
package google.api.servicecontrol.v1;
import "google/api/annotations.proto";
import "google/api/servicecontrol/v1/metric_value.proto";
import "google/rpc/status.proto";
import "google/api/client.proto";
option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.ServiceControl.V1";
option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol";
option java_multiple_files = true;
option java_outer_classname = "QuotaControllerProto";
option java_package = "com.google.api.servicecontrol.v1";
option php_namespace = "Google\\Cloud\\ServiceControl\\V1";
option ruby_package = "Google::Cloud::ServiceControl::V1";
// [Google Quota Control API](/service-control/overview)
//
// Allows clients to allocate and release quota against a [managed
// service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService).
service QuotaController {
option (google.api.default_host) = "servicecontrol.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/servicecontrol";
// Attempts to allocate quota for the specified consumer. It should be called
// before the operation is executed.
//
// This method requires the `servicemanagement.services.quota`
// permission on the specified service. For more information, see
// [Cloud IAM](https://cloud.google.com/iam).
//
// **NOTE:** The client **must** fail-open on server errors `INTERNAL`,
// `UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system
// reliability, the server may inject these errors to prohibit any hard
// dependency on the quota functionality.
rpc AllocateQuota(AllocateQuotaRequest) returns (AllocateQuotaResponse) {
option (google.api.http) = {
post: "/v1/services/{service_name}:allocateQuota"
body: "*"
};
}
}
// Request message for the AllocateQuota method.
message AllocateQuotaRequest {
// Name of the service as specified in the service configuration. For example,
// `"pubsub.googleapis.com"`.
//
// See [google.api.Service][google.api.Service] for the definition of a service name.
string service_name = 1;
// Operation that describes the quota allocation.
QuotaOperation allocate_operation = 2;
// Specifies which version of service configuration should be used to process
// the request. If unspecified or no matching version can be found, the latest
// one will be used.
string service_config_id = 4;
}
// Represents information regarding a quota operation.
message QuotaOperation {
// Supported quota modes.
enum QuotaMode {
// Guard against implicit default. Must not be used.
UNSPECIFIED = 0;
// For AllocateQuota request, allocates quota for the amount specified in
// the service configuration or specified using the quota metrics. If the
// amount is higher than the available quota, allocation error will be
// returned and no quota will be allocated.
// If multiple quotas are part of the request, and one fails, none of the
// quotas are allocated or released.
NORMAL = 1;
// The operation allocates quota for the amount specified in the service
// configuration or specified using the quota metrics. If the amount is
// higher than the available quota, request does not fail but all available
// quota will be allocated.
// For rate quota, BEST_EFFORT will continue to deduct from other groups
// even if one does not have enough quota. For allocation, it will find the
// minimum available amount across all groups and deduct that amount from
// all the affected groups.
BEST_EFFORT = 2;
// For AllocateQuota request, only checks if there is enough quota
// available and does not change the available quota. No lock is placed on
// the available quota either.
CHECK_ONLY = 3;
// Unimplemented. When used in AllocateQuotaRequest, this returns the
// effective quota limit(s) in the response, and no quota check will be
// performed. Not supported for other requests, and even for
// AllocateQuotaRequest, this is currently supported only for allowlisted
// services.
QUERY_ONLY = 4;
// The operation allocates quota for the amount specified in the service
// configuration or specified using the quota metrics. If the requested
// amount is higher than the available quota, request does not fail and
// remaining quota would become negative (going over the limit).
// Not supported for Rate Quota.
ADJUST_ONLY = 5;
}
// Identity of the operation. This is expected to be unique within the scope
// of the service that generated the operation, and guarantees idempotency in
// case of retries.
//
// In order to ensure best performance and latency in the Quota backends,
// operation_ids are optimally associated with time, so that related
// operations can be accessed fast in storage. For this reason, the
// recommended token for services that intend to operate at a high QPS is
// Unix time in nanos + UUID
string operation_id = 1;
// Fully qualified name of the API method for which this quota operation is
// requested. This name is used for matching quota rules or metric rules and
// billing status rules defined in service configuration.
//
// This field should not be set if any of the following is true:
// (1) the quota operation is performed on non-API resources.
// (2) quota_metrics is set because the caller is doing quota override.
//
//
// Example of an RPC method name:
// google.example.library.v1.LibraryService.CreateShelf
string method_name = 2;
// Identity of the consumer for whom this quota operation is being performed.
//
// This can be in one of the following formats:
// project:<project_id>,
// project_number:<project_number>,
// api_key:<api_key>.
string consumer_id = 3;
// Labels describing the operation.
map<string, string> labels = 4;
// Represents information about this operation. Each MetricValueSet
// corresponds to a metric defined in the service configuration.
// The data type used in the MetricValueSet must agree with
// the data type specified in the metric definition.
//
// Within a single operation, it is not allowed to have more than one
// MetricValue instances that have the same metric names and identical
// label value combinations. If a request has such duplicated MetricValue
// instances, the entire request is rejected with
// an invalid argument error.
//
// This field is mutually exclusive with method_name.
repeated MetricValueSet quota_metrics = 5;
// Quota mode for this operation.
QuotaMode quota_mode = 6;
}
// Response message for the AllocateQuota method.
message AllocateQuotaResponse {
// The same operation_id value used in the AllocateQuotaRequest. Used for
// logging and diagnostics purposes.
string operation_id = 1;
// Indicates the decision of the allocate.
repeated QuotaError allocate_errors = 2;
// Quota metrics to indicate the result of allocation. Depending on the
// request, one or more of the following metrics will be included:
//
// 1. Per quota group or per quota metric incremental usage will be specified
// using the following delta metric :
// "serviceruntime.googleapis.com/api/consumer/quota_used_count"
//
// 2. The quota limit reached condition will be specified using the following
// boolean metric :
// "serviceruntime.googleapis.com/quota/exceeded"
repeated MetricValueSet quota_metrics = 3;
// ID of the actual config used to process the request.
string service_config_id = 4;
}
// Represents error information for [QuotaOperation][google.api.servicecontrol.v1.QuotaOperation].
message QuotaError {
// Error codes related to project config validations are deprecated since the
// quota controller methods do not perform these validations. Instead services
// have to call the Check method, without quota_properties field, to perform
// these validations before calling the quota controller methods. These
// methods check only for project deletion to be wipe out compliant.
enum Code {
// This is never used.
UNSPECIFIED = 0;
// Quota allocation failed.
// Same as [google.rpc.Code.RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED].
RESOURCE_EXHAUSTED = 8;
// Consumer cannot access the service because the service requires active
// billing.
BILLING_NOT_ACTIVE = 107;
// Consumer's project has been marked as deleted (soft deletion).
PROJECT_DELETED = 108;
// Specified API key is invalid.
API_KEY_INVALID = 105;
// Specified API Key has expired.
API_KEY_EXPIRED = 112;
}
// Error code.
Code code = 1;
// Subject to whom this error applies. See the specific enum for more details
// on this field. For example, "clientip:<ip address of client>" or
// "project:<Google developer project id>".
string subject = 2;
// Free-form text that provides details on the cause of the error.
string description = 3;
// Contains additional information about the quota error.
// If available, `status.code` will be non zero.
google.rpc.Status status = 4;
}

View File

@ -0,0 +1,256 @@
// 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.
syntax = "proto3";
package google.api.servicecontrol.v1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/servicecontrol/v1/check_error.proto";
import "google/api/servicecontrol/v1/operation.proto";
import "google/protobuf/timestamp.proto";
import "google/rpc/status.proto";
option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.ServiceControl.V1";
option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol";
option java_multiple_files = true;
option java_outer_classname = "ServiceControllerProto";
option java_package = "com.google.api.servicecontrol.v1";
option objc_class_prefix = "GASC";
option php_namespace = "Google\\Cloud\\ServiceControl\\V1";
option ruby_package = "Google::Cloud::ServiceControl::V1";
// [Google Service Control API](/service-control/overview)
//
// Lets clients check and report operations against a [managed
// service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService).
service ServiceController {
option (google.api.default_host) = "servicecontrol.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/servicecontrol";
// Checks whether an operation on a service should be allowed to proceed
// based on the configuration of the service and related policies. It must be
// called before the operation is executed.
//
// If feasible, the client should cache the check results and reuse them for
// 60 seconds. In case of any server errors, the client should rely on the
// cached results for much longer time to avoid outage.
// WARNING: There is general 60s delay for the configuration and policy
// propagation, therefore callers MUST NOT depend on the `Check` method having
// the latest policy information.
//
// NOTE: the [CheckRequest][google.api.servicecontrol.v1.CheckRequest] has
// the size limit (wire-format byte size) of 1MB.
//
// This method requires the `servicemanagement.services.check` permission
// on the specified service. For more information, see
// [Cloud IAM](https://cloud.google.com/iam).
rpc Check(CheckRequest) returns (CheckResponse) {
option (google.api.http) = {
post: "/v1/services/{service_name}:check"
body: "*"
};
}
// Reports operation results to Google Service Control, such as logs and
// metrics. It should be called after an operation is completed.
//
// If feasible, the client should aggregate reporting data for up to 5
// seconds to reduce API traffic. Limiting aggregation to 5 seconds is to
// reduce data loss during client crashes. Clients should carefully choose
// the aggregation time window to avoid data loss risk more than 0.01%
// for business and compliance reasons.
//
// NOTE: the [ReportRequest][google.api.servicecontrol.v1.ReportRequest] has
// the size limit (wire-format byte size) of 1MB.
//
// This method requires the `servicemanagement.services.report` permission
// on the specified service. For more information, see
// [Google Cloud IAM](https://cloud.google.com/iam).
rpc Report(ReportRequest) returns (ReportResponse) {
option (google.api.http) = {
post: "/v1/services/{service_name}:report"
body: "*"
};
}
}
// Request message for the Check method.
message CheckRequest {
// The service name as specified in its service configuration. For example,
// `"pubsub.googleapis.com"`.
//
// See
// [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
// for the definition of a service name.
string service_name = 1;
// The operation to be checked.
Operation operation = 2;
// Specifies which version of service configuration should be used to process
// the request.
//
// If unspecified or no matching version can be found, the
// latest one will be used.
string service_config_id = 4;
}
// Response message for the Check method.
message CheckResponse {
// Contains additional information about the check operation.
message CheckInfo {
// A list of fields and label keys that are ignored by the server.
// The client doesn't need to send them for following requests to improve
// performance and allow better aggregation.
repeated string unused_arguments = 1;
// Consumer info of this check.
ConsumerInfo consumer_info = 2;
}
// `ConsumerInfo` provides information about the consumer.
message ConsumerInfo {
// The type of the consumer as defined in
// [Google Resource Manager](https://cloud.google.com/resource-manager/).
enum ConsumerType {
// This is never used.
CONSUMER_TYPE_UNSPECIFIED = 0;
// The consumer is a Google Cloud Project.
PROJECT = 1;
// The consumer is a Google Cloud Folder.
FOLDER = 2;
// The consumer is a Google Cloud Organization.
ORGANIZATION = 3;
// Service-specific resource container which is defined by the service
// producer to offer their users the ability to manage service control
// functionalities at a finer level of granularity than the PROJECT.
SERVICE_SPECIFIC = 4;
}
// The Google cloud project number, e.g. 1234567890. A value of 0 indicates
// no project number is found.
//
// NOTE: This field is deprecated after we support flexible consumer
// id. New code should not depend on this field anymore.
int64 project_number = 1;
// The type of the consumer which should have been defined in
// [Google Resource Manager](https://cloud.google.com/resource-manager/).
ConsumerType type = 2;
// The consumer identity number, can be Google cloud project number, folder
// number or organization number e.g. 1234567890. A value of 0 indicates no
// consumer number is found.
int64 consumer_number = 3;
}
// The same operation_id value used in the
// [CheckRequest][google.api.servicecontrol.v1.CheckRequest]. Used for logging
// and diagnostics purposes.
string operation_id = 1;
// Indicate the decision of the check.
//
// If no check errors are present, the service should process the operation.
// Otherwise the service should use the list of errors to determine the
// appropriate action.
repeated CheckError check_errors = 2;
// The actual config id used to process the request.
string service_config_id = 5;
// The current service rollout id used to process the request.
string service_rollout_id = 11;
// Feedback data returned from the server during processing a Check request.
CheckInfo check_info = 6;
}
// Request message for the Report method.
message ReportRequest {
// The service name as specified in its service configuration. For example,
// `"pubsub.googleapis.com"`.
//
// See
// [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
// for the definition of a service name.
string service_name = 1;
// Operations to be reported.
//
// Typically the service should report one operation per request.
// Putting multiple operations into a single request is allowed, but should
// be used only when multiple operations are natually available at the time
// of the report.
//
// There is no limit on the number of operations in the same ReportRequest,
// however the ReportRequest size should be no larger than 1MB. See
// [ReportResponse.report_errors][google.api.servicecontrol.v1.ReportResponse.report_errors]
// for partial failure behavior.
repeated Operation operations = 2;
// Specifies which version of service config should be used to process the
// request.
//
// If unspecified or no matching version can be found, the
// latest one will be used.
string service_config_id = 3;
}
// Response message for the Report method.
message ReportResponse {
// Represents the processing error of one
// [Operation][google.api.servicecontrol.v1.Operation] in the request.
message ReportError {
// The
// [Operation.operation_id][google.api.servicecontrol.v1.Operation.operation_id]
// value from the request.
string operation_id = 1;
// Details of the error when processing the
// [Operation][google.api.servicecontrol.v1.Operation].
google.rpc.Status status = 2;
}
// Partial failures, one for each `Operation` in the request that failed
// processing. There are three possible combinations of the RPC status:
//
// 1. The combination of a successful RPC status and an empty `report_errors`
// list indicates a complete success where all `Operations` in the
// request are processed successfully.
// 2. The combination of a successful RPC status and a non-empty
// `report_errors` list indicates a partial success where some
// `Operations` in the request succeeded. Each
// `Operation` that failed processing has a corresponding item
// in this list.
// 3. A failed RPC status indicates a general non-deterministic failure.
// When this happens, it's impossible to know which of the
// 'Operations' in the request succeeded or failed.
repeated ReportError report_errors = 1;
// The actual config id used to process the request.
string service_config_id = 2;
// The current service rollout id used to process the request.
string service_rollout_id = 4;
}

View File

@ -0,0 +1,178 @@
type: google.api.Service
config_version: 3
name: servicecontrol.googleapis.com
title: Service Control API
apis:
- name: google.api.servicecontrol.v1.QuotaController
- name: google.api.servicecontrol.v1.ServiceController
documentation:
summary: |-
Provides admission control and telemetry reporting for services integrated
with Service Infrastructure.
overview: |-
Google Service Control provides control plane functionality to managed
services, such as logging, monitoring, and status checks. This page
provides an overview of what it does and how it works.
## Why use Service Control?
When you develop a cloud service, you typically start with the business
requirements and the architecture design, then proceed with API definition
and implementation. Before you put your service into production, you
need to deal with many control plane issues:
* How to control access to your service.
* How to send logging and monitoring data to both consumers and producers.
* How to create and manage dashboards to visualize this data.
* How to automatically scale the control plane components with your
service.
Service Control is a mature and feature-rich control plane provider
that addresses these needs with high efficiency, high scalability,
and high availability. It provides a simple public API that can be
accessed from anywhere using JSON REST and gRPC clients, so when you move
your service from on-premise to a cloud provider, or from one cloud
provider to another, you don't need to change the control plane provider.
Services built using Google Cloud Endpoints already take advantage of
Service Control. Cloud Endpoints sends logging and monitoring data
through Google Service Control for every request arriving at its
proxy. If you need to report any additional logging and monitoring data
for your Cloud Endpoints service, you can call the Service Control API
directly from your service.
The Service Control API definition is open sourced and available on
[GitHub](https://github.com/googleapis/googleapis/tree/master/google/api/servicecontrol). By
changing the DNS name, you can easily use alternative implementations
of the Service Control API.
## Architecture
Google Service Control works with a set of *managed services* and their
*operations* (activities), *checks* whether an operation is allowed to
proceed, and *reports* completed operations. Behind the scenes, it
leverages other
Google Cloud services, such as
[Google Service
Management](/service-infrastructure/docs/service-management/getting-started), [Stackdriver
Logging](/logging), and [Stackdriver Monitoring](/monitoring), while
hiding their complexity from service producers. It enables service
producers to send telemetry data to their consumers. It uses caching,
batching, aggregation, and retries to deliver higher performance and
availability than the individual backend systems it encapsulates.
<figure id="fig-arch" class="center">
<div style="width: 70%;margin: auto">
<img src="/service-infrastructure/docs/service-control/images/arch.svg"
alt="The overall architecture of a service that uses Google Service
Control."> </div> <figcaption><b>Figure 1</b>: Using Google Service
Control.</figcaption> </figure>
The Service Control API provides two methods:
*
[`services.check`](/service-infrastructure/docs/service-control/reference/rest/v1/services/check),
used for:
* Ensuring valid consumer status
* Validating API keys
*
[`services.report`](/service-infrastructure/docs/service-control/reference/rest/v1/services/report),
used for:
* Sending logs to Stackdriver Logging
* Sending metrics to Stackdriver Monitoring
We'll look at these in more detail in the rest of this overview.
## Managed services
A [managed
service](/service-infrastructure/docs/service-management/reference/rest/v1/services) is
a network service managed by
[Google Service
Management](/service-infrastructure/docs/service-management/getting-started). Each
managed service has a unique name, such as `example.googleapis.com`,
which must be a valid fully-qualified DNS name, as per RFC 1035.
For example:
* Google Cloud Pub/Sub (`pubsub.googleapis.com`)
* Google Cloud Vision (`vision.googleapis.com`)
* Google Cloud Bigtable (`bigtable.googleapis.com`)
* Google Cloud Datastore (`datastore.googleapis.com`)
Google Service Management manages the lifecycle of each service's
configuration, which is used to customize Google Service Control's
behavior. Service configurations are also used by Google Cloud Console for
displaying APIs and their settings, enabling/disabling APIs, and more.
## Operations
Google Service Control uses the generic concept of an *operation*
to represent the activities of a managed service, such as API calls and
resource usage. Each operation is associated with a managed service and a
specific service consumer, and has a set of properties that describe the
operation, such as the API method name and resource usage amount. For more
information, see the
[Operation
definition](/service-infrastructure/docs/service-control/reference/rest/v1/Operation). ##
Check
The
[`services.check`](/service-infrastructure/docs/service-control/reference/rest/v1/services/check) method
determines whether an operation should be allowed to proceed for a
managed service.
For example:
* Check if the consumer is still active.
* Check if the consumer has enabled the service.
* Check if the API key is still valid.
By performing multiple checks within a single method call, it provides
better performance, higher reliability, and reduced development cost to
service producers compared to checking with multiple backend systems.
## Report
The
[`services.report`](/service-infrastructure/docs/service-control/reference/rest/v1/services/report) method
reports completed operations for a managed service to backend
systems, such as logging and monitoring. The reported data can be seen in
Google API Console and Google Cloud Console, and retrieved with
appropriate APIs, such as the Stackdriver Logging and Stackdriver
Monitoring APIs.
## Next steps
* Read our [Getting Started
guide](/service-infrastructure/docs/service-control/getting-started) to
find out how to set up and use the Google Service Control API.
backend:
rules:
- selector: google.api.servicecontrol.v1.QuotaController.AllocateQuota
deadline: 10.0
- selector: google.api.servicecontrol.v1.ServiceController.Check
deadline: 5.0
- selector: google.api.servicecontrol.v1.ServiceController.Report
deadline: 16.0
authentication:
rules:
- selector: google.api.servicecontrol.v1.QuotaController.AllocateQuota
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/cloud-platform,
https://www.googleapis.com/auth/servicecontrol
- selector: google.api.servicecontrol.v1.ServiceController.Check
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/cloud-platform,
https://www.googleapis.com/auth/servicecontrol
- selector: google.api.servicecontrol.v1.ServiceController.Report
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/cloud-platform,
https://www.googleapis.com/auth/servicecontrol

Some files were not shown because too many files have changed in this diff Show More