aap

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultOrganizationID = 1

DefaultOrganizationID is the org ID reserved for the default / system organization within AAP

Variables

View Source
var (
	ErrNotFound  = errors.New("resource not found")
	ErrForbidden = errors.New("resource forbidden")
)

Functions

This section is empty.

Types

type AAPContentObject added in v1.0.0

type AAPContentObject struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

ContentObject represents the organization in role assignments

type AAPGatewayClient

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

func NewAAPGatewayClient

func NewAAPGatewayClient(options AAPGatewayClientOptions) (*AAPGatewayClient, error)

func (*AAPGatewayClient) CreateOAuthApplication added in v1.2.0

func (a *AAPGatewayClient) CreateOAuthApplication(ctx context.Context, token string, request *AAPOAuthApplicationRequest) (*AAPOAuthApplicationResponse, error)

CreateOAuthApplication creates a new OAuth application in AAP Gateway POST /api/gateway/v1/applications/

func (*AAPGatewayClient) GetMe

func (a *AAPGatewayClient) GetMe(ctx context.Context, token string) (*AAPUser, error)

GET /api/gateway/v1/me/

func (*AAPGatewayClient) GetOrganization

func (a *AAPGatewayClient) GetOrganization(ctx context.Context, token string, organizationID string) (*AAPOrganization, error)

GET /api/gateway/v1/organizations/{organization_id}

func (*AAPGatewayClient) ListOrganizations

func (a *AAPGatewayClient) ListOrganizations(ctx context.Context, token string) ([]*AAPOrganization, error)

GET /api/gateway/v1/organizations

func (*AAPGatewayClient) ListTeamRoleAssignments added in v1.2.0

func (a *AAPGatewayClient) ListTeamRoleAssignments(ctx context.Context, token string, ansibleID string) ([]*AAPRoleTeamAssignment, error)

GET /api/controller/v2/role_team_assignments/?team__resource__ansible_id={ansible_id}

See ListUserRoleAssignments for why this filters by ansible_id and uses the Controller API.

func (*AAPGatewayClient) ListUserOrganizations

func (a *AAPGatewayClient) ListUserOrganizations(ctx context.Context, token string, userID string) ([]*AAPOrganization, error)

GET /api/gateway/v1/users/{user_id}/organizations

func (*AAPGatewayClient) ListUserRoleAssignments added in v1.0.0

func (a *AAPGatewayClient) ListUserRoleAssignments(ctx context.Context, token string, ansibleID string) ([]*AAPRoleUserAssignment, error)

GET /api/controller/v2/role_user_assignments/?user__resource__ansible_id={ansible_id}

Filters by ansible_id rather than the Gateway numeric user ID: a user's numeric ID is not guaranteed to be the same between the Gateway and Controller components, but ansible_id is. Custom role definitions (e.g. flightctl-org-admin) are only visible through the Controller API today, not the Gateway's role_user_assignments endpoint.

func (*AAPGatewayClient) ListUserTeams

func (a *AAPGatewayClient) ListUserTeams(ctx context.Context, token string, userID string) ([]*AAPTeam, error)

GET /api/gateway/v1/users/{user_id}/teams

type AAPGatewayClientOptions

type AAPGatewayClientOptions struct {
	GatewayUrl      string
	TLSClientConfig *tls.Config
	MaxPageSize     *int
}

type AAPOAuthApplicationRequest added in v1.2.0

type AAPOAuthApplicationRequest struct {
	Name                   string `json:"name"`
	Organization           int    `json:"organization"`
	AuthorizationGrantType string `json:"authorization_grant_type"`
	ClientType             string `json:"client_type"`
	RedirectURIs           string `json:"redirect_uris"`
	AppURL                 string `json:"app_url"`
}

type AAPOAuthApplicationResponse added in v1.2.0

type AAPOAuthApplicationResponse struct {
	ID                     int    `json:"id"`
	Name                   string `json:"name"`
	ClientID               string `json:"client_id"`
	ClientSecret           string `json:"client_secret,omitempty"`
	ClientType             string `json:"client_type"`
	AuthorizationGrantType string `json:"authorization_grant_type"`
	RedirectURIs           string `json:"redirect_uris"`
	AppURL                 string `json:"app_url"`
	Organization           int    `json:"organization"`
}

type AAPOrganization

type AAPOrganization struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type AAPOrganizationsResponse

