Skip to main content

repositories

Creates, updates, deletes, gets or lists a repositories resource.

Overview

Namerepositories
TypeResource
Idgoogle.dataform.repositories

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringIdentifier. The repository's name.
createTimestring (google-datetime)Output only. The timestamp of when the repository was created.
dataEncryptionStateobjectOutput only. A data encryption state of a Git repository if this Repository is protected by a KMS key. (id: DataEncryptionState)
displayNamestringOptional. The repository's user-friendly name.
gitRemoteSettingsobjectOptional. If set, configures this repository to be linked to a Git remote. (id: GitRemoteSettings)
internalMetadatastringOutput only. All the metadata information that is used internally to serve the resource. For example: timestamps, flags, status fields, etc. The format of this field is a JSON string.
kmsKeyNamestringOptional. The reference to a KMS encryption key. If provided, it will be used to encrypt user data in the repository and all child resources. It is not possible to add or update the encryption key after the repository is created. Example: projects/{kms_project}/locations/{location}/keyRings/{key_location}/cryptoKeys/{key}
labelsobjectOptional. Repository user labels.
npmrcEnvironmentVariablesSecretVersionstringOptional. The name of the Secret Manager secret version to be used to interpolate variables into the .npmrc file for package installation operations. Must be in the format projects/*/secrets/*/versions/*. The file itself must be in a JSON format.
serviceAccountstringOptional. The service account to run workflow invocations under.
setAuthenticatedUserAdminbooleanOptional. Input only. If set to true, the authenticated user will be granted the roles/dataform.admin role on the created repository. To modify access to the created repository later apply setIamPolicy from https://cloud.google.com/dataform/reference/rest#rest-resource:-v1beta1.projects.locations.repositories
workspaceCompilationOverridesobjectOptional. If set, fields of workspace_compilation_overrides override the default compilation settings that are specified in dataform.json when creating workspace-scoped compilation results. See documentation for WorkspaceCompilationOverrides for more information. (id: WorkspaceCompilationOverrides)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, repositoriesIdFetches a single Repository.
query_directory_contentsselectprojectsId, locationsId, repositoriesIdcommitSha, path, pageSize, pageTokenReturns the contents of a given Repository directory. The Repository must not have a value for git_remote_settings.url.
listselectprojectsId, locationsIdpageSize, pageToken, orderBy, filterLists Repositories in a given project and location. Note: This method can return repositories not shown in the Dataform UI.
createinsertprojectsId, locationsIdrepositoryIdCreates a new Repository in a given project and location.
patchupdateprojectsId, locationsId, repositoriesIdupdateMaskUpdates a single Repository. Note: This method does not fully implement AIP/134. The wildcard entry (*) is treated as a bad request, and when the field_mask is omitted, the request is treated as a full update on all modifiable fields.
deletedeleteprojectsId, locationsId, repositoriesIdforceDeletes a single Repository.
commitexecprojectsId, locationsId, repositoriesIdApplies a Git commit to a Repository. The Repository must not have a value for git_remote_settings.url.
read_fileexecprojectsId, locationsId, repositoriesIdcommitSha, pathReturns the contents of a file (inside a Repository). The Repository must not have a value for git_remote_settings.url.
compute_access_token_statusexecprojectsId, locationsId, repositoriesIdComputes a Repository's Git access token status.

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.

NameDatatypeDescription
locationsIdstring
projectsIdstring
repositoriesIdstring
commitShastring
filterstring
forceboolean
orderBystring
pageSizeinteger (int32)
pageTokenstring
pathstring
repositoryIdstring
updateMaskstring (google-fieldmask)

SELECT examples

Fetches a single Repository.

SELECT
name,
createTime,
dataEncryptionState,
displayName,
gitRemoteSettings,
internalMetadata,
kmsKeyName,
labels,
npmrcEnvironmentVariablesSecretVersion,
serviceAccount,
setAuthenticatedUserAdmin,
workspaceCompilationOverrides
FROM google.dataform.repositories
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND repositoriesId = '{{ repositoriesId }}' -- required;

INSERT examples

Creates a new Repository in a given project and location.

INSERT INTO google.dataform.repositories (
data__name,
data__displayName,
data__gitRemoteSettings,
data__npmrcEnvironmentVariablesSecretVersion,
data__workspaceCompilationOverrides,
data__labels,
data__setAuthenticatedUserAdmin,
data__serviceAccount,
data__kmsKeyName,
projectsId,
locationsId,
repositoryId
)
SELECT
'{{ name }}',
'{{ displayName }}',
'{{ gitRemoteSettings }}',
'{{ npmrcEnvironmentVariablesSecretVersion }}',
'{{ workspaceCompilationOverrides }}',
'{{ labels }}',
{{ setAuthenticatedUserAdmin }},
'{{ serviceAccount }}',
'{{ kmsKeyName }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ repositoryId }}'
RETURNING
name,
createTime,
dataEncryptionState,
displayName,
gitRemoteSettings,
internalMetadata,
kmsKeyName,
labels,
npmrcEnvironmentVariablesSecretVersion,
serviceAccount,
setAuthenticatedUserAdmin,
workspaceCompilationOverrides
;

UPDATE examples

Updates a single Repository. Note: This method does not fully implement AIP/134. The wildcard entry (*) is treated as a bad request, and when the field_mask is omitted, the request is treated as a full update on all modifiable fields.

UPDATE google.dataform.repositories
SET
data__name = '{{ name }}',
data__displayName = '{{ displayName }}',
data__gitRemoteSettings = '{{ gitRemoteSettings }}',
data__npmrcEnvironmentVariablesSecretVersion = '{{ npmrcEnvironmentVariablesSecretVersion }}',
data__workspaceCompilationOverrides = '{{ workspaceCompilationOverrides }}',
data__labels = '{{ labels }}',
data__setAuthenticatedUserAdmin = {{ setAuthenticatedUserAdmin }},
data__serviceAccount = '{{ serviceAccount }}',
data__kmsKeyName = '{{ kmsKeyName }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND repositoriesId = '{{ repositoriesId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
createTime,
dataEncryptionState,
displayName,
gitRemoteSettings,
internalMetadata,
kmsKeyName,
labels,
npmrcEnvironmentVariablesSecretVersion,
serviceAccount,
setAuthenticatedUserAdmin,
workspaceCompilationOverrides;

DELETE examples

Deletes a single Repository.

DELETE FROM google.dataform.repositories
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND repositoriesId = '{{ repositoriesId }}' --required
AND force = '{{ force }}';

Lifecycle Methods

Applies a Git commit to a Repository. The Repository must not have a value for git_remote_settings.url.

EXEC google.dataform.repositories.commit 
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@repositoriesId='{{ repositoriesId }}' --required
@@json=
'{
"commitMetadata": "{{ commitMetadata }}",
"requiredHeadCommitSha": "{{ requiredHeadCommitSha }}",
"fileOperations": "{{ fileOperations }}"
}';