Unverified Commit e844aef4 authored by Angela Nguyen's avatar Angela Nguyen Committed by GitHub
Browse files

dynamodb: add proto (#1590)

parent 540f0acf
Showing with 4012 additions and 0 deletions
+4012 -0
syntax = "proto3";
package clutch.aws.dynamodb.v1;
option go_package = "github.com/lyft/clutch/backend/api/aws/dynamodb/v1;ddbv1";
import "google/api/annotations.proto";
import "validate/validate.proto";
import "api/v1/annotations.proto";
service DDBAPI {
rpc GetTable(GetTableRequest) returns (GetTableResponse) {
option (google.api.http) = {
post : "/v1/aws/dynamodb/getTable"
body : "*"
};
option (clutch.api.v1.action).type = READ;
}
rpc UpdateTableCapacity(UpdateTableCapacityRequest) returns (UpdateTableCapacityResponse) {
option (google.api.http) = {
post : "/v1/aws/dynamodb/updateTableCapacity"
body : "*"
};
option (clutch.api.v1.action).type = UPDATE;
}
rpc UpdateGSICapacity(UpdateGSICapacityRequest) returns (UpdateGSICapacityResponse) {
option (google.api.http) = {
post : "/v1/aws/dynamodb/updateGSICapacity"
body : "*"
};
option (clutch.api.v1.action).type = UPDATE;
}
}
message Table {
option (clutch.api.v1.id).patterns = {
type_url : "clutch.aws.dynamodb.v1.Table",
pattern : "{region}/{name}"
};
string name = 1;
string region = 2;
repeated GlobalSecondaryIndex global_secondary_indexes = 3;
ProvisionedThroughput capacity = 4;
}
message GlobalSecondaryIndex {
string name = 1;
ProvisionedThroughput capacity = 2;
}
message ProvisionedThroughput {
int32 write_capacity_units = 1;
int32 read_capacity_units = 2;
}
message GetTableRequest {
string table_name = 1 [ (validate.rules).string = {min_bytes : 1} ];
string region = 2 [ (validate.rules).string = {min_bytes : 1} ];
}
message GetTableResponse {
option (clutch.api.v1.reference).fields = "table";
Table table = 1;
}
message UpdateTableCapacityRequest {
string table_name = 1 [ (validate.rules).string = {min_bytes : 1} ];
string region = 2 [ (validate.rules).string = {min_bytes : 1} ];
int32 target_table_rcu = 3;
int32 target_table_wcu = 4;
}
message UpdateTableCapacityResponse {
}
message UpdateGSICapacityRequest {
string table_name = 1 [ (validate.rules).string = {min_bytes : 1} ];
string region = 2 [ (validate.rules).string = {min_bytes : 1} ];
string index_name = 3 [ (validate.rules).string = {min_bytes : 1} ];
int32 target_index_rcu = 4;
int32 target_index_wcu = 5;
}
message UpdateGSICapacityResponse {
}
This diff is collapsed.
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: aws/dynamodb/v1/dynamodb.proto
/*
Package ddbv1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package ddbv1
import (
"context"
"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
var _ io.Reader
var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = metadata.Join
func request_DDBAPI_GetTable_0(ctx context.Context, marshaler runtime.Marshaler, client DDBAPIClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq GetTableRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.GetTable(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_DDBAPI_GetTable_0(ctx context.Context, marshaler runtime.Marshaler, server DDBAPIServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq GetTableRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.GetTable(ctx, &protoReq)
return msg, metadata, err
}
func request_DDBAPI_UpdateTableCapacity_0(ctx context.Context, marshaler runtime.Marshaler, client DDBAPIClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq UpdateTableCapacityRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.UpdateTableCapacity(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_DDBAPI_UpdateTableCapacity_0(ctx context.Context, marshaler runtime.Marshaler, server DDBAPIServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq UpdateTableCapacityRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.UpdateTableCapacity(ctx, &protoReq)
return msg, metadata, err
}
func request_DDBAPI_UpdateGSICapacity_0(ctx context.Context, marshaler runtime.Marshaler, client DDBAPIClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq UpdateGSICapacityRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.UpdateGSICapacity(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_DDBAPI_UpdateGSICapacity_0(ctx context.Context, marshaler runtime.Marshaler, server DDBAPIServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq UpdateGSICapacityRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.UpdateGSICapacity(ctx, &protoReq)
return msg, metadata, err
}
// RegisterDDBAPIHandlerServer registers the http handlers for service DDBAPI to "mux".
// UnaryRPC :call DDBAPIServer 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 RegisterDDBAPIHandlerFromEndpoint instead.
func RegisterDDBAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DDBAPIServer) error {
mux.Handle("POST", pattern_DDBAPI_GetTable_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)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/clutch.aws.dynamodb.v1.DDBAPI/GetTable", runtime.WithHTTPPathPattern("/v1/aws/dynamodb/getTable"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_DDBAPI_GetTable_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_DDBAPI_GetTable_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_DDBAPI_UpdateTableCapacity_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)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/clutch.aws.dynamodb.v1.DDBAPI/UpdateTableCapacity", runtime.WithHTTPPathPattern("/v1/aws/dynamodb/updateTableCapacity"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_DDBAPI_UpdateTableCapacity_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_DDBAPI_UpdateTableCapacity_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_DDBAPI_UpdateGSICapacity_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)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/clutch.aws.dynamodb.v1.DDBAPI/UpdateGSICapacity", runtime.WithHTTPPathPattern("/v1/aws/dynamodb/updateGSICapacity"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_DDBAPI_UpdateGSICapacity_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_DDBAPI_UpdateGSICapacity_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterDDBAPIHandlerFromEndpoint is same as RegisterDDBAPIHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterDDBAPIHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.Dial(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterDDBAPIHandler(ctx, mux, conn)
}
// RegisterDDBAPIHandler registers the http handlers for service DDBAPI to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterDDBAPIHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterDDBAPIHandlerClient(ctx, mux, NewDDBAPIClient(conn))
}
// RegisterDDBAPIHandlerClient registers the http handlers for service DDBAPI
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "DDBAPIClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "DDBAPIClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "DDBAPIClient" to call the correct interceptors.
func RegisterDDBAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DDBAPIClient) error {
mux.Handle("POST", pattern_DDBAPI_GetTable_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)
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/clutch.aws.dynamodb.v1.DDBAPI/GetTable", runtime.WithHTTPPathPattern("/v1/aws/dynamodb/getTable"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_DDBAPI_GetTable_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_DDBAPI_GetTable_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_DDBAPI_UpdateTableCapacity_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)
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/clutch.aws.dynamodb.v1.DDBAPI/UpdateTableCapacity", runtime.WithHTTPPathPattern("/v1/aws/dynamodb/updateTableCapacity"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_DDBAPI_UpdateTableCapacity_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_DDBAPI_UpdateTableCapacity_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_DDBAPI_UpdateGSICapacity_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)
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/clutch.aws.dynamodb.v1.DDBAPI/UpdateGSICapacity", runtime.WithHTTPPathPattern("/v1/aws/dynamodb/updateGSICapacity"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_DDBAPI_UpdateGSICapacity_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_DDBAPI_UpdateGSICapacity_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_DDBAPI_GetTable_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "aws", "dynamodb", "getTable"}, ""))
pattern_DDBAPI_UpdateTableCapacity_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "aws", "dynamodb", "updateTableCapacity"}, ""))
pattern_DDBAPI_UpdateGSICapacity_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "aws", "dynamodb", "updateGSICapacity"}, ""))
)
var (
forward_DDBAPI_GetTable_0 = runtime.ForwardResponseMessage
forward_DDBAPI_UpdateTableCapacity_0 = runtime.ForwardResponseMessage
forward_DDBAPI_UpdateGSICapacity_0 = runtime.ForwardResponseMessage
)
// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: aws/dynamodb/v1/dynamodb.proto
package ddbv1
import (
"bytes"
"errors"
"fmt"
"net"
"net/mail"
"net/url"
"regexp"
"strings"
"time"
"unicode/utf8"
"google.golang.org/protobuf/types/known/anypb"
)
// ensure the imports are used
var (
_ = bytes.MinRead
_ = errors.New("")
_ = fmt.Print
_ = utf8.UTFMax
_ = (*regexp.Regexp)(nil)
_ = (*strings.Reader)(nil)
_ = net.IPv4len
_ = time.Duration(0)
_ = (*url.URL)(nil)
_ = (*mail.Address)(nil)
_ = anypb.Any{}
)
// Validate checks the field values on Table with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned.
func (m *Table) Validate() error {
if m == nil {
return nil
}
// no validation rules for Name
// no validation rules for Region
for idx, item := range m.GetGlobalSecondaryIndexes() {
_, _ = idx, item
if v, ok := interface{}(item).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return TableValidationError{
field: fmt.Sprintf("GlobalSecondaryIndexes[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if v, ok := interface{}(m.GetCapacity()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return TableValidationError{
field: "Capacity",
reason: "embedded message failed validation",
cause: err,
}
}
}
return nil
}
// TableValidationError is the validation error returned by Table.Validate if
// the designated constraints aren't met.
type TableValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e TableValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e TableValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e TableValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e TableValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e TableValidationError) ErrorName() string { return "TableValidationError" }
// Error satisfies the builtin error interface
func (e TableValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sTable.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = TableValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = TableValidationError{}
// Validate checks the field values on GlobalSecondaryIndex with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned.
func (m *GlobalSecondaryIndex) Validate() error {
if m == nil {
return nil
}
// no validation rules for Name
if v, ok := interface{}(m.GetCapacity()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GlobalSecondaryIndexValidationError{
field: "Capacity",
reason: "embedded message failed validation",
cause: err,
}
}
}
return nil
}
// GlobalSecondaryIndexValidationError is the validation error returned by
// GlobalSecondaryIndex.Validate if the designated constraints aren't met.
type GlobalSecondaryIndexValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e GlobalSecondaryIndexValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e GlobalSecondaryIndexValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e GlobalSecondaryIndexValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e GlobalSecondaryIndexValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e GlobalSecondaryIndexValidationError) ErrorName() string {
return "GlobalSecondaryIndexValidationError"
}
// Error satisfies the builtin error interface
func (e GlobalSecondaryIndexValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sGlobalSecondaryIndex.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = GlobalSecondaryIndexValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = GlobalSecondaryIndexValidationError{}
// Validate checks the field values on ProvisionedThroughput with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned.
func (m *ProvisionedThroughput) Validate() error {
if m == nil {
return nil
}
// no validation rules for WriteCapacityUnits
// no validation rules for ReadCapacityUnits
return nil
}
// ProvisionedThroughputValidationError is the validation error returned by
// ProvisionedThroughput.Validate if the designated constraints aren't met.
type ProvisionedThroughputValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ProvisionedThroughputValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ProvisionedThroughputValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ProvisionedThroughputValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ProvisionedThroughputValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ProvisionedThroughputValidationError) ErrorName() string {
return "ProvisionedThroughputValidationError"
}
// Error satisfies the builtin error interface
func (e ProvisionedThroughputValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sProvisionedThroughput.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ProvisionedThroughputValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ProvisionedThroughputValidationError{}
// Validate checks the field values on GetTableRequest with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned.
func (m *GetTableRequest) Validate() error {
if m == nil {
return nil
}
if len(m.GetTableName()) < 1 {
return GetTableRequestValidationError{
field: "TableName",
reason: "value length must be at least 1 bytes",
}
}
if len(m.GetRegion()) < 1 {
return GetTableRequestValidationError{
field: "Region",
reason: "value length must be at least 1 bytes",
}
}
return nil
}
// GetTableRequestValidationError is the validation error returned by
// GetTableRequest.Validate if the designated constraints aren't met.
type GetTableRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e GetTableRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e GetTableRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e GetTableRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e GetTableRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e GetTableRequestValidationError) ErrorName() string { return "GetTableRequestValidationError" }
// Error satisfies the builtin error interface
func (e GetTableRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sGetTableRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = GetTableRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = GetTableRequestValidationError{}
// Validate checks the field values on GetTableResponse with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned.
func (m *GetTableResponse) Validate() error {
if m == nil {
return nil
}
if v, ok := interface{}(m.GetTable()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GetTableResponseValidationError{
field: "Table",
reason: "embedded message failed validation",
cause: err,
}
}
}
return nil
}
// GetTableResponseValidationError is the validation error returned by
// GetTableResponse.Validate if the designated constraints aren't met.
type GetTableResponseValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e GetTableResponseValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e GetTableResponseValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e GetTableResponseValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e GetTableResponseValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e GetTableResponseValidationError) ErrorName() string { return "GetTableResponseValidationError" }
// Error satisfies the builtin error interface
func (e GetTableResponseValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sGetTableResponse.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = GetTableResponseValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = GetTableResponseValidationError{}
// Validate checks the field values on UpdateTableCapacityRequest with the
// rules defined in the proto definition for this message. If any rules are
// violated, an error is returned.
func (m *UpdateTableCapacityRequest) Validate() error {
if m == nil {
return nil
}
if len(m.GetTableName()) < 1 {
return UpdateTableCapacityRequestValidationError{
field: "TableName",
reason: "value length must be at least 1 bytes",
}
}
if len(m.GetRegion()) < 1 {
return UpdateTableCapacityRequestValidationError{
field: "Region",
reason: "value length must be at least 1 bytes",
}
}
// no validation rules for TargetTableRcu
// no validation rules for TargetTableWcu
return nil
}
// UpdateTableCapacityRequestValidationError is the validation error returned
// by UpdateTableCapacityRequest.Validate if the designated constraints aren't met.
type UpdateTableCapacityRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e UpdateTableCapacityRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e UpdateTableCapacityRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e UpdateTableCapacityRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e UpdateTableCapacityRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e UpdateTableCapacityRequestValidationError) ErrorName() string {
return "UpdateTableCapacityRequestValidationError"
}
// Error satisfies the builtin error interface
func (e UpdateTableCapacityRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sUpdateTableCapacityRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = UpdateTableCapacityRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = UpdateTableCapacityRequestValidationError{}
// Validate checks the field values on UpdateTableCapacityResponse with the
// rules defined in the proto definition for this message. If any rules are
// violated, an error is returned.
func (m *UpdateTableCapacityResponse) Validate() error {
if m == nil {
return nil
}
return nil
}
// UpdateTableCapacityResponseValidationError is the validation error returned
// by UpdateTableCapacityResponse.Validate if the designated constraints
// aren't met.
type UpdateTableCapacityResponseValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e UpdateTableCapacityResponseValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e UpdateTableCapacityResponseValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e UpdateTableCapacityResponseValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e UpdateTableCapacityResponseValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e UpdateTableCapacityResponseValidationError) ErrorName() string {
return "UpdateTableCapacityResponseValidationError"
}
// Error satisfies the builtin error interface
func (e UpdateTableCapacityResponseValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sUpdateTableCapacityResponse.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = UpdateTableCapacityResponseValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = UpdateTableCapacityResponseValidationError{}
// Validate checks the field values on UpdateGSICapacityRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned.
func (m *UpdateGSICapacityRequest) Validate() error {
if m == nil {
return nil
}
if len(m.GetTableName()) < 1 {
return UpdateGSICapacityRequestValidationError{
field: "TableName",
reason: "value length must be at least 1 bytes",
}
}
if len(m.GetRegion()) < 1 {
return UpdateGSICapacityRequestValidationError{
field: "Region",
reason: "value length must be at least 1 bytes",
}
}
if len(m.GetIndexName()) < 1 {
return UpdateGSICapacityRequestValidationError{
field: "IndexName",
reason: "value length must be at least 1 bytes",
}
}
// no validation rules for TargetIndexRcu
// no validation rules for TargetIndexWcu
return nil
}
// UpdateGSICapacityRequestValidationError is the validation error returned by
// UpdateGSICapacityRequest.Validate if the designated constraints aren't met.
type UpdateGSICapacityRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e UpdateGSICapacityRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e UpdateGSICapacityRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e UpdateGSICapacityRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e UpdateGSICapacityRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e UpdateGSICapacityRequestValidationError) ErrorName() string {
return "UpdateGSICapacityRequestValidationError"
}
// Error satisfies the builtin error interface
func (e UpdateGSICapacityRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sUpdateGSICapacityRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = UpdateGSICapacityRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = UpdateGSICapacityRequestValidationError{}
// Validate checks the field values on UpdateGSICapacityResponse with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned.
func (m *UpdateGSICapacityResponse) Validate() error {
if m == nil {
return nil
}
return nil
}
// UpdateGSICapacityResponseValidationError is the validation error returned by
// UpdateGSICapacityResponse.Validate if the designated constraints aren't met.
type UpdateGSICapacityResponseValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e UpdateGSICapacityResponseValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e UpdateGSICapacityResponseValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e UpdateGSICapacityResponseValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e UpdateGSICapacityResponseValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e UpdateGSICapacityResponseValidationError) ErrorName() string {
return "UpdateGSICapacityResponseValidationError"
}
// Error satisfies the builtin error interface
func (e UpdateGSICapacityResponseValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sUpdateGSICapacityResponse.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = UpdateGSICapacityResponseValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = UpdateGSICapacityResponseValidationError{}
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package ddbv1
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.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// DDBAPIClient is the client API for DDBAPI 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 DDBAPIClient interface {
GetTable(ctx context.Context, in *GetTableRequest, opts ...grpc.CallOption) (*GetTableResponse, error)
UpdateTableCapacity(ctx context.Context, in *UpdateTableCapacityRequest, opts ...grpc.CallOption) (*UpdateTableCapacityResponse, error)
UpdateGSICapacity(ctx context.Context, in *UpdateGSICapacityRequest, opts ...grpc.CallOption) (*UpdateGSICapacityResponse, error)
}
type dDBAPIClient struct {
cc grpc.ClientConnInterface
}
func NewDDBAPIClient(cc grpc.ClientConnInterface) DDBAPIClient {
return &dDBAPIClient{cc}
}
func (c *dDBAPIClient) GetTable(ctx context.Context, in *GetTableRequest, opts ...grpc.CallOption) (*GetTableResponse, error) {
out := new(GetTableResponse)
err := c.cc.Invoke(ctx, "/clutch.aws.dynamodb.v1.DDBAPI/GetTable", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *dDBAPIClient) UpdateTableCapacity(ctx context.Context, in *UpdateTableCapacityRequest, opts ...grpc.CallOption) (*UpdateTableCapacityResponse, error) {
out := new(UpdateTableCapacityResponse)
err := c.cc.Invoke(ctx, "/clutch.aws.dynamodb.v1.DDBAPI/UpdateTableCapacity", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *dDBAPIClient) UpdateGSICapacity(ctx context.Context, in *UpdateGSICapacityRequest, opts ...grpc.CallOption) (*UpdateGSICapacityResponse, error) {
out := new(UpdateGSICapacityResponse)
err := c.cc.Invoke(ctx, "/clutch.aws.dynamodb.v1.DDBAPI/UpdateGSICapacity", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// DDBAPIServer is the server API for DDBAPI service.
// All implementations should embed UnimplementedDDBAPIServer
// for forward compatibility
type DDBAPIServer interface {
GetTable(context.Context, *GetTableRequest) (*GetTableResponse, error)
UpdateTableCapacity(context.Context, *UpdateTableCapacityRequest) (*UpdateTableCapacityResponse, error)
UpdateGSICapacity(context.Context, *UpdateGSICapacityRequest) (*UpdateGSICapacityResponse, error)
}
// UnimplementedDDBAPIServer should be embedded to have forward compatible implementations.
type UnimplementedDDBAPIServer struct {
}
func (UnimplementedDDBAPIServer) GetTable(context.Context, *GetTableRequest) (*GetTableResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetTable not implemented")
}
func (UnimplementedDDBAPIServer) UpdateTableCapacity(context.Context, *UpdateTableCapacityRequest) (*UpdateTableCapacityResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateTableCapacity not implemented")
}
func (UnimplementedDDBAPIServer) UpdateGSICapacity(context.Context, *UpdateGSICapacityRequest) (*UpdateGSICapacityResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateGSICapacity not implemented")
}
// UnsafeDDBAPIServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to DDBAPIServer will
// result in compilation errors.
type UnsafeDDBAPIServer interface {
mustEmbedUnimplementedDDBAPIServer()
}
func RegisterDDBAPIServer(s grpc.ServiceRegistrar, srv DDBAPIServer) {
s.RegisterService(&DDBAPI_ServiceDesc, srv)
}
func _DDBAPI_GetTable_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetTableRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DDBAPIServer).GetTable(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/clutch.aws.dynamodb.v1.DDBAPI/GetTable",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DDBAPIServer).GetTable(ctx, req.(*GetTableRequest))
}
return interceptor(ctx, in, info, handler)
}
func _DDBAPI_UpdateTableCapacity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateTableCapacityRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DDBAPIServer).UpdateTableCapacity(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/clutch.aws.dynamodb.v1.DDBAPI/UpdateTableCapacity",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DDBAPIServer).UpdateTableCapacity(ctx, req.(*UpdateTableCapacityRequest))
}
return interceptor(ctx, in, info, handler)
}
func _DDBAPI_UpdateGSICapacity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateGSICapacityRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DDBAPIServer).UpdateGSICapacity(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/clutch.aws.dynamodb.v1.DDBAPI/UpdateGSICapacity",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DDBAPIServer).UpdateGSICapacity(ctx, req.(*UpdateGSICapacityRequest))
}
return interceptor(ctx, in, info, handler)
}
// DDBAPI_ServiceDesc is the grpc.ServiceDesc for DDBAPI service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var DDBAPI_ServiceDesc = grpc.ServiceDesc{
ServiceName: "clutch.aws.dynamodb.v1.DDBAPI",
HandlerType: (*DDBAPIServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetTable",
Handler: _DDBAPI_GetTable_Handler,
},
{
MethodName: "UpdateTableCapacity",
Handler: _DDBAPI_UpdateTableCapacity_Handler,
},
{
MethodName: "UpdateGSICapacity",
Handler: _DDBAPI_UpdateGSICapacity_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "aws/dynamodb/v1/dynamodb.proto",
}
This diff is collapsed.
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment