azure_mgmt_security 0.18.1 → 0.18.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-06-01-preview/generated/azure_mgmt_security/security_center.rb +1 -1
  3. data/lib/2017-08-01-preview/generated/azure_mgmt_security/security_center.rb +1 -1
  4. data/lib/2017-08-01/generated/azure_mgmt_security/security_center.rb +1 -1
  5. data/lib/2018-06-01/generated/azure_mgmt_security/security_center.rb +1 -1
  6. data/lib/2019-01-01-preview/generated/azure_mgmt_security/security_center.rb +1 -1
  7. data/lib/2019-01-01/generated/azure_mgmt_security/security_center.rb +1 -1
  8. data/lib/2019-08-01/generated/azure_mgmt_security/security_center.rb +1 -1
  9. data/lib/2020-01-01-preview/generated/azure_mgmt_security.rb +48 -0
  10. data/lib/2020-01-01-preview/generated/azure_mgmt_security/models/asc_location.rb +73 -0
  11. data/lib/2020-01-01-preview/generated/azure_mgmt_security/models/azure_resource_link.rb +47 -0
  12. data/lib/2020-01-01-preview/generated/azure_mgmt_security/models/control_type.rb +16 -0
  13. data/lib/2020-01-01-preview/generated/azure_mgmt_security/models/etag.rb +48 -0
  14. data/lib/2020-01-01-preview/generated/azure_mgmt_security/models/expand_controls_enum.rb +15 -0
  15. data/lib/2020-01-01-preview/generated/azure_mgmt_security/models/kind.rb +46 -0
  16. data/lib/2020-01-01-preview/generated/azure_mgmt_security/models/location.rb +47 -0
  17. data/lib/2020-01-01-preview/generated/azure_mgmt_security/models/resource.rb +80 -0
  18. data/lib/2020-01-01-preview/generated/azure_mgmt_security/models/secure_score_control_definition_item.rb +141 -0
  19. data/lib/2020-01-01-preview/generated/azure_mgmt_security/models/secure_score_control_definition_list.rb +101 -0
  20. data/lib/2020-01-01-preview/generated/azure_mgmt_security/models/secure_score_control_definition_source.rb +47 -0
  21. data/lib/2020-01-01-preview/generated/azure_mgmt_security/models/secure_score_control_details.rb +153 -0
  22. data/lib/2020-01-01-preview/generated/azure_mgmt_security/models/secure_score_control_list.rb +101 -0
  23. data/lib/2020-01-01-preview/generated/azure_mgmt_security/models/secure_score_control_score.rb +69 -0
  24. data/lib/2020-01-01-preview/generated/azure_mgmt_security/models/secure_score_item.rb +104 -0
  25. data/lib/2020-01-01-preview/generated/azure_mgmt_security/models/secure_scores_list.rb +101 -0
  26. data/lib/2020-01-01-preview/generated/azure_mgmt_security/models/tags.rb +55 -0
  27. data/lib/2020-01-01-preview/generated/azure_mgmt_security/models/tracked_resource.rb +126 -0
  28. data/lib/2020-01-01-preview/generated/azure_mgmt_security/module_definition.rb +9 -0
  29. data/lib/2020-01-01-preview/generated/azure_mgmt_security/secure_score_control_definitions.rb +423 -0
  30. data/lib/2020-01-01-preview/generated/azure_mgmt_security/secure_score_controls.rb +444 -0
  31. data/lib/2020-01-01-preview/generated/azure_mgmt_security/secure_scores.rb +326 -0
  32. data/lib/2020-01-01-preview/generated/azure_mgmt_security/security_center.rb +139 -0
  33. data/lib/2020-01-01/generated/azure_mgmt_security.rb +121 -0
  34. data/lib/2020-01-01/generated/azure_mgmt_security/adaptive_application_controls.rb +394 -0
  35. data/lib/2020-01-01/generated/azure_mgmt_security/adaptive_network_hardenings.rb +539 -0
  36. data/lib/2020-01-01/generated/azure_mgmt_security/allowed_connections.rb +535 -0
  37. data/lib/2020-01-01/generated/azure_mgmt_security/assessments.rb +555 -0
  38. data/lib/2020-01-01/generated/azure_mgmt_security/assessments_metadata.rb +799 -0
  39. data/lib/2020-01-01/generated/azure_mgmt_security/discovered_security_solutions.rb +532 -0
  40. data/lib/2020-01-01/generated/azure_mgmt_security/external_security_solutions.rb +525 -0
  41. data/lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb +1295 -0
  42. data/lib/2020-01-01/generated/azure_mgmt_security/models/aad_connectivity_state.rb +17 -0
  43. data/lib/2020-01-01/generated/azure_mgmt_security/models/aad_connectivity_state1.rb +48 -0
  44. data/lib/2020-01-01/generated/azure_mgmt_security/models/aad_external_security_solution.rb +99 -0
  45. data/lib/2020-01-01/generated/azure_mgmt_security/models/aad_solution_properties.rb +83 -0
  46. data/lib/2020-01-01/generated/azure_mgmt_security/models/adaptive_network_hardening.rb +116 -0
  47. data/lib/2020-01-01/generated/azure_mgmt_security/models/adaptive_network_hardening_enforce_request.rb +77 -0
  48. data/lib/2020-01-01/generated/azure_mgmt_security/models/adaptive_network_hardenings_list.rb +99 -0
  49. data/lib/2020-01-01/generated/azure_mgmt_security/models/allowed_connections_list.rb +100 -0
  50. data/lib/2020-01-01/generated/azure_mgmt_security/models/allowed_connections_resource.rb +118 -0
  51. data/lib/2020-01-01/generated/azure_mgmt_security/models/app_whitelisting_group.rb +207 -0
  52. data/lib/2020-01-01/generated/azure_mgmt_security/models/app_whitelisting_groups.rb +56 -0
  53. data/lib/2020-01-01/generated/azure_mgmt_security/models/app_whitelisting_issue_summary.rb +61 -0
  54. data/lib/2020-01-01/generated/azure_mgmt_security/models/asc_location.rb +73 -0
  55. data/lib/2020-01-01/generated/azure_mgmt_security/models/assessment_links.rb +47 -0
  56. data/lib/2020-01-01/generated/azure_mgmt_security/models/assessment_status.rb +71 -0
  57. data/lib/2020-01-01/generated/azure_mgmt_security/models/assessment_status_code.rb +17 -0
  58. data/lib/2020-01-01/generated/azure_mgmt_security/models/assessment_type.rb +18 -0
  59. data/lib/2020-01-01/generated/azure_mgmt_security/models/ata_external_security_solution.rb +98 -0
  60. data/lib/2020-01-01/generated/azure_mgmt_security/models/ata_solution_properties.rb +87 -0
  61. data/lib/2020-01-01/generated/azure_mgmt_security/models/azure_resource_details.rb +62 -0
  62. data/lib/2020-01-01/generated/azure_mgmt_security/models/category.rb +19 -0
  63. data/lib/2020-01-01/generated/azure_mgmt_security/models/cef_external_security_solution.rb +98 -0
  64. data/lib/2020-01-01/generated/azure_mgmt_security/models/cef_solution_properties.rb +109 -0
  65. data/lib/2020-01-01/generated/azure_mgmt_security/models/connectable_resource.rb +91 -0
  66. data/lib/2020-01-01/generated/azure_mgmt_security/models/connected_resource.rb +71 -0
  67. data/lib/2020-01-01/generated/azure_mgmt_security/models/connected_workspace.rb +47 -0
  68. data/lib/2020-01-01/generated/azure_mgmt_security/models/connection_type.rb +16 -0
  69. data/lib/2020-01-01/generated/azure_mgmt_security/models/direction.rb +16 -0
  70. data/lib/2020-01-01/generated/azure_mgmt_security/models/discovered_security_solution.rb +129 -0
  71. data/lib/2020-01-01/generated/azure_mgmt_security/models/discovered_security_solution_list.rb +99 -0
  72. data/lib/2020-01-01/generated/azure_mgmt_security/models/effective_network_security_groups.rb +66 -0
  73. data/lib/2020-01-01/generated/azure_mgmt_security/models/etag.rb +48 -0
  74. data/lib/2020-01-01/generated/azure_mgmt_security/models/expand_enum.rb +16 -0
  75. data/lib/2020-01-01/generated/azure_mgmt_security/models/external_security_solution.rb +98 -0
  76. data/lib/2020-01-01/generated/azure_mgmt_security/models/external_security_solution_kind.rb +17 -0
  77. data/lib/2020-01-01/generated/azure_mgmt_security/models/external_security_solution_kind1.rb +47 -0
  78. data/lib/2020-01-01/generated/azure_mgmt_security/models/external_security_solution_list.rb +101 -0
  79. data/lib/2020-01-01/generated/azure_mgmt_security/models/external_security_solution_properties.rb +88 -0
  80. data/lib/2020-01-01/generated/azure_mgmt_security/models/implementation_effort.rb +17 -0
  81. data/lib/2020-01-01/generated/azure_mgmt_security/models/jit_network_access_policies_list.rb +99 -0
  82. data/lib/2020-01-01/generated/azure_mgmt_security/models/jit_network_access_policy.rb +149 -0
  83. data/lib/2020-01-01/generated/azure_mgmt_security/models/jit_network_access_policy_initiate_port.rb +70 -0
  84. data/lib/2020-01-01/generated/azure_mgmt_security/models/jit_network_access_policy_initiate_request.rb +68 -0
  85. data/lib/2020-01-01/generated/azure_mgmt_security/models/jit_network_access_policy_initiate_virtual_machine.rb +70 -0
  86. data/lib/2020-01-01/generated/azure_mgmt_security/models/jit_network_access_policy_virtual_machine.rb +81 -0
  87. data/lib/2020-01-01/generated/azure_mgmt_security/models/jit_network_access_port_rule.rb +103 -0
  88. data/lib/2020-01-01/generated/azure_mgmt_security/models/jit_network_access_request.rb +89 -0
  89. data/lib/2020-01-01/generated/azure_mgmt_security/models/jit_network_access_request_port.rb +128 -0
  90. data/lib/2020-01-01/generated/azure_mgmt_security/models/jit_network_access_request_virtual_machine.rb +69 -0
  91. data/lib/2020-01-01/generated/azure_mgmt_security/models/kind.rb +46 -0
  92. data/lib/2020-01-01/generated/azure_mgmt_security/models/location.rb +47 -0
  93. data/lib/2020-01-01/generated/azure_mgmt_security/models/on_premise_resource_details.rb +95 -0
  94. data/lib/2020-01-01/generated/azure_mgmt_security/models/path_recommendation.rb +156 -0
  95. data/lib/2020-01-01/generated/azure_mgmt_security/models/protection_mode.rb +80 -0
  96. data/lib/2020-01-01/generated/azure_mgmt_security/models/protocol.rb +17 -0
  97. data/lib/2020-01-01/generated/azure_mgmt_security/models/publisher_info.rb +84 -0
  98. data/lib/2020-01-01/generated/azure_mgmt_security/models/resource.rb +80 -0
  99. data/lib/2020-01-01/generated/azure_mgmt_security/models/resource_details.rb +47 -0
  100. data/lib/2020-01-01/generated/azure_mgmt_security/models/rule.rb +111 -0
  101. data/lib/2020-01-01/generated/azure_mgmt_security/models/security_assessment.rb +156 -0
  102. data/lib/2020-01-01/generated/azure_mgmt_security/models/security_assessment_list.rb +101 -0
  103. data/lib/2020-01-01/generated/azure_mgmt_security/models/security_assessment_metadata.rb +221 -0
  104. data/lib/2020-01-01/generated/azure_mgmt_security/models/security_assessment_metadata_list.rb +100 -0
  105. data/lib/2020-01-01/generated/azure_mgmt_security/models/security_assessment_metadata_partner_data.rb +70 -0
  106. data/lib/2020-01-01/generated/azure_mgmt_security/models/security_assessment_metadata_properties.rb +194 -0
  107. data/lib/2020-01-01/generated/azure_mgmt_security/models/security_assessment_partner_data.rb +57 -0
  108. data/lib/2020-01-01/generated/azure_mgmt_security/models/security_family.rb +18 -0
  109. data/lib/2020-01-01/generated/azure_mgmt_security/models/server_vulnerability_assessment.rb +76 -0
  110. data/lib/2020-01-01/generated/azure_mgmt_security/models/server_vulnerability_assessments_list.rb +55 -0
  111. data/lib/2020-01-01/generated/azure_mgmt_security/models/severity.rb +17 -0
  112. data/lib/2020-01-01/generated/azure_mgmt_security/models/status.rb +16 -0
  113. data/lib/2020-01-01/generated/azure_mgmt_security/models/status_reason.rb +17 -0
  114. data/lib/2020-01-01/generated/azure_mgmt_security/models/tags.rb +55 -0
  115. data/lib/2020-01-01/generated/azure_mgmt_security/models/threats.rb +22 -0
  116. data/lib/2020-01-01/generated/azure_mgmt_security/models/topology_list.rb +100 -0
  117. data/lib/2020-01-01/generated/azure_mgmt_security/models/topology_resource.rb +118 -0
  118. data/lib/2020-01-01/generated/azure_mgmt_security/models/topology_single_resource.rb +154 -0
  119. data/lib/2020-01-01/generated/azure_mgmt_security/models/topology_single_resource_child.rb +49 -0
  120. data/lib/2020-01-01/generated/azure_mgmt_security/models/topology_single_resource_parent.rb +49 -0
  121. data/lib/2020-01-01/generated/azure_mgmt_security/models/tracked_resource.rb +126 -0
  122. data/lib/2020-01-01/generated/azure_mgmt_security/models/transport_protocol.rb +16 -0
  123. data/lib/2020-01-01/generated/azure_mgmt_security/models/user_impact.rb +17 -0
  124. data/lib/2020-01-01/generated/azure_mgmt_security/models/user_recommendation.rb +58 -0
  125. data/lib/2020-01-01/generated/azure_mgmt_security/models/vm_recommendation.rb +81 -0
  126. data/lib/2020-01-01/generated/azure_mgmt_security/module_definition.rb +9 -0
  127. data/lib/2020-01-01/generated/azure_mgmt_security/security_center.rb +172 -0
  128. data/lib/2020-01-01/generated/azure_mgmt_security/server_vulnerability_assessment_operations.rb +462 -0
  129. data/lib/2020-01-01/generated/azure_mgmt_security/topology.rb +530 -0
  130. data/lib/azure_mgmt_security.rb +2 -0
  131. data/lib/profiles/latest/modules/security_profile_module.rb +366 -258
  132. data/lib/version.rb +1 -1
  133. metadata +123 -2