type AAPOrganizationsResponse = AAPPaginatedResponse[AAPOrganization]

type AAPPaginatedResponse

type AAPPaginatedResponse[T any] struct {
	Count    int     `json:"count"`
	Next     *string `json:"next"`
	Previous *string `json:"previous"`
	Results  []*T    `json:"results"`
}

AAP Gateway API response types

type AAPResourceSummary added in v1.3.0

type AAPResourceSummary struct {
	AnsibleID    string `json:"ansible_id"`
	ResourceType string `json:"resource_type"`
}

AAPResourceSummary is the "resource" summary field shared across AAP objects (users, teams, ...), carrying the ansible_id that stays stable across AAP components (Gateway, Controller, ...).

type AAPRoleDefinition added in v1.0.0

type AAPRoleDefinition struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Managed     bool   `json:"managed"`
}

RoleDefinition represents an AAP role definition

type AAPRoleTeamAssignment added in v1.2.0

type AAPRoleTeamAssignment struct {
	ID             int                                `json:"id"`
	SummaryFields  AAPRoleTeamAssignmentSummaryFields `json:"summary_fields"`
	ContentType    string                             `json:"content_type"`
	ObjectID       string                             `json:"object_id"`
	RoleDefinition int                                `json:"role_definition"`
	Team           int                                `json:"team"`
}

AAPRoleTeamAssignment represents a team's role assignment to an organization

type AAPRoleTeamAssignmentSummaryFields added in v1.2.0

type AAPRoleTeamAssignmentSummaryFields struct {
	RoleDefinition AAPRoleDefinition `json:"role_definition"`
	Team           AAPTeamSummary    `json:"team"`
	ContentObject  AAPContentObject  `json:"content_object"`
}

AAPRoleTeamAssignmentSummaryFields contains nested summary information for team role assignments

type AAPRoleUser added in v1.0.0

type AAPRoleUser struct {
	ID        int    `json:"id"`
	Username  string `json:"username"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
}

User represents an AAP user in role assignments

type AAPRoleUserAssignment added in v1.0.0

type AAPRoleUserAssignment struct {
	ID             int                                `json:"id"`
	SummaryFields  AAPRoleUserAssignmentSummaryFields `json:"summary_fields"`
	ContentType    string                             `json:"content_type"`
	ObjectID       string                             `json:"object_id"`
	RoleDefinition int                                `json:"role_definition"`
	User           int                                `json:"user"`
}

RoleUserAssignment represents a user's role assignment to an organization

type AAPRoleUserAssignmentSummaryFields added in v1.0.0

type AAPRoleUserAssignmentSummaryFields struct {
	RoleDefinition AAPRoleDefinition `json:"role_definition"`
	User           AAPRoleUser       `json:"user"`
	ContentObject  AAPContentObject  `json:"content_object"`
}

RoleUserAssignmentSummaryFields contains nested summary information

type AAPRoleUserAssignmentsResponse added in v1.0.0

type AAPRoleUserAssignmentsResponse = AAPPaginatedResponse[AAPRoleUserAssignment]

type AAPTeam

type AAPTeam struct {
	ID            int                  `json:"id"`
	SummaryFields AAPTeamSummaryFields `json:"summary_fields"`
}

type AAPTeamSummary added in v1.2.0

type AAPTeamSummary struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

AAPTeamSummary represents a team in role assignment summary fields

type AAPTeamSummaryFields

type AAPTeamSummaryFields struct {
	Organization AAPOrganization    `json:"organization"`
	Resource     AAPResourceSummary `json:"resource"`
}

type AAPTeamsResponse

type AAPTeamsResponse = AAPPaginatedResponse[AAPTeam]

type AAPUser

type AAPUser struct {
	ID                int                  `json:"id,omitempty"`
	Username          string               `json:"username,omitempty"`
	IsSuperuser       bool                 `json:"is_superuser,omitempty"`
	IsPlatformAuditor bool                 `json:"is_platform_auditor,omitempty"`
	SummaryFields     AAPUserSummaryFields `json:"summary_fields,omitempty"`
}

type AAPUserSummaryFields added in v1.3.0

type AAPUserSummaryFields struct {
	Resource AAPResourceSummary `json:"resource"`
}

type AAPUsersResponse

type AAPUsersResponse = AAPPaginatedResponse[AAPUser]

Jump to

Keyboard shortcuts

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