Skip to content

Commit be2a3e9

Browse files
feat: Update Compute Engine v1 API to revision 20250916 (#1107) (#31762)
* feat: Update Compute Engine v1 API to revision 20250916 (#1107) Source-Link: googleapis/googleapis@a23c956 Source-Link: googleapis/googleapis-gen@eca33e4 Copy-Tag: eyJwIjoiZ29vZ2xlLWNsb3VkLWNvbXB1dGUvLk93bEJvdC55YW1sIiwiaCI6ImVjYTMzZTQ3ZjExM2NmMWIwYThkMzM5NDNkMWYwMzc4YzEyYTNlMzgifQ== * 🦉 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 1198cae commit be2a3e9

2 files changed

Lines changed: 146 additions & 0 deletions

File tree

google-cloud-compute/lib/google/cloud/compute.rb

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2944,6 +2944,69 @@ def self.node_types_available? version: :v1
29442944
false
29452945
end
29462946

2947+
##
2948+
# Create a new client object for OrganizationSecurityPolicies.
2949+
#
2950+
# By default, this returns an instance of
2951+
# [Google::Cloud::Compute::V1::OrganizationSecurityPolicies::Rest::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-compute-v1/latest/Google-Cloud-Compute-V1-OrganizationSecurityPolicies-Rest-Client)
2952+
# for a REST client for version V1 of the API.
2953+
# However, you can specify a different API version by passing it in the
2954+
# `version` parameter. If the OrganizationSecurityPolicies service is
2955+
# supported by that API version, and the corresponding gem is available, the
2956+
# appropriate versioned client will be returned.
2957+
#
2958+
# Raises an exception if the currently installed versioned client gem for the
2959+
# given API version does not support the OrganizationSecurityPolicies service.
2960+
# You can determine whether the method will succeed by calling
2961+
# {Google::Cloud::Compute.organization_security_policies_available?}.
2962+
#
2963+
# ## About OrganizationSecurityPolicies
2964+
#
2965+
# The OrganizationSecurityPolicies API.
2966+
#
2967+
# @param version [::String, ::Symbol] The API version to connect to. Optional.
2968+
# Defaults to `:v1`.
2969+
# @return [::Object] A client object for the specified version.
2970+
#
2971+
def self.organization_security_policies version: :v1, &block
2972+
require "google/cloud/compute/#{version.to_s.downcase}"
2973+
2974+
package_name = Google::Cloud::Compute
2975+
.constants
2976+
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
2977+
.first
2978+
service_module = Google::Cloud::Compute.const_get(package_name).const_get(:OrganizationSecurityPolicies)
2979+
service_module.const_get(:Rest).const_get(:Client).new(&block)
2980+
end
2981+
2982+
##
2983+
# Determines whether the OrganizationSecurityPolicies service is supported by the current client.
2984+
# If true, you can retrieve a client object by calling {Google::Cloud::Compute.organization_security_policies}.
2985+
# If false, that method will raise an exception. This could happen if the given
2986+
# API version does not exist or does not support the OrganizationSecurityPolicies service,
2987+
# or if the versioned client gem needs an update to support the OrganizationSecurityPolicies service.
2988+
#
2989+
# @param version [::String, ::Symbol] The API version to connect to. Optional.
2990+
# Defaults to `:v1`.
2991+
# @return [boolean] Whether the service is available.
2992+
#
2993+
def self.organization_security_policies_available? version: :v1
2994+
require "google/cloud/compute/#{version.to_s.downcase}"
2995+
package_name = Google::Cloud::Compute
2996+
.constants
2997+
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
2998+
.first
2999+
return false unless package_name
3000+
service_module = Google::Cloud::Compute.const_get package_name
3001+
return false unless service_module.const_defined? :OrganizationSecurityPolicies
3002+
service_module = service_module.const_get :OrganizationSecurityPolicies
3003+
return false unless service_module.const_defined? :Rest
3004+
service_module = service_module.const_get :Rest
3005+
service_module.const_defined? :Client
3006+
rescue ::LoadError
3007+
false
3008+
end
3009+
29473010
##
29483011
# Create a new client object for PacketMirrorings.
29493012
#
@@ -3007,6 +3070,69 @@ def self.packet_mirrorings_available? version: :v1
30073070
false
30083071
end
30093072

3073+
##
3074+
# Create a new client object for PreviewFeatures.
3075+
#
3076+
# By default, this returns an instance of
3077+
# [Google::Cloud::Compute::V1::PreviewFeatures::Rest::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-compute-v1/latest/Google-Cloud-Compute-V1-PreviewFeatures-Rest-Client)
3078+
# for a REST client for version V1 of the API.
3079+
# However, you can specify a different API version by passing it in the
3080+
# `version` parameter. If the PreviewFeatures service is
3081+
# supported by that API version, and the corresponding gem is available, the
3082+
# appropriate versioned client will be returned.
3083+
#
3084+
# Raises an exception if the currently installed versioned client gem for the
3085+
# given API version does not support the PreviewFeatures service.
3086+
# You can determine whether the method will succeed by calling
3087+
# {Google::Cloud::Compute.preview_features_available?}.
3088+
#
3089+
# ## About PreviewFeatures
3090+
#
3091+
# The PreviewFeatures API.
3092+
#
3093+
# @param version [::String, ::Symbol] The API version to connect to. Optional.
3094+
# Defaults to `:v1`.
3095+
# @return [::Object] A client object for the specified version.
3096+
#
3097+
def self.preview_features version: :v1, &block
3098+
require "google/cloud/compute/#{version.to_s.downcase}"
3099+
3100+
package_name = Google::Cloud::Compute
3101+
.constants
3102+
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
3103+
.first
3104+
service_module = Google::Cloud::Compute.const_get(package_name).const_get(:PreviewFeatures)
3105+
service_module.const_get(:Rest).const_get(:Client).new(&block)
3106+
end
3107+
3108+
##
3109+
# Determines whether the PreviewFeatures service is supported by the current client.
3110+
# If true, you can retrieve a client object by calling {Google::Cloud::Compute.preview_features}.
3111+
# If false, that method will raise an exception. This could happen if the given
3112+
# API version does not exist or does not support the PreviewFeatures service,
3113+
# or if the versioned client gem needs an update to support the PreviewFeatures service.
3114+
#
3115+
# @param version [::String, ::Symbol] The API version to connect to. Optional.
3116+
# Defaults to `:v1`.
3117+
# @return [boolean] Whether the service is available.
3118+
#
3119+
def self.preview_features_available? version: :v1
3120+
require "google/cloud/compute/#{version.to_s.downcase}"
3121+
package_name = Google::Cloud::Compute
3122+
.constants
3123+
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
3124+
.first
3125+
return false unless package_name
3126+
service_module = Google::Cloud::Compute.const_get package_name
3127+
return false unless service_module.const_defined? :PreviewFeatures
3128+
service_module = service_module.const_get :PreviewFeatures
3129+
return false unless service_module.const_defined? :Rest
3130+
service_module = service_module.const_get :Rest
3131+
service_module.const_defined? :Client
3132+
rescue ::LoadError
3133+
false
3134+
end
3135+
30103136
##
30113137
# Create a new client object for Projects.
30123138
#

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,16 @@ def test_node_types_rest
500500
end
501501
end
502502

503+
def test_organization_security_policies_rest
504+
skip unless Google::Cloud::Compute.organization_security_policies_available?
505+
Gapic::Rest::ClientStub.stub :new, DummyStub.new do
506+
client = Google::Cloud::Compute.organization_security_policies do |config|
507+
config.credentials = :dummy_credentials
508+
end
509+
assert_kind_of Google::Cloud::Compute::V1::OrganizationSecurityPolicies::Rest::Client, client
510+
end
511+
end
512+
503513
def test_packet_mirrorings_rest
504514
skip unless Google::Cloud::Compute.packet_mirrorings_available?
505515
Gapic::Rest::ClientStub.stub :new, DummyStub.new do
@@ -510,6 +520,16 @@ def test_packet_mirrorings_rest
510520
end
511521
end
512522

523+
def test_preview_features_rest
524+
skip unless Google::Cloud::Compute.preview_features_available?
525+
Gapic::Rest::ClientStub.stub :new, DummyStub.new do
526+
client = Google::Cloud::Compute.preview_features do |config|
527+
config.credentials = :dummy_credentials
528+
end
529+
assert_kind_of Google::Cloud::Compute::V1::PreviewFeatures::Rest::Client, client
530+
end
531+
end
532+
513533
def test_projects_rest
514534
skip unless Google::Cloud::Compute.projects_available?
515535
Gapic::Rest::ClientStub.stub :new, DummyStub.new do

0 commit comments

Comments
 (0)