# frozen_string_literal: true # Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Auto-generated by gapic-generator-ruby. DO NOT EDIT! require "google/cloud/errors" require "google/cloud/video/livestream/v1/service_pb" require "google/cloud/video/live_stream/v1/livestream_service/rest/service_stub" module Google module Cloud module Video module LiveStream module V1 module LivestreamService module Rest ## # REST client for the LivestreamService service. # # Using Live Stream API, you can generate live streams in the various # renditions and streaming formats. The streaming format include HTTP Live # Streaming (HLS) and Dynamic Adaptive Streaming over HTTP (DASH). You can send # a source stream in the various ways, including Real-Time Messaging # Protocol (RTMP) and Secure Reliable Transport (SRT). # class Client include Paths # @private attr_reader :livestream_service_stub ## # Configure the LivestreamService Client class. # # See {::Google::Cloud::Video::LiveStream::V1::LivestreamService::Rest::Client::Configuration} # for a description of the configuration fields. # # @example # # # Modify the configuration for all LivestreamService clients # ::Google::Cloud::Video::LiveStream::V1::LivestreamService::Rest::Client.configure do |config| # config.timeout = 10.0 # end # # @yield [config] Configure the Client client. # @yieldparam config [Client::Configuration] # # @return [Client::Configuration] # def self.configure @configure ||= begin namespace = ["Google", "Cloud", "Video", "LiveStream", "V1"] parent_config = while namespace.any? parent_name = namespace.join "::" parent_const = const_get parent_name break parent_const.configure if parent_const.respond_to? :configure namespace.pop end default_config = Client::Configuration.new parent_config default_config.rpcs.create_channel.timeout = 60.0 default_config.rpcs.list_channels.timeout = 60.0 default_config.rpcs.list_channels.retry_policy = { initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.get_channel.timeout = 60.0 default_config.rpcs.get_channel.retry_policy = { initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.delete_channel.timeout = 60.0 default_config.rpcs.update_channel.timeout = 60.0 default_config.rpcs.start_channel.timeout = 60.0 default_config.rpcs.stop_channel.timeout = 60.0 default_config.rpcs.create_input.timeout = 60.0 default_config.rpcs.list_inputs.timeout = 60.0 default_config.rpcs.list_inputs.retry_policy = { initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.get_input.timeout = 60.0 default_config.rpcs.get_input.retry_policy = { initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.delete_input.timeout = 60.0 default_config.rpcs.update_input.timeout = 60.0 default_config.rpcs.create_event.timeout = 60.0 default_config.rpcs.list_events.timeout = 60.0 default_config.rpcs.list_events.retry_policy = { initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.get_event.timeout = 60.0 default_config.rpcs.get_event.retry_policy = { initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.delete_event.timeout = 60.0 default_config end yield @configure if block_given? @configure end ## # Configure the LivestreamService Client instance. # # The configuration is set to the derived mode, meaning that values can be changed, # but structural changes (adding new fields, etc.) are not allowed. Structural changes # should be made on {Client.configure}. # # See {::Google::Cloud::Video::LiveStream::V1::LivestreamService::Rest::Client::Configuration} # for a description of the configuration fields. # # @yield [config] Configure the Client client. # @yieldparam config [Client::Configuration] # # @return [Client::Configuration] # def configure yield @config if block_given? @config end ## # Create a new LivestreamService REST client object. # # @example # # # Create a client using the default configuration # client = ::Google::Cloud::Video::LiveStream::V1::LivestreamService::Rest::Client.new # # # Create a client using a custom configuration # client = ::Google::Cloud::Video::LiveStream::V1::LivestreamService::Rest::Client.new do |config| # config.timeout = 10.0 # end # # @yield [config] Configure the LivestreamService client. # @yieldparam config [Client::Configuration] # def initialize # Create the configuration object @config = Configuration.new Client.configure # Yield the configuration if needed yield @config if block_given? # Create credentials credentials = @config.credentials # Use self-signed JWT if the endpoint is unchanged from default, # but only if the default endpoint does not have a region prefix. enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint && !@config.endpoint.split(".").first.include?("-") credentials ||= Credentials.default scope: @config.scope, enable_self_signed_jwt: enable_self_signed_jwt if credentials.is_a?(::String) || credentials.is_a?(::Hash) credentials = Credentials.new credentials, scope: @config.scope end @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id @operations_client = ::Google::Cloud::Video::LiveStream::V1::LivestreamService::Rest::Operations.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint end @livestream_service_stub = ::Google::Cloud::Video::LiveStream::V1::LivestreamService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials end ## # Get the associated client for long-running operations. # # @return [::Google::Cloud::Video::LiveStream::V1::LivestreamService::Rest::Operations] # attr_reader :operations_client # Service calls ## # Creates a channel with the provided unique ID in the specified # region. # # @overload create_channel(request, options = nil) # Pass arguments to `create_channel` via a request object, either of type # {::Google::Cloud::Video::LiveStream::V1::CreateChannelRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Video::LiveStream::V1::CreateChannelRequest, ::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 create_channel(parent: nil, channel: nil, channel_id: nil, request_id: nil) # Pass arguments to `create_channel` 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 parent location for the resource, in the form of: # `projects/{project}/locations/{location}`. # @param channel [::Google::Cloud::Video::LiveStream::V1::Channel, ::Hash] # Required. The channel resource to be created. # @param channel_id [::String] # Required. The ID of the channel resource to be created. # This value must be 1-63 characters, begin and end with `[a-z0-9]`, # could contain dashes (-) in between. # @param request_id [::String] # A request ID to identify requests. Specify a unique request ID # so that if you must retry your request, the server will know to ignore # the request if it has already been completed. The server will guarantee # that for at least 60 minutes since the first request. # # For example, consider a situation where you make an initial request and the # request times out. If you make the request again with the same request ID, # the server can check if original operation with the same request ID was # received, and if so, will ignore the second request. This prevents clients # from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported `(00000000-0000-0000-0000-000000000000)`. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def create_channel request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::LiveStream::V1::CreateChannelRequest # 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.create_channel.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::Video::LiveStream::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.create_channel.timeout, metadata: call_metadata, retry_policy: @config.rpcs.create_channel.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @livestream_service_stub.create_channel request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Returns a list of all channels in the specified region. # # @overload list_channels(request, options = nil) # Pass arguments to `list_channels` via a request object, either of type # {::Google::Cloud::Video::LiveStream::V1::ListChannelsRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Video::LiveStream::V1::ListChannelsRequest, ::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_channels(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) # Pass arguments to `list_channels` 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 parent location for the resource, in the form of: # `projects/{project}/locations/{location}`. # @param page_size [::Integer] # The maximum number of items to return. If unspecified, server # will pick an appropriate default. Server may return fewer items than # requested. A caller should only rely on response's # {::Google::Cloud::Video::LiveStream::V1::ListChannelsResponse#next_page_token next_page_token} to # determine if there are more items left to be queried. # @param page_token [::String] # The next_page_token value returned from a previous List request, if any. # @param filter [::String] # The filter to apply to list results. # @param order_by [::String] # Specifies the ordering of results following syntax at # https://cloud.google.com/apis/design/design_patterns#sorting_order. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Video::LiveStream::V1::ListChannelsResponse] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Video::LiveStream::V1::ListChannelsResponse] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def list_channels request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::LiveStream::V1::ListChannelsRequest # 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_channels.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::Video::LiveStream::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_channels.timeout, metadata: call_metadata, retry_policy: @config.rpcs.list_channels.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @livestream_service_stub.list_channels request, options do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Returns the specified channel. # # @overload get_channel(request, options = nil) # Pass arguments to `get_channel` via a request object, either of type # {::Google::Cloud::Video::LiveStream::V1::GetChannelRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Video::LiveStream::V1::GetChannelRequest, ::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 get_channel(name: nil) # Pass arguments to `get_channel` 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 name [::String] # Required. The name of the channel resource, in the form of: # `projects/{project}/locations/{location}/channels/{channelId}`. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Video::LiveStream::V1::Channel] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Video::LiveStream::V1::Channel] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def get_channel request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::LiveStream::V1::GetChannelRequest # 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.get_channel.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::Video::LiveStream::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.get_channel.timeout, metadata: call_metadata, retry_policy: @config.rpcs.get_channel.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @livestream_service_stub.get_channel request, options do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Deletes the specified channel. # # @overload delete_channel(request, options = nil) # Pass arguments to `delete_channel` via a request object, either of type # {::Google::Cloud::Video::LiveStream::V1::DeleteChannelRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Video::LiveStream::V1::DeleteChannelRequest, ::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 delete_channel(name: nil, request_id: nil, force: nil) # Pass arguments to `delete_channel` 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 name [::String] # Required. The name of the channel resource, in the form of: # `projects/{project}/locations/{location}/channels/{channelId}`. # @param request_id [::String] # A request ID to identify requests. Specify a unique request ID # so that if you must retry your request, the server will know to ignore # the request if it has already been completed. The server will guarantee # that for at least 60 minutes after the first request. # # For example, consider a situation where you make an initial request and the # request times out. If you make the request again with the same request ID, # the server can check if original operation with the same request ID was # received, and if so, will ignore the second request. This prevents clients # from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported `(00000000-0000-0000-0000-000000000000)`. # @param force [::Boolean] # If the `force` field is set to the default value of `false`, you must # delete all of a channel's events before you can delete the channel itself. # If the field is set to `true`, requests to delete a channel also delete # associated channel events. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def delete_channel request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::LiveStream::V1::DeleteChannelRequest # 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.delete_channel.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::Video::LiveStream::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.delete_channel.timeout, metadata: call_metadata, retry_policy: @config.rpcs.delete_channel.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @livestream_service_stub.delete_channel request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Updates the specified channel. # # @overload update_channel(request, options = nil) # Pass arguments to `update_channel` via a request object, either of type # {::Google::Cloud::Video::LiveStream::V1::UpdateChannelRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Video::LiveStream::V1::UpdateChannelRequest, ::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 update_channel(update_mask: nil, channel: nil, request_id: nil) # Pass arguments to `update_channel` 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 update_mask [::Google::Protobuf::FieldMask, ::Hash] # Field mask is used to specify the fields to be overwritten in the Channel # resource by the update. You can only update the following fields: # # * [`inputAttachments`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#inputattachment) # * [`output`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#output) # * [`elementaryStreams`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#ElementaryStream) # * [`muxStreams`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#muxstream) # * [`manifests`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#Manifest) # * [`spritesheets`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#spritesheet) # # The fields specified in the update_mask are relative to the resource, not # the full request. A field will be overwritten if it is in the mask. # @param channel [::Google::Cloud::Video::LiveStream::V1::Channel, ::Hash] # Required. The channel resource to be updated. # @param request_id [::String] # A request ID to identify requests. Specify a unique request ID # so that if you must retry your request, the server will know to ignore # the request if it has already been completed. The server will guarantee # that for at least 60 minutes since the first request. # # For example, consider a situation where you make an initial request and the # request times out. If you make the request again with the same request ID, # the server can check if original operation with the same request ID was # received, and if so, will ignore the second request. This prevents clients # from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported `(00000000-0000-0000-0000-000000000000)`. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def update_channel request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::LiveStream::V1::UpdateChannelRequest # 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.update_channel.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::Video::LiveStream::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.update_channel.timeout, metadata: call_metadata, retry_policy: @config.rpcs.update_channel.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @livestream_service_stub.update_channel request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Starts the specified channel. Part of the video pipeline will be created # only when the StartChannel request is received by the server. # # @overload start_channel(request, options = nil) # Pass arguments to `start_channel` via a request object, either of type # {::Google::Cloud::Video::LiveStream::V1::StartChannelRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Video::LiveStream::V1::StartChannelRequest, ::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 start_channel(name: nil, request_id: nil) # Pass arguments to `start_channel` 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 name [::String] # Required. The name of the channel resource, in the form of: # `projects/{project}/locations/{location}/channels/{channelId}`. # @param request_id [::String] # A request ID to identify requests. Specify a unique request ID # so that if you must retry your request, the server will know to ignore # the request if it has already been completed. The server will guarantee # that for at least 60 minutes since the first request. # # For example, consider a situation where you make an initial request and the # request times out. If you make the request again with the same request ID, # the server can check if original operation with the same request ID was # received, and if so, will ignore the second request. This prevents clients # from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported `(00000000-0000-0000-0000-000000000000)`. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def start_channel request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::LiveStream::V1::StartChannelRequest # 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.start_channel.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::Video::LiveStream::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.start_channel.timeout, metadata: call_metadata, retry_policy: @config.rpcs.start_channel.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @livestream_service_stub.start_channel request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Stops the specified channel. Part of the video pipeline will be released # when the StopChannel request is received by the server. # # @overload stop_channel(request, options = nil) # Pass arguments to `stop_channel` via a request object, either of type # {::Google::Cloud::Video::LiveStream::V1::StopChannelRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Video::LiveStream::V1::StopChannelRequest, ::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 stop_channel(name: nil, request_id: nil) # Pass arguments to `stop_channel` 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 name [::String] # Required. The name of the channel resource, in the form of: # `projects/{project}/locations/{location}/channels/{channelId}`. # @param request_id [::String] # A request ID to identify requests. Specify a unique request ID # so that if you must retry your request, the server will know to ignore # the request if it has already been completed. The server will guarantee # that for at least 60 minutes since the first request. # # For example, consider a situation where you make an initial request and the # request times out. If you make the request again with the same request ID, # the server can check if original operation with the same request ID was # received, and if so, will ignore the second request. This prevents clients # from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported `(00000000-0000-0000-0000-000000000000)`. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def stop_channel request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::LiveStream::V1::StopChannelRequest # 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.stop_channel.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::Video::LiveStream::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.stop_channel.timeout, metadata: call_metadata, retry_policy: @config.rpcs.stop_channel.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @livestream_service_stub.stop_channel request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Creates an input with the provided unique ID in the specified region. # # @overload create_input(request, options = nil) # Pass arguments to `create_input` via a request object, either of type # {::Google::Cloud::Video::LiveStream::V1::CreateInputRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Video::LiveStream::V1::CreateInputRequest, ::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 create_input(parent: nil, input: nil, input_id: nil, request_id: nil) # Pass arguments to `create_input` 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 parent location for the resource, in the form of: # `projects/{project}/locations/{location}`. # @param input [::Google::Cloud::Video::LiveStream::V1::Input, ::Hash] # Required. The input resource to be created. # @param input_id [::String] # Required. The ID of the input resource to be created. # This value must be 1-63 characters, begin and end with `[a-z0-9]`, # could contain dashes (-) in between. # @param request_id [::String] # A request ID to identify requests. Specify a unique request ID # so that if you must retry your request, the server will know to ignore # the request if it has already been completed. The server will guarantee # that for at least 60 minutes since the first request. # # For example, consider a situation where you make an initial request and the # request times out. If you make the request again with the same request ID, # the server can check if original operation with the same request ID was # received, and if so, will ignore the second request. This prevents clients # from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported `(00000000-0000-0000-0000-000000000000)`. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def create_input request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::LiveStream::V1::CreateInputRequest # 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.create_input.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::Video::LiveStream::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.create_input.timeout, metadata: call_metadata, retry_policy: @config.rpcs.create_input.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @livestream_service_stub.create_input request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Returns a list of all inputs in the specified region. # # @overload list_inputs(request, options = nil) # Pass arguments to `list_inputs` via a request object, either of type # {::Google::Cloud::Video::LiveStream::V1::ListInputsRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Video::LiveStream::V1::ListInputsRequest, ::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_inputs(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) # Pass arguments to `list_inputs` 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 parent location for the resource, in the form of: # `projects/{project}/locations/{location}`. # @param page_size [::Integer] # The maximum number of items to return. If unspecified, server # will pick an appropriate default. Server may return fewer items than # requested. A caller should only rely on response's # {::Google::Cloud::Video::LiveStream::V1::ListInputsResponse#next_page_token next_page_token} to # determine if there are more items left to be queried. # @param page_token [::String] # The next_page_token value returned from a previous List request, if any. # @param filter [::String] # The filter to apply to list results. # @param order_by [::String] # Specifies the ordering of results following syntax at [Sorting # Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Video::LiveStream::V1::ListInputsResponse] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Video::LiveStream::V1::ListInputsResponse] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def list_inputs request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::LiveStream::V1::ListInputsRequest # 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_inputs.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::Video::LiveStream::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_inputs.timeout, metadata: call_metadata, retry_policy: @config.rpcs.list_inputs.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @livestream_service_stub.list_inputs request, options do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Returns the specified input. # # @overload get_input(request, options = nil) # Pass arguments to `get_input` via a request object, either of type # {::Google::Cloud::Video::LiveStream::V1::GetInputRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Video::LiveStream::V1::GetInputRequest, ::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 get_input(name: nil) # Pass arguments to `get_input` 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 name [::String] # Required. The name of the input resource, in the form of: # `projects/{project}/locations/{location}/inputs/{inputId}`. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Video::LiveStream::V1::Input] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Video::LiveStream::V1::Input] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def get_input request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::LiveStream::V1::GetInputRequest # 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.get_input.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::Video::LiveStream::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.get_input.timeout, metadata: call_metadata, retry_policy: @config.rpcs.get_input.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @livestream_service_stub.get_input request, options do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Deletes the specified input. # # @overload delete_input(request, options = nil) # Pass arguments to `delete_input` via a request object, either of type # {::Google::Cloud::Video::LiveStream::V1::DeleteInputRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Video::LiveStream::V1::DeleteInputRequest, ::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 delete_input(name: nil, request_id: nil) # Pass arguments to `delete_input` 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 name [::String] # Required. The name of the input resource, in the form of: # `projects/{project}/locations/{location}/inputs/{inputId}`. # @param request_id [::String] # A request ID to identify requests. Specify a unique request ID # so that if you must retry your request, the server will know to ignore # the request if it has already been completed. The server will guarantee # that for at least 60 minutes since the first request. # # For example, consider a situation where you make an initial request and the # request times out. If you make the request again with the same request ID, # the server can check if original operation with the same request ID was # received, and if so, will ignore the second request. This prevents clients # from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported `(00000000-0000-0000-0000-000000000000)`. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def delete_input request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::LiveStream::V1::DeleteInputRequest # 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.delete_input.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::Video::LiveStream::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.delete_input.timeout, metadata: call_metadata, retry_policy: @config.rpcs.delete_input.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @livestream_service_stub.delete_input request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Updates the specified input. # # @overload update_input(request, options = nil) # Pass arguments to `update_input` via a request object, either of type # {::Google::Cloud::Video::LiveStream::V1::UpdateInputRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Video::LiveStream::V1::UpdateInputRequest, ::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 update_input(update_mask: nil, input: nil, request_id: nil) # Pass arguments to `update_input` 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 update_mask [::Google::Protobuf::FieldMask, ::Hash] # Field mask is used to specify the fields to be overwritten in the Input # resource by the update. You can only update the following fields: # # * [`preprocessingConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.inputs#PreprocessingConfig) # * [`securityRules`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.inputs#SecurityRule) # # The fields specified in the update_mask are relative to the resource, not # the full request. A field will be overwritten if it is in the mask. # @param input [::Google::Cloud::Video::LiveStream::V1::Input, ::Hash] # Required. The input resource to be updated. # @param request_id [::String] # A request ID to identify requests. Specify a unique request ID # so that if you must retry your request, the server will know to ignore # the request if it has already been completed. The server will guarantee # that for at least 60 minutes since the first request. # # For example, consider a situation where you make an initial request and the # request times out. If you make the request again with the same request ID, # the server can check if original operation with the same request ID was # received, and if so, will ignore the second request. This prevents clients # from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported `(00000000-0000-0000-0000-000000000000)`. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Gapic::Operation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Gapic::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def update_input request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::LiveStream::V1::UpdateInputRequest # 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.update_input.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::Video::LiveStream::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.update_input.timeout, metadata: call_metadata, retry_policy: @config.rpcs.update_input.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @livestream_service_stub.update_input request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: options yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Creates an event with the provided unique ID in the specified channel. # # @overload create_event(request, options = nil) # Pass arguments to `create_event` via a request object, either of type # {::Google::Cloud::Video::LiveStream::V1::CreateEventRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Video::LiveStream::V1::CreateEventRequest, ::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 create_event(parent: nil, event: nil, event_id: nil, request_id: nil) # Pass arguments to `create_event` 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 parent channel for the resource, in the form of: # `projects/{project}/locations/{location}/channels/{channelId}`. # @param event [::Google::Cloud::Video::LiveStream::V1::Event, ::Hash] # Required. The event resource to be created. # @param event_id [::String] # Required. The ID of the event resource to be created. # This value must be 1-63 characters, begin and end with `[a-z0-9]`, # could contain dashes (-) in between. # @param request_id [::String] # A request ID to identify requests. Specify a unique request ID # so that if you must retry your request, the server will know to ignore # the request if it has already been completed. The server will guarantee # that for at least 60 minutes since the first request. # # For example, consider a situation where you make an initial request and the # request times out. If you make the request again with the same request ID, # the server can check if original operation with the same request ID was # received, and if so, will ignore the second request. This prevents clients # from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported `(00000000-0000-0000-0000-000000000000)`. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Video::LiveStream::V1::Event] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Video::LiveStream::V1::Event] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def create_event request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::LiveStream::V1::CreateEventRequest # 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.create_event.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::Video::LiveStream::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.create_event.timeout, metadata: call_metadata, retry_policy: @config.rpcs.create_event.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @livestream_service_stub.create_event request, options do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Returns a list of all events in the specified channel. # # @overload list_events(request, options = nil) # Pass arguments to `list_events` via a request object, either of type # {::Google::Cloud::Video::LiveStream::V1::ListEventsRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Video::LiveStream::V1::ListEventsRequest, ::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_events(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) # Pass arguments to `list_events` 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 parent channel for the resource, in the form of: # `projects/{project}/locations/{location}/channels/{channelId}`. # @param page_size [::Integer] # The maximum number of items to return. If unspecified, server # will pick an appropriate default. Server may return fewer items than # requested. A caller should only rely on response's # {::Google::Cloud::Video::LiveStream::V1::ListEventsResponse#next_page_token next_page_token} to # determine if there are more items left to be queried. # @param page_token [::String] # The next_page_token value returned from a previous List request, if any. # @param filter [::String] # The filter to apply to list results. # @param order_by [::String] # Specifies the ordering of results following syntax at # https://cloud.google.com/apis/design/design_patterns#sorting_order. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Video::LiveStream::V1::ListEventsResponse] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Video::LiveStream::V1::ListEventsResponse] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def list_events request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::LiveStream::V1::ListEventsRequest # 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_events.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::Video::LiveStream::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_events.timeout, metadata: call_metadata, retry_policy: @config.rpcs.list_events.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @livestream_service_stub.list_events request, options do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Returns the specified event. # # @overload get_event(request, options = nil) # Pass arguments to `get_event` via a request object, either of type # {::Google::Cloud::Video::LiveStream::V1::GetEventRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Video::LiveStream::V1::GetEventRequest, ::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 get_event(name: nil) # Pass arguments to `get_event` 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 name [::String] # Required. The name of the event resource, in the form of: # `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Video::LiveStream::V1::Event] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Video::LiveStream::V1::Event] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def get_event request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::LiveStream::V1::GetEventRequest # 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.get_event.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::Video::LiveStream::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.get_event.timeout, metadata: call_metadata, retry_policy: @config.rpcs.get_event.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @livestream_service_stub.get_event request, options do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Deletes the specified event. # # @overload delete_event(request, options = nil) # Pass arguments to `delete_event` via a request object, either of type # {::Google::Cloud::Video::LiveStream::V1::DeleteEventRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Video::LiveStream::V1::DeleteEventRequest, ::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 delete_event(name: nil, request_id: nil) # Pass arguments to `delete_event` 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 name [::String] # Required. The name of the event resource, in the form of: # `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. # @param request_id [::String] # A request ID to identify requests. Specify a unique request ID # so that if you must retry your request, the server will know to ignore # the request if it has already been completed. The server will guarantee # that for at least 60 minutes since the first request. # # For example, consider a situation where you make an initial request and the # request times out. If you make the request again with the same request ID, # the server can check if original operation with the same request ID was # received, and if so, will ignore the second request. This prevents clients # from accidentally creating duplicate commitments. # # The request ID must be a valid UUID with the exception that zero UUID is # not supported `(00000000-0000-0000-0000-000000000000)`. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Protobuf::Empty] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Protobuf::Empty] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def delete_event request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Video::LiveStream::V1::DeleteEventRequest # 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.delete_event.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::Video::LiveStream::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.delete_event.timeout, metadata: call_metadata, retry_policy: @config.rpcs.delete_event.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @livestream_service_stub.delete_event request, options do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## # Configuration class for the LivestreamService REST API. # # This class represents the configuration for LivestreamService REST, # providing control over timeouts, retry behavior, logging, transport # parameters, and other low-level controls. Certain parameters can also be # applied individually to specific RPCs. See # {::Google::Cloud::Video::LiveStream::V1::LivestreamService::Rest::Client::Configuration::Rpcs} # for a list of RPCs that can be configured independently. # # Configuration can be applied globally to all clients, or to a single client # on construction. # # @example # # # Modify the global config, setting the timeout for # # create_channel to 20 seconds, # # and all remaining timeouts to 10 seconds. # ::Google::Cloud::Video::LiveStream::V1::LivestreamService::Rest::Client.configure do |config| # config.timeout = 10.0 # config.rpcs.create_channel.timeout = 20.0 # end # # # Apply the above configuration only to a new client. # client = ::Google::Cloud::Video::LiveStream::V1::LivestreamService::Rest::Client.new do |config| # config.timeout = 10.0 # config.rpcs.create_channel.timeout = 20.0 # end # # @!attribute [rw] endpoint # The hostname or hostname:port of the service endpoint. # Defaults to `"livestream.googleapis.com"`. # @return [::String] # @!attribute [rw] credentials # Credentials to send with calls. You may provide any of the following types: # * (`String`) The path to a service account key file in JSON format # * (`Hash`) A service account key as a Hash # * (`Google::Auth::Credentials`) A googleauth credentials object # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html)) # * (`Signet::OAuth2::Client`) A signet oauth2 client object # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html)) # * (`nil`) indicating no credentials # @return [::Object] # @!attribute [rw] scope # The OAuth scopes # @return [::Array<::String>] # @!attribute [rw] lib_name # The library name as recorded in instrumentation and logging # @return [::String] # @!attribute [rw] lib_version # The library version as recorded in instrumentation and logging # @return [::String] # @!attribute [rw] timeout # The call timeout in seconds. # @return [::Numeric] # @!attribute [rw] metadata # Additional headers to be sent with the call. # @return [::Hash{::Symbol=>::String}] # @!attribute [rw] retry_policy # The retry policy. The value is a hash with the following keys: # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. # * `:retry_codes` (*type:* `Array`) - The error codes that should # trigger a retry. # @return [::Hash] # @!attribute [rw] quota_project # A separate project against which to charge quota. # @return [::String] # class Configuration extend ::Gapic::Config config_attr :endpoint, "livestream.googleapis.com", ::String config_attr :credentials, nil do |value| allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil] allowed.any? { |klass| klass === value } end config_attr :scope, nil, ::String, ::Array, nil config_attr :lib_name, nil, ::String, nil config_attr :lib_version, nil, ::String, nil config_attr :timeout, nil, ::Numeric, nil config_attr :metadata, nil, ::Hash, nil config_attr :retry_policy, nil, ::Hash, ::Proc, nil config_attr :quota_project, nil, ::String, nil # @private def initialize parent_config = nil @parent_config = parent_config unless parent_config.nil? yield self if block_given? end ## # Configurations for individual RPCs # @return [Rpcs] # def rpcs @rpcs ||= begin parent_rpcs = nil parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) Rpcs.new parent_rpcs end end ## # Configuration RPC class for the LivestreamService API. # # Includes fields providing the configuration for each RPC in this service. # Each configuration object is of type `Gapic::Config::Method` and includes # the following configuration fields: # # * `timeout` (*type:* `Numeric`) - The call timeout in seconds # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields # include the following keys: # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. # * `:retry_codes` (*type:* `Array`) - The error codes that should # trigger a retry. # class Rpcs ## # RPC-specific configuration for `create_channel` # @return [::Gapic::Config::Method] # attr_reader :create_channel ## # RPC-specific configuration for `list_channels` # @return [::Gapic::Config::Method] # attr_reader :list_channels ## # RPC-specific configuration for `get_channel` # @return [::Gapic::Config::Method] # attr_reader :get_channel ## # RPC-specific configuration for `delete_channel` # @return [::Gapic::Config::Method] # attr_reader :delete_channel ## # RPC-specific configuration for `update_channel` # @return [::Gapic::Config::Method] # attr_reader :update_channel ## # RPC-specific configuration for `start_channel` # @return [::Gapic::Config::Method] # attr_reader :start_channel ## # RPC-specific configuration for `stop_channel` # @return [::Gapic::Config::Method] # attr_reader :stop_channel ## # RPC-specific configuration for `create_input` # @return [::Gapic::Config::Method] # attr_reader :create_input ## # RPC-specific configuration for `list_inputs` # @return [::Gapic::Config::Method] # attr_reader :list_inputs ## # RPC-specific configuration for `get_input` # @return [::Gapic::Config::Method] # attr_reader :get_input ## # RPC-specific configuration for `delete_input` # @return [::Gapic::Config::Method] # attr_reader :delete_input ## # RPC-specific configuration for `update_input` # @return [::Gapic::Config::Method] # attr_reader :update_input ## # RPC-specific configuration for `create_event` # @return [::Gapic::Config::Method] # attr_reader :create_event ## # RPC-specific configuration for `list_events` # @return [::Gapic::Config::Method] # attr_reader :list_events ## # RPC-specific configuration for `get_event` # @return [::Gapic::Config::Method] # attr_reader :get_event ## # RPC-specific configuration for `delete_event` # @return [::Gapic::Config::Method] # attr_reader :delete_event # @private def initialize parent_rpcs = nil create_channel_config = parent_rpcs.create_channel if parent_rpcs.respond_to? :create_channel @create_channel = ::Gapic::Config::Method.new create_channel_config list_channels_config = parent_rpcs.list_channels if parent_rpcs.respond_to? :list_channels @list_channels = ::Gapic::Config::Method.new list_channels_config get_channel_config = parent_rpcs.get_channel if parent_rpcs.respond_to? :get_channel @get_channel = ::Gapic::Config::Method.new get_channel_config delete_channel_config = parent_rpcs.delete_channel if parent_rpcs.respond_to? :delete_channel @delete_channel = ::Gapic::Config::Method.new delete_channel_config update_channel_config = parent_rpcs.update_channel if parent_rpcs.respond_to? :update_channel @update_channel = ::Gapic::Config::Method.new update_channel_config start_channel_config = parent_rpcs.start_channel if parent_rpcs.respond_to? :start_channel @start_channel = ::Gapic::Config::Method.new start_channel_config stop_channel_config = parent_rpcs.stop_channel if parent_rpcs.respond_to? :stop_channel @stop_channel = ::Gapic::Config::Method.new stop_channel_config create_input_config = parent_rpcs.create_input if parent_rpcs.respond_to? :create_input @create_input = ::Gapic::Config::Method.new create_input_config list_inputs_config = parent_rpcs.list_inputs if parent_rpcs.respond_to? :list_inputs @list_inputs = ::Gapic::Config::Method.new list_inputs_config get_input_config = parent_rpcs.get_input if parent_rpcs.respond_to? :get_input @get_input = ::Gapic::Config::Method.new get_input_config delete_input_config = parent_rpcs.delete_input if parent_rpcs.respond_to? :delete_input @delete_input = ::Gapic::Config::Method.new delete_input_config update_input_config = parent_rpcs.update_input if parent_rpcs.respond_to? :update_input @update_input = ::Gapic::Config::Method.new update_input_config create_event_config = parent_rpcs.create_event if parent_rpcs.respond_to? :create_event @create_event = ::Gapic::Config::Method.new create_event_config list_events_config = parent_rpcs.list_events if parent_rpcs.respond_to? :list_events @list_events = ::Gapic::Config::Method.new list_events_config get_event_config = parent_rpcs.get_event if parent_rpcs.respond_to? :get_event @get_event = ::Gapic::Config::Method.new get_event_config delete_event_config = parent_rpcs.delete_event if parent_rpcs.respond_to? :delete_event @delete_event = ::Gapic::Config::Method.new delete_event_config yield self if block_given? end end end end end end end end end end end