Class: SemgrepWebApp::UpdatePolicyRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- SemgrepWebApp::UpdatePolicyRequest
- Defined in:
- lib/semgrep_web_app/models/update_policy_request.rb
Overview
UpdatePolicyRequest Model.
Instance Attribute Summary collapse
-
#deployment_id ⇒ String
Deployment ID (numeric).
-
#policy_id ⇒ String
Policy ID (numeric).
-
#policy_mode ⇒ PolicyMode3
New policy mode to set for the Rule.
-
#rule_path ⇒ String
Full path of the Rule.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(deployment_id:, policy_id:, policy_mode:, rule_path:, additional_properties: nil) ⇒ UpdatePolicyRequest
constructor
A new instance of UpdatePolicyRequest.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(deployment_id:, policy_id:, policy_mode:, rule_path:, additional_properties: nil) ⇒ UpdatePolicyRequest
Returns a new instance of UpdatePolicyRequest.
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/semgrep_web_app/models/update_policy_request.rb', line 60 def initialize(deployment_id:, policy_id:, policy_mode:, rule_path:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @deployment_id = deployment_id @policy_id = policy_id @policy_mode = policy_mode @rule_path = rule_path @additional_properties = additional_properties end |
Instance Attribute Details
#deployment_id ⇒ String
Deployment ID (numeric). Example: 123. Can be found at /deployments,
or in your Settings in the web UI.
15 16 17 |
# File 'lib/semgrep_web_app/models/update_policy_request.rb', line 15 def deployment_id @deployment_id end |
#policy_id ⇒ String
Policy ID (numeric). Example: 456. Can be found at
/deployments/{deploymentId}/policies.
20 21 22 |
# File 'lib/semgrep_web_app/models/update_policy_request.rb', line 20 def policy_id @policy_id end |
#policy_mode ⇒ PolicyMode3
New policy mode to set for the Rule.
- MODE_MONITOR: Monitor mode, silently report findings
- MODE_COMMENT: Comment mode, leaves PR comments but does not block
- MODE_BLOCK: Block mode, leaves PR comments and blocks PR
- MODE_DISABLED: Disabled mode, not active
| value | description |
|---|---|
| MODE_MONITOR | Monitor mode, silently report findings |
| MODE_COMMENT | Comment mode, leaves PR comments but does not block |
| MODE_BLOCK | Block mode, leaves PR comments and blocks PR |
| MODE_DISABLED | Disabled mode, not active |
34 35 36 |
# File 'lib/semgrep_web_app/models/update_policy_request.rb', line 34 def policy_mode @policy_mode end |
#rule_path ⇒ String
Full path of the Rule.
38 39 40 |
# File 'lib/semgrep_web_app/models/update_policy_request.rb', line 38 def rule_path @rule_path end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/semgrep_web_app/models/update_policy_request.rb', line 73 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. deployment_id = hash.key?('deploymentId') ? hash['deploymentId'] : nil policy_id = hash.key?('policyId') ? hash['policyId'] : nil policy_mode = hash.key?('policyMode') ? hash['policyMode'] : nil rule_path = hash.key?('rulePath') ? hash['rulePath'] : nil # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. UpdatePolicyRequest.new(deployment_id: deployment_id, policy_id: policy_id, policy_mode: policy_mode, rule_path: rule_path, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 |
# File 'lib/semgrep_web_app/models/update_policy_request.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['deployment_id'] = 'deploymentId' @_hash['policy_id'] = 'policyId' @_hash['policy_mode'] = 'policyMode' @_hash['rule_path'] = 'rulePath' @_hash end |
.nullables ⇒ Object
An array for nullable fields
56 57 58 |
# File 'lib/semgrep_web_app/models/update_policy_request.rb', line 56 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
51 52 53 |
# File 'lib/semgrep_web_app/models/update_policy_request.rb', line 51 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
106 107 108 109 110 111 |
# File 'lib/semgrep_web_app/models/update_policy_request.rb', line 106 def inspect class_name = self.class.name.split('::').last "<#{class_name} deployment_id: #{@deployment_id.inspect}, policy_id: #{@policy_id.inspect},"\ " policy_mode: #{@policy_mode.inspect}, rule_path: #{@rule_path.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
98 99 100 101 102 103 |
# File 'lib/semgrep_web_app/models/update_policy_request.rb', line 98 def to_s class_name = self.class.name.split('::').last "<#{class_name} deployment_id: #{@deployment_id}, policy_id: #{@policy_id}, policy_mode:"\ " #{@policy_mode}, rule_path: #{@rule_path}, additional_properties:"\ " #{@additional_properties}>" end |