Class: Falcon::Cloud
- Inherits:
-
Object
- Object
- Falcon::Cloud
- Defined in:
- lib/crimson-falcon/cloud.rb
Overview
Validates and returns the cloud to use for API Requests.
Constant Summary collapse
- VALID_CLOUDS =
{ "us-1" => "api.crowdstrike.com", "us-2" => "api.us-2.crowdstrike.com", "us-gov-1" => "api.laggar.gcw.crowdstrike.com", "eu-1" => "api.eu-1.crowdstrike.com", }.freeze
Instance Attribute Summary collapse
-
#cloud ⇒ String
readonly
The name of the cloud instance.
Instance Method Summary collapse
-
#host ⇒ String
Returns the host name for the current cloud instance.
-
#initialize(cloud) ⇒ Cloud
constructor
Initializes a new ‘Cloud` instance with the specified cloud name.
Constructor Details
#initialize(cloud) ⇒ Cloud
Initializes a new ‘Cloud` instance with the specified cloud name.
42 43 44 45 46 47 |
# File 'lib/crimson-falcon/cloud.rb', line 42 def initialize(cloud) = "Invalid cloud '#{cloud}'. Valid clouds are: #{VALID_CLOUDS.keys.map { |c| "'#{c}'" }.join(", ")}" raise ArgumentError, unless VALID_CLOUDS.key?(cloud) @cloud = cloud end |
Instance Attribute Details
#cloud ⇒ String (readonly)
The name of the cloud instance.
59 60 61 |
# File 'lib/crimson-falcon/cloud.rb', line 59 def cloud @cloud end |
Instance Method Details
#host ⇒ String
Returns the host name for the current cloud instance.
52 53 54 |
# File 'lib/crimson-falcon/cloud.rb', line 52 def host VALID_CLOUDS[cloud] end |