Cloud Dataproc V1 API - Class Google::Cloud::Dataproc::V1::SessionController::Rest::Client (v1.6.0)

Reference documentation and code samples for the Cloud Dataproc V1 API class Google::Cloud::Dataproc::V1::SessionController::Rest::Client.

REST client for the SessionController service.

The SessionController provides methods to manage interactive sessions.

Inherits

  • Object

Methods

.configure

defself.configure(){|config|...}->Client::Configuration

Configure the SessionController Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all SessionController clients
::Google::Cloud::Dataproc::V1::SessionController::Rest::Client.configuredo|config|
config.timeout=10.0
end

#configure

defconfigure(){|config|...}->Client::Configuration

Configure the SessionController 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 Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_session

defcreate_session(request,options=nil)->::Gapic::Operation
defcreate_session(parent:nil,session:nil,session_id:nil,request_id:nil)->::Gapic::Operation

Create an interactive session asynchronously.

Overloads
defcreate_session(request,options=nil)->::Gapic::Operation
Pass arguments to create_session via a request object, either of type CreateSessionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::CreateSessionRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
defcreate_session(parent:nil,session:nil,session_id:nil,request_id:nil)->::Gapic::Operation
Pass arguments to create_session 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).
Parameters
  • parent (::String) — Required. The parent resource where this session will be created.
  • session (::Google::Cloud::Dataproc::V1::Session, ::Hash) — Required. The interactive session to create.
  • session_id (::String) — Required. The ID to use for the session, which becomes the final component of the session's resource name.

    This value must be 4-63 characters. Valid characters are /[a-z][0-9]-/.

  • request_id (::String) — Optional. A unique ID used to identify the request. If the service receives two CreateSessionRequestss with the same ID, the second request is ignored, and the first Session is created and stored in the backend.

    Recommendation: Set this value to a UUID.

    The value must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require"google/cloud/dataproc/v1"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Dataproc::V1::SessionController::Rest::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Dataproc::V1::CreateSessionRequest.new
# Call the create_session method.
result=client.create_sessionrequest
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done!timeout:60
ifresult.response?
presult.response
else
puts"No response received."
end

#delete_session

defdelete_session(request,options=nil)->::Gapic::Operation
defdelete_session(name:nil,request_id:nil)->::Gapic::Operation

Deletes the interactive session resource. If the session is not in terminal state, it is terminated, and then deleted.

Overloads
defdelete_session(request,options=nil)->::Gapic::Operation
Pass arguments to delete_session via a request object, either of type DeleteSessionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::DeleteSessionRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
defdelete_session(name:nil,request_id:nil)->::Gapic::Operation
Pass arguments to delete_session 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).
Parameters
  • name (::String) — Required. The name of the session resource to delete.
  • request_id (::String) — Optional. A unique ID used to identify the request. If the service receives two DeleteSessionRequests with the same ID, the second request is ignored.

    Recommendation: Set this value to a UUID.

    The value must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require"google/cloud/dataproc/v1"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Dataproc::V1::SessionController::Rest::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Dataproc::V1::DeleteSessionRequest.new
# Call the delete_session method.
result=client.delete_sessionrequest
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done!timeout:60
ifresult.response?
presult.response
else
puts"No response received."
end

#get_session

defget_session(request,options=nil)->::Google::Cloud::Dataproc::V1::Session
defget_session(name:nil)->::Google::Cloud::Dataproc::V1::Session

Gets the resource representation for an interactive session.

Overloads
defget_session(request,options=nil)->::Google::Cloud::Dataproc::V1::Session
Pass arguments to get_session via a request object, either of type GetSessionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::GetSessionRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
defget_session(name:nil)->::Google::Cloud::Dataproc::V1::Session
Pass arguments to get_session 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).
Parameter
  • name (::String) — Required. The name of the session to retrieve.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require"google/cloud/dataproc/v1"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Dataproc::V1::SessionController::Rest::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Dataproc::V1::GetSessionRequest.new
# Call the get_session method.
result=client.get_sessionrequest
# The returned object is of type Google::Cloud::Dataproc::V1::Session.
presult

