rbac

package
v0.0.0-...-4263410 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package rbac provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen/v2 version v2.0.0 DO NOT EDIT.

Index

Constants

View Source
const (
	Basic_authScopes = "basic_auth.Scopes"
)
View Source
const TraceName = "github.com/EnVision/provisioning/internal/clients/http/rbac"

Variables

View Source
var ErrMetaNotPresent = fmt.Errorf("RBAC did not return metadata: %w", usrerr.ErrBadRequest400)

ErrMetaNotPresent is returned when metadata for pagination is not present in the response.

View Source
var ErrNoPermissionRbac = errors.New("RBAC client could not be established")
View Source
var FetchLimit = ptr.To(500)

FetchLimit is the maximum possible entries returned in one request

Functions

func Acl

func Acl(ctx context.Context) clients.RbacAcl

RbacAcl returns ACL interface, when no ACL is present it returns a list that always evaluates to false.

func NewGetPrincipalAccessRequest

func NewGetPrincipalAccessRequest(server string, params *GetPrincipalAccessParams) (*http.Request, error)

NewGetPrincipalAccessRequest generates requests for GetPrincipalAccess

func NewGetStatusRequest

func NewGetStatusRequest(server string) (*http.Request, error)

NewGetStatusRequest generates requests for GetStatus

func WithAcl

func WithAcl(ctx context.Context, id clients.RbacAcl) context.Context

WithAcl returns context copy with ACL interface.

Types

type Access

type Access struct {
	Permission          string               `json:"permission"`
	ResourceDefinitions []ResourceDefinition `json:"resourceDefinitions"`
}

Access defines model for Access.

type AccessPagination

type AccessPagination struct {
	Data  []Access         `json:"data"`
	Links *PaginationLinks `json:"links,omitempty"`
	Meta  *PaginationMeta  `json:"meta,omitempty"`
}

AccessPagination defines model for AccessPagination.

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) GetPrincipalAccess

func (c *Client) GetPrincipalAccess(ctx context.Context, params *GetPrincipalAccessParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetStatus

func (c *Client) GetStatus(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// GetPrincipalAccess request
	GetPrincipalAccess(ctx context.Context, params *GetPrincipalAccessParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetStatus request
	GetStatus(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) GetPrincipalAccessWithResponse

func (c *ClientWithResponses) GetPrincipalAccessWithResponse(ctx context.Context, params *GetPrincipalAccessParams, reqEditors ...RequestEditorFn) (*GetPrincipalAccessResponse, error)

GetPrincipalAccessWithResponse request returning *GetPrincipalAccessResponse

func (*ClientWithResponses) GetStatusWithResponse

func (c *ClientWithResponses) GetStatusWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetStatusResponse, error)

GetStatusWithResponse request returning *GetStatusResponse

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetPrincipalAccessWithResponse request
	GetPrincipalAccessWithResponse(ctx context.Context, params *GetPrincipalAccessParams, reqEditors ...RequestEditorFn) (*GetPrincipalAccessResponse, error)

	// GetStatusWithResponse request
	GetStatusWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetStatusResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type Error

type Error struct {
	Errors []struct {
		Detail *string `json:"detail,omitempty"`
		Status *string `json:"status,omitempty"`
	} `json:"errors"`
}

Error defines model for Error.

type GetPrincipalAccessParams

type GetPrincipalAccessParams struct {
	// Application The application name(s) to obtain access for the principal. This is an exact match. When no application is supplied, all permissions for the principal are returned. You may also use a comma-separated list to match on multiple applications.
	Application string `form:"application" json:"application"`

	// Username Unique username of the principal to obtain access for (only available for admins, and if supplied, takes precedence over the identity header).
	Username *string `form:"username,omitempty" json:"username,omitempty"`

	// OrderBy Parameter for ordering roles by value. For inverse ordering, supply '-' before the param value, such as: ?order_by=-application
	OrderBy *GetPrincipalAccessParamsOrderBy `form:"order_by,omitempty" json:"order_by,omitempty"`

	// Limit Parameter for selecting the amount of data returned.
	Limit *QueryLimit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Parameter for selecting the offset of data.
	Offset *QueryOffset `form:"offset,omitempty" json:"offset,omitempty"`
}

GetPrincipalAccessParams defines parameters for GetPrincipalAccess.

type GetPrincipalAccessParamsOrderBy

type GetPrincipalAccessParamsOrderBy string

GetPrincipalAccessParamsOrderBy defines parameters for GetPrincipalAccess.

const (
	Application  GetPrincipalAccessParamsOrderBy = "application"
	ResourceType GetPrincipalAccessParamsOrderBy = "resource_type"
	Verb         GetPrincipalAccessParamsOrderBy = "verb"
)

Defines values for GetPrincipalAccessParamsOrderBy.

type GetPrincipalAccessResponse

type GetPrincipalAccessResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *AccessPagination
	JSON404      *Error
	JSON500      *Error
}

func ParseGetPrincipalAccessResponse

func ParseGetPrincipalAccessResponse(rsp *http.Response) (*GetPrincipalAccessResponse, error)

ParseGetPrincipalAccessResponse parses an HTTP response from a GetPrincipalAccessWithResponse call

func (GetPrincipalAccessResponse) Status

Status returns HTTPResponse.Status

func (GetPrincipalAccessResponse) StatusCode

func (r GetPrincipalAccessResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetStatusResponse

type GetStatusResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Status
	JSON500      *Error
}

func ParseGetStatusResponse

func ParseGetStatusResponse(rsp *http.Response) (*GetStatusResponse, error)

ParseGetStatusResponse parses an HTTP response from a GetStatusWithResponse call

func (GetStatusResponse) Status

func (r GetStatusResponse) Status() string

Status returns HTTPResponse.Status

func (GetStatusResponse) StatusCode

func (r GetStatusResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type ListPagination

type ListPagination struct {
	Links *PaginationLinks `json:"links,omitempty"`
	Meta  *PaginationMeta  `json:"meta,omitempty"`
}

ListPagination defines model for ListPagination.

type PaginationLinks struct {
	First    *string `json:"first,omitempty"`
	Last     *string `json:"last,omitempty"`
	Next     *string `json:"next,omitempty"`
	Previous *string `json:"previous,omitempty"`
}

PaginationLinks defines model for PaginationLinks.

type PaginationMeta

type PaginationMeta struct {
	Count *int64 `json:"count,omitempty"`
}

PaginationMeta defines model for PaginationMeta.

type QueryLimit

type QueryLimit = int

QueryLimit defines model for QueryLimit.

type QueryOffset

type QueryOffset = int

QueryOffset defines model for QueryOffset.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type ResourceDefinition

type ResourceDefinition struct {
	AttributeFilter ResourceDefinitionFilter `json:"attributeFilter"`
}

ResourceDefinition defines model for ResourceDefinition.

type ResourceDefinitionFilter

type ResourceDefinitionFilter struct {
	Key       string                            `json:"key"`
	Operation ResourceDefinitionFilterOperation `json:"operation"`
	Value     string                            `json:"value"`
}

ResourceDefinitionFilter defines model for ResourceDefinitionFilter.

type ResourceDefinitionFilterOperation

type ResourceDefinitionFilterOperation string

ResourceDefinitionFilterOperation defines model for ResourceDefinitionFilter.Operation.

Defines values for ResourceDefinitionFilterOperation.

type Status

type Status struct {
	ApiVersion int64   `json:"api_version"`
	Commit     *string `json:"commit,omitempty"`
}

Status defines model for Status.

Jump to

Keyboard shortcuts

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