Module: Gapic::Model::Method
- Defined in:
- lib/gapic/model/method/lro.rb,
lib/gapic/model/method/routing.rb,
lib/gapic/model/method/http_annotation.rb
Overview
Method-level models
Defined Under Namespace
Classes: AipLro, HttpAnnotation, NoLro, NonStandardLro, Routing
Class Method Summary collapse
-
.parse_lro(method, api) ⇒ Object
Inspects the method and returns it's long-running operation model.
Class Method Details
.parse_lro(method, api) ⇒ Object
Inspects the method and returns it's long-running operation model
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/gapic/model/method/lro.rb', line 131 def parse_lro method, api is_aip_lro = method.output.full_name == "google.longrunning.Operation" return AipLro.instance if is_aip_lro # If a method is annotated with operation_service, this is a nonstandard LRO consumer method is_nonstandard_lro = !method.operation_service.nil? && !method.operation_service.empty? if is_nonstandard_lro # LRO service name is given plain, so it has to be in the same package as this method's service service_full_name = (method.address[0..-3] << method.operation_service).join "." ops_service_lro = api.nonstandard_lro_model_for service_full_name unless ops_service_lro.nonstandard_lro? error_text = "A service #{service_full_name} specified as a nonstandard LRO service for " \ "the method #{method.full_name} was not found." raise ModelError, error_text end unless method.output.full_name == ops_service_lro.lro_object_full_name error_text = "A service #{service_full_name} specified as a nonstandard LRO service for " \ "the method #{method.full_name} has a different LRO object " \ "(#{ops_service_lro.lro_object_full_name}) from the method's return type " \ "(#{method.output.full_name})." raise ModelError, error_text end return NonStandardLro.new method, service_full_name end NoLro.instance end |