Class: Auth0::LogStreams::Client
- Inherits:
-
Object
- Object
- Auth0::LogStreams::Client
- Defined in:
- lib/auth0/log_streams/client.rb
Instance Method Summary collapse
-
#create(request_options: {}, **params) ⇒ Auth0::Types::CreateLogStreamResponseContent
Create a log stream.
-
#delete(request_options: {}, **params) ⇒ untyped
Delete a log stream.
-
#get(request_options: {}, **params) ⇒ Auth0::Types::GetLogStreamResponseContent
Retrieve a log stream configuration and status.
- #initialize(client:) ⇒ void constructor
-
#list(request_options: {}, **params) ⇒ Array[Auth0::Types::LogStreamResponseSchema]
Retrieve details on <a href=“auth0.com/docs/logs/streams”>log streams</a>.
-
#update(request_options: {}, **params) ⇒ Auth0::Types::UpdateLogStreamResponseContent
Update a log stream.
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/auth0/log_streams/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#create(request_options: {}, **params) ⇒ Auth0::Types::CreateLogStreamResponseContent
Create a log stream. <h5>Log Stream Types</h5> The type of log stream being created determines the properties required in the sink payload. <h5>HTTP Stream</h5> For an http Stream, the sink properties are listed in the payload below Request: <pre>{ "name": "string", "type": "http", "sink": { "httpEndpoint": "string", "httpContentType": "string", "httpContentFormat": "JSONLINES|JSONARRAY", "httpAuthorization": "string" } }</pre> Response: <pre>{ "id": "string", "name": "string", "type": "http", "status": "active", "sink": { "httpEndpoint": "string", "httpContentType": "string", "httpContentFormat": "JSONLINES|JSONARRAY", "httpAuthorization": "string" } }</pre> <h5>Amazon EventBridge Stream</h5> For an eventbridge Stream, the sink properties are listed in the payload below Request: <pre>{ "name": "string", "type": "eventbridge", "sink": { "awsRegion": "string", "awsAccountId": "string" } }</pre> The response will include an additional field awsPartnerEventSource in the sink: <pre>{ "id": "string", "name": "string", "type": "eventbridge", "status": "active", "sink": { "awsAccountId": "string", "awsRegion": "string", "awsPartnerEventSource": "string" } }</pre> <h5>Azure Event Grid Stream</h5> For an Azure Event Grid Stream, the sink properties are listed in the payload below Request: <pre>{ "name": "string", "type": "eventgrid", "sink": { "azureSubscriptionId": "string", "azureResourceGroup": "string", "azureRegion": "string" } }</pre> Response: <pre>{ "id": "string", "name": "string", "type": "http", "status": "active", "sink": { "azureSubscriptionId": "string", "azureResourceGroup": "string", "azureRegion": "string", "azurePartnerTopic": "string" } }</pre> <h5>Datadog Stream</h5> For a Datadog Stream, the sink properties are listed in the payload below Request: <pre>{ "name": "string", "type": "datadog", "sink": { "datadogRegion": "string", "datadogApiKey": "string" } }</pre> Response: <pre>{ "id": "string", "name": "string", "type": "datadog", "status": "active", "sink": { "datadogRegion": "string", "datadogApiKey": "string" } }</pre> <h5>Splunk Stream</h5> For a Splunk Stream, the sink properties are listed in the payload below Request: <pre>{ "name": "string", "type": "splunk", "sink": { "splunkDomain": "string", "splunkToken": "string", "splunkPort": "string", "splunkSecure": "boolean" } }</pre> Response: <pre>{ "id": "string", "name": "string", "type": "splunk", "status": "active", "sink": { "splunkDomain": "string", "splunkToken": "string", "splunkPort": "string", "splunkSecure": "boolean" } }</pre> <h5>Sumo Logic Stream</h5> For a Sumo Logic Stream, the sink properties are listed in the payload below Request: <pre>{ "name": "string", "type": "sumo", "sink": { "sumoSourceAddress": "string", } }</pre> Response: <pre>{ "id": "string", "name": "string", "type": "sumo", "status": "active", "sink": { "sumoSourceAddress": "string", } }</pre>
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/auth0/log_streams/client.rb', line 253 def create(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "log-streams", body: Auth0::Types::CreateLogStreamRequestContent.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Auth0::Types::CreateLogStreamResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete(request_options: {}, **params) ⇒ untyped
Delete a log stream.
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 |
# File 'lib/auth0/log_streams/client.rb', line 423 def delete(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "log-streams/#{URI.encode_uri_component(params[:id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i return if code.between?(200, 299) error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end |
#get(request_options: {}, **params) ⇒ Auth0::Types::GetLogStreamResponseContent
Retrieve a log stream configuration and status. <h5>Sample responses</h5><h5>Amazon EventBridge Log Stream</h5><pre>{ "id": "string", "name": "string", "type": "eventbridge", "status": "active|paused|suspended", "sink": { "awsAccountId": "string", "awsRegion": "string", "awsPartnerEventSource": "string" } }</pre> <h5>HTTP Log Stream</h5><pre>{ "id": "string", "name": "string", "type": "http", "status": "active|paused|suspended", "sink": { "httpContentFormat": "JSONLINES|JSONARRAY", "httpContentType": "string", "httpEndpoint": "string", "httpAuthorization": "string" } }</pre> <h5>Datadog Log Stream</h5><pre><code>{ “id”: “string”, “name”: “string”, “type”: “datadog”, “status”: “active|paused|suspended”, “sink”: { “datadogRegion”: “string”, “datadogApiKey”: “string” }
}</code></pre><h5>Mixpanel</h5>
Request: <pre>{ "name": "string", "type": "mixpanel", "sink": { "mixpanelRegion": "string", // "us" | "eu", "mixpanelProjectId": "string", "mixpanelServiceAccountUsername": "string", "mixpanelServiceAccountPassword": "string" } } </pre>
Response: <pre>{ "id": "string", "name": "string", "type": "mixpanel", "status": "active", "sink": { "mixpanelRegion": "string", // "us" | "eu", "mixpanelProjectId": "string", "mixpanelServiceAccountUsername": "string", "mixpanelServiceAccountPassword": "string" // the following is redacted on return } } </pre>
<h5>Segment</h5>
Request: <pre> { "name": "string", "type": "segment", "sink": { "segmentWriteKey": "string" } }</pre>
Response: <pre>{ "id": "string", "name": "string", "type": "segment", "status": "active", "sink": { "segmentWriteKey": "string" } } </pre>
<h5>Splunk Log Stream</h5><pre>{ "id": "string", "name": "string", "type": "splunk", "status": "active|paused|suspended", "sink": { "splunkDomain": "string", "splunkToken": "string", "splunkPort": "string", "splunkSecure": "boolean" } }</pre> <h5>Sumo Logic Log Stream</h5><pre>{ "id": "string", "name": "string", "type": "sumo", "status": "active|paused|suspended", "sink": { "sumoSourceAddress": "string", } }</pre> <h5>Status</h5> The status of a log stream maybe any of the following:
-
active- Stream is currently enabled. -
paused- Stream is currently user disabled and will not attempt log delivery. -
suspended- Stream is currently disabled because of errors and will not attempt log delivery.
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 |
# File 'lib/auth0/log_streams/client.rb', line 389 def get(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "log-streams/#{URI.encode_uri_component(params[:id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Auth0::Types::GetLogStreamResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list(request_options: {}, **params) ⇒ Array[Auth0::Types::LogStreamResponseSchema]
Retrieve details on <a href=“auth0.com/docs/logs/streams”>log streams</a>. <h5>Sample Response</h5><pre>[{ "id": "string", "name": "string", "type": "eventbridge", "status": "active|paused|suspended", "sink": { "awsAccountId": "string", "awsRegion": "string", "awsPartnerEventSource": "string" } }, { "id": "string", "name": "string", "type": "http", "status": "active|paused|suspended", "sink": { "httpContentFormat": "JSONLINES|JSONARRAY", "httpContentType": "string", "httpEndpoint": "string", "httpAuthorization": "string" } }, { "id": "string", "name": "string", "type": "eventgrid", "status": "active|paused|suspended", "sink": { "azureSubscriptionId": "string", "azureResourceGroup": "string", "azureRegion": "string", "azurePartnerTopic": "string" } }, { "id": "string", "name": "string", "type": "splunk", "status": "active|paused|suspended", "sink": { "splunkDomain": "string", "splunkToken": "string", "splunkPort": "string", "splunkSecure": "boolean" } }, { "id": "string", "name": "string", "type": "sumo", "status": "active|paused|suspended", "sink": { "sumoSourceAddress": "string", } }, { "id": "string", "name": "string", "type": "datadog", "status": "active|paused|suspended", "sink": { "datadogRegion": "string", "datadogApiKey": "string" } }]</pre>
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/auth0/log_streams/client.rb', line 89 def list(request_options: {}, **params) Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "log-streams", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i return if code.between?(200, 299) error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end |
#update(request_options: {}, **params) ⇒ Auth0::Types::UpdateLogStreamResponseContent
Update a log stream. <h4>Examples of how to use the PATCH endpoint.</h4> The following fields may be updated in a PATCH operation: <ul><li>name</li><li>status</li><li>sink</li></ul> Note: For log streams of type eventbridge and eventgrid, updating the sink is not permitted. <h5>Update the status of a log stream</h5><pre>{ "status": "active|paused" }</pre> <h5>Update the name of a log stream</h5><pre>{ "name": "string" }</pre> <h5>Update the sink properties of a stream of type http</h5><pre><code>{
"sink": {
"httpEndpoint": "string",
"httpContentType": "string",
"httpContentFormat": "JSONARRAY|JSONLINES",
"httpAuthorization": "string"
}
}</code></pre> <h5>Update the sink properties of a stream of type datadog</h5><pre><code>
"sink": {
“datadogRegion”: “string”, “datadogApiKey”: “string”
}</code></pre> <h5>Update the sink properties of a stream of type splunk</h5><pre><code>{
"sink": {
"splunkDomain": "string",
"splunkToken": "string",
"splunkPort": "string",
"splunkSecure": "boolean"
}
}</code></pre> <h5>Update the sink properties of a stream of type sumo</h5><pre><code>{
"sink": {
"sumoSourceAddress": "string"
}
}</code></pre>
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 |
# File 'lib/auth0/log_streams/client.rb', line 491 def update(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request_data = Auth0::LogStreams::Types::UpdateLogStreamRequestContent.new(params).to_h non_body_param_names = ["id"] body = request_data.except(*non_body_param_names) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "PATCH", path: "log-streams/#{URI.encode_uri_component(params[:id].to_s)}", body: body, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Auth0::Types::UpdateLogStreamResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |