Method: Google::Cloud::VisionAI::V1::AppPlatform::Rest::Client#create_draft
- Defined in:
- lib/google/cloud/vision_ai/v1/app_platform/rest/client.rb
#create_draft(request, options = nil) ⇒ ::Gapic::Operation #create_draft(parent: nil, draft_id: nil, draft: nil, request_id: nil) ⇒ ::Gapic::Operation
Creates a new Draft in a given project and location.
1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 |
# File 'lib/google/cloud/vision_ai/v1/app_platform/rest/client.rb', line 1981 def create_draft request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::CreateDraftRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.create_draft..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::VisionAI::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.create_draft.timeout, metadata: , retry_policy: @config.rpcs.create_draft.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @app_platform_stub.create_draft request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |