api

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultPerPageLimit = 100

Variables

This section is empty.

Functions

func NewClientConfig added in v1.1.2

func NewClientConfig(config *config.PermitConfig) *openapi.Configuration

func NewFactsClientConfig added in v1.1.2

func NewFactsClientConfig(config *config.PermitConfig) *openapi.Configuration

Types

type ConditionSets added in v0.0.16

type ConditionSets struct {
	// contains filtered or unexported fields
}

func NewConditionSetsApi added in v0.0.16

func NewConditionSetsApi(client *openapi.APIClient, config *config.PermitConfig) *ConditionSets

func (*ConditionSets) AssignSetPermissions added in v0.0.16

func (c *ConditionSets) AssignSetPermissions(ctx context.Context, userSetKey string, permission string, resourceSetKey string) ([]models.ConditionSetRuleRead, error)

func (*ConditionSets) Create added in v0.0.16

Create a new condition set. Usage Example: ``` csCreate := models.NewConditionSetCreate("cs-key", "cs-name") cs, err := PermitClient.Api.ConditionSets.Create(ctx, csCreate) ```

func (*ConditionSets) Delete added in v0.0.16

func (c *ConditionSets) Delete(ctx context.Context, conditionSetKey string) error

Delete a condition set.

func (*ConditionSets) Get added in v0.0.16

func (c *ConditionSets) Get(ctx context.Context, conditionSetKey string) (*models.ConditionSetRead, error)

Get a condition set by key. Usage Example: `conditionSet, err := PermitClient.Api.ConditionSets.Get(ctx, "cs-key")`

func (*ConditionSets) GetById added in v0.0.16

func (c *ConditionSets) GetById(ctx context.Context, conditionSetId uuid.UUID) (*models.ConditionSetRead, error)

GetById gets a condition set by id from your context's environment. Usage Example:

`cs, err := PermitClient.Api.ConditionSets.GetById(ctx, uuid.New())`

func (*ConditionSets) GetByKey added in v0.0.16

func (c *ConditionSets) GetByKey(ctx context.Context, conditionSetKey string) (*models.ConditionSetRead, error)

GetByKey gets a condition set by key from your context's environment. Usage Example:

`cs, err := PermitClient.Api.ConditionSets.GetByKey(ctx, "cs-key")`

func (*ConditionSets) List added in v0.0.16

func (c *ConditionSets) List(ctx context.Context, page int, perPage int) ([]models.ConditionSetRead, error)

List all condition sets in the current environment. Usage Example: `condition_sets, err := PermitClient.Api.ConditionSets.List(ctx,1, 10)`

func (*ConditionSets) ListSetPermissions added in v0.0.17

func (c *ConditionSets) ListSetPermissions(ctx context.Context, userSetKey string, permission string, resourceSetKey string) ([]models.ConditionSetRuleRead, error)

func (*ConditionSets) UnassignSetPermissions added in v0.0.16

func (c *ConditionSets) UnassignSetPermissions(ctx context.Context, userSetKey string, permission string, resourceSetKey string) error

func (*ConditionSets) Update added in v0.0.16

func (c *ConditionSets) Update(ctx context.Context, conditionSetKey string, conditionSetUpdate models.ConditionSetUpdate) (*models.ConditionSetRead, error)

Update a condition set.

type Elements

type Elements struct {
	// contains filtered or unexported fields
}

func NewElementsApi

func NewElementsApi(client *openapi.APIClient, config *config.PermitConfig) *Elements

func (*Elements) LoginAs

LoginAs login as a given user. Usage Example: ``` userLogin := models.NewUserLoginRequestInput("user-id", "tenant-id") embeddedLoginRequestOutput, err := PermitClient.Api.Elements.LoginAs(ctx, userLogin) ```

type Environments

type Environments struct {
	// contains filtered or unexported fields
}

func NewEnvironmentsApi

func NewEnvironmentsApi(client *openapi.APIClient, config *config.PermitConfig) *Environments

func (*Environments) Create

func (e *Environments) Create(ctx context.Context, environmentCreate models.EnvironmentCreate) (*models.EnvironmentRead, error)

Create an environment in the project of your context. Usage Example:

 ```
 environmentCreate := models.NewEnvironmentCreate("production", "Production")
	environment, err := PermitClient.Api.Environments.Create(ctx, *environmentCreate)
 ```

func (*Environments) Delete

func (e *Environments) Delete(ctx context.Context, environmentKey string) error

Delete an environment in the project of your context. Usage Example:

`err := PermitClient.Api.Environments.Delete(ctx, "production")`

func (*Environments) Get

func (e *Environments) Get(ctx context.Context, environmentKey string) (*models.EnvironmentRead, error)

Get an environment by key. Usage Example:

`environment, err := PermitClient.Api.Environments.Get(ctx, "production")`

func (*Environments) GetById

func (e *Environments) GetById(ctx context.Context, environmentId uuid.UUID) (*models.EnvironmentRead, error)

GetById get an environment by id. Usage Example:

`environment, err := PermitClient.Api.Environments.GetById(ctx, uuid.New())`

func (*Environments) GetByKey

func (e *Environments) GetByKey(ctx context.Context, environmentKey string) (*models.EnvironmentRead, error)

GetByKey get an environment by key. Usage Example:

`environment, err := PermitClient.Api.Environments.GetByKey(ctx, "production")`

func (*Environments) List

func (e *Environments) List(ctx context.Context, page int, perPage int) ([]models.EnvironmentRead, error)

List the environments in the project of your context Usage Example:

`environments, err := PermitClient.Api.Environments.List(ctx, 1, 10)`

func (*Environments) Update

func (e *Environments) Update(ctx context.Context, environmentKey string, environmentUpdate models.EnvironmentUpdate) (*models.EnvironmentRead, error)

type IPermitBaseApi

type IPermitBaseApi interface {
	// contains filtered or unexported methods
}

type IPermitBaseFactsApi added in v1.1.2

type IPermitBaseFactsApi interface {
	WaitForSync(timeout *time.Duration, options WaitForSyncOptions) *PermitBaseFactsApi
	// contains filtered or unexported methods
}

type ImplicitGrants added in v1.0.5

type ImplicitGrants struct {
	// contains filtered or unexported fields
}

