Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
 - func APILastCommits(owner, project, repo string) string
 - func APILastCommitsOfBranch(owner, project, repo, branch string) string
 - func APILastCommitsOfPath(owner, project, repo, branch, path string) string
 - func APIMetadata(owner, project, repo string) string
 - func APIRaw(owner, project, repo, branch, path string) string
 - func APIRepoTree(owner, project, repo, branch string) string
 - type AzureAPI
 - func (az *AzureAPI) GetDefaultBranchName(owner, project, repo string, headers *Headers) (string, error)
 - func (az *AzureAPI) GetFileLatestCommit(owner, project, repo, branch, fullPath string, headers *Headers) ([]Commit, error)
 - func (az *AzureAPI) GetLatestCommit(owner, project, repo, branch string, headers *Headers) (*Commit, error)
 - func (az *AzureAPI) GetRepoTree(owner, project, repo, branch string, headers *Headers) (*Tree, error)
 
- type BranchValue
 - type Commit
 - type CommitsMetadata
 - type CommitsValue
 - type Headers
 - type IAzureAPI
 - type InnerTree
 - type MockAzureAPI
 - func (az MockAzureAPI) GetDefaultBranchName(owner, project, repo string, headers *Headers) (string, error)
 - func (az MockAzureAPI) GetLatestCommit(owner, project, repo, branch string, headers *Headers) (*Commit, error)
 - func (az *MockAzureAPI) GetRepoTree(owner, project, repo, branch string, headers *Headers) (*Tree, error)
 
- type ObjectType
 - type Tree
 
Constants ¶
const ( DEFAULT_HOST string = "azure.com" DEV_HOST string = "dev.azure.com" SSH_DEV_HOST string = "ssh.dev.azure.com" )
Variables ¶
This section is empty.
Functions ¶
func APILastCommits ¶
APILastCommits Azure last commit api API Ref: https://learn.microsoft.com/en-us/rest/api/azure/devops/git/commits/get-commits?view=azure-devops-rest-4.1&tabs=HTTP Example: https://dev.azure.com/anubhav06/k8s-example/_apis/git/repositories/k8s-example/commits?searchCriteria.$top=1&api-version=4.1
func APILastCommitsOfBranch ¶
APILastCommitsOfBranch Azure last commit of specific branch api API Ref: https://learn.microsoft.com/en-us/rest/api/azure/devops/git/commits/get-commits?view=azure-devops-rest-4.1&tabs=HTTP Example: https://dev.azure.com/anubhav06/testing/_apis/git/repositories/testing/commits?searchCriteria.$top=1&searchCriteria.itemVersion.version=dev
func APILastCommitsOfPath ¶
APILastCommitsOfPath Azure last commit of specific branch api API Ref: https://learn.microsoft.com/en-us/rest/api/azure/devops/git/commits/get-commits?view=azure-devops-rest-4.1&tabs=HTTP Example: https://dev.azure.com/anubhav06/k8s-example/_apis/git/repositories/k8s-example/commits?searchCriteria.$top=1&searchCriteria.itemVersion.version=master&searchCriteria.itemPath=volumes/storageos/storageos-pod.yaml
func APIMetadata ¶
APIDefaultBranch Azure repo metadata api API Ref: https://learn.microsoft.com/en-us/rest/api/azure/devops/git/stats/list?view=azure-devops-rest-4.1&tabs=HTTP Example: https://dev.azure.com/anubhav06/k8s-example/_apis/git/repositories/k8s-example/stats/branches?api-version=4.1
func APIRaw ¶
APIRaw Azure raw file api API Ref: https://learn.microsoft.com/en-us/rest/api/azure/devops/build/source-providers/get-file-contents?view=azure-devops-rest-7.0 https://stackoverflow.com/questions/56281152/how-to-get-a-link-to-a-file-from-a-vso-repo/56283730#56283730 Example: https://dev.azure.com/anubhav06/k8s-example/_apis/sourceProviders/tfsgit/filecontents?&repository=k8s-example&commitOrBranch=master&path=/volumes/cephfs/cephfs.yaml&api-version=7.0
func APIRepoTree ¶
APIRepoTree Azure tree api API Ref: https://learn.microsoft.com/en-us/rest/api/azure/devops/git/items/list?view=azure-devops-rest-7.0&tabs=HTTP#full-recursion-and-with-content-metadata Example: https://dev.azure.com/anubhav06/testing/_apis/git/repositories/testing/items?recursionLevel=Full&versionDescriptor.version=dev&api-version=5.1
Types ¶
type AzureAPI ¶
type AzureAPI struct {
	// contains filtered or unexported fields
}
    func NewAzureAPI ¶
