From 8b52608d7460f515f022d7f01ecea40977ac8f67 Mon Sep 17 00:00:00 2001 From: Viacheslav Rostovtsev <58152857+viacheslav-rostovtsev@users.noreply.github.com> Date: Thu, 9 Feb 2023 00:45:38 +0000 Subject: [PATCH] feat: add a transport operation class in Rest (#911) --- .../lib/gapic/rest/transport_operation.rb | 38 +++++++++++++++++++ .../templates/cloud/gem/rubocop.erb | 3 ++ .../templates/default/gem/rubocop.erb | 3 ++ .../output/cloud/compute_small/.rubocop.yml | 3 ++ shared/output/cloud/grafeas_v1/.rubocop.yml | 3 ++ shared/output/cloud/language_v1/.rubocop.yml | 3 ++ .../cloud/language_v1beta1/.rubocop.yml | 3 ++ .../cloud/language_v1beta2/.rubocop.yml | 3 ++ shared/output/cloud/location/.rubocop.yml | 3 ++ .../cloud/secretmanager_v1beta1/.rubocop.yml | 3 ++ shared/output/cloud/speech_v1/.rubocop.yml | 3 ++ shared/output/cloud/vision_v1/.rubocop.yml | 3 ++ .../gapic/templates/garbage/.rubocop.yml | 3 ++ .../gapic/templates/showcase/.rubocop.yml | 3 ++ .../gapic/templates/testing/.rubocop.yml | 3 ++ 15 files changed, 80 insertions(+) create mode 100644 gapic-common/lib/gapic/rest/transport_operation.rb diff --git a/gapic-common/lib/gapic/rest/transport_operation.rb b/gapic-common/lib/gapic/rest/transport_operation.rb new file mode 100644 index 000000000..575ee7030 --- /dev/null +++ b/gapic-common/lib/gapic/rest/transport_operation.rb @@ -0,0 +1,38 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +module Gapic + module Rest + ## + # Surfaces information about the active call + # from the underlying transport library. + # + class TransportOperation + ## + # @private + # The underlying transport's library object that describes the active call, if any. + # It is not guaranteed to be any specific type, and its value is not guarateed to be stable. + # @return [::Object, nil, ::Faraday::Response] + attr_reader :underlying_op + + ## + # @private + # @param request [::Object, nil, ::Faraday::Response] + # The underlying transport's library object that describes the active call, if any. + def initialize underlying_op + @underlying_op = underlying_op + end + end + end +end diff --git a/gapic-generator-cloud/templates/cloud/gem/rubocop.erb b/gapic-generator-cloud/templates/cloud/gem/rubocop.erb index c95760353..1389d96e4 100644 --- a/gapic-generator-cloud/templates/cloud/gem/rubocop.erb +++ b/gapic-generator-cloud/templates/cloud/gem/rubocop.erb @@ -14,6 +14,9 @@ AllCops: Layout/LineLength: Enabled: false +Lint/Debugger: + Exclude: + - "snippets/**/*.rb" Metrics/AbcSize: Enabled: false Metrics/ClassLength: diff --git a/gapic-generator/templates/default/gem/rubocop.erb b/gapic-generator/templates/default/gem/rubocop.erb index 2a569cfb0..0b939c069 100644 --- a/gapic-generator/templates/default/gem/rubocop.erb +++ b/gapic-generator/templates/default/gem/rubocop.erb @@ -10,6 +10,9 @@ AllCops: Layout/LineLength: Enabled: false +Lint/Debugger: + Exclude: + - "snippets/**/*.rb" Metrics/AbcSize: Enabled: false Metrics/ClassLength: diff --git a/shared/output/cloud/compute_small/.rubocop.yml b/shared/output/cloud/compute_small/.rubocop.yml index c3ee529af..5ffd8a3a4 100644 --- a/shared/output/cloud/compute_small/.rubocop.yml +++ b/shared/output/cloud/compute_small/.rubocop.yml @@ -13,6 +13,9 @@ AllCops: Layout/LineLength: Enabled: false +Lint/Debugger: + Exclude: + - "snippets/**/*.rb" Metrics/AbcSize: Enabled: false Metrics/ClassLength: diff --git a/shared/output/cloud/grafeas_v1/.rubocop.yml b/shared/output/cloud/grafeas_v1/.rubocop.yml index 34342e2db..033cd4bca 100644 --- a/shared/output/cloud/grafeas_v1/.rubocop.yml +++ b/shared/output/cloud/grafeas_v1/.rubocop.yml @@ -13,6 +13,9 @@ AllCops: Layout/LineLength: Enabled: false +Lint/Debugger: + Exclude: + - "snippets/**/*.rb" Metrics/AbcSize: Enabled: false Metrics/ClassLength: diff --git a/shared/output/cloud/language_v1/.rubocop.yml b/shared/output/cloud/language_v1/.rubocop.yml index 77a6ecd01..b0b703140 100644 --- a/shared/output/cloud/language_v1/.rubocop.yml +++ b/shared/output/cloud/language_v1/.rubocop.yml @@ -13,6 +13,9 @@ AllCops: Layout/LineLength: Enabled: false +Lint/Debugger: + Exclude: + - "snippets/**/*.rb" Metrics/AbcSize: Enabled: false Metrics/ClassLength: diff --git a/shared/output/cloud/language_v1beta1/.rubocop.yml b/shared/output/cloud/language_v1beta1/.rubocop.yml index f003db43a..42e66fd7d 100644 --- a/shared/output/cloud/language_v1beta1/.rubocop.yml +++ b/shared/output/cloud/language_v1beta1/.rubocop.yml @@ -13,6 +13,9 @@ AllCops: Layout/LineLength: Enabled: false +Lint/Debugger: + Exclude: + - "snippets/**/*.rb" Metrics/AbcSize: Enabled: false Metrics/ClassLength: diff --git a/shared/output/cloud/language_v1beta2/.rubocop.yml b/shared/output/cloud/language_v1beta2/.rubocop.yml index 83e391712..1f2008918 100644 --- a/shared/output/cloud/language_v1beta2/.rubocop.yml +++ b/shared/output/cloud/language_v1beta2/.rubocop.yml @@ -13,6 +13,9 @@ AllCops: Layout/LineLength: Enabled: false +Lint/Debugger: + Exclude: + - "snippets/**/*.rb" Metrics/AbcSize: Enabled: false Metrics/ClassLength: diff --git a/shared/output/cloud/location/.rubocop.yml b/shared/output/cloud/location/.rubocop.yml index 69d68e58f..e11b04d9c 100644 --- a/shared/output/cloud/location/.rubocop.yml +++ b/shared/output/cloud/location/.rubocop.yml @@ -13,6 +13,9 @@ AllCops: Layout/LineLength: Enabled: false +Lint/Debugger: + Exclude: + - "snippets/**/*.rb" Metrics/AbcSize: Enabled: false Metrics/ClassLength: diff --git a/shared/output/cloud/secretmanager_v1beta1/.rubocop.yml b/shared/output/cloud/secretmanager_v1beta1/.rubocop.yml index 7f3f3a64f..1f7fe7f47 100644 --- a/shared/output/cloud/secretmanager_v1beta1/.rubocop.yml +++ b/shared/output/cloud/secretmanager_v1beta1/.rubocop.yml @@ -13,6 +13,9 @@ AllCops: Layout/LineLength: Enabled: false +Lint/Debugger: + Exclude: + - "snippets/**/*.rb" Metrics/AbcSize: Enabled: false Metrics/ClassLength: diff --git a/shared/output/cloud/speech_v1/.rubocop.yml b/shared/output/cloud/speech_v1/.rubocop.yml index 3c22305c5..516bf8847 100644 --- a/shared/output/cloud/speech_v1/.rubocop.yml +++ b/shared/output/cloud/speech_v1/.rubocop.yml @@ -13,6 +13,9 @@ AllCops: Layout/LineLength: Enabled: false +Lint/Debugger: + Exclude: + - "snippets/**/*.rb" Metrics/AbcSize: Enabled: false Metrics/ClassLength: diff --git a/shared/output/cloud/vision_v1/.rubocop.yml b/shared/output/cloud/vision_v1/.rubocop.yml index 94d0134a2..234014f3a 100644 --- a/shared/output/cloud/vision_v1/.rubocop.yml +++ b/shared/output/cloud/vision_v1/.rubocop.yml @@ -13,6 +13,9 @@ AllCops: Layout/LineLength: Enabled: false +Lint/Debugger: + Exclude: + - "snippets/**/*.rb" Metrics/AbcSize: Enabled: false Metrics/ClassLength: diff --git a/shared/output/gapic/templates/garbage/.rubocop.yml b/shared/output/gapic/templates/garbage/.rubocop.yml index 7d7a187aa..174b55e05 100644 --- a/shared/output/gapic/templates/garbage/.rubocop.yml +++ b/shared/output/gapic/templates/garbage/.rubocop.yml @@ -9,6 +9,9 @@ AllCops: Layout/LineLength: Enabled: false +Lint/Debugger: + Exclude: + - "snippets/**/*.rb" Metrics/AbcSize: Enabled: false Metrics/ClassLength: diff --git a/shared/output/gapic/templates/showcase/.rubocop.yml b/shared/output/gapic/templates/showcase/.rubocop.yml index 6b7e133f0..1939735b8 100644 --- a/shared/output/gapic/templates/showcase/.rubocop.yml +++ b/shared/output/gapic/templates/showcase/.rubocop.yml @@ -9,6 +9,9 @@ AllCops: Layout/LineLength: Enabled: false +Lint/Debugger: + Exclude: + - "snippets/**/*.rb" Metrics/AbcSize: Enabled: false Metrics/ClassLength: diff --git a/shared/output/gapic/templates/testing/.rubocop.yml b/shared/output/gapic/templates/testing/.rubocop.yml index 97fc0596b..628c2cf45 100644 --- a/shared/output/gapic/templates/testing/.rubocop.yml +++ b/shared/output/gapic/templates/testing/.rubocop.yml @@ -9,6 +9,9 @@ AllCops: Layout/LineLength: Enabled: false +Lint/Debugger: + Exclude: + - "snippets/**/*.rb" Metrics/AbcSize: Enabled: false Metrics/ClassLength: