Skip to content

Commit c45fac1

Browse files
feat: Added RequestOrderDateChange RPC - allows Customers to request date changes (#30918)
* feat: Added RequestOrderDateChange RPC - allows Customers to request date changes feat: Added CancelOrder RPC - allows Customers to request cancellation feat: Exposed Order-level output-only fields for transparency docs: `fulfillment_time` marked as deprecated PiperOrigin-RevId: 800209985 Source-Link: googleapis/googleapis@2b1af6f Source-Link: googleapis/googleapis-gen@ed891dd Copy-Tag: eyJwIjoiZ29vZ2xlLWNsb3VkLWdkY19oYXJkd2FyZV9tYW5hZ2VtZW50LXYxYWxwaGEvLk93bEJvdC55YW1sIiwiaCI6ImVkODkxZGRjZGY3ZjE5MzUzNjMyNDg4ZDk3MjVhNTgzYmRiNmM2YjkifQ== * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 2d95e3b commit c45fac1

15 files changed

Lines changed: 1082 additions & 7 deletions

File tree

google-cloud-gdc_hardware_management-v1alpha/.owlbot-manifest.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"proto_docs/google/type/postal_address.rb",
5252
"proto_docs/google/type/timeofday.rb",
5353
"snippets/Gemfile",
54+
"snippets/gdc_hardware_management/cancel_order.rb",
5455
"snippets/gdc_hardware_management/create_comment.rb",
5556
"snippets/gdc_hardware_management/create_hardware.rb",
5657
"snippets/gdc_hardware_management/create_hardware_group.rb",
@@ -79,6 +80,7 @@
7980
"snippets/gdc_hardware_management/list_skus.rb",
8081
"snippets/gdc_hardware_management/list_zones.rb",
8182
"snippets/gdc_hardware_management/record_action_on_comment.rb",
83+
"snippets/gdc_hardware_management/request_order_date_change.rb",
8284
"snippets/gdc_hardware_management/signal_zone_state.rb",
8385
"snippets/gdc_hardware_management/submit_order.rb",
8486
"snippets/gdc_hardware_management/update_hardware.rb",

google-cloud-gdc_hardware_management-v1alpha/gapic_metadata.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
"submit_order"
4141
]
4242
},
43+
"CancelOrder": {
44+
"methods": [
45+
"cancel_order"
46+
]
47+
},
4348
"ListSites": {
4449
"methods": [
4550
"list_sites"
@@ -184,6 +189,11 @@
184189
"methods": [
185190
"signal_zone_state"
186191
]
192+
},
193+
"RequestOrderDateChange": {
194+
"methods": [
195+
"request_order_date_change"
196+
]
187197
}
188198
}
189199
}

google-cloud-gdc_hardware_management-v1alpha/lib/google/cloud/gdc_hardware_management/v1alpha/gdc_hardware_management/client.rb

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ def self.configure
9898
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
9999
}
100100

