Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions google-cloud-developer_connect-v1/.owlbot-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,22 @@
"snippets/developer_connect/fetch_read_token.rb",
"snippets/developer_connect/fetch_read_write_token.rb",
"snippets/developer_connect/fetch_self.rb",
"snippets/developer_connect/finish_o_auth.rb",
"snippets/developer_connect/get_account_connector.rb",
"snippets/developer_connect/get_connection.rb",
"snippets/developer_connect/get_git_repository_link.rb",
"snippets/developer_connect/list_account_connectors.rb",
"snippets/developer_connect/list_connections.rb",
"snippets/developer_connect/list_git_repository_links.rb",
"snippets/developer_connect/list_users.rb",
"snippets/developer_connect/start_o_auth.rb",
"snippets/developer_connect/update_account_connector.rb",
"snippets/developer_connect/update_connection.rb",
"snippets/insights_config_service/create_insights_config.rb",
"snippets/insights_config_service/delete_insights_config.rb",
"snippets/insights_config_service/get_deployment_event.rb",
"snippets/insights_config_service/get_insights_config.rb",
"snippets/insights_config_service/list_deployment_events.rb",
"snippets/insights_config_service/list_insights_configs.rb",
"snippets/insights_config_service/update_insights_config.rb",
"snippets/snippet_metadata_google.cloud.developerconnect.v1.json",
Expand Down
20 changes: 20 additions & 0 deletions google-cloud-developer_connect-v1/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@
"methods": [
"delete_self"
]
},
"StartOAuth": {
"methods": [
"start_o_auth"
]
},
"FinishOAuth": {
"methods": [
"finish_o_auth"
]
}
}
}
Expand Down Expand Up @@ -163,6 +173,16 @@
"methods": [
"delete_insights_config"
]
},
"GetDeploymentEvent": {
"methods": [
"get_deployment_event"
]
},
"ListDeploymentEvents": {
"methods": [
"list_deployment_events"
]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -814,8 +814,9 @@ def delete_connection request, options = nil
# Creates a GitRepositoryLink. Upon linking a Git Repository, Developer
# Connect will configure the Git Repository to send webhook events to
# Developer Connect. Connections that use Firebase GitHub Application will
# have events forwarded to the Firebase service. All other Connections will
# have events forwarded to Cloud Build.
# have events forwarded to the Firebase service. Connections that use Gemini
# Code Assist will have events forwarded to Gemini Code Assist service. All
# other Connections will have events forwarded to Cloud Build.
#
# @overload create_git_repository_link(request, options = nil)
# Pass arguments to `create_git_repository_link` via a request object, either of type
Expand Down Expand Up @@ -2697,6 +2698,186 @@ def delete_self request, options = nil
raise ::Google::Cloud::Error.from_error(e)
end

##
# Starts OAuth flow for an account connector.
#
# @overload start_o_auth(request, options = nil)
# Pass arguments to `start_o_auth` via a request object, either of type
# {::Google::Cloud::DeveloperConnect::V1::StartOAuthRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::DeveloperConnect::V1::StartOAuthRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload start_o_auth(account_connector: nil)
# Pass arguments to `start_o_auth` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param account_connector [::String]
# Required. The resource name of the AccountConnector in the format
# `projects/*/locations/*/accountConnectors/*`.
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Google::Cloud::DeveloperConnect::V1::StartOAuthResponse]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
# @return [::Google::Cloud::DeveloperConnect::V1::StartOAuthResponse]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
# @example Basic example
# require "google/cloud/developer_connect/v1"
#
# # Create a client object. The client can be reused for multiple calls.
# client = Google::Cloud::DeveloperConnect::V1::DeveloperConnect::Client.new
#
# # Create a request. To set request fields, pass in keyword arguments.
# request = Google::Cloud::DeveloperConnect::V1::StartOAuthRequest.new
#
# # Call the start_o_auth method.
# result = client.start_o_auth request
#
# # The returned object is of type Google::Cloud::DeveloperConnect::V1::StartOAuthResponse.
# p result
#
def start_o_auth request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?

request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DeveloperConnect::V1::StartOAuthRequest

# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

# Customize the options with defaults
metadata = @config.rpcs.start_o_auth.metadata.to_h

# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::DeveloperConnect::V1::VERSION
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

header_params = {}
if request.account_connector
header_params["account_connector"] = request.account_connector
end

request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header

options.apply_defaults timeout: @config.rpcs.start_o_auth.timeout,
metadata: metadata,
retry_policy: @config.rpcs.start_o_auth.retry_policy

options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy

@developer_connect_stub.call_rpc :start_o_auth, request, options: options do |response, operation|
yield response, operation if block_given?
end
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end

##
# Finishes OAuth flow for an account connector.
#
# @overload finish_o_auth(request, options = nil)
# Pass arguments to `finish_o_auth` via a request object, either of type
# {::Google::Cloud::DeveloperConnect::V1::FinishOAuthRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::DeveloperConnect::V1::FinishOAuthRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload finish_o_auth(oauth_params: nil, google_oauth_params: nil, account_connector: nil)
# Pass arguments to `finish_o_auth` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param oauth_params [::Google::Cloud::DeveloperConnect::V1::FinishOAuthRequest::OAuthParams, ::Hash]
# The params returned by non-Google OAuth 2.0 flow redirect.
#
# Note: The following parameters are mutually exclusive: `oauth_params`, `google_oauth_params`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
# @param google_oauth_params [::Google::Cloud::DeveloperConnect::V1::FinishOAuthRequest::GoogleOAuthParams, ::Hash]
# The params returned by Google OAuth flow redirects.
#
# Note: The following parameters are mutually exclusive: `google_oauth_params`, `oauth_params`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
# @param account_connector [::String]
# Required. The resource name of the AccountConnector in the format
# `projects/*/locations/*/accountConnectors/*`.
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Google::Cloud::DeveloperConnect::V1::FinishOAuthResponse]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
# @return [::Google::Cloud::DeveloperConnect::V1::FinishOAuthResponse]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
# @example Basic example
# require "google/cloud/developer_connect/v1"
#
# # Create a client object. The client can be reused for multiple calls.
# client = Google::Cloud::DeveloperConnect::V1::DeveloperConnect::Client.new
#
# # Create a request. To set request fields, pass in keyword arguments.
# request = Google::Cloud::DeveloperConnect::V1::FinishOAuthRequest.new
#
# # Call the finish_o_auth method.
# result = client.finish_o_auth request
#
# # The returned object is of type Google::Cloud::DeveloperConnect::V1::FinishOAuthResponse.
# p result
#
def finish_o_auth request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?

request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DeveloperConnect::V1::FinishOAuthRequest

# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

# Customize the options with defaults
metadata = @config.rpcs.finish_o_auth.metadata.to_h

# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::DeveloperConnect::V1::VERSION
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

header_params = {}
if request.account_connector
header_params["account_connector"] = request.account_connector
end

request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header

options.apply_defaults timeout: @config.rpcs.finish_o_auth.timeout,
metadata: metadata,
retry_policy: @config.rpcs.finish_o_auth.retry_policy

options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy

@developer_connect_stub.call_rpc :finish_o_auth, request, options: options do |response, operation|
yield response, operation if block_given?
end
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end

##
# Configuration class for the DeveloperConnect API.
#
Expand Down Expand Up @@ -3000,6 +3181,16 @@ class Rpcs
# @return [::Gapic::Config::Method]
#
attr_reader :delete_self
##
# RPC-specific configuration for `start_o_auth`
# @return [::Gapic::Config::Method]
#
attr_reader :start_o_auth
##
# RPC-specific configuration for `finish_o_auth`
# @return [::Gapic::Config::Method]
#
attr_reader :finish_o_auth

# @private
def initialize parent_rpcs = nil
Expand Down Expand Up @@ -3051,6 +3242,10 @@ def initialize parent_rpcs = nil
@fetch_self = ::Gapic::Config::Method.new fetch_self_config
delete_self_config = parent_rpcs.delete_self if parent_rpcs.respond_to? :delete_self
@delete_self = ::Gapic::Config::Method.new delete_self_config
start_o_auth_config = parent_rpcs.start_o_auth if parent_rpcs.respond_to? :start_o_auth
@start_o_auth = ::Gapic::Config::Method.new start_o_auth_config
finish_o_auth_config = parent_rpcs.finish_o_auth if parent_rpcs.respond_to? :finish_o_auth
@finish_o_auth = ::Gapic::Config::Method.new finish_o_auth_config

yield self if block_given?
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,25 @@ def git_repository_link_path project:, location:, connection:, git_repository_li
"projects/#{project}/locations/#{location}/connections/#{connection}/gitRepositoryLinks/#{git_repository_link}"
end

##
# Create a fully-qualified Instance resource string.
#
# The resource will be in the following format:
#
# `projects/{project}/locations/{location}/instances/{instance}`
#
# @param project [String]
# @param location [String]
# @param instance [String]
#
# @return [::String]
def instance_path project:, location:, instance:
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

"projects/#{project}/locations/#{location}/instances/#{instance}"
end

##
# Create a fully-qualified Location resource string.
#
Expand All @@ -124,20 +143,46 @@ def location_path project:, location:
##
# Create a fully-qualified SecretVersion resource string.
#
# The resource will be in the following format:
# @overload secret_version_path(project:, secret:, secret_version:)
# The resource will be in the following format:
#
# `projects/{project}/secrets/{secret}/versions/{secret_version}`
# `projects/{project}/secrets/{secret}/versions/{secret_version}`
#
# @param project [String]
# @param secret [String]
# @param secret_version [String]
# @param project [String]
# @param secret [String]
# @param secret_version [String]
#
# @overload secret_version_path(project:, location:, secret:, secret_version:)
# The resource will be in the following format:
#
# `projects/{project}/locations/{location}/secrets/{secret}/versions/{secret_version}`
#
# @param project [String]
# @param location [String]
# @param secret [String]
# @param secret_version [String]
#
# @return [::String]
def secret_version_path project:, secret:, secret_version:
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
raise ::ArgumentError, "secret cannot contain /" if secret.to_s.include? "/"

"projects/#{project}/secrets/#{secret}/versions/#{secret_version}"
def secret_version_path **args
resources = {
"project:secret:secret_version" => (proc do |project:, secret:, secret_version:|
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
raise ::ArgumentError, "secret cannot contain /" if secret.to_s.include? "/"

"projects/#{project}/secrets/#{secret}/versions/#{secret_version}"
end),
"location:project:secret:secret_version" => (proc do |project:, location:, secret:, secret_version:|
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
raise ::ArgumentError, "secret cannot contain /" if secret.to_s.include? "/"

"projects/#{project}/locations/#{location}/secrets/#{secret}/versions/#{secret_version}"
end)
}

resource = resources[args.keys.sort.join(":")]
raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
resource.call(**args)
end

##
Expand Down
Loading
Loading