Class: Google::Apis::PubsubV1::JavaScriptUdf
- Inherits:
-
Object
- Object
- Google::Apis::PubsubV1::JavaScriptUdf
- Includes:
- Core::Hashable, Core::JsonObjectSupport
- Defined in:
- lib/google/apis/pubsub_v1/classes.rb,
lib/google/apis/pubsub_v1/representations.rb,
lib/google/apis/pubsub_v1/representations.rb
Overview
User-defined JavaScript function that can transform or filter a Pub/Sub message.
Instance Attribute Summary collapse
-
#code ⇒ String
Required.
-
#function_name ⇒ String
Required.
Instance Method Summary collapse
-
#initialize(**args) ⇒ JavaScriptUdf
constructor
A new instance of JavaScriptUdf.
-
#update!(**args) ⇒ Object
Update properties of this object.
Constructor Details
#initialize(**args) ⇒ JavaScriptUdf
Returns a new instance of JavaScriptUdf.
967 968 969 |
# File 'lib/google/apis/pubsub_v1/classes.rb', line 967 def initialize(**args) update!(**args) end |
Instance Attribute Details
#code ⇒ String
Required. JavaScript code that contains a function function_name with the
below signature: ``/** * Transforms a Pub/Sub message. * @return(Object)>|
null)- To * filter a message, returnnull. To transform a message return a
map * with the following keys: * - (required) 'data' :string* - (optional)
'attributes' :Object* Returning emptyattributeswill remove all
attributes from the * message. * * @param(Object)>` Pub/Sub * message. Keys:
- - (required) 'data' :
string* - (required) 'attributes' :Object* * @ paramObjectmetadata - Pub/Sub message metadata. * Keys: * - (optional) ' message_id' :string* - (optional) 'publish_time':stringYYYY-MM-DDTHH: MM:SSZ format * - (optional) 'ordering_key':string*/ function (message, metadata)``Corresponds to the JSON propertycode`
959 960 961 |
# File 'lib/google/apis/pubsub_v1/classes.rb', line 959 def code @code end |
#function_name ⇒ String
Required. Name of the JavasScript function that should applied to Pub/Sub
messages.
Corresponds to the JSON property functionName
965 966 967 |
# File 'lib/google/apis/pubsub_v1/classes.rb', line 965 def function_name @function_name end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
972 973 974 975 |
# File 'lib/google/apis/pubsub_v1/classes.rb', line 972 def update!(**args) @code = args[:code] if args.key?(:code) @function_name = args[:function_name] if args.key?(:function_name) end |