Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for ListSkuGroups and ListSkuGroupBillableSkus APIs in Cloud Channel APIs #22409

Merged
merged 2 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions google-cloud-channel-v1/.owlbot-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@
"snippets/cloud_channel_service/list_products.rb",
"snippets/cloud_channel_service/list_purchasable_offers.rb",
"snippets/cloud_channel_service/list_purchasable_skus.rb",
"snippets/cloud_channel_service/list_sku_group_billable_skus.rb",
"snippets/cloud_channel_service/list_sku_groups.rb",
"snippets/cloud_channel_service/list_skus.rb",
"snippets/cloud_channel_service/list_subscribers.rb",
"snippets/cloud_channel_service/list_transferable_offers.rb",
Expand Down
10 changes: 10 additions & 0 deletions google-cloud-channel-v1/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,16 @@
"delete_channel_partner_repricing_config"
]
},
"ListSkuGroups": {
"methods": [
"list_sku_groups"
]
},
"ListSkuGroupBillableSkus": {
"methods": [
"list_sku_group_billable_skus"
]
},
"LookupOffer": {
"methods": [
"lookup_offer"
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,23 @@ def product_path product:
"products/#{product}"
end

##
# Create a fully-qualified SkuGroup resource string.
#
# The resource will be in the following format:
#
# `accounts/{account}/skuGroups/{sku_group}`
#
# @param account [String]
# @param sku_group [String]
#
# @return [::String]
def sku_group_path account:, sku_group:
raise ::ArgumentError, "account cannot contain /" if account.to_s.include? "/"

"accounts/#{account}/skuGroups/#{sku_group}"
end

extend self
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3584,6 +3584,191 @@ def delete_channel_partner_repricing_config request, options = nil
raise ::Google::Cloud::Error.from_error(e)
end

##
# Lists the Rebilling supported SKU groups the account is authorized to
# sell.
# Reference: https://cloud.google.com/skus/sku-groups
#
# Possible Error Codes:
#
# * PERMISSION_DENIED: If the account making the request and the account
# being queried are different, or the account doesn't exist.
# * INTERNAL: Any non-user error related to technical issues in the
# backend. In this case, contact Cloud Channel support.
#
# Return Value:
# If successful, the {::Google::Cloud::Channel::V1::SkuGroup SkuGroup} resources.
# The data for each resource is displayed in the alphabetical order of SKU
# group display name.
# The data for each resource is displayed in the ascending order of
# {::Google::Cloud::Channel::V1::SkuGroup#display_name SkuGroup.display_name}
#
# If unsuccessful, returns an error.
#
# @overload list_sku_groups(request, options = nil)
# Pass arguments to `list_sku_groups` via a request object, either of type
# {::Google::Cloud::Channel::V1::ListSkuGroupsRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Channel::V1::ListSkuGroupsRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
#
# @overload list_sku_groups(parent: nil, page_size: nil, page_token: nil)
# Pass arguments to `list_sku_groups` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param parent [::String]
# Required. The resource name of the account from which to list SKU groups.
# Parent uses the format: accounts/\\{account}.
# @param page_size [::Integer]
# Optional. The maximum number of SKU groups to return. The service may
# return fewer than this value. If unspecified, returns a maximum of 1000 SKU
# groups. The maximum value is 1000; values above 1000 will be coerced to
# 1000.
# @param page_token [::String]
# Optional. A token identifying a page of results beyond the first page.
# Obtained through
# [ListSkuGroups.next_page_token][] of the previous
# {::Google::Cloud::Channel::V1::CloudChannelService::Rest::Client#list_sku_groups CloudChannelService.ListSkuGroups}
# call.
# @yield [result, operation] Access the result along with the TransportOperation object
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Channel::V1::SkuGroup>]
# @yieldparam operation [::Gapic::Rest::TransportOperation]
#
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Channel::V1::SkuGroup>]
#
# @raise [::Google::Cloud::Error] if the REST call is aborted.
def list_sku_groups request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?

request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Channel::V1::ListSkuGroupsRequest

# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

# Customize the options with defaults
call_metadata = @config.rpcs.list_sku_groups.metadata.to_h

# Set x-goog-api-client and x-goog-user-project headers
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Channel::V1::VERSION,
transports_version_send: [:rest]

call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

options.apply_defaults timeout: @config.rpcs.list_sku_groups.timeout,
metadata: call_metadata,
retry_policy: @config.rpcs.list_sku_groups.retry_policy

options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy

@cloud_channel_service_stub.list_sku_groups request, options do |result, operation|
result = ::Gapic::Rest::PagedEnumerable.new @cloud_channel_service_stub, :list_sku_groups, "sku_groups", request, result, options
yield result, operation if block_given?
return result
end
rescue ::Gapic::Rest::Error => e
raise ::Google::Cloud::Error.from_error(e)
end

