google-cloud-capacity_planner 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +3 -3
- data/README.md +3 -3
- data/lib/google/cloud/capacity_planner/version.rb +1 -1
- data/lib/google/cloud/capacity_planner.rb +0 -72
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a101d9035e6f3faca0334e2c00029ddbfa836cd69a082a5717ae99c908afed21
|
4
|
+
data.tar.gz: 4691b3f0b913d2fb4c8aa3ac3487302920a5c79195417e8f4850ffa65806ebfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53b4bb4c522e247dccb48d7d5dd27642a8ac61ec37abbe62ef3c1b5338f84c31f0e288e365a1200ebd642e38a5ee626a2a8bd996329fee878bff27f2d407c62d
|
7
|
+
data.tar.gz: c87042e5bb3c59667025d2e049757fc828e8797dfa99255fd6773204576c32117bfdf9ab52049fff8febbc88c9b42488fc0eac3a67d9e36dac2301e121ea99bc
|
data/AUTHENTICATION.md
CHANGED
@@ -56,7 +56,7 @@ To configure a credentials file for an individual client initialization:
|
|
56
56
|
```ruby
|
57
57
|
require "google/cloud/capacity_planner"
|
58
58
|
|
59
|
-
client = Google::Cloud::CapacityPlanner.
|
59
|
+
client = Google::Cloud::CapacityPlanner.usage_service do |config|
|
60
60
|
config.credentials = "path/to/credentialfile.json"
|
61
61
|
end
|
62
62
|
```
|
@@ -70,7 +70,7 @@ Google::Cloud::CapacityPlanner.configure do |config|
|
|
70
70
|
config.credentials = "path/to/credentialfile.json"
|
71
71
|
end
|
72
72
|
|
73
|
-
client = Google::Cloud::CapacityPlanner.
|
73
|
+
client = Google::Cloud::CapacityPlanner.usage_service
|
74
74
|
```
|
75
75
|
|
76
76
|
### Environment Variables
|
@@ -100,7 +100,7 @@ require "google/cloud/capacity_planner"
|
|
100
100
|
|
101
101
|
ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json"
|
102
102
|
|
103
|
-
client = Google::Cloud::CapacityPlanner.
|
103
|
+
client = Google::Cloud::CapacityPlanner.usage_service
|
104
104
|
```
|
105
105
|
|
106
106
|
### Local ADC file
|
data/README.md
CHANGED
@@ -36,9 +36,9 @@ In order to use this library, you first need to go through the following steps:
|
|
36
36
|
```ruby
|
37
37
|
require "google/cloud/capacity_planner"
|
38
38
|
|
39
|
-
client = Google::Cloud::CapacityPlanner.
|
40
|
-
request = ::Google::Cloud::CapacityPlanner::V1beta::
|
41
|
-
response = client.
|
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
|
42
42
|
```
|
43
43
|
|
44
44
|
## Debug Logging
|
@@ -45,78 +45,6 @@ end
|
|
45
45
|
module Google
|
46
46
|
module Cloud
|
47
47
|
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
|
-
|
120
48
|
##
|
121
49
|
# Create a new client object for UsageService.
|
122
50
|
#
|