luci: go.chromium.org/luci/buildbucket/access Index | Files

package access

import "go.chromium.org/luci/buildbucket/access"

Index

Package Files

acl.go action.go testutil.go

func NewClient Uses

func NewClient(host string, client *http.Client) access.AccessClient

NewClient returns a new AccessClient which can be used to talk to buildbucket's access API.

type Action Uses

type Action uint32
const (
    // AddBuild: Schedule a build.
    AddBuild Action = 1 << iota

    // ViewBuild: Get information about a build.
    ViewBuild

    // LeaseBuild: Lease a build for execution. Normally done by build systems.
    LeaseBuild

    // CancelBuild: Cancel an existing build. Does not require a lease key.
    CancelBuild

    // ResetBuild: Unlease and reset state of an existing build. Normally done by admins.
    ResetBuild

    // SearchBuilds: Search for builds or get a list of scheduled builds.
    SearchBuilds

    // ReadACL: View bucket ACLs.
    ReadACL

    // WriteACL: Change bucket ACLs.
    WriteACL

    // DeleteScheduledBuilds: Delete all scheduled builds from a bucket.
    DeleteScheduledBuilds

    // AccessBucket: Know about bucket existence and read its info.
    AccessBucket

    // PauseBucket: Pause builds for a given bucket.
    PauseBucket

    // SetNextNumber: Set the number for the next build in a builder.
    SetNextNumber
)

func ParseAction Uses

func ParseAction(action string) (Action, error)

ParseAction parses the action name into an.

func (*Action) MarshalBinary Uses

func (a *Action) MarshalBinary() ([]byte, error)

MarshalBinary encodes the Action as bytes.

func (Action) String Uses

func (a Action) String() string

String returns the action name as a string.

func (*Action) UnmarshalBinary Uses

func (a *Action) UnmarshalBinary(blob []byte) error

UnmarshalBinary decodes an Action from bytes.

type Permissions Uses

type Permissions map[string]Action

Permissions represents a set of permitted actions for a set of buckets.

Since Action is encoded as bits, the Action here is actually the bitwise OR of all available Actions for a particular bucket.

func BucketPermissions Uses

func BucketPermissions(c context.Context, client access.AccessClient, buckets []string) (Permissions, time.Duration, error)

BucketPermissions retrieves permitted actions for a set of buckets, for the identity specified in the client. It also returns the duration for which the client is allowed to cache the permissions.

func (Permissions) Can Uses

func (p Permissions) Can(bucket string, action Action) bool

Can checks whether an Action is allowed for a given bucket.

func (Permissions) FromProto Uses

func (p Permissions) FromProto(resp *access.PermittedActionsResponse) error

FromProto populates a Permissions from an access.PermittedActionsResponse.

func (Permissions) ToProto Uses

func (p Permissions) ToProto(validTime time.Duration) *access.PermittedActionsResponse

ToProto converts a Permissions into a PermittedActionsResponse.

type TestClient Uses

type TestClient struct {
    *access.PermittedActionsResponse
    *access.DescriptionResponse
    Error                    error
    PermittedActionsRequests []*access.PermittedActionsRequest
}

TestClient implements an access.AccessClient with stubs for use in testing.

func (*TestClient) Description Uses

func (c *TestClient) Description(_ context.Context, _ *empty.Empty, _ ...grpc.CallOption) (*access.DescriptionResponse, error)

Description implements the AccessClient interface.

func (*TestClient) PermittedActions Uses

func (c *TestClient) PermittedActions(_ context.Context, req *access.PermittedActionsRequest, _ ...grpc.CallOption) (*access.PermittedActionsResponse, error)

PermittedActions implements the AccessClient interface.

Package access imports 13 packages (graph) and is imported by 4 packages. Updated 2018-08-19. Refresh now. Tools for package owners.