Skip to content

Commit 165e30b

Browse files
fix!: An existing service CapacityPlanningService is removed (#31587)
fix!: Changed field behavior for an existing field `cloud_resource_type` in message `.google.cloud.capacityplanner.v1beta.QueryUsageHistoriesRequest` fix!: Changed field behavior for an existing field `cloud_resource_type` in message `.google.cloud.capacityplanner.v1beta.QueryForecastsRequest` fix!: Changed field behavior for an existing field `cloud_resource_type` in message `.google.cloud.capacityplanner.v1beta.QueryReservationsRequest` fix!: Changed field behavior for an existing field `reservation_type` in message `.google.cloud.capacityplanner.v1beta.QueryReservationsRequest` fix!: Changed field behavior for an existing field `reservation_data_level` in message `.google.cloud.capacityplanner.v1beta.QueryReservationsRequest` docs: A comment for field `cloud_resource_type` in message `.google.cloud.capacityplanner.v1beta.QueryUsageHistoriesRequest` is changed docs: A comment for field `cloud_resource_type` in message `.google.cloud.capacityplanner.v1beta.QueryForecastsRequest` is changed docs: A comment for field `cloud_resource_type` in message `.google.cloud.capacityplanner.v1beta.QueryReservationsRequest` is changed docs: A comment for field `reservation_type` in message `.google.cloud.capacityplanner.v1beta.QueryReservationsRequest` is changed docs: A comment for field `reservation_data_level` in message `.google.cloud.capacityplanner.v1beta.QueryReservationsRequest` is changed PiperOrigin-RevId: 816537824 Source-Link: googleapis/googleapis@2954ae6 Source-Link: googleapis/googleapis-gen@cf5779f Copy-Tag: eyJwIjoiZ29vZ2xlLWNsb3VkLWNhcGFjaXR5X3BsYW5uZXIvLk93bEJvdC55YW1sIiwiaCI6ImNmNTc3OWY2N2Q4NTM0ZjhhY2ZiZTZiODhhYjMwY2Q5YWI2MDAwMTkifQ== * 🦉 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 f48b7c1 commit 165e30b

5 files changed

Lines changed: 8 additions & 101 deletions

File tree

google-cloud-capacity_planner/AUTHENTICATION.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ To configure a credentials file for an individual client initialization:
5656
```ruby
5757
require "google/cloud/capacity_planner"
5858

59-
client = Google::Cloud::CapacityPlanner.capacity_planning_service do |config|
59+
client = Google::Cloud::CapacityPlanner.usage_service do |config|
6060
config.credentials = "path/to/credentialfile.json"
6161
end
6262
```
@@ -70,7 +70,7 @@ Google::Cloud::CapacityPlanner.configure do |config|
7070
config.credentials = "path/to/credentialfile.json"
7171
end
7272

73-
client = Google::Cloud::CapacityPlanner.capacity_planning_service
73+
client = Google::Cloud::CapacityPlanner.usage_service
7474
```
7575

7676
### Environment Variables
@@ -100,7 +100,7 @@ require "google/cloud/capacity_planner"
100100

101101
ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json"
102102

103-
client = Google::Cloud::CapacityPlanner.capacity_planning_service
103+
client = Google::Cloud::CapacityPlanner.usage_service
104104
```
105105

106106
### Local ADC file

google-cloud-capacity_planner/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ In order to use this library, you first need to go through the following steps:
3636
```ruby
3737
require "google/cloud/capacity_planner"
3838

39-
client = Google::Cloud::CapacityPlanner.capacity_planning_service
40-
request = ::Google::Cloud::CapacityPlanner::V1beta::GetCapacityPlanRequest.new # (request fields as keyword arguments...)
41-
response = client.get_capacity_plan request
39+
client = Google::Cloud::CapacityPlanner.usage_service
40+
request = ::Google::Cloud::CapacityPlanner::V1beta::QueryUsageHistoriesRequest.new # (request fields as keyword arguments...)
41+
response = client.query_usage_histories request
4242
```
4343

4444
## Debug Logging

google-cloud-capacity_planner/Rakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ task :acceptance, :project, :keyfile do |t, args|
5757
if project.nil? || keyfile.nil?
5858
fail "You must provide a project and keyfile. e.g. rake acceptance[test123, /path/to/keyfile.json] or GOOGLE_CLOUD_TEST_PROJECT=test123 GOOGLE_CLOUD_TEST_KEYFILE=/path/to/keyfile.json rake acceptance"
5959
end
60-
require "google/cloud/capacity_planner/v1beta/capacity_planning_service/credentials"
61-
::Google::Cloud::CapacityPlanner::V1beta::CapacityPlanningService::Credentials.env_vars.each do |path|
60+
require "google/cloud/capacity_planner/v1beta/usage_service/credentials"
61+
::Google::Cloud::CapacityPlanner::V1beta::UsageService::Credentials.env_vars.each do |path|
6262
ENV[path] = nil
6363
end
6464
ENV["GOOGLE_CLOUD_PROJECT"] = project

google-cloud-capacity_planner/lib/google/cloud/capacity_planner.rb

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -45,78 +45,6 @@
4545
module Google
4646
module Cloud
4747
module CapacityPlanner
48-
##
49-
# Create a new client object for CapacityPlanningService.
50-
#
51-
# By default, this returns an instance of
52-
# [Google::Cloud::CapacityPlanner::V1beta::CapacityPlanningService::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-CapacityPlanningService-Client)
53-
# for a gRPC client for version V1beta of the API.
54-
# However, you can specify a different API version by passing it in the
55-
# `version` parameter. If the CapacityPlanningService service is
56-
# supported by that API version, and the corresponding gem is available, the
57-
# appropriate versioned client will be returned.
58-
# You can also specify a different transport by passing `:rest` or `:grpc` in
59-
# the `transport` parameter.
60-
#
61-
# Raises an exception if the currently installed versioned client gem for the
62-
# given API version does not support the given transport of the CapacityPlanningService service.
63-
# You can determine whether the method will succeed by calling
64-
# {Google::Cloud::CapacityPlanner.capacity_planning_service_available?}.
65-
#
66-
# ## About CapacityPlanningService
67-
#
68-
# This API allows users to plan for GCP capacity associated with their
69-
# projects. Users can request additional capacity for GCP resources such as
70-
# VMs, PDs, etc.
71-
#
72-
# @param version [::String, ::Symbol] The API version to connect to. Optional.
73-
# Defaults to `:v1beta`.
74-
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
75-
# @return [::Object] A client object for the specified version.
76-
#
77-
def self.capacity_planning_service version: :v1beta, transport: :grpc, &block
78-
require "google/cloud/capacity_planner/#{version.to_s.downcase}"
79-
80-
package_name = Google::Cloud::CapacityPlanner
81-
.constants
82-
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
83-
.first
84-
service_module = Google::Cloud::CapacityPlanner.const_get(package_name).const_get(:CapacityPlanningService)
85-
service_module = service_module.const_get(:Rest) if transport == :rest
86-
service_module.const_get(:Client).new(&block)
87-
end
88-
89-
##
90-
# Determines whether the CapacityPlanningService service is supported by the current client.
91-
# If true, you can retrieve a client object by calling {Google::Cloud::CapacityPlanner.capacity_planning_service}.
92-
# If false, that method will raise an exception. This could happen if the given
93-
# API version does not exist or does not support the CapacityPlanningService service,
94-
# or if the versioned client gem needs an update to support the CapacityPlanningService service.
95-
#
96-
# @param version [::String, ::Symbol] The API version to connect to. Optional.
97-
# Defaults to `:v1beta`.
98-
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
99-
# @return [boolean] Whether the service is available.
100-
#
101-
def self.capacity_planning_service_available? version: :v1beta, transport: :grpc
102-
require "google/cloud/capacity_planner/#{version.to_s.downcase}"
103-
package_name = Google::Cloud::CapacityPlanner
104-
.constants
105-
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
106-
.first
107-
return false unless package_name
108-
service_module = Google::Cloud::CapacityPlanner.const_get package_name
109-
return false unless service_module.const_defined? :CapacityPlanningService
110-
service_module = service_module.const_get :CapacityPlanningService
111-
if transport == :rest
112-
return false unless service_module.const_defined? :Rest
113-
service_module = service_module.const_get :Rest
114-
end
115-
service_module.const_defined? :Client
116-
rescue ::LoadError
117-
false
118-
end
119-
12048
##
12149
# Create a new client object for UsageService.
12250
#

google-cloud-capacity_planner/test/google/cloud/capacity_planner/client_test.rb

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,6 @@ def logger
4141
end
4242
end
4343

44-
def test_capacity_planning_service_grpc
45-
skip unless Google::Cloud::CapacityPlanner.capacity_planning_service_available? transport: :grpc
46-
Gapic::ServiceStub.stub :new, DummyStub.new do
47-
grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
48-
client = Google::Cloud::CapacityPlanner.capacity_planning_service transport: :grpc do |config|
49-
config.credentials = grpc_channel
50-
end
51-
assert_kind_of Google::Cloud::CapacityPlanner::V1beta::CapacityPlanningService::Client, client
52-
end
53-
end
54-
55-
def test_capacity_planning_service_rest
56-
skip unless Google::Cloud::CapacityPlanner.capacity_planning_service_available? transport: :rest
57-
Gapic::Rest::ClientStub.stub :new, DummyStub.new do
58-
client = Google::Cloud::CapacityPlanner.capacity_planning_service transport: :rest do |config|
59-
config.credentials = :dummy_credentials
60-
end
61-
assert_kind_of Google::Cloud::CapacityPlanner::V1beta::CapacityPlanningService::Rest::Client, client
62-
end
63-
end
64-
6544
def test_usage_service_grpc
6645
skip unless Google::Cloud::CapacityPlanner.usage_service_available? transport: :grpc
6746
Gapic::ServiceStub.stub :new, DummyStub.new do

0 commit comments

Comments
 (0)