func NewImplicitGrantsApi added in v1.0.5

func NewImplicitGrantsApi(client *openapi.APIClient, config *config.PermitConfig) *ImplicitGrants

func (*ImplicitGrants) Create added in v1.0.5

func (r *ImplicitGrants) Create(
	ctx context.Context,
	resourceId string,
	roleId string,
	derivedRuleCreate models.DerivedRoleRuleCreate,
) (*models.DerivedRoleRuleRead, error)

func (*ImplicitGrants) Delete added in v1.0.5

func (r *ImplicitGrants) Delete(
	ctx context.Context,
	roleId string,
	resourceId string,
	derivedRoleRuleDelete models.DerivedRoleRuleDelete,
) error

func (*ImplicitGrants) UpdateConditions added in v1.0.5

type PermitApiClient

type PermitApiClient struct {
	ConditionSets        *ConditionSets
	Elements             *Elements
	Environments         *Environments
	ImplicitGrants       *ImplicitGrants
	Projects             *Projects
	ProxyConfigs         *ProxyConfigs
	RelationshipTuples   *RelationshipTuples
	ResourceActionGroups *ResourceActionGroups
	ResourceActions      *ResourceActions
	ResourceAttributes   *ResourceAttributes
	ResourceInstances    *ResourceInstances
	ResourceRelations    *ResourceRelations
	ResourceRoles        *ResourceRoles
	Resources            *Resources
	RoleAssignments      *RoleAssignments
	Roles                *Roles
	Tenants              *Tenants
	Users                *Users
	// contains filtered or unexported fields
}

func NewPermitApiClient

func NewPermitApiClient(config *config.PermitConfig) *PermitApiClient

func (*PermitApiClient) SetContext

func (p *PermitApiClient) SetContext(ctx context.Context, project string, environment string)

type PermitBaseFactsApi added in v1.1.2

type PermitBaseFactsApi struct {
	// contains filtered or unexported fields
}

func NewPermitBaseFactsApi added in v1.1.2

func NewPermitBaseFactsApi(client *openapi.APIClient, config *config.PermitConfig) *PermitBaseFactsApi

func (*PermitBaseFactsApi) WaitForSync added in v1.1.2

func (a *PermitBaseFactsApi) WaitForSync(timeout *time.Duration, options WaitForSyncOptions) *PermitBaseFactsApi

WaitForSync configures the client to wait for facts synchronization.

Parameters:

  • timeout: Required duration to wait for synchronization
  • options: Additional configuration options for facts synchronization

type Projects

type Projects struct {
	// contains filtered or unexported fields
}

func NewProjectsApi

func NewProjectsApi(client *openapi.APIClient, config *config.PermitConfig) *Projects

func (*Projects) Create

func (p *Projects) Create(ctx context.Context, projectCreate models.ProjectCreate) (*models.ProjectRead, error)

Create a new project, requires Project level API key, or higher. Usage Example: ``` projectCreate := models.NewProjectCreate("project-key", "project-name") project, err := PermitClient.Api.Projects.Create(ctx, projectCreate) ```

func (*Projects) Delete

func (p *Projects) Delete(ctx context.Context, projectKey string) error

Delete a project, requires Project level API key, or higher. Usage Example: `err := PermitClient.Api.Projects.Delete(ctx, "project-key")`

func (*Projects) Get

func (p *Projects) Get(ctx context.Context, projectKey string) (*models.ProjectRead, error)

Get a project by key, requires Project level API key, or higher. Usage Example: `project, err := PermitClient.Api.Projects.Get(ctx, "project-key")`

func (*Projects) GetById

func (p *Projects) GetById(ctx context.Context, projectId uuid.UUID) (*models.ProjectRead, error)

GetById get a project by id, requires Project level API key, or higher. Usage Example: `project, err := PermitClient.Api.Projects.GetById(ctx, uuid.New())`

func (*Projects) GetByKey

func (p *Projects) GetByKey(ctx context.Context, projectKey string) (*models.ProjectRead, error)

GetByKey get a project by key, requires Project level API key, or higher. Usage Example: `project, err := PermitClient.Api.Projects.GetByKey(ctx, "project-key")`

func (*Projects) List

func (p *Projects) List(ctx context.Context, page int, perPage int) ([]models.ProjectRead, error)

List all projects in the organization, requires Project level API key, or higher. Usage Example: `projects, err := PermitClient.Api.Projects.List(ctx, 1, 10)`

func (*Projects) Update

func (p *Projects) Update(ctx context.Context, projectKey string, projectUpdate models.ProjectUpdate) (*models.ProjectRead, error)

Update a project, requires Project level API key, or higher. Usage Example: ``` projectUpdate := models.NewProjectUpdate() projectUpdate.SetName("new-project-name") project, err := PermitClient.Api.Projects.Update(ctx, "project-key", projectUpdate) ```

type ProxyConfigs added in v1.0.1

type ProxyConfigs struct {
	// contains filtered or unexported fields
}

func NewProxyConfigsApi added in v1.0.1

func NewProxyConfigsApi(client *openapi.APIClient, config *config.PermitConfig) *ProxyConfigs

func (*ProxyConfigs) Create added in v1.0.1

func (p *ProxyConfigs) Create(ctx context.Context, proxyConfigCreate models.ProxyConfigCreate) (*models.ProxyConfigRead, error)

Create a new proxy config, requires Environment level API key, or higher. Usage Example: ``` proxyConfigCreate := models.NewProxyConfigCreate("user:pass", "proxyConfigKey", "proxyConfigName") proxyConfig, err := PermitClient.Api.ProxyConfigs.Create(ctx, proxyConfigCreate) ```

func (*ProxyConfigs) Delete added in v1.0.1

func (p *ProxyConfigs) Delete(ctx context.Context, proxyConfigKey string) error

Delete a proxy config, requires Environment level API key, or higher. Usage Example: `err := PermitClient.Api.ProxyConfigs.Delete(ctx, "proxy-config-key")`

func (*ProxyConfigs) Get added in v1.0.1

func (p *ProxyConfigs) Get(ctx context.Context, proxyConfigKey string) (*models.ProxyConfigRead, error)

Get a Proxy Config by key, requires Environment level API key, or higher. Usage Example: `proxyConfig, err := PermitClient.Api.ProxyConfigs.Get(ctx, "proxyconfig-key")`

func (*ProxyConfigs) GetById added in v1.0.1

func (p *ProxyConfigs) GetById(ctx context.Context, ProxyConfigId uuid.UUID) (*models.ProxyConfigRead, error)

GetById get a proxy config by id, requires Environment level API key, or higher. Usage Example: `proxyConfig, err := PermitClient.Api.ProxyConfigs.GetById(ctx, uuid.New())`

func (*ProxyConfigs) GetByKey added in v1.0.1

func (p *ProxyConfigs) GetByKey(ctx context.Context, ProxyConfigKey string) (*models.ProxyConfigRead, error)

GetByKey get a project by key, requires Environment level API key, or higher. Usage Example: `proxyConfig, err := PermitClient.Api.ProxyConfigs.GetByKey(ctx, "proxyconfig-key")`

func (*ProxyConfigs) List added in v1.0.1

func (p *ProxyConfigs) List(ctx context.Context, page int, perPage int) ([]models.ProxyConfigRead, error)

List all ProxyConfigs in the organization, requires Environment level API key, or higher. Usage Example: `ProxyConfigs, err := PermitClient.Api.ProxyConfigs.List(ctx, 1, 10)`

func (*ProxyConfigs) Update added in v1.0.1

func (p *ProxyConfigs) Update(ctx context.Context, proxyConfigKey string, proxyConfigUpdate models.ProxyConfigUpdate) (*models.ProxyConfigRead, error)

Update a proxy config, requires Environment level API key, or higher. Usage Example: ``` proxyConfigUpdate := models.NewProxyConfigUpdate() proxyConfigUpdate.SetName("new-proxy-config-name") proxyConfig, err := PermitClient.Api.ProxyConfigs.Update(ctx, "proxy-config-key", proxyConfigUpdate) ```

type RelationshipTuples added in v1.0.5

type RelationshipTuples struct {
	PermitBaseFactsApi
}

func NewRelationshipTuplesApi added in v1.0.5

func NewRelationshipTuplesApi(client *openapi.APIClient, config *config.PermitConfig) *RelationshipTuples

func (*RelationshipTuples) BulkCreate added in v1.0.5

func (r *RelationshipTuples) BulkCreate(
	ctx context.Context,
	bulkCreateOperation models.RelationshipTupleCreateBulkOperation,
) error

func (*RelationshipTuples) BulkDelete added in v1.0.5

func (r *RelationshipTuples) BulkDelete(
	ctx context.Context,
	bulkDeleteOperation models.RelationshipTupleDeleteBulkOperation,
) error

func (*RelationshipTuples) Create added in v1.0.5

func (r *RelationshipTuples) Create(
	ctx context.Context,
	relationshipTupleCreate models.RelationshipTupleCreate,
) (*models.RelationshipTupleRead, error)

func (*RelationshipTuples) Delete added in v1.0.5

func (r *RelationshipTuples) Delete(
	ctx context.Context,
	relationshipTupleDelete models.RelationshipTupleDelete,
) error

func (*RelationshipTuples) List added in v1.0.5

func (r *RelationshipTuples) List(
	ctx context.Context,
	page int,
	perPage int,
	tenantFilter string,
	subjectFilter string,
	relationFilter string,
	objectFilter string,
) (*[]models.RelationshipTupleRead, error)

func (*RelationshipTuples) ListDetailed added in v1.0.5

func (r *RelationshipTuples) ListDetailed(
	ctx context.Context,
	page int,
	perPage int,
	tenantFilter string,
	subjectFilter string,
	relationFilter string,
	objectFilter string,
) (*[]models.RelationshipTupleRead, error)

func (*RelationshipTuples) WaitForSync added in v1.1.2

func (u *RelationshipTuples) WaitForSync(timeout *time.Duration, options WaitForSyncOptions) *RelationshipTuples

WaitForSync configures the client to wait for facts synchronization.

Parameters:

  • timeout: Optional duration to wait for synchronization.
  • options: Additional configuration options for facts synchronization

type ResourceActionGroups added in v0.0.10

type ResourceActionGroups struct {
	// contains filtered or unexported fields
}

func NewResourceActionGroupsApi added in v0.0.10

func NewResourceActionGroupsApi(client *openapi.APIClient, config *config.PermitConfig) *ResourceActionGroups

func (*ResourceActionGroups) Create added in v0.0.10

func (a *ResourceActionGroups) Create(ctx context.Context, resourceKey string, resourceActionCreate models.ResourceActionGroupCreate) (*models.ResourceActionGroupRead, error)

Create a resource action by resource key. Usage Example: ```

resourceActionCreate := models.NewResourceActionCreate("action-key", "action-name")
resourceAction, err := PermitClient.Api.ResourceActions.Create(ctx, "resource-key", resourceActionCreate)

```

func (*ResourceActionGroups) Delete added in v0.0.10

func (a *ResourceActionGroups) Delete(ctx context.Context, resourceKey string, actionKey string) error

Delete a resource action by resource key and action key. Usage Example:

`err := PermitClient.Api.ResourceActions.Delete(ctx, "resource-key", "action-key")`

func (*ResourceActionGroups) Get added in v0.0.10

func (a *ResourceActionGroups) Get(ctx context.Context, resourceKey string, actionKey string) (*models.ResourceActionGroupRead, error)

Get a resource action by resource key and action key. Usage Example:

`resourceAction, err := PermitClient.Api.ResourceActions.Get(ctx, "resource-key", "action-key")`

func (*ResourceActionGroups) GetById added in v0.0.10

func (a *ResourceActionGroups) GetById(ctx context.Context, resourceKey uuid.UUID, actionKey uuid.UUID) (*models.ResourceActionGroupRead, error)

GetById gets a resource action by resource ID and action ID. Usage Example:

`resourceAction, err := PermitClient.Api.ResourceActions.GetById(ctx, uuid.New(), uuid.New())`

func (*ResourceActionGroups) GetByKey added in v0.0.10

func (a *ResourceActionGroups) GetByKey(ctx context.Context, resourceKey string, actionKey string) (*models.ResourceActionGroupRead, error)

GetByKey gets a resource action by resource key and action key. Usage Example:

`resourceAction, err := PermitClient.Api.ResourceActions.GetByKey(ctx, "resource-key", "action-key")`

func (*ResourceActionGroups) List added in v0.0.10

func (a *ResourceActionGroups) List(ctx context.Context, resourceKey string, page int, perPage int) ([]models.ResourceActionGroupRead, error)

List all resource action groups of a resource by resource key. Usage Example:

`resourceActions, err := PermitClient.Api.ResourceActions.List(ctx, "resource-key", 1, 10)`

func (*ResourceActionGroups) ListByAttributes added in v0.0.10

func (a *ResourceActionGroups) ListByAttributes(ctx context.Context, resourceKey string, page int, perPage int, attributesFilter map[string]interface{}) ([]models.ResourceActionGroupRead, error)

ListByAttributes lists all action groups in the current environment by attributes filter

type ResourceActions

type ResourceActions struct {
	// contains filtered or unexported fields
}

func NewResourceActionsApi

func NewResourceActionsApi(client *openapi.APIClient, config *config.PermitConfig) *ResourceActions

func (*ResourceActions) Create

func (a *ResourceActions) Create(ctx context.Context, resourceKey string, resourceActionCreate models.ResourceActionCreate) (*models.ResourceActionRead, error)

Create a resource action by resource key. Usage Example: ```

resourceActionCreate := models.NewResourceActionCreate("action-key", "action-name")
resourceAction, err := PermitClient.Api.ResourceActions.Create(ctx, "resource-key", resourceActionCreate)

```

func (*ResourceActions) Delete

func (a *ResourceActions) Delete(ctx context.Context, resourceKey string, actionKey string) error

Delete a resource action by resource key and action key. Usage Example:

`err := PermitClient.Api.ResourceActions.Delete(ctx, "resource-key", "action-key")`

func (*ResourceActions) Get

func (a *ResourceActions) Get(ctx context.Context, resourceKey string, actionKey string) (*models.ResourceActionRead, error)

Get a resource action by resource key and action key. Usage Example:

`resourceAction, err := PermitClient.Api.ResourceActions.Get(ctx, "resource-key", "action-key")`

func (*ResourceActions) GetById

func (a *ResourceActions) GetById(ctx context.Context, resourceKey uuid.UUID, actionKey uuid.UUID) (*models.ResourceActionRead, error)

GetById gets a resource action by resource ID and action ID. Usage Example:

`resourceAction, err := PermitClient.Api.ResourceActions.GetById(ctx, uuid.New(), uuid.New())`

func (*ResourceActions) GetByKey

func (a *ResourceActions) GetByKey(ctx context.Context, resourceKey string, actionKey string) (*models.ResourceActionRead, error)

GetByKey gets a resource action by resource key and action key. Usage Example:

`resourceAction, err := PermitClient.Api.ResourceActions.GetByKey(ctx, "resource-key", "action-key")`

func (*ResourceActions) List

func (a *ResourceActions) List(ctx context.Context, resourceKey string, page int, perPage int) ([]models.ResourceActionRead, error)

List all resource actions of a resource by resource key. Usage Example:

`resourceActions, err := PermitClient.Api.ResourceActions.List(ctx, "resource-key", 1, 10)`

func (*ResourceActions) ListByAttributes added in v0.0.10

func (r *ResourceActions) ListByAttributes(ctx context.Context, resourceKey string, page int, perPage int, attributesFilter map[string]interface{}) ([]models.ResourceActionRead, error)

List all actions in the current environment by attributes filter Usage Example: `actions, err := PermitClient.Api.ResourceActions.List(ctx,1, 10, map[string]string{"attribute": "xyz"})`

func (*ResourceActions) Update

func (a *ResourceActions) Update(ctx context.Context, resourceKey string, actionKey string, resourceActionUpdate models.ResourceActionUpdate) (*models.ResourceActionRead, error)

Update a resource action by resource key and action key. Usage Example: ```

resourceActionUpdate := models.NewResourceActionUpdate()
resourceActionUpdate.SetName("new-action-name")
resourceAction, err := PermitClient.Api.ResourceActions.Update(ctx, "resource-key", "action-key", resourceActionUpdate)

```

type ResourceAttributes

type ResourceAttributes struct {
	// contains filtered or unexported fields
}

func NewResourceAttributesApi

func NewResourceAttributesApi(client *openapi.APIClient, config *config.PermitConfig) *ResourceAttributes

func (*ResourceAttributes) Create

func (a *ResourceAttributes) Create(ctx context.Context, resourceKey string, resourceAttributeCreate models.ResourceAttributeCreate) (*models.ResourceAttributeRead, error)

Create a resource attribute by resource key. Usage Example: ```

resourceAttributeCreate := models.NewResourceAttributeCreate("attribute-key", models.AttributeType("string"))
resourceAttribute, err := PermitClient.Api.ResourceAttributes.Create(ctx, "resource-key", resourceAttributeCreate)

```

func (*ResourceAttributes) Delete

func (a *ResourceAttributes) Delete(ctx context.Context, resourceKey string, attributeKey string) error

Delete a resource attribute by resource key and attribute key. Usage Example:

`err := PermitClient.Api.ResourceAttributes.Delete(ctx, "resource-key", "attribute-key")`

func (*ResourceAttributes) Get

func (a *ResourceAttributes) Get(ctx context.Context, resourceKey string, attributeKey string) (*models.ResourceAttributeRead, error)

Get a resource attribute by resource key and attribute key. Usage Example:

`resourceAttribute, err := PermitClient.Api.ResourceAttributes.Get(ctx, "resource-key", "attribute-key")`

func (*ResourceAttributes) GetById

func (a *ResourceAttributes) GetById(ctx context.Context, resourceKey uuid.UUID, attributeKey uuid.UUID) (*models.ResourceAttributeRead, error)

GetById gets a resource attribute by resource ID and attribute ID. Usage Example:

`resourceAttribute, err := PermitClient.Api.ResourceAttributes.GetById(ctx, uuid.New(), uuid.New())`

func (*ResourceAttributes) GetByKey

func (a *ResourceAttributes) GetByKey(ctx context.Context, resourceKey string, attributeKey string) (*models.ResourceAttributeRead, error)

GetByKey gets a resource attribute by resource key and attribute key. Usage Example:

`resourceAttribute, err := PermitClient.Api.ResourceAttributes.GetByKey(ctx, "resource-key", "attribute-key")`

func (*ResourceAttributes) List

func (a *ResourceAttributes) List(ctx context.Context, resourceKey string, page int, perPage int) ([]models.ResourceAttributeRead, error)

List all resource attributes of a resource, by resource key. Usage Example:

`resourceAttributes, err := PermitClient.Api.ResourceAttributes.List(ctx, "resource-key", 1, 10)`

func (*ResourceAttributes) Update

func (a *ResourceAttributes) Update(ctx context.Context, resourceKey string, attributeKey string, resourceAttributeUpdate models.ResourceAttributeUpdate) (*models.ResourceAttributeRead, error)

Update a resource attribute by resource key and attribute key. Usage Example: ```

resourceAttributeUpdate := models.NewResourceAttributeUpdate()
resourceAttributeUpdate.SetType("bool")
resourceAttribute, err := PermitClient.Api.ResourceAttributes.Update(ctx, "resource-key", "attribute-key", resourceAttributeUpdate)

```

type ResourceInstances added in v1.0.5

type ResourceInstances struct {
	PermitBaseFactsApi
}

func NewResourceInstancesApi added in v1.0.5

func NewResourceInstancesApi(client *openapi.APIClient, config *config.PermitConfig) *ResourceInstances

func (*ResourceInstances) Create added in v1.0.5

func (r *ResourceInstances) Create(
	ctx context.Context,
	resourceInstanceCreate models.ResourceInstanceCreate,
) (*models.ResourceInstanceRead, error)

func (*ResourceInstances) Delete added in v1.0.5

func (r *ResourceInstances) Delete(
	ctx context.Context,
	instanceId string,
) error

func (*ResourceInstances) Get added in v1.0.5

func (r *ResourceInstances) Get(
	ctx context.Context,
	instanceId string,
) (*models.ResourceInstanceRead, error)

func (*ResourceInstances) List added in v1.0.5

func (r *ResourceInstances) List(
	ctx context.Context,
	page int,
	perPage int,
	tenantFilter string,
	resourceFilter string,
	keyFilter string,
) (*[]models.ResourceInstanceRead, error)

func (*ResourceInstances) ListDetailed added in v1.0.5

func (r *ResourceInstances) ListDetailed(
	ctx context.Context,
	page int,
	perPage int,
	tenantFilter string,
	resourceFilter string,
	keyFilter string,
) (*[]models.ResourceInstanceRead, error)

func (*ResourceInstances) Update added in v1.0.5

func (r *ResourceInstances) Update(
	ctx context.Context,
	instanceId string,
	resourceInstanceUpdate models.ResourceInstanceUpdate,
) (*models.ResourceInstanceRead, error)

func (*ResourceInstances) WaitForSync added in v1.1.2

func (r *ResourceInstances) WaitForSync(timeout *time.Duration, options WaitForSyncOptions) *ResourceInstances

WaitForSync configures the client to wait for facts synchronization.

Parameters:

  • timeout: Optional duration to wait for synchronization.
  • options: Additional configuration options for facts synchronization

type ResourceRelations added in v1.0.5

type ResourceRelations struct {
	// contains filtered or unexported fields
}

func NewResourceRelationsApi added in v1.0.5

func NewResourceRelationsApi(client *openapi.APIClient, config *config.PermitConfig) *ResourceRelations

func (*ResourceRelations) Create added in v1.0.5

func (r *ResourceRelations) Create(
	ctx context.Context,
	resourceId string,
	relationCreate models.RelationCreate,
) (*models.RelationRead, error)

func (*ResourceRelations) Delete added in v1.0.5

func (r *ResourceRelations) Delete(
	ctx context.Context,
	resourceId string,
	relationId string,
) error

func (*ResourceRelations) Get added in v1.0.5

func (r *ResourceRelations) Get(
	ctx context.Context,
	resourceId string,
	relationId string,
) (*models.RelationRead, error)

func (*ResourceRelations) List added in v1.0.5

func (r *ResourceRelations) List(
	ctx context.Context,
	page int,
	perPage int,
	resourceId string,
) (*[]models.RelationRead, error)

type ResourceRoles added in v1.0.5

type ResourceRoles struct {
	// contains filtered or unexported fields
}

func NewResourceRolesApi added in v1.0.5

func NewResourceRolesApi(client *openapi.APIClient, config *config.PermitConfig) *ResourceRoles

func (*ResourceRoles) AddParent added in v1.0.5

func (r *ResourceRoles) AddParent(
	ctx context.Context,
	resourceId string,
	roleId string,
	parentRoleId string,
) (*models.ResourceRoleRead, error)

func (*ResourceRoles) AssignPermissions added in v1.0.5

func (r *ResourceRoles) AssignPermissions(
	ctx context.Context,
	resourceId string,
	roleId string,
	addRolePermissions models.AddRolePermissions,
) (*models.ResourceRoleRead, error)

func (*ResourceRoles) Create added in v1.0.5

func (r *ResourceRoles) Create(
	ctx context.Context,
	resourceId string,
	resourceRoleCreate models.ResourceRoleCreate,
) (*models.ResourceRoleRead, error)

func (*ResourceRoles) Delete added in v1.0.5

func (r *ResourceRoles) Delete(
	ctx context.Context,
	resourceId string,
	roleId string,
) error

func (*ResourceRoles) Get added in v1.0.5

func (r *ResourceRoles) Get(
	ctx context.Context,
	resourceId string,
	roleId string,
) (*models.ResourceRoleRead, error)

func (*ResourceRoles) GetAncestors added in v1.0.5

func (r *ResourceRoles) GetAncestors(
	ctx context.Context,
	resourceId string,
	roleId string,
) (*[]models.ResourceRoleRead, error)

func (*ResourceRoles) GetDescendants added in v1.0.5

func (r *ResourceRoles) GetDescendants(
	ctx context.Context,
	resourceId string,
	roleId string,
) (*[]models.ResourceRoleRead, error)

func (*ResourceRoles) List added in v1.0.5

func (r *ResourceRoles) List(
	ctx context.Context,
	page int,
	perPage int,
	resourceId string,
) (*[]models.ResourceRoleRead, error)

func (*ResourceRoles) RemoveParent added in v1.0.5

func (r *ResourceRoles) RemoveParent(
	ctx context.Context,
	resourceId string,
	roleId string,
	parentRoleId string,
) (*models.ResourceRoleRead, error)

func (*ResourceRoles) RemovePermissions added in v1.0.5

func (r *ResourceRoles) RemovePermissions(
	ctx context.Context,
	resourceId string,
	roleId string,
	removeRolePermissions models.RemoveRolePermissions,
) (*models.ResourceRoleRead, error)

func (*ResourceRoles) Update added in v1.0.5

func (r *ResourceRoles) Update(
	ctx context.Context,
	resourceId string,
	roleId string,
	resourceInstanceUpdate models.ResourceRoleUpdate,
) (*models.ResourceRoleRead, error)

type Resources

type Resources struct {
	// contains filtered or unexported fields
}

func NewResourcesApi

func NewResourcesApi(client *openapi.APIClient, config *config.PermitConfig) *Resources

func (*Resources) Create

func (r *Resources) Create(ctx context.Context, resourceCreate models.ResourceCreate) (*models.ResourceRead, error)

Create a new resource. Usage Example: ```

resourceCreate := models.NewResourceCreate("document", "Document", map[string]models.ActionBlockEditable{"read": {}, "write": {}}
resource, err := PermitClient.Api.Resources.Create(ctx, resourceCreate)

```

func (*Resources) Delete

func (r *Resources) Delete(ctx context.Context, resourceKey string) error

Delete a resource. Usage Example:

`err := PermitClient.Api.Resources.Delete(ctx, "my-resource")`

func (*Resources) Get

func (r *Resources) Get(ctx context.Context, resourceKey string) (*models.ResourceRead, error)

Get a resource by its key. Usage Example:

`resource, err := PermitClient.Api.Resources.Get(ctx, "my-resource")`

func (*Resources) GetById

func (r *Resources) GetById(ctx context.Context, resourceId uuid.UUID) (*models.ResourceRead, error)

GetById gets a resource by its ID. Usage Example:

`resource, err := PermitClient.Api.Resources.GetById(ctx, uuid.New())`

func (*Resources) GetByKey

func (r *Resources) GetByKey(ctx context.Context, resourceKey string) (*models.ResourceRead, error)

GetByKey gets a resource by its key. Usage Example:

`resource, err := PermitClient.Api.Resources.GetByKey(ctx, "my-resource")`

func (*Resources) List

func (r *Resources) List(ctx context.Context, page int, perPage int) ([]models.ResourceRead, error)

List all the resources in the current environment. Usage Example:

`resources, err := PermitClient.Api.Resources.List(ctx, 1, 10)`

func (*Resources) Search added in v0.0.13

func (r *Resources) Search(ctx context.Context, page int, perPage int, query string) ([]models.ResourceRead, error)

Search for resources by key or name. Usage Example:

`resources, err := PermitClient.Api.Resources.List(ctx, 1, 10)`

func (*Resources) Update

func (r *Resources) Update(ctx context.Context, resourceKey string, resourceUpdate models.ResourceUpdate) (*models.ResourceRead, error)

Update a resource. Usage Example: ```

resourceUpdate := models.NewResourceUpdate()
resourceUpdate.SetActions(map[string]models.ActionBlockEditable{"read": {}, "write": {}}
resource, err := PermitClient.Api.Resources.Update(ctx, "my-resource", resourceUpdate)

```

type RoleAssignments added in v0.0.13

type RoleAssignments struct {
	PermitBaseFactsApi
}

func NewRoleAssignmentsApi added in v0.0.13

func NewRoleAssignmentsApi(client *openapi.APIClient, config *config.PermitConfig) *RoleAssignments

func (*RoleAssignments) List added in v0.0.13

func (r *RoleAssignments) List(ctx context.Context, page int, perPage int, userFilter, roleFilter, tenantFilter string) (*[]models.RoleAssignmentRead, error)

func (*RoleAssignments) ListDetailed added in v0.0.13

func (r *RoleAssignments) ListDetailed(ctx context.Context, page int, perPage int, userFilter, roleFilter, tenantFilter string) (*[]models.RoleAssignmentDetailedRead, error)

func (*RoleAssignments) WaitForSync added in v1.1.2

func (r *RoleAssignments) WaitForSync(timeout *time.Duration, options WaitForSyncOptions) *RoleAssignments

WaitForSync configures the client to wait for facts synchronization.

Parameters:

  • timeout: Optional duration to wait for synchronization.
  • options: Additional configuration options for facts synchronization

type RoleRead

type RoleRead struct {
	models.RoleRead
}

type Roles

type Roles struct {
	// contains filtered or unexported fields
}

func NewRolesApi

func NewRolesApi(client *openapi.APIClient, config *config.PermitConfig) *Roles

func (*Roles) AddParentRole

func (r *Roles) AddParentRole(ctx context.Context, roleKey string, parentRoleKey string) error

AddParentRole add a parent role to a role, by role key and parent role key. Makes a role extend the parent role. In other words, a role will automatically be assigned any permissions that are granted to the parent role. We can say the role extends the parent role or inherits from the parent role. Usage Example: `err := PermitClient.Api.Roles.AddParentRole(ctx, "role-key", "parent-role-key")`

func (*Roles) AssignPermissions

func (r *Roles) AssignPermissions(ctx context.Context, roleKey string, permissions []string) error

AssignPermissions assign permissions to a role, by role key and list of permission keys. If a permission is already granted to the role it is skipped. Each permission can be either a resource-action key, or {resource_key}:{action_key}, i.e: the "document:read". Usage Example: `err := PermitClient.Api.Roles.AssignPermissions(ctx, "role-key", []string{"document:read", "document:write"})`

func (*Roles) BulkAssignRole added in v0.0.10

func (r *Roles) BulkAssignRole(ctx context.Context, assignments []models.RoleAssignmentCreate) (*models.BulkRoleAssignmentReport, error)

func (*Roles) BulkUnAssignRole added in v0.0.10

func (r *Roles) BulkUnAssignRole(ctx context.Context, unassignments []models.RoleAssignmentRemove) (*models.BulkRoleUnAssignmentReport, error)

func (*Roles) Create

func (r *Roles) Create(ctx context.Context, roleCreate models.RoleCreate) (*models.RoleRead, error)

Create a new role. Usage Example: ``` roleCreate := models.NewRoleCreate("role-key", "role-name") role, err := PermitClient.Api.Roles.Create(ctx, roleCreate) ```

func (*Roles) Delete

func (r *Roles) Delete(ctx context.Context, roleKey string) error

Delete a role. Usage Example: `err := PermitClient.Api.Roles.Delete(ctx, "role-key")`

func (*Roles) Get

func (r *Roles) Get(ctx context.Context, roleKey string) (*models.RoleRead, error)

Get a role by key. Usage Example: `role, err := PermitClient.Api.Roles.Get(ctx, "role-key")`

func (*Roles) GetById

func (r *Roles) GetById(ctx context.Context, roleKey uuid.UUID) (*models.RoleRead, error)

GetById get a role by id. Usage Example: `role, err := PermitClient.Api.Roles.GetById(ctx, uuid.New())`

func (*Roles) GetByKey

func (r *Roles) GetByKey(ctx context.Context, roleKey string) (*models.RoleRead, error)

GetByKey get a role by key. Usage Example: `role, err := PermitClient.Api.Roles.GetByKey(ctx, "role-key")`

func (*Roles) List

func (r *Roles) List(ctx context.Context, page int, perPage int) ([]models.RoleRead, error)

List all roles in the current environment. Usage Example: `roles, err := PermitClient.Api.Roles.List(ctx,1, 10)`

func (*Roles) ListByAttributes added in v0.0.9

func (r *Roles) ListByAttributes(ctx context.Context, page int, perPage int, attributesFilter map[string]interface{}) ([]models.RoleRead, error)

List all roles in the current environment by attributes filter Usage Example: `roles, err := PermitClient.Api.Roles.List(ctx,1, 10, map[string]string{"attribute": "xyz"})`

func (*Roles) RemoveParentRole

func (r *Roles) RemoveParentRole(ctx context.Context, roleKey string, parentRoleKey string) error

RemoveParentRole remove a parent role from a role, by role key and parent role key. Usage Example: `err := PermitClient.Api.Roles.RemoveParentRole(ctx, "role-key", "parent-role-key")`

func (*Roles) RemovePermissions

func (r *Roles) RemovePermissions(ctx context.Context, roleKey string, permissions []string) error

RemovePermissions remove permissions from a role, by role key and list of permission keys. If a permission is not found it is skipped. Each permission can be either a resource-action key, or {resource_key}:{action_key}, i.e: the "document:read". Usage Example: `err := PermitClient.Api.Roles.RemovePermissions(ctx, "role-key", []string{"document:read", "document:write"})`

func (*Roles) Update

func (r *Roles) Update(ctx context.Context, roleKey string, roleUpdate models.RoleUpdate) (*models.RoleRead, error)

Update a role. Usage Example: ``` roleUpdate := models.NewRoleUpdate() roleUpdate.SetName("new-role-name") role, err := PermitClient.Api.Roles.Update(ctx, "role-key", roleUpdate) ```

type Tenants

type Tenants struct {
	PermitBaseFactsApi
}

func NewTenantsApi

func NewTenantsApi(client *openapi.APIClient, config *config.PermitConfig) *Tenants

func (*Tenants) Create

func (t *Tenants) Create(ctx context.Context, tenantCreate models.TenantCreate) (*models.TenantRead, error)

Create a new tenant under the context's environment. Usage Example: ``` tenantCreate := models.NewTenantCreate("tenant-key", "tenant-name") tenant, err := PermitClient.Api.Tenants.Create(ctx, tenantCreate) ```

func (*Tenants) Delete

func (t *Tenants) Delete(ctx context.Context, tenantKey string) error

Delete a tenant under the context's environment. Usage Example: `err := PermitClient.Api.Tenants.Delete(ctx, "tenant-key")`

func (*Tenants) Get

func (t *Tenants) Get(ctx context.Context, tenantKey string) (*models.TenantRead, error)

Get a tenant under the context's environment - by a given tenant key. Usage Example: `tenant, err := PermitClient.Api.Tenants.Get(ctx, "tenant-key")`

func (*Tenants) GetById

func (t *Tenants) GetById(ctx context.Context, tenantId uuid.UUID) (*models.TenantRead, error)

GetById gets a tenant under the context's environment - by a given tenant id. Usage Example: `tenant, err := PermitClient.Api.Tenants.GetById(ctx, uuid.New())`

func (*Tenants) GetByKey

func (t *Tenants) GetByKey(ctx context.Context, tenantKey string) (*models.TenantRead, error)

GetByKey gets a tenant under the context's environment - by a given tenant key. Usage Example: `tenant, err := PermitClient.Api.Tenants.GetByKey(ctx, "tenant-key")`

func (*Tenants) List

func (t *Tenants) List(ctx context.Context, page int, perPage int) ([]models.TenantRead, error)

List all tenants under the context's environment. Usage Example: `tenants, err := PermitClient.Api.Tenants.List(ctx, 1, 10)`

func (*Tenants) ListByAttributes added in v0.0.9

func (t *Tenants) ListByAttributes(ctx context.Context, attributes map[string]interface{}, page int, perPage int) ([]models.TenantRead, error)

ListTenantsByAttributes gets tenants under the context's environment - by a given attributes. Usage Example: `tenants, err := PermitClient.Api.Tenants.ListTenantsByAttributes(ctx, map[string]string{"key": "value"})`

func (*Tenants) ListTenantUsers added in v1.2.6

func (t *Tenants) ListTenantUsers(ctx context.Context, tenantKey string, page int, perPage int) ([]models.UserRead, error)

ListTenantUsers lists all users within a specific tenant under the context's environment. Usage Example: `users, err := PermitClient.Api.Tenants.ListTenantUsers(ctx, "tenant-key", 1, 10)`

func (*Tenants) Update

func (t *Tenants) Update(ctx context.Context, tenantKey string, tenantUpdate models.TenantUpdate) (*models.TenantRead, error)

Update a tenant under the context's environment. Usage Example: ``` tenantUpdate := models.NewTenantUpdate() tenantUpdate.SetName("new-tenant-name") tenant, err := PermitClient.Api.Tenants.Update(ctx, "tenant-key", tenantUpdate) ```

