azdo

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAzDORemoteURL

func IsAzDORemoteURL(u *url.URL) (result bool, err error)

Types

type Authenticator

type Authenticator interface {
	GetPAT(organizationName string) (string, error)
	GetAuthorizationHeader(organizationName string) (string, error)
}

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 {
	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)
	Security(ctx context.Context, organization string) (security.Client, error)
	Extensions(ctx context.Context, organization string) (extensions.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

type OrganizationName interface {
	Organization() string
	FullName() string
}

func ParseOrgnizationName

func ParseOrgnizationName(n string) (OrganizationName, error)

type ProjectName

type ProjectName interface {
	OrganizationName
	Project() string
}

func ParseProjectName

func ParseProjectName(n string) (ProjectName, error)

type Remote

type Remote struct {
	*git.Remote
	// contains filtered or unexported fields
}

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)

func (RemoteSet) DefaultRemote

func (r RemoteSet) DefaultRemote() (*Remote, error)

func (RemoteSet) FilterByOrganization

func (r RemoteSet) FilterByOrganization(organizations ...string) RemoteSet

Filter remotes by given organization, maintains original order

func (RemoteSet) FindByName

func (r RemoteSet) FindByName(names ...string) (*Remote, error)

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) Len

func (r RemoteSet) Len() int

https://golang.org/pkg/sort/#Interface

func (RemoteSet) Less

func (r RemoteSet) Less(i, j int) bool

func (RemoteSet) Swap

func (r RemoteSet) Swap(i, j int)

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
}

func ParseRepositoryName

func ParseRepositoryName(n string) (RepositoryName, error)

type Translator

type Translator interface {
	Translate(*url.URL) *url.URL
}

func NewIdentityTranslator

func NewIdentityTranslator() Translator

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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