Class: Google::Apis::SourcerepoV1::CloudSourceRepositoriesService

Inherits:
Core::BaseService
  • Object
show all
Defined in:
generated/google/apis/sourcerepo_v1/service.rb

Overview

Cloud Source Repositories API

Accesses source code repositories hosted by Google.

Examples:

require 'google/apis/sourcerepo_v1'

Sourcerepo = Google::Apis::SourcerepoV1 # Alias the module
service = Sourcerepo::CloudSourceRepositoriesService.new

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCloudSourceRepositoriesService

Returns a new instance of CloudSourceRepositoriesService.



45
46
47
48
# File 'generated/google/apis/sourcerepo_v1/service.rb', line 45

def initialize
  super('https://sourcerepo.googleapis.com/', '')
  @batch_path = 'batch'
end

Instance Attribute Details

#keyString

Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

Returns:

  • (String)

    API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.



38
39
40
# File 'generated/google/apis/sourcerepo_v1/service.rb', line 38

def key
  @key
end

#quota_userString

Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

Returns:

  • (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.



43
44
45
# File 'generated/google/apis/sourcerepo_v1/service.rb', line 43

def quota_user
  @quota_user
end

Instance Method Details

#create_project_repo(parent, repo_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SourcerepoV1::Repo

Creates a repo in the given project with the given name. If the named repository already exists, CreateRepo returns ALREADY_EXISTS.

Parameters:

  • parent (String)

    The project in which to create the repo. Values are of the form projects/.

  • repo_object (Google::Apis::SourcerepoV1::Repo) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



135
136
137
138
139
140
141
142
143
144
145
# File 'generated/google/apis/sourcerepo_v1/service.rb', line 135

def create_project_repo(parent, repo_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/{+parent}/repos', options)
  command.request_representation = Google::Apis::SourcerepoV1::Repo::Representation
  command.request_object = repo_object
  command.response_representation = Google::Apis::SourcerepoV1::Repo::Representation
  command.response_class = Google::Apis::SourcerepoV1::Repo
  command.params['parent'] = parent unless parent.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#delete_project_repo(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SourcerepoV1::Empty

Deletes a repo.

Parameters:

  • name (String)

    The name of the repo to delete. Values are of the form projects//repos/.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



167
168
169
170
171
172
173
174
175
# File 'generated/google/apis/sourcerepo_v1/service.rb', line 167

def delete_project_repo(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:delete, 'v1/{+name}', options)
  command.response_representation = Google::Apis::SourcerepoV1::Empty::Representation
  command.response_class = Google::Apis::SourcerepoV1::Empty
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_project_config(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SourcerepoV1::ProjectConfig

Returns the Cloud Source Repositories configuration of the project.

Parameters:

  • name (String)

    The name of the requested project. Values are of the form projects/.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



70
71
72
73
74
75
76
77
78
# File 'generated/google/apis/sourcerepo_v1/service.rb', line 70

def get_project_config(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+name}/config', options)
  command.response_representation = Google::Apis::SourcerepoV1::ProjectConfig::Representation
  command.response_class = Google::Apis::SourcerepoV1::ProjectConfig
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_project_repo(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SourcerepoV1::Repo

Returns information about a repo.

Parameters:

  • name (String)

    The name of the requested repository. Values are of the form projects//repos/ .

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



198
199
200
201
202
203
204
205
206
# File 'generated/google/apis/sourcerepo_v1/service.rb', line 198

def get_project_repo(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+name}', options)
  command.response_representation = Google::Apis::SourcerepoV1::Repo::Representation
  command.response_class = Google::Apis::SourcerepoV1::Repo
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_project_repo_iam_policy(resource, options_requested_policy_version: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SourcerepoV1::Policy

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

Parameters:

  • resource (String)

    REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

  • options_requested_policy_version (Fixnum) (defaults to: nil)

    Optional. The policy format version to be returned. Valid values are 0, 1, and

    1. Requests specifying an invalid value will be rejected. Requests for policies with any conditional bindings must specify version 3. Policies without any conditional bindings may specify any valid value or leave the field unset. To learn which resources support conditions in their IAM policies, see the IAM documentation.
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



238
239
240
241
242
243
244
245
246
247
# File 'generated/google/apis/sourcerepo_v1/service.rb', line 238

def get_project_repo_iam_policy(resource, options_requested_policy_version: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+resource}:getIamPolicy', options)
  command.response_representation = Google::Apis::SourcerepoV1::Policy::Representation
  command.response_class = Google::Apis::SourcerepoV1::Policy
  command.params['resource'] = resource unless resource.nil?
  command.query['options.requestedPolicyVersion'] = options_requested_policy_version unless options_requested_policy_version.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#list_project_repos(name, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SourcerepoV1::ListReposResponse

Returns all repos belonging to a project. The sizes of the repos are not set by ListRepos. To get the size of a repo, use GetRepo.

Parameters:

  • name (String)

    The project ID whose repos should be listed. Values are of the form projects/ .

  • page_size (Fixnum) (defaults to: nil)

    Maximum number of repositories to return; between 1 and 500. If not set or zero, defaults to 100 at the server.

  • page_token (String) (defaults to: nil)

    Resume listing repositories where a prior ListReposResponse left off. This is an opaque token that must be obtained from a recent, prior ListReposResponse's next_page_token field.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



278
279
280
281
282
283
284
285
286
287
288
# File 'generated/google/apis/sourcerepo_v1/service.rb', line 278

def list_project_repos(name, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+name}/repos', options)
  command.response_representation = Google::Apis::SourcerepoV1::ListReposResponse::Representation
  command.response_class = Google::Apis::SourcerepoV1::ListReposResponse
  command.params['name'] = name unless name.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#patch_project_repo(name, update_repo_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SourcerepoV1::Repo

Updates information about a repo.

Parameters:

  • name (String)

    The name of the requested repository. Values are of the form projects//repos/ .

  • update_repo_request_object (Google::Apis::SourcerepoV1::UpdateRepoRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



312
313
314
315
316
317
318
319
320
321
322
# File 'generated/google/apis/sourcerepo_v1/service.rb', line 312

def patch_project_repo(name, update_repo_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:patch, 'v1/{+name}', options)
  command.request_representation = Google::Apis::SourcerepoV1::UpdateRepoRequest::Representation
  command.request_object = update_repo_request_object
  command.response_representation = Google::Apis::SourcerepoV1::Repo::Representation
  command.response_class = Google::Apis::SourcerepoV1::Repo
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#set_repo_iam_policy(resource, set_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SourcerepoV1::Policy

Sets the access control policy on the specified resource. Replaces any existing policy.

Parameters:

  • resource (String)

    REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

  • set_iam_policy_request_object (Google::Apis::SourcerepoV1::SetIamPolicyRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



347
348
349
350
351
352
353
354
355
356
357
# File 'generated/google/apis/sourcerepo_v1/service.rb', line 347

def set_repo_iam_policy(resource, set_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/{+resource}:setIamPolicy', options)
  command.request_representation = Google::Apis::SourcerepoV1::SetIamPolicyRequest::Representation
  command.request_object = set_iam_policy_request_object
  command.response_representation = Google::Apis::SourcerepoV1::Policy::Representation
  command.response_class = Google::Apis::SourcerepoV1::Policy
  command.params['resource'] = resource unless resource.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#sync_repo(name, sync_repo_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SourcerepoV1::Operation

Synchronize a connected repo. The response contains SyncRepoMetadata in the metadata field.

Parameters:

  • name (String)

    The name of the repo to synchronize. Values are of the form projects//repos/.

  • sync_repo_request_object (Google::Apis::SourcerepoV1::SyncRepoRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



381
382
383
384
385
386
387
388
389
390
391
# File 'generated/google/apis/sourcerepo_v1/service.rb', line 381

def sync_repo(name, sync_repo_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/{+name}:sync', options)
  command.request_representation = Google::Apis::SourcerepoV1::SyncRepoRequest::Representation
  command.request_object = sync_repo_request_object
  command.response_representation = Google::Apis::SourcerepoV1::Operation::Representation
  command.response_class = Google::Apis::SourcerepoV1::Operation
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#test_repo_iam_permissions(resource, test_iam_permissions_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SourcerepoV1::TestIamPermissionsResponse

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Parameters:

  • resource (String)

    REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

  • test_iam_permissions_request_object (Google::Apis::SourcerepoV1::TestIamPermissionsRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



417
418
419
420
421
422
423
424
425
426
427
# File 'generated/google/apis/sourcerepo_v1/service.rb', line 417

def test_repo_iam_permissions(resource, test_iam_permissions_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/{+resource}:testIamPermissions', options)
  command.request_representation = Google::Apis::SourcerepoV1::TestIamPermissionsRequest::Representation
  command.request_object = test_iam_permissions_request_object
  command.response_representation = Google::Apis::SourcerepoV1::TestIamPermissionsResponse::Representation
  command.response_class = Google::Apis::SourcerepoV1::TestIamPermissionsResponse
  command.params['resource'] = resource unless resource.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#update_project_config(name, update_project_config_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SourcerepoV1::ProjectConfig

Updates the Cloud Source Repositories configuration of the project.

Parameters:

  • name (String)

    The name of the requested project. Values are of the form projects/.

  • update_project_config_request_object (Google::Apis::SourcerepoV1::UpdateProjectConfigRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



101
102
103
104
105
106
107
108
109
110
111
# File 'generated/google/apis/sourcerepo_v1/service.rb', line 101

def update_project_config(name, update_project_config_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:patch, 'v1/{+name}/config', options)
  command.request_representation = Google::Apis::SourcerepoV1::UpdateProjectConfigRequest::Representation
  command.request_object = update_project_config_request_object
  command.response_representation = Google::Apis::SourcerepoV1::ProjectConfig::Representation
  command.response_class = Google::Apis::SourcerepoV1::ProjectConfig
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end