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
- Variables
- func Acl(ctx context.Context) clients.RbacAcl
- func NewGetPrincipalAccessRequest(server string, params *GetPrincipalAccessParams) (*http.Request, error)
- func NewGetStatusRequest(server string) (*http.Request, error)
- func WithAcl(ctx context.Context, id clients.RbacAcl) context.Context
- type Access
- type AccessPagination
- type Client
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- type ClientWithResponsesInterface
- type Error
- type GetPrincipalAccessParams
- type GetPrincipalAccessParamsOrderBy
- type GetPrincipalAccessResponse
- type GetStatusResponse
- type HttpRequestDoer
- type ListPagination
- type PaginationLinks
- type PaginationMeta
- type QueryLimit
- type QueryOffset
- type RequestEditorFn
- type ResourceDefinition
- type ResourceDefinitionFilter
- type ResourceDefinitionFilterOperation
- type Status
Constants ¶
const (
Basic_authScopes = "basic_auth.Scopes"
)
const TraceName = "github.com/EnVision/provisioning/internal/clients/http/rbac"
Variables ¶
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.
var ErrNoPermissionRbac = errors.New("RBAC client could not be established")
var FetchLimit = ptr.To(500)
FetchLimit is the maximum possible entries returned in one request
Functions ¶
func Acl ¶
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 ¶
NewGetStatusRequest generates requests for GetStatus
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)
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 ¶
ClientOption allows setting custom parameters during construction
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 ¶
func (r GetPrincipalAccessResponse) Status() string
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 ¶
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 ¶
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 RequestEditorFn ¶
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.
const ( Equal ResourceDefinitionFilterOperation = "equal" In ResourceDefinitionFilterOperation = "in" )
Defines values for ResourceDefinitionFilterOperation.