Skip to content

Commit f9472da

Browse files
feat: [Memorystore for Valkey] Add support for Flexible CA feature (#33661)
1 parent ffe1c10 commit f9472da

File tree

12 files changed

+425
-1
lines changed

12 files changed

+425
-1
lines changed

google-cloud-memorystore-v1beta/.owlbot-manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"snippets/memorystore/delete_instance.rb",
4747
"snippets/memorystore/get_certificate_authority.rb",
4848
"snippets/memorystore/get_instance.rb",
49+
"snippets/memorystore/get_shared_regional_certificate_authority.rb",
4950
"snippets/memorystore/list_instances.rb",
5051
"snippets/memorystore/update_instance.rb",
5152
"snippets/snippet_metadata_google.cloud.memorystore.v1beta.json",

google-cloud-memorystore-v1beta/gapic_metadata.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
3939
"methods": [
4040
"get_certificate_authority"
4141
]
42+
},
43+
"GetSharedRegionalCertificateAuthority": {
44+
"methods": [
45+
"get_shared_regional_certificate_authority"
46+
]
4247
}
4348
}
4449
}

google-cloud-memorystore-v1beta/lib/google/cloud/memorystore/v1beta/memorystore/paths.rb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,25 @@ module V1beta
2424
module Memorystore
2525
# Path helper methods for the Memorystore API.
2626
module Paths
27+
##
28+
# Create a fully-qualified CaPool resource string.
29+
#
30+
# The resource will be in the following format:
31+
#
32+
# `projects/{project}/locations/{location}/caPools/{ca_pool}`
33+
#
34+
# @param project [String]
35+
# @param location [String]
36+
# @param ca_pool [String]
37+
#
38+
# @return [::String]
39+
def ca_pool_path project:, location:, ca_pool:
40+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
41+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
42+
43+
"projects/#{project}/locations/#{location}/caPools/#{ca_pool}"
44+
end
45+
2746
##
2847
# Create a fully-qualified ForwardingRule resource string.
2948
#
@@ -115,6 +134,23 @@ def service_attachment_path project:, region:, service_attachment:
115134
"projects/#{project}/regions/#{region}/serviceAttachments/#{service_attachment}"
116135
end
117136

137+
##
138+
# Create a fully-qualified SharedRegionalCertificateAuthority resource string.
139+
#
140+
# The resource will be in the following format:
141+
#
142+
# `projects/{project}/locations/{location}/sharedRegionalCertificateAuthority`
143+
#
144+
# @param project [String]
145+
# @param location [String]
146+
#
147+
# @return [::String]
148+
def shared_regional_certificate_authority_path project:, location:
149+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
150+
151+
"projects/#{project}/locations/#{location}/sharedRegionalCertificateAuthority"
152+
end
153+
118154
extend self
119155
end
120156
end

google-cloud-memorystore-v1beta/lib/google/cloud/memorystore/v1beta/memorystore/rest/client.rb

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,87 @@ def get_certificate_authority request, options = nil
803803
raise ::Google::Cloud::Error.from_error(e)
804804
end
805805

806+
##
807+
# Gets the details of shared regional certificate authority information for
808+
# Memorystore instance.
809+
#
810+
# @overload get_shared_regional_certificate_authority(request, options = nil)
811+
# Pass arguments to `get_shared_regional_certificate_authority` via a request object, either of type
812+
# {::Google::Cloud::Memorystore::V1beta::GetSharedRegionalCertificateAuthorityRequest} or an equivalent Hash.
813+
#
814+
# @param request [::Google::Cloud::Memorystore::V1beta::GetSharedRegionalCertificateAuthorityRequest, ::Hash]
815+
# A request object representing the call parameters. Required. To specify no
816+
# parameters, or to keep all the default parameter values, pass an empty Hash.
817+
# @param options [::Gapic::CallOptions, ::Hash]
818+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
819+
#
820+
# @overload get_shared_regional_certificate_authority(name: nil)
821+
# Pass arguments to `get_shared_regional_certificate_authority` via keyword arguments. Note that at
822+
# least one keyword argument is required. To specify no parameters, or to keep all
823+
# the default parameter values, pass an empty Hash as a request object (see above).
824+
#
825+
# @param name [::String]
826+
# Required. Regional certificate authority resource name using the form:
827+
# `projects/{project}/locations/{location}/sharedRegionalCertificateAuthority`
828+
# where `location_id` refers to a Google Cloud region.
829+
# @yield [result, operation] Access the result along with the TransportOperation object
830+
# @yieldparam result [::Google::Cloud::Memorystore::V1beta::SharedRegionalCertificateAuthority]
831+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
832+
#
833+
# @return [::Google::Cloud::Memorystore::V1beta::SharedRegionalCertificateAuthority]
834+
#
835+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
836+
#
837+
# @example Basic example
838+
# require "google/cloud/memorystore/v1beta"
839+
#
840+
# # Create a client object. The client can be reused for multiple calls.
841+
# client = Google::Cloud::Memorystore::V1beta::Memorystore::Rest::Client.new
842+
#
843+
# # Create a request. To set request fields, pass in keyword arguments.
844+
# request = Google::Cloud::Memorystore::V1beta::GetSharedRegionalCertificateAuthorityRequest.new
845+
#
846+
# # Call the get_shared_regional_certificate_authority method.
847+
# result = client.get_shared_regional_certificate_authority request
848+
#
849+
# # The returned object is of type Google::Cloud::Memorystore::V1beta::SharedRegionalCertificateAuthority.
850+
# p result
851+
#
852+
def get_shared_regional_certificate_authority request, options = nil
853+
raise ::ArgumentError, "request must be provided" if request.nil?
854+
855+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Memorystore::V1beta::GetSharedRegionalCertificateAuthorityRequest
856+
857+
# Converts hash and nil to an options object
858+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
859+
860+
# Customize the options with defaults
861+
call_metadata = @config.rpcs.get_shared_regional_certificate_authority.metadata.to_h
862+
863+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
864+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
865+
lib_name: @config.lib_name, lib_version: @config.lib_version,
866+
gapic_version: ::Google::Cloud::Memorystore::V1beta::VERSION,
867+
transports_version_send: [:rest]
868+
869+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
870+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
871+
872+
options.apply_defaults timeout: @config.rpcs.get_shared_regional_certificate_authority.timeout,
873+
metadata: call_metadata,
874+
retry_policy: @config.rpcs.get_shared_regional_certificate_authority.retry_policy
875+
876+
options.apply_defaults timeout: @config.timeout,
877+
metadata: @config.metadata,
878+
retry_policy: @config.retry_policy
879+
880+
@memorystore_stub.get_shared_regional_certificate_authority request, options do |result, operation|
881+
yield result, operation if block_given?
882+
end
883+
rescue ::Gapic::Rest::Error => e
884+
raise ::Google::Cloud::Error.from_error(e)
885+
end
886+
806887
##
807888
# Configuration class for the Memorystore REST API.
808889
#
@@ -986,6 +1067,11 @@ class Rpcs
9861067
# @return [::Gapic::Config::Method]
9871068
#
9881069
attr_reader :get_certificate_authority
1070+
##
1071+
# RPC-specific configuration for `get_shared_regional_certificate_authority`
1072+
# @return [::Gapic::Config::Method]
1073+
#
1074+
attr_reader :get_shared_regional_certificate_authority
9891075

