client

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultEndCursor = "{{endCursor}}"
View Source
const DefaultPageSize = 500
View Source
const ListUsersResourceTypeResourceID = "resourceID"
View Source
const ListUsersResourceTypeResourceTag = "resourceTag"

Variables

This section is empty.

Functions

func WithBearerToken

func WithBearerToken(token string) uhttp.RequestOption

Types

type Client

type Client struct {
	BearerToken string
	BaseUrl     *url.URL
	// contains filtered or unexported fields
}

func New

func New(
	ctx context.Context,
	clientId string,
	clientSecret string,
	audience string,
	authUrl string,
	endpointUrlPath string,
	resourceIDs []string,
	resourceTags []string,
) (*Client, error)

func (*Client) Authorize

func (c *Client) Authorize(
	ctx context.Context,
	authUrlPath string,
	clientId string,
	clientSecret string,
	audience string,
) error

func (*Client) ListResourcePermissions

func (c *Client) ListResourcePermissions(ctx context.Context, resourceId string, pToken *pagination.Token) (*ResourcePermissions, string, error)

func (*Client) ListResources

func (c *Client) ListResources(ctx context.Context, pToken *pagination.Token) (*ResourceResponse, string, error)

func (*Client) ListUsersWithAccessToResources

func (c *Client) ListUsersWithAccessToResources(ctx context.Context, pToken *pagination.Token) (*UsersWithAccessQueryResponse, string, error)

type Emails

type Emails []string

func (*Emails) UnmarshalJSON

func (e *Emails) UnmarshalJSON(data []byte) error

Emails can be a single string or string array.

type GrantedEntity

type GrantedEntity struct {
	Id         string `json:"id"`
	Name       string `json:"name"`
	Type       string `json:"type"`
	Properties struct {
		VertexID     string `json:"_vertexID"`
		Email        string `json:"email"`
		Emails       Emails `json:"emails,omitempty"`
		Name         string `json:"name"`
		NativeType   string `json:"nativeType"`
		PrimaryEmail string `json:"primaryEmail"`
		Enabled      *bool  `json:"accountEnabled"`
		ExternalId   string `json:"externalId"`
	} `json:"properties"`
}

type PageInfo

type PageInfo struct {
	HasNextPage bool   `json:"hasNextPage"`
	EndCursor   string `json:"endCursor"`
}

type ResourcePermissions

type ResourcePermissions struct {
	Data struct {
		EntityEffectiveAccessEntries struct {
			Nodes []struct {
				GrantedEntity *GrantedEntity `json:"grantedEntity"`
				AccessTypes   []string       `json:"accessTypes"`
			} `json:"nodes"`
			PageInfo PageInfo `json:"pageInfo"`
		} `json:"entityEffectiveAccessEntries"`
	} `json:"data"`
}

type ResourceResponse

type ResourceResponse struct {
	Data struct {
		GraphSearch struct {
			Nodes []struct {
				Entities []struct {
					Id   string `json:"id"`
					Name string `json:"name"`
					Type string `json:"type"`
				} `json:"entities"`
			} `json:"nodes"`
			PageInfo PageInfo `json:"pageInfo"`
		} `json:"graphSearch"`
	} `json:"data"`
}

type UsersWithAccessQueryResponse

type UsersWithAccessQueryResponse struct {
	Data struct {
		EntityEffectiveAccessEntries struct {
			Nodes []struct {
				GrantedEntity *GrantedEntity `json:"grantedEntity"`
			} `json:"nodes"`
			PageInfo PageInfo `json:"pageInfo"`
		} `json:"entityEffectiveAccessEntries"`
	} `json:"data"`
}

Jump to

Keyboard shortcuts

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