##
# Lists the Billable SKUs in a given SKU group.
#
# Possible error codes:
# PERMISSION_DENIED: If the account making the request and the account
# being queried for are different, or the account doesn't exist.
# INVALID_ARGUMENT: Missing or invalid required parameters in the
# request.
# INTERNAL: Any non-user error related to technical issue in the
# backend. In this case, contact cloud channel support.
#
# Return Value:
# If successful, the {::Google::Cloud::Channel::V1::BillableSku BillableSku}
# resources. The data for each resource is displayed in the ascending order
# of:
#
# * {::Google::Cloud::Channel::V1::BillableSku#service_display_name BillableSku.service_display_name}
# * {::Google::Cloud::Channel::V1::BillableSku#sku_display_name BillableSku.sku_display_name}
#
# If unsuccessful, returns an error.
#
# @overload list_sku_group_billable_skus(request, options = nil)
# Pass arguments to `list_sku_group_billable_skus` via a request object, either of type
# {::Google::Cloud::Channel::V1::ListSkuGroupBillableSkusRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Channel::V1::ListSkuGroupBillableSkusRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
#
# @overload list_sku_group_billable_skus(parent: nil, page_size: nil, page_token: nil)
# Pass arguments to `list_sku_group_billable_skus` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param parent [::String]
# Required. Resource name of the SKU group.
# Format: accounts/\\{account}/skuGroups/\\{sku_group}.
# @param page_size [::Integer]
# Optional. The maximum number of SKUs to return. The service may return
# fewer than this value. If unspecified, returns a maximum of 100000 SKUs.
# The maximum value is 100000; values above 100000 will be coerced to 100000.
# @param page_token [::String]
# Optional. A token identifying a page of results beyond the first page.
# Obtained through
# [ListSkuGroupBillableSkus.next_page_token][] of the previous
# {::Google::Cloud::Channel::V1::CloudChannelService::Rest::Client#list_sku_group_billable_skus CloudChannelService.ListSkuGroupBillableSkus}
# call.
# @yield [result, operation] Access the result along with the TransportOperation object
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Channel::V1::BillableSku>]
# @yieldparam operation [::Gapic::Rest::TransportOperation]
#
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Channel::V1::BillableSku>]
#
# @raise [::Google::Cloud::Error] if the REST call is aborted.
def list_sku_group_billable_skus request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?

request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Channel::V1::ListSkuGroupBillableSkusRequest

# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

# Customize the options with defaults
call_metadata = @config.rpcs.list_sku_group_billable_skus.metadata.to_h

# Set x-goog-api-client and x-goog-user-project headers
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Channel::V1::VERSION,
transports_version_send: [:rest]

call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

options.apply_defaults timeout: @config.rpcs.list_sku_group_billable_skus.timeout,
metadata: call_metadata,
retry_policy: @config.rpcs.list_sku_group_billable_skus.retry_policy

options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy

@cloud_channel_service_stub.list_sku_group_billable_skus request, options do |result, operation|
result = ::Gapic::Rest::PagedEnumerable.new @cloud_channel_service_stub, :list_sku_group_billable_skus, "billable_skus", request, result, options
yield result, operation if block_given?
return result
end
rescue ::Gapic::Rest::Error => e
raise ::Google::Cloud::Error.from_error(e)
end

##
# Returns the requested {::Google::Cloud::Channel::V1::Offer Offer} resource.
#
Expand Down Expand Up @@ -4740,6 +4925,16 @@ class Rpcs
#
attr_reader :delete_channel_partner_repricing_config
##
# RPC-specific configuration for `list_sku_groups`
# @return [::Gapic::Config::Method]
#
attr_reader :list_sku_groups
##
# RPC-specific configuration for `list_sku_group_billable_skus`
# @return [::Gapic::Config::Method]
#
attr_reader :list_sku_group_billable_skus
##
# RPC-specific configuration for `lookup_offer`
# @return [::Gapic::Config::Method]
#
Expand Down Expand Up @@ -4864,6 +5059,10 @@ def initialize parent_rpcs = nil
@update_channel_partner_repricing_config = ::Gapic::Config::Method.new update_channel_partner_repricing_config_config
delete_channel_partner_repricing_config_config = parent_rpcs.delete_channel_partner_repricing_config if parent_rpcs.respond_to? :delete_channel_partner_repricing_config
@delete_channel_partner_repricing_config = ::Gapic::Config::Method.new delete_channel_partner_repricing_config_config
list_sku_groups_config = parent_rpcs.list_sku_groups if parent_rpcs.respond_to? :list_sku_groups
@list_sku_groups = ::Gapic::Config::Method.new list_sku_groups_config
list_sku_group_billable_skus_config = parent_rpcs.list_sku_group_billable_skus if parent_rpcs.respond_to? :list_sku_group_billable_skus
@list_sku_group_billable_skus = ::Gapic::Config::Method.new list_sku_group_billable_skus_config
lookup_offer_config = parent_rpcs.lookup_offer if parent_rpcs.respond_to? :lookup_offer
@lookup_offer = ::Gapic::Config::Method.new lookup_offer_config
list_products_config = parent_rpcs.list_products if parent_rpcs.respond_to? :list_products
Expand Down
Loading