expr

package
v0.34.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

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

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

func NewCelClient(ctx context.Context, opts ...option.ClientOption) (*CelClient, error)

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

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

func (c *CelClient) Close() error

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

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

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

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

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

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:

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL