Documentation ¶
Overview ¶
Package expr is an auto-generated package for the Common Expression Language.
NOTE: This package is in alpha. It is not stable, and is likely to change.
Defines common types for the Common Expression Language.
Index ¶
- func DefaultAuthScopes() []string
- type CelCallOptions
- type CelClient
- func (c *CelClient) Check(ctx context.Context, req *exprpb.CheckRequest, opts ...gax.CallOption) (*exprpb.CheckResponse, error)
- func (c *CelClient) Close() error
- func (c *CelClient) Connection() *grpc.ClientConn
- func (c *CelClient) Eval(ctx context.Context, req *exprpb.EvalRequest, opts ...gax.CallOption) (*exprpb.EvalResponse, error)
- func (c *CelClient) Parse(ctx context.Context, req *exprpb.ParseRequest, opts ...gax.CallOption) (*exprpb.ParseResponse, error)
- type ConformanceCallOptions
- type ConformanceClient
- func (c *ConformanceClient) Check(ctx context.Context, req *exprpb.CheckRequest, opts ...gax.CallOption) (*exprpb.CheckResponse, error)
- func (c *ConformanceClient) Close() error
- func (c *ConformanceClient) Connection() *grpc.ClientConn
- func (c *ConformanceClient) Eval(ctx context.Context, req *exprpb.EvalRequest, opts ...gax.CallOption) (*exprpb.EvalResponse, error)
- func (c *ConformanceClient) Parse(ctx context.Context, req *exprpb.ParseRequest, opts ...gax.CallOption) (*exprpb.ParseResponse, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type CelCallOptions ¶
type CelCallOptions struct { Parse []gax.CallOption Check []gax.CallOption Eval []gax.CallOption }
CelCallOptions contains the retry settings for each method of CelClient.
type CelClient ¶
type CelClient struct { // The call options for this service. CallOptions *CelCallOptions // contains filtered or unexported fields }
CelClient is a client for interacting with Common Expression Language.
Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewCelClient ¶
NewCelClient creates a new cel service client.
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, utilities, and execution as a service.
Example ¶
package main import ( "context" expr "cloud.google.com/go/expr/apiv1alpha1" ) func main() { ctx := context.Background() c, err := expr.NewCelClient(ctx) if err != nil { // TODO: Handle error. } // TODO: Use client. _ = c }
Output:
func (*CelClient) Check ¶
func (c *CelClient) Check(ctx context.Context, req *exprpb.CheckRequest, opts ...gax.CallOption) (*exprpb.CheckResponse, error)
Check runs static checks on a parsed CEL representation and return an annotated representation, or a set of issues.
Example ¶
package main import ( "context" expr "cloud.google.com/go/expr/apiv1alpha1" exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1" ) func main() { ctx := context.Background() c, err := expr.NewCelClient(ctx) if err != nil { // TODO: Handle error. } req := &exprpb.CheckRequest{ // TODO: Fill request struct fields. } resp, err := c.Check(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*CelClient) Close ¶
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*CelClient) Connection ¶
func (c *CelClient) Connection() *grpc.ClientConn
Connection returns the client's connection to the API service.
func (*CelClient) Eval ¶
func (c *CelClient) Eval(ctx context.Context, req *exprpb.EvalRequest, opts ...gax.CallOption) (*exprpb.EvalResponse, error)
Eval evaluates a parsed or annotation CEL representation given values of external bindings.
Example ¶
package main import ( "context" expr "cloud.google.com/go/expr/apiv1alpha1" exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1" ) func main() { ctx := context.Background() c, err := expr.NewCelClient(ctx) if err != nil { // TODO: Handle error. } req := &exprpb.EvalRequest{ // TODO: Fill request struct fields. } resp, err := c.Eval(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*CelClient) Parse ¶
func (c *CelClient) Parse(ctx context.Context, req *exprpb.ParseRequest, opts ...gax.CallOption) (*exprpb.ParseResponse, error)
Parse transforms CEL source text into a parsed representation.
Example ¶
package main import ( "context" expr "cloud.google.com/go/expr/apiv1alpha1" exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1" ) func main() { ctx := context.Background() c, err := expr.NewCelClient(ctx) if err != nil { // TODO: Handle error. } req := &exprpb.ParseRequest{ // TODO: Fill request struct fields. } resp, err := c.Parse(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type ConformanceCallOptions ¶
type ConformanceCallOptions struct { Parse []gax.CallOption Check []gax.CallOption Eval []gax.CallOption }
ConformanceCallOptions contains the retry settings for each method of ConformanceClient.
type ConformanceClient ¶
type ConformanceClient struct { // The call options for this service. CallOptions *ConformanceCallOptions // contains filtered or unexported fields }
ConformanceClient is a client for interacting with Common Expression Language.
Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewConformanceClient ¶
func NewConformanceClient(ctx context.Context, opts ...option.ClientOption) (*ConformanceClient, error)
NewConformanceClient creates a new conformance service client.
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.
Example ¶
package main import ( "context" expr "cloud.google.com/go/expr/apiv1alpha1" ) func main() { ctx := context.Background() c, err := expr.NewConformanceClient(ctx) if err != nil { // TODO: Handle error. } // TODO: Use client. _ = c }
Output:
func (*ConformanceClient) Check ¶
func (c *ConformanceClient) Check(ctx context.Context, req *exprpb.CheckRequest, opts ...gax.CallOption) (*exprpb.CheckResponse, error)
Check runs static checks on a parsed CEL representation and return an annotated representation, or a set of issues.
Example ¶
package main import ( "context" expr "cloud.google.com/go/expr/apiv1alpha1" exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1" ) func main() { ctx := context.Background() c, err := expr.NewConformanceClient(ctx) if err != nil { // TODO: Handle error. } req := &exprpb.CheckRequest{ // TODO: Fill request struct fields. } resp, err := c.Check(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ConformanceClient) Close ¶
func (c *ConformanceClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ConformanceClient) Connection ¶
func (c *ConformanceClient) Connection() *grpc.ClientConn
Connection returns the client's connection to the API service.
func (*ConformanceClient) Eval ¶
func (c *ConformanceClient) Eval(ctx context.Context, req *exprpb.EvalRequest, opts ...gax.CallOption) (*exprpb.EvalResponse, error)
Eval evaluates a parsed or annotation CEL representation given values of external bindings.
Example ¶
package main import ( "context" expr "cloud.google.com/go/expr/apiv1alpha1" exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1" ) func main() { ctx := context.Background() c, err := expr.NewConformanceClient(ctx) if err != nil { // TODO: Handle error. } req := &exprpb.EvalRequest{ // TODO: Fill request struct fields. } resp, err := c.Eval(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ConformanceClient) Parse ¶
func (c *ConformanceClient) Parse(ctx context.Context, req *exprpb.ParseRequest, opts ...gax.CallOption) (*exprpb.ParseResponse, error)
Parse transforms CEL source text into a parsed representation.
Example ¶
package main import ( "context" expr "cloud.google.com/go/expr/apiv1alpha1" exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1" ) func main() { ctx := context.Background() c, err := expr.NewConformanceClient(ctx) if err != nil { // TODO: Handle error. } req := &exprpb.ParseRequest{ // TODO: Fill request struct fields. } resp, err := c.Parse(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output: