api

package
v1.16.1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateGroupWithCleanup

func CreateGroupWithCleanup(client *APIClient, ctx context.Context, config *TestConfig, payload identityopenapi.GroupWrite) (identityopenapi.GroupRead, string)

CreateGroupWithCleanup creates a group and schedules automatic cleanup. Accepts a typed struct for type safety (or use Build() from the builder).

func CreateOauth2ProviderWithCleanup added in v1.16.1

func CreateOauth2ProviderWithCleanup(client *APIClient, ctx context.Context, config *TestConfig, payload identityopenapi.Oauth2ProviderWrite) (identityopenapi.Oauth2ProviderRead, string)

CreateOauth2ProviderWithCleanup creates an OAuth2 provider and schedules automatic cleanup.

func CreateProjectWithCleanup added in v1.16.1

func CreateProjectWithCleanup(client *APIClient, ctx context.Context, config *TestConfig, payload identityopenapi.ProjectWrite) (identityopenapi.ProjectRead, string)

CreateProjectWithCleanup creates a project and schedules automatic cleanup. Project deletion is async (202), so cleanup polls until the project is gone.

func CreateServiceAccountWithCleanup added in v1.16.1

func CreateServiceAccountWithCleanup(client *APIClient, ctx context.Context, config *TestConfig, payload identityopenapi.ServiceAccountWrite) (identityopenapi.ServiceAccountCreate, string)

CreateServiceAccountWithCleanup creates a service account and schedules automatic cleanup.

func CreateUserWithCleanup added in v1.16.1

func CreateUserWithCleanup(client *APIClient, ctx context.Context, config *TestConfig, payload identityopenapi.UserWrite) (identityopenapi.UserRead, string)

CreateUserWithCleanup creates a user and schedules automatic cleanup.

func WaitForProjectInACL added in v1.16.1

func WaitForProjectInACL(callerClient *APIClient, ctx context.Context, config *TestConfig, projectID string) identityopenapi.AclProject

WaitForProjectInACL polls until projectID appears in the caller's organization ACL. ACL propagation may lag project provisioning, so this must be called after WaitForProjectProvisioned. Returns the matching AclProject for further assertions.

func WaitForProjectProvisioned added in v1.16.1

func WaitForProjectProvisioned(client *APIClient, ctx context.Context, config *TestConfig, projectID string)

WaitForProjectProvisioned polls until the project reaches provisioned state. Projects are created asynchronously (202); mutations will conflict if the controller is still reconciling, so callers must wait before updating.

func WaitForProjectRemovedFromACL added in v1.16.1

func WaitForProjectRemovedFromACL(callerClient *APIClient, ctx context.Context, config *TestConfig, projectID string)

WaitForProjectRemovedFromACL polls until projectID is no longer present in the caller's organization ACL.

Types

type APIClient

type APIClient struct {
	*coreclient.APIClient
	// contains filtered or unexported fields
}

APIClient wraps the core API client with identity-specific methods. Add methods here as you write tests for specific endpoints.

func NewAPIClient

func NewAPIClient(baseURL string) (*APIClient, error)

NewAPIClient creates a new Identity API client.

func NewAPIClientWithConfig

func NewAPIClientWithConfig(config *TestConfig) *APIClient

NewAPIClientWithConfig creates a new Identity API client with the given config.

func (*APIClient) CreateGroup

CreateGroup creates a new group in an organization.

func (*APIClient) CreateOauth2Provider added in v1.16.1

CreateOauth2Provider creates a new OAuth2 provider in an organization.

func (*APIClient) CreateProject added in v1.16.1

func (c *APIClient) CreateProject(ctx context.Context, orgID string, project identityopenapi.ProjectWrite) (*identityopenapi.ProjectRead, error)

CreateProject creates a new project in an organization.

func (*APIClient) CreateServiceAccount added in v1.16.1

CreateServiceAccount creates a new service account in an organization. The returned ServiceAccountCreate.Status.AccessToken is non-nil and contains the one-time access token — it is only present on create and rotate responses.

func (*APIClient) CreateUser added in v1.16.1

CreateUser creates a new user in an organization.

func (*APIClient) DeleteGroup

func (c *APIClient) DeleteGroup(ctx context.Context, orgID, groupID string) error

DeleteGroup deletes a group from an organization.

func (*APIClient) DeleteOauth2Provider added in v1.16.1

func (c *APIClient) DeleteOauth2Provider(ctx context.Context, orgID, providerID string) error

DeleteOauth2Provider deletes an OAuth2 provider from an organization.

func (*APIClient) DeleteProject added in v1.16.1

func (c *APIClient) DeleteProject(ctx context.Context, orgID, projectID string) error

DeleteProject deletes a project from an organization.

func (*APIClient) DeleteServiceAccount added in v1.16.1

func (c *APIClient) DeleteServiceAccount(ctx context.Context, orgID, saID string) error

DeleteServiceAccount deletes a service account from an organization.

func (*APIClient) DeleteUser added in v1.16.1

func (c *APIClient) DeleteUser(ctx context.Context, orgID, userID string) error

DeleteUser deletes a user from an organization.

func (*APIClient) GetEndpoints added in v1.16.0

func (c *APIClient) GetEndpoints() *Endpoints

GetEndpoints returns the endpoints helper for direct path access in tests.

func (*APIClient) GetGlobalACL

func (c *APIClient) GetGlobalACL(ctx context.Context) (*identityopenapi.Acl, error)

GetGlobalACL gets the global ACL for the current user.

func (*APIClient) GetGroup

func (c *APIClient) GetGroup(ctx context.Context, orgID, groupID string) (*identityopenapi.GroupRead, error)

GetGroup gets detailed information about a specific group.

func (*APIClient) GetListOrganizationsPath

func (c *APIClient) GetListOrganizationsPath() string

GetListOrganizationsPath returns the path for listing organizations. This is useful for tests that need direct access to the endpoint path.

func (*APIClient) GetOrganization

func (c *APIClient) GetOrganization(ctx context.Context, orgID string) (*identityopenapi.OrganizationRead, error)

GetOrganization gets detailed information about a specific organization.

func (*APIClient) GetOrganizationACL

func (c *APIClient) GetOrganizationACL(ctx context.Context, orgID string) (*identityopenapi.Acl, error)

GetOrganizationACL gets the ACL for a specific organization.

func (*APIClient) GetProject

func (c *APIClient) GetProject(ctx context.Context, orgID, projectID string) (*identityopenapi.ProjectRead, error)

GetProject gets detailed information about a specific project.

func (*APIClient) GetQuotas

func (c *APIClient) GetQuotas(ctx context.Context, orgID string) (*identityopenapi.QuotasRead, error)

GetQuotas gets the quotas for an organization.

func (*APIClient) ListGlobalOauth2Providers added in v1.16.1

func (c *APIClient) ListGlobalOauth2Providers(ctx context.Context) (identityopenapi.Oauth2Providers, error)

ListGlobalOauth2Providers lists platform-level OAuth2 providers (not scoped to an organization).

func (*APIClient) ListGroups

func (c *APIClient) ListGroups(ctx context.Context, orgID string) (identityopenapi.Groups, error)

ListGroups lists all groups in an organization.

func (*APIClient) ListOauth2Providers added in v1.16.1

func (c *APIClient) ListOauth2Providers(ctx context.Context, orgID string) (identityopenapi.Oauth2Providers, error)

ListOauth2Providers lists all OAuth2 providers in an organization.

func (*APIClient) ListOrganizations

func (c *APIClient) ListOrganizations(ctx context.Context) (identityopenapi.Organizations, error)

ListOrganizations lists all organizations.

func (*APIClient) ListProjects

func (c *APIClient) ListProjects(ctx context.Context, orgID string) (identityopenapi.Projects, error)

ListProjects lists all projects in an organization.

func (*APIClient) ListRoles

func (c *APIClient) ListRoles(ctx context.Context, orgID string) (identityopenapi.Roles, error)

ListRoles lists all roles in an organization.

func (*APIClient) ListServiceAccounts

func (c *APIClient) ListServiceAccounts(ctx context.Context, orgID string) (identityopenapi.ServiceAccounts, error)

ListServiceAccounts lists all service accounts in an organization.

func (*APIClient) ListUsers

func (c *APIClient) ListUsers(ctx context.Context, orgID string) (identityopenapi.Users, error)

ListUsers lists all users in an organization.

func (*APIClient) RotateServiceAccount added in v1.16.1

func (c *APIClient) RotateServiceAccount(ctx context.Context, orgID, saID string) (*identityopenapi.ServiceAccountCreate, error)

RotateServiceAccount rotates the access token for a service account. The returned ServiceAccountCreate.Status.AccessToken contains the new one-time token.

func (*APIClient) SetQuotas added in v1.16.1

SetQuotas updates the quotas for an organization.

func (*APIClient) UpdateGroup

func (c *APIClient) UpdateGroup(ctx context.Context, orgID, groupID string, group identityopenapi.GroupWrite) error

UpdateGroup updates an existing group in an organization. Returns nil on success. API returns 200 with empty body.

func (*APIClient) UpdateOauth2Provider added in v1.16.1

func (c *APIClient) UpdateOauth2Provider(ctx context.Context, orgID, providerID string, provider identityopenapi.Oauth2ProviderWrite) error

UpdateOauth2Provider updates an existing OAuth2 provider. Returns nil on success.

func (*APIClient) UpdateOrganization added in v1.16.1

func (c *APIClient) UpdateOrganization(ctx context.Context, orgID string, org identityopenapi.OrganizationWrite) error

UpdateOrganization updates an organization.

func (*APIClient) UpdateProject added in v1.16.1

func (c *APIClient) UpdateProject(ctx context.Context, orgID, projectID string, project identityopenapi.ProjectWrite) error

UpdateProject updates an existing project.

func (*APIClient) UpdateServiceAccount added in v1.16.1

UpdateServiceAccount updates an existing service account.

func (*APIClient) UpdateUser added in v1.16.1

func (c *APIClient) UpdateUser(ctx context.Context, orgID, userID string, user identityopenapi.UserWrite) (*identityopenapi.UserRead, error)

UpdateUser updates an existing user.

type Endpoints

type Endpoints struct{}

Endpoints contains API endpoint patterns. Add endpoint methods here as you write tests for them.

func NewEndpoints

func NewEndpoints() *Endpoints

NewEndpoints creates a new Endpoints instance.

func (*Endpoints) GetGlobalACL

func (e *Endpoints) GetGlobalACL() string

GetGlobalACL returns the endpoint for getting global ACL.

func (*Endpoints) GetGroup

func (e *Endpoints) GetGroup(orgID, groupID string) string

GetGroup returns the endpoint for getting a specific group.

func (*Endpoints) GetOauth2Provider added in v1.16.1

func (e *Endpoints) GetOauth2Provider(orgID, providerID string) string

GetOauth2Provider returns the endpoint for a specific OAuth2 provider. Used for PUT and DELETE — the server does not expose a GET /oauth2providers/{providerID} route.

func (*Endpoints) GetOrganization

func (e *Endpoints) GetOrganization(orgID string) string

GetOrganization returns the endpoint for getting a specific organization.

func (*Endpoints) GetOrganizationACL

func (e *Endpoints) GetOrganizationACL(orgID string) string

GetOrganizationACL returns the endpoint for getting organization ACL.

func (*Endpoints) GetProject

func (e *Endpoints) GetProject(orgID, projectID string) string

GetProject returns the endpoint for getting a specific project.

func (*Endpoints) GetQuotas

func (e *Endpoints) GetQuotas(orgID string) string

GetQuotas returns the endpoint for getting quotas for an organization.