9901076
# @private
9911077
def initialize parent_rpcs = nil
@@ -1001,6 +1087,8 @@ def initialize parent_rpcs = nil
10011087
@delete_instance = ::Gapic::Config::Method.new delete_instance_config
10021088
get_certificate_authority_config = parent_rpcs.get_certificate_authority if parent_rpcs.respond_to? :get_certificate_authority
10031089
@get_certificate_authority = ::Gapic::Config::Method.new get_certificate_authority_config
1090+
get_shared_regional_certificate_authority_config = parent_rpcs.get_shared_regional_certificate_authority if parent_rpcs.respond_to? :get_shared_regional_certificate_authority
1091+
@get_shared_regional_certificate_authority = ::Gapic::Config::Method.new get_shared_regional_certificate_authority_config
10041092

10051093
yield self if block_given?
10061094
end

google-cloud-memorystore-v1beta/lib/google/cloud/memorystore/v1beta/memorystore/rest/service_stub.rb

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,46 @@ def get_certificate_authority request_pb, options = nil
313313
end
314314
end
315315

316+
##
317+
# Baseline implementation for the get_shared_regional_certificate_authority REST call
318+
#
319+
# @param request_pb [::Google::Cloud::Memorystore::V1beta::GetSharedRegionalCertificateAuthorityRequest]
320+
# A request object representing the call parameters. Required.
321+
# @param options [::Gapic::CallOptions]
322+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
323+
#
324+
# @yield [result, operation] Access the result along with the TransportOperation object
325+
# @yieldparam result [::Google::Cloud::Memorystore::V1beta::SharedRegionalCertificateAuthority]
326+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
327+
#
328+
# @return [::Google::Cloud::Memorystore::V1beta::SharedRegionalCertificateAuthority]
329+
# A result object deserialized from the server's reply
330+
def get_shared_regional_certificate_authority request_pb, options = nil
331+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
332+
333+
verb, uri, query_string_params, body = ServiceStub.transcode_get_shared_regional_certificate_authority_request request_pb
334+
query_string_params = if query_string_params.any?
335+
query_string_params.to_h { |p| p.split "=", 2 }
336+
else
337+
{}
338+
end
339+
340+
response = @client_stub.make_http_request(
341+
verb,
342+
uri: uri,
343+
body: body || "",
344+
params: query_string_params,
345+
method_name: "get_shared_regional_certificate_authority",
346+
options: options
347+
)
348+
operation = ::Gapic::Rest::TransportOperation.new response
349+
result = ::Google::Cloud::Memorystore::V1beta::SharedRegionalCertificateAuthority.decode_json response.body, ignore_unknown_fields: true
350+
catch :response do
351+
yield result, operation if block_given?
352+
result
353+
end
354+
end
355+
316356
##
317357
# @private
318358
#
@@ -440,6 +480,27 @@ def self.transcode_get_certificate_authority_request request_pb
440480
)
441481
transcoder.transcode request_pb
442482
end
483+
484+
##
485+
# @private
486+
#
487+
# GRPC transcoding helper method for the get_shared_regional_certificate_authority REST call
488+
#
489+
# @param request_pb [::Google::Cloud::Memorystore::V1beta::GetSharedRegionalCertificateAuthorityRequest]
490+
# A request object representing the call parameters. Required.
491+
# @return [Array(String, [String, nil], Hash{String => String})]
492+
# Uri, Body, Query string parameters
493+
def self.transcode_get_shared_regional_certificate_authority_request request_pb
494+
transcoder = Gapic::Rest::GrpcTranscoder.new
495+
.with_bindings(
496+
uri_method: :get,
497+
uri_template: "/v1beta/{name}",
498+
matches: [
499+
["name", %r{^projects/[^/]+/locations/[^/]+/sharedRegionalCertificateAuthority/?$}, false]
500+
]
501+
)
502+
transcoder.transcode request_pb
503+
end
443504
end
444505
end
445506
end

0 commit comments

Comments
 (0)