Documentation ¶
Overview ¶
The Repos API allows users to manage their git repos.
Index ¶
- type CreateRepo
- type Delete
- type Get
- type List
- type ListReposResponse
- type RepoInfo
- type ReposAPI
- func (a *ReposAPI) Create(ctx context.Context, request CreateRepo) (*RepoInfo, error)
- func (a *ReposAPI) Delete(ctx context.Context, request Delete) error
- func (a *ReposAPI) DeleteByRepoId(ctx context.Context, repoId int64) error
- func (a *ReposAPI) Get(ctx context.Context, request Get) (*RepoInfo, error)
- func (a *ReposAPI) GetByPath(ctx context.Context, name string) (*RepoInfo, error)
- func (a *ReposAPI) GetByRepoId(ctx context.Context, repoId int64) (*RepoInfo, error)
- func (a *ReposAPI) Impl() ReposService
- func (a *ReposAPI) ListAll(ctx context.Context, request List) ([]RepoInfo, error)
- func (a *ReposAPI) RepoInfoPathToIdMap(ctx context.Context, request List) (map[string]int64, error)
- func (a *ReposAPI) Update(ctx context.Context, request UpdateRepo) error
- func (a *ReposAPI) WithImpl(impl ReposService) *ReposAPI
- type ReposService
- type SparseCheckout
- type SparseCheckoutUpdate
- type UpdateRepo
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateRepo ¶
type CreateRepo struct { // Desired path for the repo in the workspace. Must be in the format // /Repos/{folder}/{repo-name}. Path string `json:"path,omitempty"` // Git provider. This field is case-insensitive. The available Git providers // are gitHub, bitbucketCloud, gitLab, azureDevOpsServices, // gitHubEnterprise, bitbucketServer, gitLabEnterpriseEdition and // awsCodeCommit. Provider string `json:"provider"` // If specified, the repo will be created with sparse checkout enabled. You // cannot enable/disable sparse checkout after the repo is created. SparseCheckout *SparseCheckout `json:"sparse_checkout,omitempty"` // URL of the Git repository to be linked. Url string `json:"url"` }
type Delete ¶
type Delete struct { // The ID for the corresponding repo to access. RepoId int64 `json:"-" url:"-"` }
Delete a repo
type Get ¶
type Get struct { // The ID for the corresponding repo to access. RepoId int64 `json:"-" url:"-"` }
Get a repo
type List ¶
type List struct { // Token used to get the next page of results. If not specified, returns the // first page of results as well as a next page token if there are more // results. NextPageToken string `json:"-" url:"next_page_token,omitempty"` // Filters repos that have paths starting with the given path prefix. PathPrefix string `json:"-" url:"path_prefix,omitempty"` }
Get repos
type ListReposResponse ¶
type RepoInfo ¶
type RepoInfo struct { // Branch that the local version of the repo is checked out to. Branch string `json:"branch,omitempty"` // SHA-1 hash representing the commit ID of the current HEAD of the repo. HeadCommitId string `json:"head_commit_id,omitempty"` // ID of the repo object in the workspace. Id int64 `json:"id,omitempty"` // Desired path for the repo in the workspace. Must be in the format // /Repos/{folder}/{repo-name}. Path string `json:"path,omitempty"` // Git provider. This field is case-insensitive. The available Git providers // are gitHub, bitbucketCloud, gitLab, azureDevOpsServices, // gitHubEnterprise, bitbucketServer, gitLabEnterpriseEdition and // awsCodeCommit. Provider string `json:"provider,omitempty"` SparseCheckout *SparseCheckout `json:"sparse_checkout,omitempty"` // URL of the Git repository to be linked. Url string `json:"url,omitempty"` }
type ReposAPI ¶
type ReposAPI struct {
// contains filtered or unexported fields
}
The Repos API allows users to manage their git repos. Users can use the API to access all repos that they have manage permissions on.
Databricks Repos is a visual Git client in Databricks. It supports common Git operations such a cloning a repository, committing and pushing, pulling, branch management, and visual comparison of diffs when committing.
Within Repos you can develop code in notebooks or other files and follow data science and engineering code development best practices using Git for version control, collaboration, and CI/CD.
func NewRepos ¶
func NewRepos(client *client.DatabricksClient) *ReposAPI
func (*ReposAPI) Create ¶
Create a repo.
Creates a repo in the workspace and links it to the remote Git repo specified. Note that repos created programmatically must be linked to a remote Git repo, unlike repos created in the browser.
func (*ReposAPI) GetByPath ¶
GetByPath calls ReposAPI.RepoInfoPathToIdMap and returns a single RepoInfo.
Returns an error if there's more than one RepoInfo with the same .Path.
Note: All RepoInfo instances are loaded into memory before returning matching by name.
This method is generated by Databricks SDK Code Generator.
Example (CheckoutBranchByPath) ¶
ctx := context.Background() w, err := databricks.NewWorkspaceClient() if err != nil { panic(err) } // shortcut for getting RepoInfo by path repo, err := w.Repos.GetByPath(ctx, "/Repos/path/to/prod") if err != nil { panic(err) } // because you can update repo only by ID, not by path err = w.Repos.Update(ctx, repos.UpdateRepo{ RepoId: repo.Id, Branch: "v1.4.18", }) if err != nil { panic(err) }
Output:
func (*ReposAPI) Impl ¶
func (a *ReposAPI) Impl() ReposService
Impl returns low-level Repos API implementation
func (*ReposAPI) ListAll ¶
Get repos.
Returns repos that the calling user has Manage permissions on. Results are paginated with each page containing twenty repos.
This method is generated by Databricks SDK Code Generator.
func (*ReposAPI) RepoInfoPathToIdMap ¶
RepoInfoPathToIdMap calls ReposAPI.ListAll and creates a map of results with RepoInfo.Path as key and RepoInfo.Id as value.
Returns an error if there's more than one RepoInfo with the same .Path.
Note: All RepoInfo instances are loaded into memory before creating a map.
This method is generated by Databricks SDK Code Generator.
func (*ReposAPI) Update ¶
func (a *ReposAPI) Update(ctx context.Context, request UpdateRepo) error
Update a repo.
Updates the repo to a different branch or tag, or updates the repo to the latest commit on the same branch.
func (*ReposAPI) WithImpl ¶
func (a *ReposAPI) WithImpl(impl ReposService) *ReposAPI
WithImpl could be used to override low-level API implementations for unit testing purposes with github.com/golang/mock or other mocking frameworks.
type ReposService ¶
type ReposService interface { // Create a repo. // // Creates a repo in the workspace and links it to the remote Git repo // specified. Note that repos created programmatically must be linked to a // remote Git repo, unlike repos created in the browser. Create(ctx context.Context, request CreateRepo) (*RepoInfo, error) // Delete a repo. // // Deletes the specified repo. Delete(ctx context.Context, request Delete) error // Get a repo. // // Returns the repo with the given repo ID. Get(ctx context.Context, request Get) (*RepoInfo, error) // Get repos. // // Returns repos that the calling user has Manage permissions on. Results // are paginated with each page containing twenty repos. // // Use ListAll() to get all RepoInfo instances, which will iterate over every result page. List(ctx context.Context, request List) (*ListReposResponse, error) // Update a repo. // // Updates the repo to a different branch or tag, or updates the repo to the // latest commit on the same branch. Update(ctx context.Context, request UpdateRepo) error }
The Repos API allows users to manage their git repos. Users can use the API to access all repos that they have manage permissions on.
Databricks Repos is a visual Git client in Databricks. It supports common Git operations such a cloning a repository, committing and pushing, pulling, branch management, and visual comparison of diffs when committing.
Within Repos you can develop code in notebooks or other files and follow data science and engineering code development best practices using Git for version control, collaboration, and CI/CD.
type SparseCheckout ¶ added in v0.3.0
type SparseCheckout struct { // List of patterns to include for sparse checkout. Patterns []string `json:"patterns,omitempty"` }
type SparseCheckoutUpdate ¶ added in v0.3.0
type SparseCheckoutUpdate struct { // List of patterns to include for sparse checkout. Patterns []string `json:"patterns,omitempty"` }
type UpdateRepo ¶
type UpdateRepo struct { // Branch that the local version of the repo is checked out to. Branch string `json:"branch,omitempty"` // The ID for the corresponding repo to access. RepoId int64 `json:"-" url:"-"` // If specified, update the sparse checkout settings. The update will fail // if sparse checkout is not enabled for the repo. SparseCheckout *SparseCheckoutUpdate `json:"sparse_checkout,omitempty"` // Tag that the local version of the repo is checked out to. Updating the // repo to a tag puts the repo in a detached HEAD state. Before committing // new changes, you must update the repo to a branch instead of the detached // HEAD. Tag string `json:"tag,omitempty"` }