func (*Endpoints) GetServiceAccount added in v1.16.1

func (e *Endpoints) GetServiceAccount(orgID, saID string) string

GetServiceAccount returns the endpoint for a specific service account.

func (*Endpoints) GetUser added in v1.16.1

func (e *Endpoints) GetUser(orgID, userID string) string

GetUser returns the endpoint for a specific user. Used for PUT and DELETE — the server does not expose a GET /users/{userID} route.

func (*Endpoints) ListGlobalOauth2Providers added in v1.16.1

func (e *Endpoints) ListGlobalOauth2Providers() string

ListGlobalOauth2Providers returns the endpoint for listing platform-level OAuth2 providers.

func (*Endpoints) ListGroups

func (e *Endpoints) ListGroups(orgID string) string

ListGroups returns the endpoint for listing all groups in an organization.

func (*Endpoints) ListOauth2Providers added in v1.16.1

func (e *Endpoints) ListOauth2Providers(orgID string) string

ListOauth2Providers returns the endpoint for listing OAuth2 providers in an organization.

func (*Endpoints) ListOrganizations

func (e *Endpoints) ListOrganizations() string

ListOrganizations returns the endpoint for listing all organizations.

func (*Endpoints) ListProjects

func (e *Endpoints) ListProjects(orgID string) string

ListProjects returns the endpoint for listing all projects in an organization.

func (*Endpoints) ListRoles

func (e *Endpoints) ListRoles(orgID string) string

ListRoles returns the endpoint for listing all roles in an organization.

func (*Endpoints) ListServiceAccounts

func (e *Endpoints) ListServiceAccounts(orgID string) string

ListServiceAccounts returns the endpoint for listing all service accounts in an organization.

func (*Endpoints) ListUsers

func (e *Endpoints) ListUsers(orgID string) string

ListUsers returns the endpoint for listing all users in an organization.

func (*Endpoints) RotateServiceAccount added in v1.16.1

func (e *Endpoints) RotateServiceAccount(orgID, saID string) string

RotateServiceAccount returns the endpoint for rotating a service account token.

type GinkgoLogger

type GinkgoLogger struct{}

GinkgoLogger implements the Logger interface for Ginkgo tests.

func (*GinkgoLogger) Printf

func (g *GinkgoLogger) Printf(format string, args ...interface{})

type GroupPayloadBuilder

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

GroupPayloadBuilder builds group payloads for testing using type-safe OpenAPI structs.

func NewGroupPayload

func NewGroupPayload() *GroupPayloadBuilder

NewGroupPayload creates a new group payload builder with a unique name.

func (*GroupPayloadBuilder) Build added in v1.16.1

Build returns the typed group struct directly.

func (*GroupPayloadBuilder) WithName

func (b *GroupPayloadBuilder) WithName(name string) *GroupPayloadBuilder

WithName sets the group name.

func (*GroupPayloadBuilder) WithRoleIDs

func (b *GroupPayloadBuilder) WithRoleIDs(roleIDs []string) *GroupPayloadBuilder

WithRoleIDs sets the role IDs for the group.

func (*GroupPayloadBuilder) WithServiceAccountIDs

func (b *GroupPayloadBuilder) WithServiceAccountIDs(serviceAccountIDs []string) *GroupPayloadBuilder

WithServiceAccountIDs sets the service account IDs for the group.

func (*GroupPayloadBuilder) WithUserIDs added in v1.16.1

func (b *GroupPayloadBuilder) WithUserIDs(userIDs []string) *GroupPayloadBuilder

WithUserIDs sets the user IDs for the group.

type Oauth2ProviderPayloadBuilder added in v1.16.1

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

Oauth2ProviderPayloadBuilder builds OAuth2 provider payloads for testing.

func NewOauth2ProviderPayload added in v1.16.1

func NewOauth2ProviderPayload() *Oauth2ProviderPayloadBuilder

NewOauth2ProviderPayload creates a new OAuth2 provider payload builder with a unique name.

func (*Oauth2ProviderPayloadBuilder) Build added in v1.16.1

Build returns the typed OAuth2 provider struct.

func (*Oauth2ProviderPayloadBuilder) WithClientID added in v1.16.1

WithClientID sets the client ID.

func (*Oauth2ProviderPayloadBuilder) WithName added in v1.16.1

WithName sets the provider name.

type OrganizationPayloadBuilder added in v1.16.1

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

OrganizationPayloadBuilder builds organization write payloads for testing.

func NewOrganizationPayload added in v1.16.1

func NewOrganizationPayload() *OrganizationPayloadBuilder

NewOrganizationPayload creates an empty organization payload builder.

func (*OrganizationPayloadBuilder) Build added in v1.16.1

Build returns the typed OrganizationWrite struct.

func (*OrganizationPayloadBuilder) FromRead added in v1.16.1

FromRead initialises the builder from an OrganizationRead, preserving the existing spec so that updates don't accidentally overwrite required fields like OrganizationType.

func (*OrganizationPayloadBuilder) WithName added in v1.16.1

WithName sets the organization name.

type ProjectPayloadBuilder added in v1.16.1

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

ProjectPayloadBuilder builds project payloads for testing.

func NewProjectPayload added in v1.16.1

func NewProjectPayload() *ProjectPayloadBuilder

NewProjectPayload creates a new project payload builder with a unique name.

func (*ProjectPayloadBuilder) Build added in v1.16.1

Build returns the typed project struct.

func (*ProjectPayloadBuilder) WithGroupIDs added in v1.16.1

func (b *ProjectPayloadBuilder) WithGroupIDs(groupIDs []string) *ProjectPayloadBuilder

WithGroupIDs sets the group IDs for the project.

func (*ProjectPayloadBuilder) WithName added in v1.16.1

WithName sets the project name.

type ServiceAccountPayloadBuilder added in v1.16.1

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

ServiceAccountPayloadBuilder builds service account payloads for testing.

func NewServiceAccountPayload added in v1.16.1

func NewServiceAccountPayload() *ServiceAccountPayloadBuilder

NewServiceAccountPayload creates a new service account payload builder with a unique name.

func (*ServiceAccountPayloadBuilder) Build added in v1.16.1

Build returns the typed service account struct.

func (*ServiceAccountPayloadBuilder) WithGroupIDs added in v1.16.1

WithGroupIDs sets the group IDs for the service account.

func (*ServiceAccountPayloadBuilder) WithName added in v1.16.1

WithName sets the service account name.

type TestConfig

type TestConfig struct {
	coreconfig.BaseConfig
	AdminToken   string
	UserToken    string
	OrgID        string
	ProjectID    string
	AdminGroupID string
	UserGroupID  string
	UserSAID     string
}

TestConfig extends the base config with Identity-specific fields.

func LoadTestConfig

func LoadTestConfig() (*TestConfig, error)

LoadTestConfig loads configuration from environment variables and .env files using viper. Returns an error if required configuration values are missing.

type UserPayloadBuilder added in v1.16.1

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

UserPayloadBuilder builds user payloads for testing.

func NewUserPayload added in v1.16.1

func NewUserPayload() *UserPayloadBuilder

NewUserPayload creates a new user payload builder with a unique subject.

func (*UserPayloadBuilder) Build added in v1.16.1

Build returns the typed user struct.

func (*UserPayloadBuilder) WithGroupIDs added in v1.16.1

func (b *UserPayloadBuilder) WithGroupIDs(groupIDs []string) *UserPayloadBuilder

WithGroupIDs sets the group IDs for the user.

func (*UserPayloadBuilder) WithState added in v1.16.1

WithState sets the user state.

func (*UserPayloadBuilder) WithSubject added in v1.16.1

func (b *UserPayloadBuilder) WithSubject(subject string) *UserPayloadBuilder

WithSubject sets the user subject (email).

Jump to

Keyboard shortcuts

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