#iam_policy_client

defiam_policy_client()->Google::Iam::V1::IAMPolicy::Rest::Client

Get the associated client for mix-in of the IAMPolicy.

Returns
  • (Google::Iam::V1::IAMPolicy::Rest::Client)

#initialize

definitialize(){|config|...}->Client

Create a new SessionController REST client object.

Yields
  • (config) — Configure the SessionController client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client=::Google::Cloud::Dataproc::V1::SessionController::Rest::Client.new
# Create a client using a custom configuration
client=::Google::Cloud::Dataproc::V1::SessionController::Rest::Client.newdo|config|
config.timeout=10.0
end

#list_sessions

deflist_sessions(request,options=nil)->::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dataproc::V1::Session>
deflist_sessions(parent:nil,page_size:nil,page_token:nil,filter:nil)->::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dataproc::V1::Session>

Lists interactive sessions.

Overloads
deflist_sessions(request,options=nil)->::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dataproc::V1::Session>
Pass arguments to list_sessions via a request object, either of type ListSessionsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::ListSessionsRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
deflist_sessions(parent:nil,page_size:nil,page_token:nil,filter:nil)->::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dataproc::V1::Session>
Pass arguments to list_sessions 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).
Parameters
  • parent (::String) — Required. The parent, which owns this collection of sessions.
  • page_size (::Integer) — Optional. The maximum number of sessions to return in each response. The service may return fewer than this value.
  • page_token (::String) — Optional. A page token received from a previous ListSessions call. Provide this token to retrieve the subsequent page.
  • filter (::String) — Optional. A filter for the sessions to return in the response.

    A filter is a logical expression constraining the values of various fields in each session resource. Filters are case sensitive, and may contain multiple clauses combined with logical operators (AND, OR). Supported fields are session_id, session_uuid, state, create_time, and labels.

    Example: state = ACTIVE and create_time < "2023年01月01日T00:00:00Z" is a filter for sessions in an ACTIVE state that were created before 2023年01月01日. state = ACTIVE and labels.environment=production is a filter for sessions in an ACTIVE state that have a production environment label.

    See https://google.aip.dev/assets/misc/ebnf-filtering.txt for a detailed description of the filter syntax and a list of supported comparators.

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require"google/cloud/dataproc/v1"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Dataproc::V1::SessionController::Rest::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Dataproc::V1::ListSessionsRequest.new
# Call the list_sessions method.
result=client.list_sessionsrequest
# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.eachdo|item|
# Each element is of type ::Google::Cloud::Dataproc::V1::Session.
pitem
end

#logger

deflogger()->Logger

The logger used for request/response debug logging.

Returns
  • (Logger)

#operations_client

defoperations_client()->::Google::Cloud::Dataproc::V1::SessionController::Rest::Operations

Get the associated client for long-running operations.

#terminate_session

defterminate_session(request,options=nil)->::Gapic::Operation
defterminate_session(name:nil,request_id:nil)->::Gapic::Operation

Terminates the interactive session.

Overloads
defterminate_session(request,options=nil)->::Gapic::Operation
Pass arguments to terminate_session via a request object, either of type TerminateSessionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::TerminateSessionRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
defterminate_session(name:nil,request_id:nil)->::Gapic::Operation
Pass arguments to terminate_session 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).
Parameters
  • name (::String) — Required. The name of the session resource to terminate.
  • request_id (::String) — Optional. A unique ID used to identify the request. If the service receives two TerminateSessionRequests with the same ID, the second request is ignored.

    Recommendation: Set this value to a UUID.

    The value must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require"google/cloud/dataproc/v1"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Dataproc::V1::SessionController::Rest::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Dataproc::V1::TerminateSessionRequest.new
# Call the terminate_session method.
result=client.terminate_sessionrequest
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done!timeout:60
ifresult.response?
presult.response
else
puts"No response received."
end

#universe_domain

defuniverse_domain()->String

The effective universe domain

Returns
  • (String)

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月30日 UTC.