@@ -0,0 +1,462 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Security::Mgmt::V2020_01_01
7
+ #
8
+ # API spec for Microsoft.Security (Azure Security Center) resource provider
9
+ #
10
+ class ServerVulnerabilityAssessmentOperations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the ServerVulnerabilityAssessmentOperations class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [SecurityCenter] reference to the SecurityCenter
22
+ attr_reader :client
23
+
24
+ #
25
+ # Gets a list of server vulnerability assessment onboarding statuses on a given
26
+ # resource.
27
+ #
28
+ # @param resource_group_name [String] The name of the resource group within the
29
+ # user's subscription. The name is case insensitive.
30
+ # @param resource_namespace [String] The Namespace of the resource.
31
+ # @param resource_type [String] The type of the resource.
32
+ # @param resource_name [String] Name of the resource.
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ # @return [ServerVulnerabilityAssessmentsList] operation results.
37
+ #
38
+ def list_by_extended_resource(resource_group_name, resource_namespace, resource_type, resource_name, custom_headers:nil)
39
+ response = list_by_extended_resource_async(resource_group_name, resource_namespace, resource_type, resource_name, custom_headers:custom_headers).value!
40
+ response.body unless response.nil?
41
+ end
42
+
43
+ #
44
+ # Gets a list of server vulnerability assessment onboarding statuses on a given
45
+ # resource.
46
+ #
47
+ # @param resource_group_name [String] The name of the resource group within the
48
+ # user's subscription. The name is case insensitive.
49
+ # @param resource_namespace [String] The Namespace of the resource.
50
+ # @param resource_type [String] The type of the resource.
51
+ # @param resource_name [String] Name of the resource.
52
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
53
+ # will be added to the HTTP request.
54
+ #
55
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
56
+ #
57
+ def list_by_extended_resource_with_http_info(resource_group_name, resource_namespace, resource_type, resource_name, custom_headers:nil)
58
+ list_by_extended_resource_async(resource_group_name, resource_namespace, resource_type, resource_name, custom_headers:custom_headers).value!
59
+ end
60
+
61
+ #
62
+ # Gets a list of server vulnerability assessment onboarding statuses on a given
63
+ # resource.
64
+ #
65
+ # @param resource_group_name [String] The name of the resource group within the
66
+ # user's subscription. The name is case insensitive.
67
+ # @param resource_namespace [String] The Namespace of the resource.
68
+ # @param resource_type [String] The type of the resource.
69
+ # @param resource_name [String] Name of the resource.
70
+ # @param [Hash{String => String}] A hash of custom headers that will be added
71
+ # to the HTTP request.
72
+ #
73
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
74
+ #
75
+ def list_by_extended_resource_async(resource_group_name, resource_namespace, resource_type, resource_name, custom_headers:nil)
76
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
77
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
78
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
79
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
80
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
81
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
82
+ fail ArgumentError, 'resource_namespace is nil' if resource_namespace.nil?
83
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
84
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
85
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
86
+
87
+
88
+ request_headers = {}
89
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
90
+
91
+ # Set Headers
92
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
93
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
94
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments'
95
+
96
+ request_url = @base_url || @client.base_url
97
+
98
+ options = {
99
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
100
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceNamespace' => resource_namespace,'resourceType' => resource_type,'resourceName' => resource_name},
101
+ query_params: {'api-version' => @client.api_version},
102
+ headers: request_headers.merge(custom_headers || {}),
103
+ base_url: request_url
104
+ }
105
+ promise = @client.make_request_async(:get, path_template, options)
106
+
107
+ promise = promise.then do |result|
108
+ http_response = result.response
109
+ status_code = http_response.status
110
+ response_content = http_response.body
111
+ unless status_code == 200
112
+ error_model = JSON.load(response_content)
113
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
114
+ end
115
+
116
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
117
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
118
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
119
+ # Deserialize Response
120
+ if status_code == 200
121
+ begin
122
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
123
+ result_mapper = Azure::Security::Mgmt::V2020_01_01::Models::ServerVulnerabilityAssessmentsList.mapper()
124
+ result.body = @client.deserialize(result_mapper, parsed_response)
125
+ rescue Exception => e
126
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
127
+ end
128
+ end
129
+
130
+ result
131
+ end
132
+
133
+ promise.execute
134
+ end
135
+
136
+ #
137
+ # Gets a server vulnerability assessment onboarding statuses on a given
138
+ # resource.
139
+ #
140
+ # @param resource_group_name [String] The name of the resource group within the
141
+ # user's subscription. The name is case insensitive.
142
+ # @param resource_namespace [String] The Namespace of the resource.
143
+ # @param resource_type [String] The type of the resource.
144
+ # @param resource_name [String] Name of the resource.
145
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
146
+ # will be added to the HTTP request.
147
+ #
148
+ # @return [ServerVulnerabilityAssessment] operation results.
149
+ #
150
+ def get(resource_group_name, resource_namespace, resource_type, resource_name, custom_headers:nil)
151
+ response = get_async(resource_group_name, resource_namespace, resource_type, resource_name, custom_headers:custom_headers).value!
152
+ response.body unless response.nil?
153
+ end
154
+
155
+ #
156
+ # Gets a server vulnerability assessment onboarding statuses on a given
157
+ # resource.
158
+ #
159
+ # @param resource_group_name [String] The name of the resource group within the
160
+ # user's subscription. The name is case insensitive.
161
+ # @param resource_namespace [String] The Namespace of the resource.
162
+ # @param resource_type [String] The type of the resource.
163
+ # @param resource_name [String] Name of the resource.
164
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
165
+ # will be added to the HTTP request.
166
+ #
167
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
168
+ #
169
+ def get_with_http_info(resource_group_name, resource_namespace, resource_type, resource_name, custom_headers:nil)
170
+ get_async(resource_group_name, resource_namespace, resource_type, resource_name, custom_headers:custom_headers).value!
171
+ end
172
+
173
+ #
174
+ # Gets a server vulnerability assessment onboarding statuses on a given
175
+ # resource.
176
+ #
177
+ # @param resource_group_name [String] The name of the resource group within the
178
+ # user's subscription. The name is case insensitive.
179
+ # @param resource_namespace [String] The Namespace of the resource.
180
+ # @param resource_type [String] The type of the resource.
181
+ # @param resource_name [String] Name of the resource.
182
+ # @param [Hash{String => String}] A hash of custom headers that will be added
183
+ # to the HTTP request.
184
+ #
185
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
186
+ #
187
+ def get_async(resource_group_name, resource_namespace, resource_type, resource_name, custom_headers:nil)
188
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
189
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
190
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
191
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
192
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
193
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
194
+ fail ArgumentError, 'resource_namespace is nil' if resource_namespace.nil?
195
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
196
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
197
+ server_vulnerability_assessment = 'default'
198
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
199
+
200
+
201
+ request_headers = {}
202
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
203
+
204
+ # Set Headers
205
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
206
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
207
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}'
208
+
209
+ request_url = @base_url || @client.base_url
210
+
211
+ options = {
212
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
213
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceNamespace' => resource_namespace,'resourceType' => resource_type,'resourceName' => resource_name,'serverVulnerabilityAssessment' => server_vulnerability_assessment},
214
+ query_params: {'api-version' => @client.api_version},
215
+ headers: request_headers.merge(custom_headers || {}),
216
+ base_url: request_url
217
+ }
218
+ promise = @client.make_request_async(:get, path_template, options)
219
+
220
+ promise = promise.then do |result|
221
+ http_response = result.response
222
+ status_code = http_response.status
223
+ response_content = http_response.body
224
+ unless status_code == 200
225
+ error_model = JSON.load(response_content)
226
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
227
+ end
228
+
229
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
230
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
231
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
232
+ # Deserialize Response
233
+ if status_code == 200
234
+ begin
235
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
236
+ result_mapper = Azure::Security::Mgmt::V2020_01_01::Models::ServerVulnerabilityAssessment.mapper()
237
+ result.body = @client.deserialize(result_mapper, parsed_response)
238
+ rescue Exception => e
239
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
240
+ end
241
+ end
242
+
243
+ result
244
+ end
245
+
246
+ promise.execute
247
+ end
248
+
249
+ #
250
+ # Creating a server vulnerability assessment on a resource, which will onboard
251
+ # a resource for having a vulnerability assessment on it
252
+ #
253
+ # @param resource_group_name [String] The name of the resource group within the
254
+ # user's subscription. The name is case insensitive.
255
+ # @param resource_namespace [String] The Namespace of the resource.
256
+ # @param resource_type [String] The type of the resource.
257
+ # @param resource_name [String] Name of the resource.
258
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
259
+ # will be added to the HTTP request.
260
+ #
261
+ # @return [ServerVulnerabilityAssessment] operation results.
262
+ #
263
+ def create_or_update(resource_group_name, resource_namespace, resource_type, resource_name, custom_headers:nil)
264
+ response = create_or_update_async(resource_group_name, resource_namespace, resource_type, resource_name, custom_headers:custom_headers).value!
265
+ response.body unless response.nil?
266
+ end
267
+
268
+ #
269
+ # Creating a server vulnerability assessment on a resource, which will onboard
270
+ # a resource for having a vulnerability assessment on it
271
+ #
272
+ # @param resource_group_name [String] The name of the resource group within the
273
+ # user's subscription. The name is case insensitive.
274
+ # @param resource_namespace [String] The Namespace of the resource.
275
+ # @param resource_type [String] The type of the resource.
276
+ # @param resource_name [String] Name of the resource.
277
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
278
+ # will be added to the HTTP request.
279
+ #
280
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
281
+ #
282
+ def create_or_update_with_http_info(resource_group_name, resource_namespace, resource_type, resource_name, custom_headers:nil)
283
+ create_or_update_async(resource_group_name, resource_namespace, resource_type, resource_name, custom_headers:custom_headers).value!
284
+ end
285
+
286
+ #
287
+ # Creating a server vulnerability assessment on a resource, which will onboard
288
+ # a resource for having a vulnerability assessment on it
289
+ #
290
+ # @param resource_group_name [String] The name of the resource group within the
291
+ # user's subscription. The name is case insensitive.
292
+ # @param resource_namespace [String] The Namespace of the resource.
293
+ # @param resource_type [String] The type of the resource.
294
+ # @param resource_name [String] Name of the resource.
295
+ # @param [Hash{String => String}] A hash of custom headers that will be added
296
+ # to the HTTP request.
297
+ #
298
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
299
+ #
300
+ def create_or_update_async(resource_group_name, resource_namespace, resource_type, resource_name, custom_headers:nil)
301
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
302
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
303
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
304
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
305
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
306
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
307
+ fail ArgumentError, 'resource_namespace is nil' if resource_namespace.nil?
308
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
309
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
310
+ server_vulnerability_assessment = 'default'
311
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
312
+
313
+
314
+ request_headers = {}
315
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
316
+
317
+ # Set Headers
318
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
319
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
320
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}'
321
+
322
+ request_url = @base_url || @client.base_url
323
+
324
+ options = {
325
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
326
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceNamespace' => resource_namespace,'resourceType' => resource_type,'resourceName' => resource_name,'serverVulnerabilityAssessment' => server_vulnerability_assessment},
327
+ query_params: {'api-version' => @client.api_version},
328
+ headers: request_headers.merge(custom_headers || {}),
329
+ base_url: request_url
330
+ }
331
+ promise = @client.make_request_async(:put, path_template, options)
332
+
333
+ promise = promise.then do |result|
334
+ http_response = result.response
335
+ status_code = http_response.status
336
+ response_content = http_response.body
337
+ unless status_code == 202
338
+ error_model = JSON.load(response_content)
339
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
340
+ end
341
+
342
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
343
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
344
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
345
+ # Deserialize Response
346
+ if status_code == 202
347
+ begin
348
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
349
+ result_mapper = Azure::Security::Mgmt::V2020_01_01::Models::ServerVulnerabilityAssessment.mapper()
350
+ result.body = @client.deserialize(result_mapper, parsed_response)
351
+ rescue Exception => e
352
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
353
+ end
354
+ end
355
+
356
+ result
357
+ end
358
+
359
+ promise.execute
360
+ end
361
+
362
+ #
363
+ # Removing server vulnerability assessment from a resource.
364
+ #
365
+ # @param resource_group_name [String] The name of the resource group within the
366
+ # user's subscription. The name is case insensitive.
367
+ # @param resource_namespace [String] The Namespace of the resource.
368
+ # @param resource_type [String] The type of the resource.
369
+ # @param resource_name [String] Name of the resource.
370
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
371
+ # will be added to the HTTP request.
372
+ #
373
+ #
374
+ def delete(resource_group_name, resource_namespace, resource_type, resource_name, custom_headers:nil)
375
+ response = delete_async(resource_group_name, resource_namespace, resource_type, resource_name, custom_headers:custom_headers).value!
376
+ nil
377
+ end
378
+
379
+ #
380
+ # Removing server vulnerability assessment from a resource.
381
+ #
382
+ # @param resource_group_name [String] The name of the resource group within the
383
+ # user's subscription. The name is case insensitive.
384
+ # @param resource_namespace [String] The Namespace of the resource.
385
+ # @param resource_type [String] The type of the resource.
386
+ # @param resource_name [String] Name of the resource.
387
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
388
+ # will be added to the HTTP request.
389
+ #
390
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
391
+ #
392
+ def delete_with_http_info(resource_group_name, resource_namespace, resource_type, resource_name, custom_headers:nil)
393
+ delete_async(resource_group_name, resource_namespace, resource_type, resource_name, custom_headers:custom_headers).value!
394
+ end
395
+
396
+ #
397
+ # Removing server vulnerability assessment from a resource.
398
+ #
399
+ # @param resource_group_name [String] The name of the resource group within the
400
+ # user's subscription. The name is case insensitive.
401
+ # @param resource_namespace [String] The Namespace of the resource.
402
+ # @param resource_type [String] The type of the resource.
403
+ # @param resource_name [String] Name of the resource.
404
+ # @param [Hash{String => String}] A hash of custom headers that will be added
405
+ # to the HTTP request.
406
+ #
407
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
408
+ #
409
+ def delete_async(resource_group_name, resource_namespace, resource_type, resource_name, custom_headers:nil)
410
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
411
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
412
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
413
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
414
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
415
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
416
+ fail ArgumentError, 'resource_namespace is nil' if resource_namespace.nil?
417
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
418
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
419
+ server_vulnerability_assessment = 'default'
420
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
421
+
422
+
423
+ request_headers = {}
424
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
425
+
426
+ # Set Headers
427
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
428
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
429
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}'
430
+
431
+ request_url = @base_url || @client.base_url
432
+
433
+ options = {
434
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
435
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceNamespace' => resource_namespace,'resourceType' => resource_type,'resourceName' => resource_name,'serverVulnerabilityAssessment' => server_vulnerability_assessment},
436
+ query_params: {'api-version' => @client.api_version},
437
+ headers: request_headers.merge(custom_headers || {}),
438
+ base_url: request_url
439
+ }
440
+ promise = @client.make_request_async(:delete, path_template, options)
441
+
442
+ promise = promise.then do |result|
443
+ http_response = result.response
444
+ status_code = http_response.status
445
+ response_content = http_response.body
446
+ unless status_code == 200 || status_code == 204
447
+ error_model = JSON.load(response_content)
448
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
449
+ end
450
+
451
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
452
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
453
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
454
+
455
+ result
456
+ end
457
+
458
+ promise.execute
459
+ end
460
+
461
+ end
462
+ end