google_cloud_dataform_v1/
client.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16#![allow(rustdoc::redundant_explicit_links)]
17#![allow(rustdoc::broken_intra_doc_links)]
18
19/// Implements a client for the Dataform API.
20///
21/// # Example
22/// ```
23/// # tokio_test::block_on(async {
24/// # use google_cloud_dataform_v1::client::Dataform;
25/// let client = Dataform::builder().build().await?;
26/// // use `client` to make requests to the Dataform API.
27/// # gax::client_builder::Result::<()>::Ok(()) });
28/// ```
29///
30/// # Service Description
31///
32/// Dataform is a service to develop, create, document, test, and update curated
33/// tables in BigQuery.
34///
35/// # Configuration
36///
37/// To configure `Dataform` use the `with_*` methods in the type returned
38/// by [builder()][Dataform::builder]. The default configuration should
39/// work for most applications. Common configuration changes include
40///
41/// * [with_endpoint()]: by default this client uses the global default endpoint
42///   (`https://dataform.googleapis.com`). Applications using regional
43///   endpoints or running in restricted networks (e.g. a network configured
44//    with [Private Google Access with VPC Service Controls]) may want to
45///   override this default.
46/// * [with_credentials()]: by default this client uses
47///   [Application Default Credentials]. Applications using custom
48///   authentication may need to override this default.
49///
50/// [with_endpoint()]: super::builder::dataform::ClientBuilder::with_endpoint
51/// [with_credentials()]: super::builder::dataform::ClientBuilder::credentials
52/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
53/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
54///
55/// # Pooling and Cloning
56///
57/// `Dataform` holds a connection pool internally, it is advised to
58/// create one and the reuse it.  You do not need to wrap `Dataform` in
59/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
60/// already uses an `Arc` internally.
61#[derive(Clone, Debug)]
62pub struct Dataform {
63    inner: std::sync::Arc<dyn super::stub::dynamic::Dataform>,
64}
65
66impl Dataform {
67    /// Returns a builder for [Dataform].
68    ///
69    /// ```
70    /// # tokio_test::block_on(async {
71    /// # use google_cloud_dataform_v1::client::Dataform;
72    /// let client = Dataform::builder().build().await?;
73    /// # gax::client_builder::Result::<()>::Ok(()) });
74    /// ```
75    pub fn builder() -> super::builder::dataform::ClientBuilder {
76        gax::client_builder::internal::new_builder(super::builder::dataform::client::Factory)
77    }
78
79    /// Creates a new client from the provided stub.
80    ///
81    /// The most common case for calling this function is in tests mocking the
82    /// client's behavior.
83    pub fn from_stub<T>(stub: T) -> Self
84    where
85        T: super::stub::Dataform + 'static,
86    {
87        Self {
88            inner: std::sync::Arc::new(stub),
89        }
90    }
91
92    pub(crate) async fn new(
93        config: gaxi::options::ClientConfig,
94    ) -> gax::client_builder::Result<Self> {
95        let inner = Self::build_inner(config).await?;
96        Ok(Self { inner })
97    }
98
99    async fn build_inner(
100        conf: gaxi::options::ClientConfig,
101    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Dataform>> {
102        if gaxi::options::tracing_enabled(&conf) {
103            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
104        }
105        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
106    }
107
108    async fn build_transport(
109        conf: gaxi::options::ClientConfig,
110    ) -> gax::client_builder::Result<impl super::stub::Dataform> {
111        super::transport::Dataform::new(conf).await
112    }
113
114    async fn build_with_tracing(
115        conf: gaxi::options::ClientConfig,
116    ) -> gax::client_builder::Result<impl super::stub::Dataform> {
117        Self::build_transport(conf)
118            .await
119            .map(super::tracing::Dataform::new)
120    }
121
122    /// Lists Repositories in a given project and location.
123    ///
124    /// **Note:** *This method can return repositories not shown in the [Dataform
125    /// UI](https://console.cloud.google.com/bigquery/dataform)*.
126    pub fn list_repositories(&self) -> super::builder::dataform::ListRepositories {
127        super::builder::dataform::ListRepositories::new(self.inner.clone())
128    }
129
130    /// Fetches a single Repository.
131    pub fn get_repository(&self) -> super::builder::dataform::GetRepository {
132        super::builder::dataform::GetRepository::new(self.inner.clone())
133    }
134
135    /// Creates a new Repository in a given project and location.
136    pub fn create_repository(&self) -> super::builder::dataform::CreateRepository {
137        super::builder::dataform::CreateRepository::new(self.inner.clone())
138    }
139
140    /// Updates a single Repository.
141    ///
142    /// **Note:** *This method does not fully implement
143    /// [AIP/134](https://google.aip.dev/134). The wildcard entry (\*) is treated
144    /// as a bad request, and when the `field_mask` is omitted, the request is
145    /// treated as a full update on all modifiable fields.*
146    pub fn update_repository(&self) -> super::builder::dataform::UpdateRepository {
147        super::builder::dataform::UpdateRepository::new(self.inner.clone())
148    }
149
150    /// Deletes a single Repository.
151    pub fn delete_repository(&self) -> super::builder::dataform::DeleteRepository {
152        super::builder::dataform::DeleteRepository::new(self.inner.clone())
153    }
154
155    /// Applies a Git commit to a Repository. The Repository must not have a value
156    /// for `git_remote_settings.url`.
157    pub fn commit_repository_changes(&self) -> super::builder::dataform::CommitRepositoryChanges {
158        super::builder::dataform::CommitRepositoryChanges::new(self.inner.clone())
159    }
160
161    /// Returns the contents of a file (inside a Repository). The Repository
162    /// must not have a value for `git_remote_settings.url`.
163    pub fn read_repository_file(&self) -> super::builder::dataform::ReadRepositoryFile {
164        super::builder::dataform::ReadRepositoryFile::new(self.inner.clone())
165    }
166
167    /// Returns the contents of a given Repository directory. The Repository must
168    /// not have a value for `git_remote_settings.url`.
169    pub fn query_repository_directory_contents(
170        &self,
171    ) -> super::builder::dataform::QueryRepositoryDirectoryContents {
172        super::builder::dataform::QueryRepositoryDirectoryContents::new(self.inner.clone())
173    }
174
175    /// Fetches a Repository's history of commits.  The Repository must not have a
176    /// value for `git_remote_settings.url`.
177    pub fn fetch_repository_history(&self) -> super::builder::dataform::FetchRepositoryHistory {
178        super::builder::dataform::FetchRepositoryHistory::new(self.inner.clone())
179    }
180
181    /// Computes a Repository's Git access token status.
182    pub fn compute_repository_access_token_status(
183        &self,
184    ) -> super::builder::dataform::ComputeRepositoryAccessTokenStatus {
185        super::builder::dataform::ComputeRepositoryAccessTokenStatus::new(self.inner.clone())
186    }
187
188    /// Fetches a Repository's remote branches.
189    pub fn fetch_remote_branches(&self) -> super::builder::dataform::FetchRemoteBranches {
190        super::builder::dataform::FetchRemoteBranches::new(self.inner.clone())
191    }
192
193    /// Lists Workspaces in a given Repository.
194    pub fn list_workspaces(&self) -> super::builder::dataform::ListWorkspaces {
195        super::builder::dataform::ListWorkspaces::new(self.inner.clone())
196    }
197
198    /// Fetches a single Workspace.
199    pub fn get_workspace(&self) -> super::builder::dataform::GetWorkspace {
200        super::builder::dataform::GetWorkspace::new(self.inner.clone())
201    }
202
203    /// Creates a new Workspace in a given Repository.
204    pub fn create_workspace(&self) -> super::builder::dataform::CreateWorkspace {
205        super::builder::dataform::CreateWorkspace::new(self.inner.clone())
206    }
207
208    /// Deletes a single Workspace.
209    pub fn delete_workspace(&self) -> super::builder::dataform::DeleteWorkspace {
210        super::builder::dataform::DeleteWorkspace::new(self.inner.clone())
211    }
212
213    /// Installs dependency NPM packages (inside a Workspace).
214    pub fn install_npm_packages(&self) -> super::builder::dataform::InstallNpmPackages {
215        super::builder::dataform::InstallNpmPackages::new(self.inner.clone())
216    }
217
218    /// Pulls Git commits from the Repository's remote into a Workspace.
219    pub fn pull_git_commits(&self) -> super::builder::dataform::PullGitCommits {
220        super::builder::dataform::PullGitCommits::new(self.inner.clone())
221    }
222
223    /// Pushes Git commits from a Workspace to the Repository's remote.
224    pub fn push_git_commits(&self) -> super::builder::dataform::PushGitCommits {
225        super::builder::dataform::PushGitCommits::new(self.inner.clone())
226    }
227
228    /// Fetches Git statuses for the files in a Workspace.
229    pub fn fetch_file_git_statuses(&self) -> super::builder::dataform::FetchFileGitStatuses {
230        super::builder::dataform::FetchFileGitStatuses::new(self.inner.clone())
231    }
232
233    /// Fetches Git ahead/behind against a remote branch.
234    pub fn fetch_git_ahead_behind(&self) -> super::builder::dataform::FetchGitAheadBehind {
235        super::builder::dataform::FetchGitAheadBehind::new(self.inner.clone())
236    }
237
238    /// Applies a Git commit for uncommitted files in a Workspace.
239    pub fn commit_workspace_changes(&self) -> super::builder::dataform::CommitWorkspaceChanges {
240        super::builder::dataform::CommitWorkspaceChanges::new(self.inner.clone())
241    }
242
243    /// Performs a Git reset for uncommitted files in a Workspace.
244    pub fn reset_workspace_changes(&self) -> super::builder::dataform::ResetWorkspaceChanges {
245        super::builder::dataform::ResetWorkspaceChanges::new(self.inner.clone())
246    }
247
248    /// Fetches Git diff for an uncommitted file in a Workspace.
249    pub fn fetch_file_diff(&self) -> super::builder::dataform::FetchFileDiff {
250        super::builder::dataform::FetchFileDiff::new(self.inner.clone())
251    }
252
253    /// Returns the contents of a given Workspace directory.
254    pub fn query_directory_contents(&self) -> super::builder::dataform::QueryDirectoryContents {
255        super::builder::dataform::QueryDirectoryContents::new(self.inner.clone())
256    }
257
258    /// Finds the contents of a given Workspace directory by filter.
259    pub fn search_files(&self) -> super::builder::dataform::SearchFiles {
260        super::builder::dataform::SearchFiles::new(self.inner.clone())
261    }
262
263    /// Creates a directory inside a Workspace.
264    pub fn make_directory(&self) -> super::builder::dataform::MakeDirectory {
265        super::builder::dataform::MakeDirectory::new(self.inner.clone())
266    }
267
268    /// Deletes a directory (inside a Workspace) and all of its contents.
269    pub fn remove_directory(&self) -> super::builder::dataform::RemoveDirectory {
270        super::builder::dataform::RemoveDirectory::new(self.inner.clone())
271    }
272
273    /// Moves a directory (inside a Workspace), and all of its contents, to a new
274    /// location.
275    pub fn move_directory(&self) -> super::builder::dataform::MoveDirectory {
276        super::builder::dataform::MoveDirectory::new(self.inner.clone())
277    }
278
279    /// Returns the contents of a file (inside a Workspace).
280    pub fn read_file(&self) -> super::builder::dataform::ReadFile {
281        super::builder::dataform::ReadFile::new(self.inner.clone())
282    }
283
284    /// Deletes a file (inside a Workspace).
285    pub fn remove_file(&self) -> super::builder::dataform::RemoveFile {
286        super::builder::dataform::RemoveFile::new(self.inner.clone())
287    }
288
289    /// Moves a file (inside a Workspace) to a new location.
290    pub fn move_file(&self) -> super::builder::dataform::MoveFile {
291        super::builder::dataform::MoveFile::new(self.inner.clone())
292    }
293
294    /// Writes to a file (inside a Workspace).
295    pub fn write_file(&self) -> super::builder::dataform::WriteFile {
296        super::builder::dataform::WriteFile::new(self.inner.clone())
297    }
298
299    /// Lists ReleaseConfigs in a given Repository.
300    pub fn list_release_configs(&self) -> super::builder::dataform::ListReleaseConfigs {
301        super::builder::dataform::ListReleaseConfigs::new(self.inner.clone())
302    }
303
304    /// Fetches a single ReleaseConfig.
305    pub fn get_release_config(&self) -> super::builder::dataform::GetReleaseConfig {
306        super::builder::dataform::GetReleaseConfig::new(self.inner.clone())
307    }
308
309    /// Creates a new ReleaseConfig in a given Repository.
310    pub fn create_release_config(&self) -> super::builder::dataform::CreateReleaseConfig {
311        super::builder::dataform::CreateReleaseConfig::new(self.inner.clone())
312    }
313
314    /// Updates a single ReleaseConfig.
315    ///
316    /// **Note:** *This method does not fully implement
317    /// [AIP/134](https://google.aip.dev/134). The wildcard entry (\*) is treated
318    /// as a bad request, and when the `field_mask` is omitted, the request is
319    /// treated as a full update on all modifiable fields.*
320    pub fn update_release_config(&self) -> super::builder::dataform::UpdateReleaseConfig {
321        super::builder::dataform::UpdateReleaseConfig::new(self.inner.clone())
322    }
323
324    /// Deletes a single ReleaseConfig.
325    pub fn delete_release_config(&self) -> super::builder::dataform::DeleteReleaseConfig {
326        super::builder::dataform::DeleteReleaseConfig::new(self.inner.clone())
327    }
328
329    /// Lists CompilationResults in a given Repository.
330    pub fn list_compilation_results(&self) -> super::builder::dataform::ListCompilationResults {
331        super::builder::dataform::ListCompilationResults::new(self.inner.clone())
332    }
333
334    /// Fetches a single CompilationResult.
335    pub fn get_compilation_result(&self) -> super::builder::dataform::GetCompilationResult {
336        super::builder::dataform::GetCompilationResult::new(self.inner.clone())
337    }
338
339    /// Creates a new CompilationResult in a given project and location.
340    pub fn create_compilation_result(&self) -> super::builder::dataform::CreateCompilationResult {
341        super::builder::dataform::CreateCompilationResult::new(self.inner.clone())
342    }
343
344    /// Returns CompilationResultActions in a given CompilationResult.
345    pub fn query_compilation_result_actions(
346        &self,
347    ) -> super::builder::dataform::QueryCompilationResultActions {
348        super::builder::dataform::QueryCompilationResultActions::new(self.inner.clone())
349    }
350
351    /// Lists WorkflowConfigs in a given Repository.
352    pub fn list_workflow_configs(&self) -> super::builder::dataform::ListWorkflowConfigs {
353        super::builder::dataform::ListWorkflowConfigs::new(self.inner.clone())
354    }
355
356    /// Fetches a single WorkflowConfig.
357    pub fn get_workflow_config(&self) -> super::builder::dataform::GetWorkflowConfig {
358        super::builder::dataform::GetWorkflowConfig::new(self.inner.clone())
359    }
360
361    /// Creates a new WorkflowConfig in a given Repository.
362    pub fn create_workflow_config(&self) -> super::builder::dataform::CreateWorkflowConfig {
363        super::builder::dataform::CreateWorkflowConfig::new(self.inner.clone())
364    }
365
366    /// Updates a single WorkflowConfig.
367    ///
368    /// **Note:** *This method does not fully implement
369    /// [AIP/134](https://google.aip.dev/134). The wildcard entry (\*) is treated
370    /// as a bad request, and when the `field_mask` is omitted, the request is
371    /// treated as a full update on all modifiable fields.*
372    pub fn update_workflow_config(&self) -> super::builder::dataform::UpdateWorkflowConfig {
373        super::builder::dataform::UpdateWorkflowConfig::new(self.inner.clone())
374    }
375
376    /// Deletes a single WorkflowConfig.
377    pub fn delete_workflow_config(&self) -> super::builder::dataform::DeleteWorkflowConfig {
378        super::builder::dataform::DeleteWorkflowConfig::new(self.inner.clone())
379    }
380
381    /// Lists WorkflowInvocations in a given Repository.
382    pub fn list_workflow_invocations(&self) -> super::builder::dataform::ListWorkflowInvocations {
383        super::builder::dataform::ListWorkflowInvocations::new(self.inner.clone())
384    }
385
386    /// Fetches a single WorkflowInvocation.
387    pub fn get_workflow_invocation(&self) -> super::builder::dataform::GetWorkflowInvocation {
388        super::builder::dataform::GetWorkflowInvocation::new(self.inner.clone())
389    }
390
391    /// Creates a new WorkflowInvocation in a given Repository.
392    pub fn create_workflow_invocation(&self) -> super::builder::dataform::CreateWorkflowInvocation {
393        super::builder::dataform::CreateWorkflowInvocation::new(self.inner.clone())
394    }
395
396    /// Deletes a single WorkflowInvocation.
397    pub fn delete_workflow_invocation(&self) -> super::builder::dataform::DeleteWorkflowInvocation {
398        super::builder::dataform::DeleteWorkflowInvocation::new(self.inner.clone())
399    }
400
401    /// Requests cancellation of a running WorkflowInvocation.
402    pub fn cancel_workflow_invocation(&self) -> super::builder::dataform::CancelWorkflowInvocation {
403        super::builder::dataform::CancelWorkflowInvocation::new(self.inner.clone())
404    }
405
406    /// Returns WorkflowInvocationActions in a given WorkflowInvocation.
407    pub fn query_workflow_invocation_actions(
408        &self,
409    ) -> super::builder::dataform::QueryWorkflowInvocationActions {
410        super::builder::dataform::QueryWorkflowInvocationActions::new(self.inner.clone())
411    }
412
413    /// Get default config for a given project and location.
414    pub fn get_config(&self) -> super::builder::dataform::GetConfig {
415        super::builder::dataform::GetConfig::new(self.inner.clone())
416    }
417
418    /// Update default config for a given project and location.
419    ///
420    /// **Note:** *This method does not fully implement
421    /// [AIP/134](https://google.aip.dev/134). The wildcard entry (\*) is treated
422    /// as a bad request, and when the `field_mask` is omitted, the request is
423    /// treated as a full update on all modifiable fields.*
424    pub fn update_config(&self) -> super::builder::dataform::UpdateConfig {
425        super::builder::dataform::UpdateConfig::new(self.inner.clone())
426    }
427
428    /// Lists information about the supported locations for this service.
429    pub fn list_locations(&self) -> super::builder::dataform::ListLocations {
430        super::builder::dataform::ListLocations::new(self.inner.clone())
431    }
432
433    /// Gets information about a location.
434    pub fn get_location(&self) -> super::builder::dataform::GetLocation {
435        super::builder::dataform::GetLocation::new(self.inner.clone())
436    }
437
438    /// Sets the access control policy on the specified resource. Replaces
439    /// any existing policy.
440    ///
441    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
442    /// errors.
443    pub fn set_iam_policy(&self) -> super::builder::dataform::SetIamPolicy {
444        super::builder::dataform::SetIamPolicy::new(self.inner.clone())
445    }
446
447    /// Gets the access control policy for a resource. Returns an empty policy
448    /// if the resource exists and does not have a policy set.
449    pub fn get_iam_policy(&self) -> super::builder::dataform::GetIamPolicy {
450        super::builder::dataform::GetIamPolicy::new(self.inner.clone())
451    }
452
453    /// Returns permissions that a caller has on the specified resource. If the
454    /// resource does not exist, this will return an empty set of
455    /// permissions, not a `NOT_FOUND` error.
456    ///
457    /// Note: This operation is designed to be used for building
458    /// permission-aware UIs and command-line tools, not for authorization
459    /// checking. This operation may "fail open" without warning.
460    pub fn test_iam_permissions(&self) -> super::builder::dataform::TestIamPermissions {
461        super::builder::dataform::TestIamPermissions::new(self.inner.clone())
462    }
463}