101+
default_config.rpcs.cancel_order.timeout = 60.0
102+
default_config.rpcs.cancel_order.retry_policy = {
103+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
104+
}
105+
101106
default_config.rpcs.list_sites.timeout = 60.0
102107
default_config.rpcs.list_sites.retry_policy = {
103108
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
@@ -965,6 +970,104 @@ def submit_order request, options = nil
965970
raise ::Google::Cloud::Error.from_error(e)
966971
end
967972

973+
##
974+
# Cancels an order.
975+
#
976+
# @overload cancel_order(request, options = nil)
977+
# Pass arguments to `cancel_order` via a request object, either of type
978+
# {::Google::Cloud::GDCHardwareManagement::V1alpha::CancelOrderRequest} or an equivalent Hash.
979+
#
980+
# @param request [::Google::Cloud::GDCHardwareManagement::V1alpha::CancelOrderRequest, ::Hash]
981+
# A request object representing the call parameters. Required. To specify no
982+
# parameters, or to keep all the default parameter values, pass an empty Hash.
983+
# @param options [::Gapic::CallOptions, ::Hash]
984+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
985+
#
986+
# @overload cancel_order(name: nil, request_id: nil)
987+
# Pass arguments to `cancel_order` via keyword arguments. Note that at
988+
# least one keyword argument is required. To specify no parameters, or to keep all
989+
# the default parameter values, pass an empty Hash as a request object (see above).
990+
#
991+
# @param name [::String]
992+
# Required. The name of the order.
993+
# Format: `projects/{project}/locations/{location}/orders/{order}`
994+
# @param request_id [::String]
995+
# Optional. An optional unique identifier for this request. See
996+
# [AIP-155](https://google.aip.dev/155).
997+
#
998+
# @yield [response, operation] Access the result along with the RPC operation
999+
# @yieldparam response [::Gapic::Operation]
1000+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
1001+
#
1002+
# @return [::Gapic::Operation]
1003+
#
1004+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
1005+
#
1006+
# @example Basic example
1007+
# require "google/cloud/gdc_hardware_management/v1alpha"
1008+
#
1009+
# # Create a client object. The client can be reused for multiple calls.
1010+
# client = Google::Cloud::GDCHardwareManagement::V1alpha::GDCHardwareManagement::Client.new
1011+
#
1012+
# # Create a request. To set request fields, pass in keyword arguments.
1013+
# request = Google::Cloud::GDCHardwareManagement::V1alpha::CancelOrderRequest.new
1014+
#
1015+
# # Call the cancel_order method.
1016+
# result = client.cancel_order request
1017+
#
1018+
# # The returned object is of type Gapic::Operation. You can use it to
1019+
# # check the status of an operation, cancel it, or wait for results.
1020+
# # Here is how to wait for a response.
1021+
# result.wait_until_done! timeout: 60
1022+
# if result.response?
1023+
# p result.response
1024+
# else
1025+
# puts "No response received."
1026+
# end
1027+
#
1028+
def cancel_order request, options = nil
1029+
raise ::ArgumentError, "request must be provided" if request.nil?
1030+
1031+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GDCHardwareManagement::V1alpha::CancelOrderRequest
1032+
1033+
# Converts hash and nil to an options object
1034+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1035+
1036+
# Customize the options with defaults
1037+
metadata = @config.rpcs.cancel_order.metadata.to_h
1038+
1039+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1040+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1041+
lib_name: @config.lib_name, lib_version: @config.lib_version,
1042+
gapic_version: ::Google::Cloud::GDCHardwareManagement::V1alpha::VERSION
1043+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1044+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1045+
1046+
header_params = {}
1047+
if request.name
1048+
header_params["name"] = request.name
1049+
end
1050+
1051+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1052+
metadata[:"x-goog-request-params"] ||= request_params_header
1053+
1054+
options.apply_defaults timeout: @config.rpcs.cancel_order.timeout,
1055+
metadata: metadata,
1056+
retry_policy: @config.rpcs.cancel_order.retry_policy
1057+
1058+
options.apply_defaults timeout: @config.timeout,
1059+
metadata: @config.metadata,
1060+
retry_policy: @config.retry_policy
1061+
1062+
@gdc_hardware_management_stub.call_rpc :cancel_order, request, options: options do |response, operation|
1063+
response = ::Gapic::Operation.new response, @operations_client, options: options
1064+
yield response, operation if block_given?
1065+
throw :response, response
1066+
end
1067+
rescue ::GRPC::BadStatus => e
1068+
raise ::Google::Cloud::Error.from_error(e)
1069+
end
1070+
9681071
##
9691072
# Lists sites in a given project and location.
9701073
#
@@ -3840,6 +3943,104 @@ def signal_zone_state request, options = nil
38403943
raise ::Google::Cloud::Error.from_error(e)
38413944
end
38423945

3946+
##
3947+
# Updates the requested date change of a single Order.
3948+
#
3949+
# @overload request_order_date_change(request, options = nil)
3950+
# Pass arguments to `request_order_date_change` via a request object, either of type
3951+
# {::Google::Cloud::GDCHardwareManagement::V1alpha::RequestOrderDateChangeRequest} or an equivalent Hash.
3952+
#
3953+
# @param request [::Google::Cloud::GDCHardwareManagement::V1alpha::RequestOrderDateChangeRequest, ::Hash]
3954+
# A request object representing the call parameters. Required. To specify no
3955+
# parameters, or to keep all the default parameter values, pass an empty Hash.
3956+
# @param options [::Gapic::CallOptions, ::Hash]
3957+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
3958+
#
3959+
# @overload request_order_date_change(name: nil, requested_date: nil)
3960+
# Pass arguments to `request_order_date_change` via keyword arguments. Note that at
3961+
# least one keyword argument is required. To specify no parameters, or to keep all
3962+
# the default parameter values, pass an empty Hash as a request object (see above).
3963+
#
3964+
# @param name [::String]
3965+
# Required. The name of the order to update.
3966+
# Format: projects/\\{project}/locations/\\{location}/orders/\\{order}
3967+
# @param requested_date [::Google::Type::Date, ::Hash]
3968+
# Required. The date to which the customer or Google wants to set the
3969+
# scheduled installation date.
3970+
#
3971+
# @yield [response, operation] Access the result along with the RPC operation
3972+
# @yieldparam response [::Gapic::Operation]
3973+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
3974+
#
3975+
# @return [::Gapic::Operation]
3976+
#
3977+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
3978+
#
3979+
# @example Basic example
3980+
# require "google/cloud/gdc_hardware_management/v1alpha"
3981+
#
3982+
# # Create a client object. The client can be reused for multiple calls.
3983+
# client = Google::Cloud::GDCHardwareManagement::V1alpha::GDCHardwareManagement::Client.new
3984+
#
3985+
# # Create a request. To set request fields, pass in keyword arguments.
3986+
# request = Google::Cloud::GDCHardwareManagement::V1alpha::RequestOrderDateChangeRequest.new
3987+
#
3988+
# # Call the request_order_date_change method.
3989+
# result = client.request_order_date_change request
3990+
#
3991+
# # The returned object is of type Gapic::Operation. You can use it to
3992+
# # check the status of an operation, cancel it, or wait for results.
3993+
# # Here is how to wait for a response.
3994+
# result.wait_until_done! timeout: 60
3995+
# if result.response?
3996+
# p result.response
3997+
# else
3998+
# puts "No response received."
3999+
# end
4000+
#
4001+
def request_order_date_change request, options = nil
4002+
raise ::ArgumentError, "request must be provided" if request.nil?
4003+
4004+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GDCHardwareManagement::V1alpha::RequestOrderDateChangeRequest
4005+
4006+
# Converts hash and nil to an options object
4007+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
4008+
4009+
# Customize the options with defaults
4010+
metadata = @config.rpcs.request_order_date_change.metadata.to_h
4011+
4012+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
4013+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
4014+
lib_name: @config.lib_name, lib_version: @config.lib_version,
4015+
gapic_version: ::Google::Cloud::GDCHardwareManagement::V1alpha::VERSION
4016+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
4017+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
4018+
4019+
header_params = {}
4020+
if request.name
4021+
header_params["name"] = request.name
4022+
end
4023+
4024+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
4025+
metadata[:"x-goog-request-params"] ||= request_params_header
4026+
4027+
options.apply_defaults timeout: @config.rpcs.request_order_date_change.timeout,
4028+
metadata: metadata,
4029+
retry_policy: @config.rpcs.request_order_date_change.retry_policy
4030+
4031+
options.apply_defaults timeout: @config.timeout,
4032+
metadata: @config.metadata,
4033+
retry_policy: @config.retry_policy
4034+
4035+
@gdc_hardware_management_stub.call_rpc :request_order_date_change, request, options: options do |response, operation|
4036+
response = ::Gapic::Operation.new response, @operations_client, options: options
4037+
yield response, operation if block_given?
4038+
throw :response, response
4039+
end
4040+
rescue ::GRPC::BadStatus => e
4041+
raise ::Google::Cloud::Error.from_error(e)
4042+
end
4043+
38434044
##
38444045
# Configuration class for the GDCHardwareManagement API.
38454046
#
@@ -4037,6 +4238,11 @@ class Rpcs
40374238
#
40384239
attr_reader :submit_order
40394240
##
4241+
# RPC-specific configuration for `cancel_order`
4242+
# @return [::Gapic::Config::Method]
4243+
#
4244+
attr_reader :cancel_order
4245+
##
40404246
# RPC-specific configuration for `list_sites`
40414247
# @return [::Gapic::Config::Method]
40424248
#
@@ -4181,6 +4387,11 @@ class Rpcs
41814387
# @return [::Gapic::Config::Method]
41824388
#
41834389
attr_reader :signal_zone_state
4390+
##
4391+
# RPC-specific configuration for `request_order_date_change`
4392+
# @return [::Gapic::Config::Method]
4393+
#
4394+
attr_reader :request_order_date_change
41844395

41854396
# @private
41864397
def initialize parent_rpcs = nil
@@ -4196,6 +4407,8 @@ def initialize parent_rpcs = nil
41964407
@delete_order = ::Gapic::Config::Method.new delete_order_config
41974408
submit_order_config = parent_rpcs.submit_order if parent_rpcs.respond_to? :submit_order
41984409
@submit_order = ::Gapic::Config::Method.new submit_order_config
4410+
cancel_order_config = parent_rpcs.cancel_order if parent_rpcs.respond_to? :cancel_order
4411+
@cancel_order = ::Gapic::Config::Method.new cancel_order_config
41994412
list_sites_config = parent_rpcs.list_sites if parent_rpcs.respond_to? :list_sites
42004413
@list_sites = ::Gapic::Config::Method.new list_sites_config
42014414
get_site_config = parent_rpcs.get_site if parent_rpcs.respond_to? :get_site
@@ -4254,6 +4467,8 @@ def initialize parent_rpcs = nil
42544467
@delete_zone = ::Gapic::Config::Method.new delete_zone_config
42554468
signal_zone_state_config = parent_rpcs.signal_zone_state if parent_rpcs.respond_to? :signal_zone_state
42564469
@signal_zone_state = ::Gapic::Config::Method.new signal_zone_state_config
4470+
request_order_date_change_config = parent_rpcs.request_order_date_change if parent_rpcs.respond_to? :request_order_date_change
4471+
@request_order_date_change = ::Gapic::Config::Method.new request_order_date_change_config
42574472

42584473
yield self if block_given?
42594474
end

0 commit comments

Comments
 (0)