Documentation
¶
Index ¶
- func GetProjects(ctx context.Context, client core.Client, args core.GetProjectsArgs) ([]core.TeamProjectReference, error)
- func GetVariableGroups(ctx context.Context, client extensions.Client, ...) ([]taskagent.VariableGroup, error)
- func IsAzDORemoteURL(u *url.URL) (result bool, err error)
- func OrganizationFromURL(u *url.URL) (string, error)
- func PollOperationResult(ctx context.Context, client operations.Client, ...) (*operations.Operation, error)
- func PollOperationResultWithState(ctx context.Context, client operations.Client, ...) (*operations.Operation, error)
- type Authenticator
- type Client
- type ClientFactory
- type Connection
- type ConnectionFactory
- type OrganizationName
- type ProjectName
- type Remote
- type RemoteSet
- func (r RemoteSet) DefaultRemote() (*Remote, error)
- func (r RemoteSet) FilterByOrganization(organizations ...string) RemoteSet
- func (r RemoteSet) FindByName(names ...string) (*Remote, error)
- func (r RemoteSet) FindByRepo(repo Repository) (*Remote, error)
- func (r RemoteSet) Len() int
- func (r RemoteSet) Less(i, j int) bool
- func (rs RemoteSet) MarshalLogArray(enc zapcore.ArrayEncoder) error
- func (r RemoteSet) Swap(i, j int)
- type Repository
- type RepositoryName
- type Translator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetProjects ¶ added in v0.6.0
func GetProjects(ctx context.Context, client core.Client, args core.GetProjectsArgs) ([]core.TeamProjectReference, error)
func GetVariableGroups ¶ added in v0.6.0
func GetVariableGroups(ctx context.Context, client extensions.Client, args taskagent.GetVariableGroupsArgs) ([]taskagent.VariableGroup, error)
func OrganizationFromURL ¶ added in v0.6.0
OrganizationFromURL extracts the Azure DevOps organization from a validated URL. It supports both https://dev.azure.com/{organization}/... and https://{organization}.visualstudio.com/... styles and assumes the URL has already passed IsAzDORemoteURL validation.
func PollOperationResult ¶ added in v0.3.0
func PollOperationResult(ctx context.Context, client operations.Client, opRef *operations.OperationReference, timeout time.Duration) (*operations.Operation, error)
PollOperationResult polls the status of a long-running operation until it completes or times out.
func PollOperationResultWithState ¶ added in v0.3.0
func PollOperationResultWithState(ctx context.Context, client operations.Client, opRef *operations.OperationReference, timeout time.Duration, targetState operations.OperationStatus) (*operations.Operation, error)
PollOperationResultWithState polls the status of a long-running operation until it reaches the target state or times out.
Types ¶
type Authenticator ¶
type Client ¶
type Client interface {
CreateRequestMessage(ctx context.Context, httpMethod string, url string, apiVersion string, body io.Reader, mediaType string, acceptMediaType string, additionalHeaders map[string]string) (*http.Request, error)
GenerateUrl(apiResourceLocation *azuredevops.ApiResourceLocation, routeValues map[string]string, queryParameters url.Values) string
GetResourceAreas(ctx context.Context) (*[]azuredevops.ResourceAreaInfo, error)
Send(ctx context.Context, httpMethod string, locationId uuid.UUID, apiVersion string, routeValues map[string]string, queryParameters url.Values, body io.Reader, mediaType string, acceptMediaType string, additionalHeaders map[string]string) (*http.Response, error)
SendRequest(request *http.Request) (*http.Response, error)
UnmarshalBody(response *http.Response, v any) error
UnmarshalCollectionBody(response *http.Response, v any) error
UnmarshalCollectionJson(jsonValue []byte, v any) error
UnwrapError(response *http.Response) error
}
type ClientFactory ¶
type ClientFactory interface {
Build(ctx context.Context, organization string) (build.Client, error)
Git(ctx context.Context, organization string) (azdogit.Client, error)
Identity(ctx context.Context, organization string) (identity.Client, error)
Graph(ctx context.Context, organization string) (graph.Client, error)
Core(ctx context.Context, organization string) (core.Client, error)
Operations(ctx context.Context, organization string) (operations.Client, error)
PipelinePermissions(ctx context.Context, organization string) (pipelinepermissions.Client, error)
ServiceEndpoint(ctx context.Context, organization string) (serviceendpoint.Client, error)
Security(ctx context.Context, organization string) (security.Client, error)
TaskAgent(ctx context.Context, organization string) (taskagent.Client, error)
Extensions(ctx context.Context, organization string) (extensions.Client, error)
WorkItemTracking(ctx context.Context, organization string) (workitemtracking.Client, error)
}
func NewClientFactory ¶
func NewClientFactory(factory ConnectionFactory) (ClientFactory, error)
type Connection ¶
type Connection interface {
GetClientByResourceAreaId(ctx context.Context, resourceAreaID uuid.UUID) (Client, error)
GetClientByUrl(baseUrl string) Client
Organization() string
}
Connection mirrors the exported methods on azuredevops.Connection for creating service clients. It intentionally returns the local Client interface to keep code decoupled from the vendor type.
func NewPatConnection ¶
func NewPatConnection(organizationUrl string, personalAccessToken string) Connection
type ConnectionFactory ¶
type ConnectionFactory interface {
Connection(organization string) (Connection, error)
}
ConnectionFactory provides connections and org-scoped SDK clients.
func NewConnectionFactory ¶
func NewConnectionFactory(cfg config.Config, auth Authenticator) (ConnectionFactory, error)
type OrganizationName ¶
func ParseOrgnizationName ¶
func ParseOrgnizationName(n string) (OrganizationName, error)
type ProjectName ¶
type ProjectName interface {
OrganizationName
Project() string
}
func ProjectFromName ¶ added in v0.3.0
func ProjectFromName(n string) (ProjectName, error)
func ProjectFromURL ¶ added in v0.3.0
func ProjectFromURL(u *url.URL) (ProjectName, error)
ProjectFromURL parses an Azure DevOps project URL and returns a ProjectName. Supports both https://dev.azure.com/{organization}/{project} and https://{organization}.visualstudio.com/{project} formats.
type Remote ¶
Remote represents a git remote mapped to a AzDO repository
func (Remote) Repository ¶
func (r Remote) Repository() Repository
type RemoteSet ¶
type RemoteSet []*Remote
RemoteSet represents a set of git remotes which point to an AzDO endpoint
func TranslateRemotes ¶
func TranslateRemotes(gitRemotes git.RemoteSet, translator Translator) (remotes RemoteSet, err error)
func (RemoteSet) DefaultRemote ¶
func (RemoteSet) FilterByOrganization ¶
Filter remotes by given organization, maintains original order
func (RemoteSet) FindByName ¶
FindByName returns the first Remote whose name matches the list
func (RemoteSet) FindByRepo ¶
func (r RemoteSet) FindByRepo(repo Repository) (*Remote, error)
FindByRepo returns the first Remote that points to a specific Azure DevOps repository
func (RemoteSet) MarshalLogArray ¶ added in v0.6.0
func (rs RemoteSet) MarshalLogArray(enc zapcore.ArrayEncoder) error
type Repository ¶
type Repository interface {
fmt.Stringer
RepositoryName
Hostname() string
Equals(other Repository) bool
RemoteUrl(protocol string) (string, error)
OrganizationUrl() (string, error)
ProjectUrl() (string, error)
GitClient(ctx context.Context, connectionFactory ConnectionFactory) (azdogit.Client, error)
GitRepository(ctx context.Context, repoClient azdogit.Client) (*azdogit.GitRepository, error)
}
Repository describes an object that represents an Azure DevOps Git repository.
func NewRepository ¶
func NewRepository(project, name string) (Repository, error)
New creates a new repository using the default organization.
func NewRepositoryWithOrganization ¶
func NewRepositoryWithOrganization(organization, project, name string) (Repository, error)
NewWithOrganization creates a new repository with the specified organization.
func RepositoryFromName ¶
func RepositoryFromName(name string) (Repository, error)
func RepositoryFromURL ¶
func RepositoryFromURL(u *url.URL) (Repository, error)
FromURL extracts repository information from a git remote URL.
type RepositoryName ¶
type RepositoryName interface {
ProjectName
Name() string
}
type Translator ¶
func NewIdentityTranslator ¶
func NewIdentityTranslator() Translator