func (*Tenants) WaitForSync added in v1.1.2

func (t *Tenants) WaitForSync(timeout *time.Duration, options WaitForSyncOptions) *Tenants

WaitForSync configures the client to wait for facts synchronization.

Parameters:

  • timeout: Optional duration to wait for synchronization.
  • options: Additional configuration options for facts synchronization

type Users

type Users struct {
	PermitBaseFactsApi
}

func NewUsersApi

func NewUsersApi(client *openapi.APIClient, config *config.PermitConfig) *Users

func (*Users) AssignResourceRole added in v1.0.8

func (u *Users) AssignResourceRole(ctx context.Context, userKey string, roleKey string, tenantKey string, resourceInstance string) (*models.RoleAssignmentRead, error)

AssignResourceRole assigns a *resource* role to a user in your context's environment, by user key, role key, tenant key and a resource instance string (e.g. "document:mydoc"). Usage Example: `roleAssignment, err := PermitClient.Api.Users.AssignRole(ctx, "user-key", "role-key", "default", "document:mydoc")`

func (*Users) AssignRole

func (u *Users) AssignRole(ctx context.Context, userKey string, roleKey string, tenantKey string) (*models.RoleAssignmentRead, error)

AssignRole assigns a role to a user in your context's environment, by user key, role key and tenant key. Usage Example: `roleAssignment, err := PermitClient.Api.Users.AssignRole(ctx, "user-key", "role-key", "default")`

func (*Users) Create

func (u *Users) Create(ctx context.Context, userCreate models.UserCreate) (*models.UserRead, error)

Create a user in your context's environment. Usage Example: ```

userCreate := models.NewUserCreate("user-key")
userCreate.SetEmail("user-email@mail.com")
userCreate.SetFirstName("user-first-name")
userCreate.SetLastName("user-last-name")
user, err := PermitClient.Api.Users.Create(ctx, userCreate)

```

func (*Users) Delete

func (u *Users) Delete(ctx context.Context, userKey string) error

Delete a user from your context's environment. Usage Example:

`err := PermitClient.Api.Users.Delete(ctx, "user-key")`

func (*Users) Get

func (u *Users) Get(ctx context.Context, userKey string) (*models.UserRead, error)

Get a user from your context's environment. Usage Example:

`user, err := PermitClient.Api.Users.Get(ctx, "user-key")`

func (*Users) GetAssignedRoles

func (u *Users) GetAssignedRoles(ctx context.Context, userKey string, tenantKey string, page int, perPage int) ([]models.RoleAssignmentRead, error)

GetAssignedRoles lists all roles assigned to a user in your context's environment, by user key, tenant key and pagination options. Usage Example: ```

`roleAssignmentList, err := PermitClient.Api.Users.GetAssignedRoles(ctx, "user-key", "default", 1, 10)`

func (*Users) GetById

func (u *Users) GetById(ctx context.Context, userId uuid.UUID) (*models.UserRead, error)

GetById gets a user by id from your context's environment. Usage Example:

`user, err := PermitClient.Api.Users.GetById(ctx, uuid.New())`

func (*Users) GetByKey

func (u *Users) GetByKey(ctx context.Context, userKey string) (*models.UserRead, error)

GetByKey gets a user by key from your context's environment. Usage Example:

`user, err := PermitClient.Api.Users.GetByKey(ctx, "user-key")`

func (*Users) List

func (u *Users) List(ctx context.Context, page int, perPage int) ([]models.UserRead, error)

List the users from your context's environment. Usage Example:

`users, err := PermitClient.Api.Users.List(ctx, 1, 10)`

func (*Users) SyncUser

func (u *Users) SyncUser(ctx context.Context, user models.UserCreate) (*models.UserRead, error)

SyncUser syncs a user in your context's environment, by user. Usage Example: ``` userCreate := *models.NewUserCreate("user-key") userCreate.SetEmail("user-email") userCreate.SetFirstName("user-first-name") userCreate.SetLastName("user-last-name") user, err := PermitClient.Api.Users.SyncUser(ctx, userCreate) ```

func (*Users) UnassignResourceRole added in v1.2.4

func (u *Users) UnassignResourceRole(ctx context.Context, userKey string, roleKey string, tenantKey string, resourceInstance string) (*models.UserRead, error)

UnassignResourceRole unassigns a *resource* role from a user in your context's environment, by user key, role key, tenant key and a resource instance string (e.g. "document:mydoc"). Usage Example: `err := PermitClient.Api.Users.UnassignResourceRole(ctx, "user-key", "role-key", "default", "document:mydoc")`

func (*Users) UnassignRole

func (u *Users) UnassignRole(ctx context.Context, userKey string, roleKey string, tenantKey string) (*models.UserRead, error)

UnassignRole unassigns a role from a user in your context's environment, by user key, role key and tenant key. Usage Example: `err := PermitClient.Api.Users.UnassignRole(ctx, "user-key", "role-key", "default")`

func (*Users) Update

func (u *Users) Update(ctx context.Context, userKey string, userUpdate models.UserUpdate) (*models.UserRead, error)

Update a user in your context's environment. Usage Example: ```

userUpdate := models.NewUserUpdate()
userUpdate.SetEmail("new@email.com")
userUpdate.SetFirstName("new-first-name")
userUpdate.SetLastName("new-last-name")
user, err := PermitClient.Api.Users.Update(ctx, "user-key", userUpdate)

```

func (*Users) WaitForSync added in v1.1.2

func (u *Users) WaitForSync(timeout *time.Duration, options WaitForSyncOptions) *Users

WaitForSync configures the client to wait for facts synchronization.

Parameters:

  • timeout: Optional duration to wait for synchronization.
  • options: Additional configuration options for facts synchronization

type WaitForSyncOptions added in v1.2.2

type WaitForSyncOptions struct {
	// Policy specifies what to do when timeout is reached ("ignore" or "fail")
	// When "ignore" is specified, the request will continue processing even if facts sync times out.
	// When "fail" is specified, the request will fail with an error if facts sync times out.
	Policy config.FactsSyncTimeoutPolicy
}

WaitForSyncOptions contains options for configuring facts synchronization behavior

Jump to

Keyboard shortcuts

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