func NewAzureAPI() *AzureAPI
func (*AzureAPI) GetDefaultBranchName ¶
func (*AzureAPI) GetFileLatestCommit ¶
func (az *AzureAPI) GetFileLatestCommit(owner, project, repo, branch, fullPath string, headers *Headers) ([]Commit, error)
Get latest commit data of path/file
func (*AzureAPI) GetLatestCommit ¶
type BranchValue ¶
type BranchValue struct {
	Commit        CommitsMetadata `json:"commit"`
	Name          string          `json:"name"`
	AheadCount    int             `json:"aheadCount"`
	BehindCount   int             `json:"behindCount"`
	IsBaseVersion bool            `json:"isBaseVersion"`
}
    type Commit ¶
type Commit struct {
	Count        int            `json:"count"`
	CommitsValue []CommitsValue `json:"value"`
}
    LatestCommit returned structure
type CommitsMetadata ¶
type CommitsMetadata struct {
	TreeID   string `json:"treeId"`
	CommitID string `json:"commitId"`
	Author   struct {
		Name  string    `json:"name"`
		Email string    `json:"email"`
		Date  time.Time `json:"date"`
	} `json:"author"`
	Committer struct {
		Name  string    `json:"name"`
		Email string    `json:"email"`
		Date  time.Time `json:"date"`
	} `json:"committer"`
	Comment string   `json:"comment"`
	Parents []string `json:"parents"`
	URL     string   `json:"url"`
}
    type CommitsValue ¶
type CommitsValue struct {
	CommitID string `json:"commitId"`
	Author   struct {
		Name  string    `json:"name"`
		Email string    `json:"email"`
		Date  time.Time `json:"date"`
	} `json:"author"`
	Committer struct {
		Name  string    `json:"name"`
		Email string    `json:"email"`
		Date  time.Time `json:"date"`
	} `json:"committer"`
	Comment      string `json:"comment"`
	ChangeCounts struct {
		Add    int `json:"add"`
		Edit   int `json:"edit"`
		Delete int `json:"delete"`
	} `json:"changeCounts"`
	Changes []struct {
		SourceServerItem string `json:"sourceServerItem"`
		ChangeType       string `json:"changeType"`
	} `json:"changes"`
	URL       string `json:"url"`
	RemoteURL string `json:"remoteUrl"`
}
    type MockAzureAPI ¶
type MockAzureAPI struct {
}
    func NewMockAzureAPI ¶
func NewMockAzureAPI() *MockAzureAPI
func (MockAzureAPI) GetDefaultBranchName ¶
func (az MockAzureAPI) GetDefaultBranchName(owner, project, repo string, headers *Headers) (string, error)
func (MockAzureAPI) GetLatestCommit ¶
func (az MockAzureAPI) GetLatestCommit(owner, project, repo, branch string, headers *Headers) (*Commit, error)
func (*MockAzureAPI) GetRepoTree ¶
func (az *MockAzureAPI) GetRepoTree(owner, project, repo, branch string, headers *Headers) (*Tree, error)
type ObjectType ¶
type ObjectType string
const ( ObjectTypeDir ObjectType = "tree" ObjectTypeFile ObjectType = "blob" )
type Tree ¶
func (*Tree) ListAllDirs ¶
ListAllDirs list all directories in repo tree
func (*Tree) ListAllFiles ¶
ListAllFiles list all files in repo tree