git_credentials
Creates, updates, deletes, gets or lists a git_credentials resource.
Overview
| Name | git_credentials |
| Type | Resource |
| Id | databricks_workspace.workspace.git_credentials |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
name | string | the name of the git credential, used for identification and ease of lookup |
credential_id | integer | |
git_email | string | The authenticating email associated with your Git provider user account. Used for authentication with the remote repository and also sets the author & committer identity for commits. Required for most Git providers except AWS CodeCommit. Learn more at https://docs.databricks.com/aws/en/repos/get-access-tokens-from-git-provider |
git_provider | string | The Git provider associated with the credential. |
git_username | string | The username provided with your Git provider account and associated with the credential. For most Git providers it is only used to set the Git committer & author names for commits, however it may be required for authentication depending on your Git provider / token requirements. Required for AWS CodeCommit. |
is_default_for_provider | boolean | if the credential is the default for the given provider |
| Name | Datatype | Description |
|---|---|---|
name | string | the name of the git credential, used for identification and ease of lookup |
credential_id | integer | |
git_email | string | The authenticating email associated with your Git provider user account. Used for authentication with the remote repository and also sets the author & committer identity for commits. Required for most Git providers except AWS CodeCommit. Learn more at https://docs.databricks.com/aws/en/repos/get-access-tokens-from-git-provider |
git_provider | string | The Git provider associated with the credential. |
git_username | string | The username provided with your Git provider account and associated with the credential. For most Git providers it is only used to set the Git committer & author names for commits, however it may be required for authentication depending on your Git provider / token requirements. Required for AWS CodeCommit. |
is_default_for_provider | boolean | if the credential is the default for the given provider |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | credential_id, deployment_name | principal_id | Gets the Git credential with the specified credential ID. |
list | select | deployment_name | principal_id | Lists the calling user's Git credentials. |
create | insert | deployment_name, git_provider | Creates a Git credential entry for the user. Use the PATCH endpoint to update existing credentials, or | |
update | update | credential_id, deployment_name, git_provider | Updates the specified Git credential. | |
delete | delete | credential_id, deployment_name | principal_id | Deletes the specified Git credential. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
credential_id | integer | The ID for the corresponding credential to access. |
deployment_name | string | The Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc) |
principal_id | integer | The ID of the service principal whose credentials will be modified. Only service principal managers can perform this action. |
SELECT examples
- get
- list
Gets the Git credential with the specified credential ID.
SELECT
name,
credential_id,
git_email,
git_provider,
git_username,
is_default_for_provider
FROM databricks_workspace.workspace.git_credentials
WHERE credential_id = '{{ credential_id }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
AND principal_id = '{{ principal_id }}'
;
Lists the calling user's Git credentials.
SELECT
name,
credential_id,
git_email,
git_provider,
git_username,
is_default_for_provider
FROM databricks_workspace.workspace.git_credentials
WHERE deployment_name = '{{ deployment_name }}' -- required
AND principal_id = '{{ principal_id }}'
;
INSERT examples
- create
- Manifest
Creates a Git credential entry for the user. Use the PATCH endpoint to update existing credentials, or
INSERT INTO databricks_workspace.workspace.git_credentials (
git_provider,
git_email,
git_username,
is_default_for_provider,
name,
personal_access_token,
principal_id,
deployment_name
)
SELECT
'{{ git_provider }}' /* required */,
'{{ git_email }}',
'{{ git_username }}',
{{ is_default_for_provider }},
'{{ name }}',
'{{ personal_access_token }}',
{{ principal_id }},
'{{ deployment_name }}'
RETURNING
name,
credential_id,
git_email,
git_provider,
git_username,
is_default_for_provider
;
# Description fields are for documentation purposes
- name: git_credentials
props:
- name: deployment_name
value: "{{ deployment_name }}"
description: Required parameter for the git_credentials resource.
- name: git_provider
value: "{{ git_provider }}"
description: |
Git provider. This field is case-insensitive. The available Git providers are `gitHub`, `bitbucketCloud`, `gitLab`, `azureDevOpsServices`, `gitHubEnterprise`, `bitbucketServer`, `gitLabEnterpriseEdition` and `awsCodeCommit`.
- name: git_email
value: "{{ git_email }}"
description: |
The authenticating email associated with your Git provider user account. Used for authentication with the remote repository and also sets the author & committer identity for commits. Required for most Git providers except AWS CodeCommit. Learn more at https://docs.databricks.com/aws/en/repos/get-access-tokens-from-git-provider
- name: git_username
value: "{{ git_username }}"
description: |
The username provided with your Git provider account and associated with the credential. For most Git providers it is only used to set the Git committer & author names for commits, however it may be required for authentication depending on your Git provider / token requirements. Required for AWS CodeCommit.
- name: is_default_for_provider
value: {{ is_default_for_provider }}
description: |
if the credential is the default for the given provider
- name: name
value: "{{ name }}"
description: |
the name of the git credential, used for identification and ease of lookup
- name: personal_access_token
value: "{{ personal_access_token }}"
description: |
The personal access token used to authenticate to the corresponding Git provider. For certain providers, support may exist for other types of scoped access tokens. [Learn more]. [Learn more]: https://docs.databricks.com/repos/get-access-tokens-from-git-provider.html
- name: principal_id
value: {{ principal_id }}
description: |
The ID of the service principal whose credentials will be modified. Only service principal managers can perform this action.
UPDATE examples
- update
Updates the specified Git credential.
UPDATE databricks_workspace.workspace.git_credentials
SET
git_provider = '{{ git_provider }}',
git_email = '{{ git_email }}',
git_username = '{{ git_username }}',
is_default_for_provider = {{ is_default_for_provider }},
name = '{{ name }}',
personal_access_token = '{{ personal_access_token }}',
principal_id = {{ principal_id }}
WHERE
credential_id = '{{ credential_id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND git_provider = '{{ git_provider }}' --required;
DELETE examples
- delete
Deletes the specified Git credential.
DELETE FROM databricks_workspace.workspace.git_credentials
WHERE credential_id = '{{ credential_id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND principal_id = '{{ principal_id }}'
;