Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR sql/resource-manager] Adding VA support for manged instance - Update readme.md #3482

Merged
merged 2 commits into from
Oct 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion azure-mgmt-sql/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
include *.rst
include azure_bdist_wheel.py
2 changes: 1 addition & 1 deletion azure-mgmt-sql/azure/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
2 changes: 1 addition & 1 deletion azure-mgmt-sql/azure/mgmt/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
6 changes: 6 additions & 0 deletions azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
from .elastic_pool_operations import ElasticPoolOperations
from .capabilities_operations import CapabilitiesOperations
from .database_vulnerability_assessment_scans_operations import DatabaseVulnerabilityAssessmentScansOperations
from .managed_database_vulnerability_assessment_rule_baselines_operations import ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations
from .managed_database_vulnerability_assessment_scans_operations import ManagedDatabaseVulnerabilityAssessmentScansOperations
from .managed_database_vulnerability_assessments_operations import ManagedDatabaseVulnerabilityAssessmentsOperations
from .instance_failover_groups_operations import InstanceFailoverGroupsOperations
from .backup_short_term_retention_policies_operations import BackupShortTermRetentionPoliciesOperations
from .tde_certificates_operations import TdeCertificatesOperations
Expand Down Expand Up @@ -137,6 +140,9 @@
'ElasticPoolOperations',
'CapabilitiesOperations',
'DatabaseVulnerabilityAssessmentScansOperations',
'ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations',
'ManagedDatabaseVulnerabilityAssessmentScansOperations',
'ManagedDatabaseVulnerabilityAssessmentsOperations',
'InstanceFailoverGroupsOperations',
'BackupShortTermRetentionPoliciesOperations',
'TdeCertificatesOperations',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,281 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError

from .. import models


class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations(object):
"""ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations operations.

:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar vulnerability_assessment_name: The name of the vulnerability assessment. Constant value: "default".
:ivar api_version: The API version to use for the request. Constant value: "2017-10-01-preview".
"""

models = models

def __init__(self, client, config, serializer, deserializer):

self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.vulnerability_assessment_name = "default"
self.api_version = "2017-10-01-preview"

self.config = config

def get(
self, resource_group_name, managed_instance_name, database_name, rule_id, baseline_name, custom_headers=None, raw=False, **operation_config):
"""Gets a database's vulnerability assessment rule baseline.

:param resource_group_name: The name of the resource group that
contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal.
:type resource_group_name: str
:param managed_instance_name: The name of the managed instance.
:type managed_instance_name: str
:param database_name: The name of the database for which the
vulnerability assessment rule baseline is defined.
:type database_name: str
:param rule_id: The vulnerability assessment rule ID.
:type rule_id: str
:param baseline_name: The name of the vulnerability assessment rule
baseline (default implies a baseline on a database level rule and
master for server level rule). Possible values include: 'master',
'default'
:type baseline_name: str or
~azure.mgmt.sql.models.VulnerabilityAssessmentPolicyBaselineName
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: DatabaseVulnerabilityAssessmentRuleBaseline or
ClientRawResponse if raw=true
:rtype:
~azure.mgmt.sql.models.DatabaseVulnerabilityAssessmentRuleBaseline or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.get.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'),
'databaseName': self._serialize.url("database_name", database_name, 'str'),
'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'),
'ruleId': self._serialize.url("rule_id", rule_id, 'str'),
'baselineName': self._serialize.url("baseline_name", baseline_name, 'VulnerabilityAssessmentPolicyBaselineName'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp

deserialized = None

if response.status_code == 200:
deserialized = self._deserialize('DatabaseVulnerabilityAssessmentRuleBaseline', response)

if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response

return deserialized
get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'}

def create_or_update(
self, resource_group_name, managed_instance_name, database_name, rule_id, baseline_name, baseline_results, custom_headers=None, raw=False, **operation_config):
"""Creates or updates a database's vulnerability assessment rule baseline.

:param resource_group_name: The name of the resource group that
contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal.
:type resource_group_name: str
:param managed_instance_name: The name of the managed instance.
:type managed_instance_name: str
:param database_name: The name of the database for which the
vulnerability assessment rule baseline is defined.
:type database_name: str
:param rule_id: The vulnerability assessment rule ID.
:type rule_id: str
:param baseline_name: The name of the vulnerability assessment rule
baseline (default implies a baseline on a database level rule and
master for server level rule). Possible values include: 'master',
'default'
:type baseline_name: str or
~azure.mgmt.sql.models.VulnerabilityAssessmentPolicyBaselineName
:param baseline_results: The rule baseline result
:type baseline_results:
list[~azure.mgmt.sql.models.DatabaseVulnerabilityAssessmentRuleBaselineItem]
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: DatabaseVulnerabilityAssessmentRuleBaseline or
ClientRawResponse if raw=true
:rtype:
~azure.mgmt.sql.models.DatabaseVulnerabilityAssessmentRuleBaseline or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
parameters = models.DatabaseVulnerabilityAssessmentRuleBaseline(baseline_results=baseline_results)

# Construct URL
url = self.create_or_update.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'),
'databaseName': self._serialize.url("database_name", database_name, 'str'),
'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'),
'ruleId': self._serialize.url("rule_id", rule_id, 'str'),
'baselineName': self._serialize.url("baseline_name", baseline_name, 'VulnerabilityAssessmentPolicyBaselineName'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

# Construct body
body_content = self._serialize.body(parameters, 'DatabaseVulnerabilityAssessmentRuleBaseline')

# Construct and send request
request = self._client.put(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp

deserialized = None

if response.status_code == 200:
deserialized = self._deserialize('DatabaseVulnerabilityAssessmentRuleBaseline', response)

if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response

return deserialized
create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'}

def delete(
self, resource_group_name, managed_instance_name, database_name, rule_id, baseline_name, custom_headers=None, raw=False, **operation_config):
"""Removes the database's vulnerability assessment rule baseline.

:param resource_group_name: The name of the resource group that
contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal.
:type resource_group_name: str
:param managed_instance_name: The name of the managed instance.
:type managed_instance_name: str
:param database_name: The name of the database for which the
vulnerability assessment rule baseline is defined.
:type database_name: str
:param rule_id: The vulnerability assessment rule ID.
:type rule_id: str
:param baseline_name: The name of the vulnerability assessment rule
baseline (default implies a baseline on a database level rule and
master for server level rule). Possible values include: 'master',
'default'
:type baseline_name: str or
~azure.mgmt.sql.models.VulnerabilityAssessmentPolicyBaselineName
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: None or ClientRawResponse if raw=true
:rtype: None or ~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.delete.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'),
'databaseName': self._serialize.url("database_name", database_name, 'str'),
'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'),
'ruleId': self._serialize.url("rule_id", rule_id, 'str'),
'baselineName': self._serialize.url("baseline_name", baseline_name, 'VulnerabilityAssessmentPolicyBaselineName'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

# Construct headers
header_parameters = {}
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

# Construct and send request
request = self._client.delete(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp

if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'}
Loading