From 7e8dbcc9a4a40129ff03fe6638a6903be3fb098e Mon Sep 17 00:00:00 2001 From: SwaggerToSDK Automation Date: Thu, 25 May 2017 19:16:08 +0000 Subject: [PATCH] Generated from 1b3e5d22884f5bf5bccf6c9d2d8805f2dbb178dc --- .../azure/mgmt/sql/models/__init__.py | 30 +- .../azure/mgmt/sql/models/database.py | 4 +- .../models/database_blob_auditing_policy.py | 9 +- .../azure/mgmt/sql/models/failover_group.py | 85 +++ .../mgmt/sql/models/failover_group_paged.py | 27 + .../failover_group_read_only_endpoint.py | 29 + .../failover_group_read_write_endpoint.py | 34 + .../azure/mgmt/sql/models/partner_info.py | 45 ++ .../models/server_azure_ad_administrator.py | 60 ++ .../server_azure_ad_administrator_paged.py | 27 + .../sql/models/sql_management_client_enums.py | 18 + .../azure/mgmt/sql/models/sql_sub_resource.py | 39 ++ .../mgmt/sql/models/vnet_firewall_rule.py | 46 ++ .../sql/models/vnet_firewall_rule_paged.py | 27 + .../azure/mgmt/sql/operations/__init__.py | 6 + .../sql/operations/databases_operations.py | 22 +- .../operations/failover_groups_operations.py | 640 ++++++++++++++++++ ...rver_azure_ad_administrators_operations.py | 363 ++++++++++ .../vnet_firewall_rules_operations.py | 357 ++++++++++ .../azure/mgmt/sql/sql_management_client.py | 29 +- azure-mgmt-sql/azure/mgmt/sql/version.py | 2 +- 21 files changed, 1871 insertions(+), 28 deletions(-) create mode 100755 azure-mgmt-sql/azure/mgmt/sql/models/failover_group.py create mode 100755 azure-mgmt-sql/azure/mgmt/sql/models/failover_group_paged.py create mode 100755 azure-mgmt-sql/azure/mgmt/sql/models/failover_group_read_only_endpoint.py create mode 100755 azure-mgmt-sql/azure/mgmt/sql/models/failover_group_read_write_endpoint.py create mode 100755 azure-mgmt-sql/azure/mgmt/sql/models/partner_info.py create mode 100755 azure-mgmt-sql/azure/mgmt/sql/models/server_azure_ad_administrator.py create mode 100755 azure-mgmt-sql/azure/mgmt/sql/models/server_azure_ad_administrator_paged.py create mode 100755 azure-mgmt-sql/azure/mgmt/sql/models/sql_sub_resource.py create mode 100755 azure-mgmt-sql/azure/mgmt/sql/models/vnet_firewall_rule.py create mode 100755 azure-mgmt-sql/azure/mgmt/sql/models/vnet_firewall_rule_paged.py create mode 100755 azure-mgmt-sql/azure/mgmt/sql/operations/failover_groups_operations.py create mode 100755 azure-mgmt-sql/azure/mgmt/sql/operations/server_azure_ad_administrators_operations.py create mode 100755 azure-mgmt-sql/azure/mgmt/sql/operations/vnet_firewall_rules_operations.py diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index 16910dc2a694..c3153a6dc6b7 100755 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -34,6 +34,7 @@ from .replication_link import ReplicationLink from .server import Server from .server_metric import ServerMetric +from .service_objective import ServiceObjective from .recommended_elastic_pool_metric import RecommendedElasticPoolMetric from .slo_usage_metric import SloUsageMetric from .service_tier_advisor import ServiceTierAdvisor @@ -46,10 +47,16 @@ from .elastic_pool_activity import ElasticPoolActivity from .elastic_pool_database_activity import ElasticPoolDatabaseActivity from .database_metric import DatabaseMetric -from .service_objective import ServiceObjective from .transparent_data_encryption_activity import TransparentDataEncryptionActivity +from .server_azure_ad_administrator import ServerAzureADAdministrator +from .sql_sub_resource import SqlSubResource from .database_security_alert_policy import DatabaseSecurityAlertPolicy from .database_blob_auditing_policy import DatabaseBlobAuditingPolicy +from .failover_group_read_write_endpoint import FailoverGroupReadWriteEndpoint +from .failover_group_read_only_endpoint import FailoverGroupReadOnlyEndpoint +from .partner_info import PartnerInfo +from .failover_group import FailoverGroup +from .vnet_firewall_rule import VnetFirewallRule from .restore_point_paged import RestorePointPaged from .replication_link_paged import ReplicationLinkPaged from .database_paged import DatabasePaged @@ -65,6 +72,9 @@ from .elastic_pool_database_activity_paged import ElasticPoolDatabaseActivityPaged from .recommended_elastic_pool_paged import RecommendedElasticPoolPaged from .recommended_elastic_pool_metric_paged import RecommendedElasticPoolMetricPaged +from .server_azure_ad_administrator_paged import ServerAzureADAdministratorPaged +from .failover_group_paged import FailoverGroupPaged +from .vnet_firewall_rule_paged import VnetFirewallRulePaged from .sql_management_client_enums import ( RestorePointTypes, CapabilityStatus, @@ -92,6 +102,9 @@ SecurityAlertPolicyEmailAccountAdmins, SecurityAlertPolicyUseServerDefault, BlobAuditingPolicyState, + ReadWriteEndpointFailoverPolicy, + ReadOnlyEndpointFailoverPolicy, + FailoverGroupReplicationRole, ) __all__ = [ @@ -120,6 +133,7 @@ 'ReplicationLink', 'Server', 'ServerMetric', + 'ServiceObjective', 'RecommendedElasticPoolMetric', 'SloUsageMetric', 'ServiceTierAdvisor', @@ -132,10 +146,16 @@ 'ElasticPoolActivity', 'ElasticPoolDatabaseActivity', 'DatabaseMetric', - 'ServiceObjective', 'TransparentDataEncryptionActivity', + 'ServerAzureADAdministrator', + 'SqlSubResource', 'DatabaseSecurityAlertPolicy', 'DatabaseBlobAuditingPolicy', + 'FailoverGroupReadWriteEndpoint', + 'FailoverGroupReadOnlyEndpoint', + 'PartnerInfo', + 'FailoverGroup', + 'VnetFirewallRule', 'RestorePointPaged', 'ReplicationLinkPaged', 'DatabasePaged', @@ -151,6 +171,9 @@ 'ElasticPoolDatabaseActivityPaged', 'RecommendedElasticPoolPaged', 'RecommendedElasticPoolMetricPaged', + 'ServerAzureADAdministratorPaged', + 'FailoverGroupPaged', + 'VnetFirewallRulePaged', 'RestorePointTypes', 'CapabilityStatus', 'MaxSizeUnits', @@ -177,4 +200,7 @@ 'SecurityAlertPolicyEmailAccountAdmins', 'SecurityAlertPolicyUseServerDefault', 'BlobAuditingPolicyState', + 'ReadWriteEndpointFailoverPolicy', + 'ReadOnlyEndpointFailoverPolicy', + 'FailoverGroupReplicationRole', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database.py b/azure-mgmt-sql/azure/mgmt/sql/models/database.py index 65072ed6f124..8cc31f71e538 100755 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database.py @@ -166,8 +166,8 @@ class Database(TrackedResource): :ivar recommended_index: The recommended indices for this database. :vartype recommended_index: list of :class:`RecommendedIndex ` - :ivar failover_group_id: The id indicating the failover group containing - this database. + :ivar failover_group_id: The resource identifier of the failover group + containing this database. :vartype failover_group_id: str :param read_scale: Conditional. If the database is a geo-secondary, readScale indicates whether read-only connections are allowed to this diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py index dbcf27ae44be..fa8f7650bc01 100755 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py @@ -13,7 +13,7 @@ class DatabaseBlobAuditingPolicy(ProxyResource): - """Contains information about a database Blob Auditing policy. + """A database blob auditing policy. Variables are only populated by the server, and will be ignored when sending a request. @@ -24,8 +24,6 @@ class DatabaseBlobAuditingPolicy(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: The geo-location where the resource lives - :type location: str :ivar kind: Resource kind. :vartype kind: str :param state: Specifies the state of the policy. If state is Enabled, @@ -60,14 +58,12 @@ class DatabaseBlobAuditingPolicy(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'kind': {'readonly': True}, - 'state': {'required': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'state': {'key': 'properties.state', 'type': 'BlobAuditingPolicyState'}, 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, @@ -78,9 +74,8 @@ class DatabaseBlobAuditingPolicy(ProxyResource): 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, } - def __init__(self, state, location=None, storage_endpoint=None, storage_account_access_key=None, retention_days=None, audit_actions_and_groups=None, storage_account_subscription_id=None, is_storage_secondary_key_in_use=None): + def __init__(self, state=None, storage_endpoint=None, storage_account_access_key=None, retention_days=None, audit_actions_and_groups=None, storage_account_subscription_id=None, is_storage_secondary_key_in_use=None): super(DatabaseBlobAuditingPolicy, self).__init__() - self.location = location self.kind = None self.state = state self.storage_endpoint = storage_endpoint diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/failover_group.py b/azure-mgmt-sql/azure/mgmt/sql/models/failover_group.py new file mode 100755 index 000000000000..b2a70b6c07f0 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/failover_group.py @@ -0,0 +1,85 @@ +# 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. +# -------------------------------------------------------------------------- + +from .proxy_resource import ProxyResource + + +class FailoverGroup(ProxyResource): + """A failover group. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :param tags: Resource tags. + :type tags: dict + :param read_write_endpoint: Read-write endpoint of the failover group + instance. + :type read_write_endpoint: :class:`FailoverGroupReadWriteEndpoint + ` + :param read_only_endpoint: Read-only endpoint of the failover group + instance. + :type read_only_endpoint: :class:`FailoverGroupReadOnlyEndpoint + ` + :ivar replication_role: Local replication role of the failover group + instance. Possible values include: 'Primary', 'Secondary' + :vartype replication_role: str or :class:`FailoverGroupReplicationRole + ` + :ivar replication_state: Replication state of the failover group instance. + :vartype replication_state: str + :param partner_servers: List of partner server information for the + failover group. + :type partner_servers: list of :class:`PartnerInfo + ` + :param databases: List of databases in the failover group. + :type databases: list of str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'replication_role': {'readonly': True}, + 'replication_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'read_write_endpoint': {'key': 'properties.readWriteEndpoint', 'type': 'FailoverGroupReadWriteEndpoint'}, + 'read_only_endpoint': {'key': 'properties.readOnlyEndpoint', 'type': 'FailoverGroupReadOnlyEndpoint'}, + 'replication_role': {'key': 'properties.replicationRole', 'type': 'str'}, + 'replication_state': {'key': 'properties.replicationState', 'type': 'str'}, + 'partner_servers': {'key': 'properties.partnerServers', 'type': '[PartnerInfo]'}, + 'databases': {'key': 'properties.databases', 'type': '[str]'}, + } + + def __init__(self, tags=None, read_write_endpoint=None, read_only_endpoint=None, partner_servers=None, databases=None): + super(FailoverGroup, self).__init__() + self.location = None + self.tags = tags + self.read_write_endpoint = read_write_endpoint + self.read_only_endpoint = read_only_endpoint + self.replication_role = None + self.replication_state = None + self.partner_servers = partner_servers + self.databases = databases diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/failover_group_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/failover_group_paged.py new file mode 100755 index 000000000000..739bc93f915a --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/failover_group_paged.py @@ -0,0 +1,27 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class FailoverGroupPaged(Paged): + """ + A paging container for iterating over a list of FailoverGroup object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[FailoverGroup]'} + } + + def __init__(self, *args, **kwargs): + + super(FailoverGroupPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/failover_group_read_only_endpoint.py b/azure-mgmt-sql/azure/mgmt/sql/models/failover_group_read_only_endpoint.py new file mode 100755 index 000000000000..49b78627232c --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/failover_group_read_only_endpoint.py @@ -0,0 +1,29 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class FailoverGroupReadOnlyEndpoint(Model): + """Read-only endpoint of the failover group instance. + + :param failover_policy: Failover policy of the read-only endpoint for the + failover group. Possible values include: 'Disabled', 'Enabled' + :type failover_policy: str or :class:`ReadOnlyEndpointFailoverPolicy + ` + """ + + _attribute_map = { + 'failover_policy': {'key': 'failoverPolicy', 'type': 'str'}, + } + + def __init__(self, failover_policy=None): + self.failover_policy = failover_policy diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/failover_group_read_write_endpoint.py b/azure-mgmt-sql/azure/mgmt/sql/models/failover_group_read_write_endpoint.py new file mode 100755 index 000000000000..d71732ca8146 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/failover_group_read_write_endpoint.py @@ -0,0 +1,34 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class FailoverGroupReadWriteEndpoint(Model): + """Read-write endpoint of the failover group instance. + + :param failover_policy: Failover policy of the read-write endpoint for the + failover group. Possible values include: 'Manual', 'Automatic' + :type failover_policy: str or :class:`ReadWriteEndpointFailoverPolicy + ` + :param failover_with_data_loss_grace_period_minutes: Grace period before + failover with data loss is attempted for the read-write endpoint. + :type failover_with_data_loss_grace_period_minutes: int + """ + + _attribute_map = { + 'failover_policy': {'key': 'failoverPolicy', 'type': 'str'}, + 'failover_with_data_loss_grace_period_minutes': {'key': 'failoverWithDataLossGracePeriodMinutes', 'type': 'int'}, + } + + def __init__(self, failover_policy=None, failover_with_data_loss_grace_period_minutes=None): + self.failover_policy = failover_policy + self.failover_with_data_loss_grace_period_minutes = failover_with_data_loss_grace_period_minutes diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/partner_info.py b/azure-mgmt-sql/azure/mgmt/sql/models/partner_info.py new file mode 100755 index 000000000000..64fe959d1bd7 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/partner_info.py @@ -0,0 +1,45 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class PartnerInfo(Model): + """Partner server information for the failover group. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param id: Resource identifier of the partner server. + :type id: str + :ivar location: Geo location of the partner server. + :vartype location: str + :ivar replication_role: Replication role of the partner server. Possible + values include: 'Primary', 'Secondary' + :vartype replication_role: str or :class:`FailoverGroupReplicationRole + ` + """ + + _validation = { + 'location': {'readonly': True}, + 'replication_role': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'replication_role': {'key': 'replicationRole', 'type': 'str'}, + } + + def __init__(self, id=None): + self.id = id + self.location = None + self.replication_role = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_azure_ad_administrator.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_azure_ad_administrator.py new file mode 100755 index 000000000000..29a8f3da46da --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_azure_ad_administrator.py @@ -0,0 +1,60 @@ +# 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. +# -------------------------------------------------------------------------- + +from .sql_sub_resource import SqlSubResource + + +class ServerAzureADAdministrator(SqlSubResource): + """An server Active Directory Administrator. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Resource name + :vartype name: str + :ivar id: Resource Id + :vartype id: str + :ivar administrator_type: The type of administrator. Default value: + "ActiveDirectory" . + :vartype administrator_type: str + :param login: The server administrator login value. + :type login: str + :param sid: The server administrator Sid (Secure ID). + :type sid: str + :param tenant_id: The server Active Directory Administrator tenant id. + :type tenant_id: str + """ + + _validation = { + 'name': {'readonly': True}, + 'id': {'readonly': True}, + 'administrator_type': {'required': True, 'constant': True}, + 'login': {'required': True}, + 'sid': {'required': True}, + 'tenant_id': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'administrator_type': {'key': 'properties.administratorType', 'type': 'str'}, + 'login': {'key': 'properties.login', 'type': 'str'}, + 'sid': {'key': 'properties.sid', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + } + + administrator_type = "ActiveDirectory" + + def __init__(self, login, sid, tenant_id): + super(ServerAzureADAdministrator, self).__init__() + self.login = login + self.sid = sid + self.tenant_id = tenant_id diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_azure_ad_administrator_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_azure_ad_administrator_paged.py new file mode 100755 index 000000000000..a7a532069db6 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_azure_ad_administrator_paged.py @@ -0,0 +1,27 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ServerAzureADAdministratorPaged(Paged): + """ + A paging container for iterating over a list of ServerAzureADAdministrator object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ServerAzureADAdministrator]'} + } + + def __init__(self, *args, **kwargs): + + super(ServerAzureADAdministratorPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py b/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py index 3033853a654e..6747f2675967 100755 --- a/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py @@ -215,3 +215,21 @@ class BlobAuditingPolicyState(Enum): enabled = "Enabled" disabled = "Disabled" + + +class ReadWriteEndpointFailoverPolicy(Enum): + + manual = "Manual" + automatic = "Automatic" + + +class ReadOnlyEndpointFailoverPolicy(Enum): + + disabled = "Disabled" + enabled = "Enabled" + + +class FailoverGroupReplicationRole(Enum): + + primary = "Primary" + secondary = "Secondary" diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sql_sub_resource.py b/azure-mgmt-sql/azure/mgmt/sql/models/sql_sub_resource.py new file mode 100755 index 000000000000..f4625c6bbcb7 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/sql_sub_resource.py @@ -0,0 +1,39 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class SqlSubResource(Model): + """Subresource properties. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Resource name + :vartype name: str + :ivar id: Resource Id + :vartype id: str + """ + + _validation = { + 'name': {'readonly': True}, + 'id': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self): + self.name = None + self.id = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/vnet_firewall_rule.py b/azure-mgmt-sql/azure/mgmt/sql/models/vnet_firewall_rule.py new file mode 100755 index 000000000000..4e22d4ae77cd --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/vnet_firewall_rule.py @@ -0,0 +1,46 @@ +# 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. +# -------------------------------------------------------------------------- + +from .proxy_resource import ProxyResource + + +class VnetFirewallRule(ProxyResource): + """A Vnet Firewall Rule Resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param virtual_network_subnet_id: The VnetSubnetId + :type virtual_network_subnet_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'virtual_network_subnet_id': {'key': 'properties.virtualNetworkSubnetId', 'type': 'str'}, + } + + def __init__(self, virtual_network_subnet_id=None): + super(VnetFirewallRule, self).__init__() + self.virtual_network_subnet_id = virtual_network_subnet_id diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/vnet_firewall_rule_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/vnet_firewall_rule_paged.py new file mode 100755 index 000000000000..cec60c09d3ea --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/vnet_firewall_rule_paged.py @@ -0,0 +1,27 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class VnetFirewallRulePaged(Paged): + """ + A paging container for iterating over a list of VnetFirewallRule object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[VnetFirewallRule]'} + } + + def __init__(self, *args, **kwargs): + + super(VnetFirewallRulePaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index a310f0741e1b..c60a7cefb4f5 100755 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -16,6 +16,9 @@ from .servers_operations import ServersOperations from .elastic_pools_operations import ElasticPoolsOperations from .recommended_elastic_pools_operations import RecommendedElasticPoolsOperations +from .server_azure_ad_administrators_operations import ServerAzureADAdministratorsOperations +from .failover_groups_operations import FailoverGroupsOperations +from .vnet_firewall_rules_operations import VnetFirewallRulesOperations __all__ = [ 'DatabasesOperations', @@ -25,4 +28,7 @@ 'ServersOperations', 'ElasticPoolsOperations', 'RecommendedElasticPoolsOperations', + 'ServerAzureADAdministratorsOperations', + 'FailoverGroupsOperations', + 'VnetFirewallRulesOperations', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py index 026e09381809..314147106f97 100755 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py @@ -24,6 +24,7 @@ class DatabasesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An objec model deserializer. + :ivar blob_auditing_policy_name: The name of the blob auditing policy. Constant value: "default". """ def __init__(self, client, config, serializer, deserializer): @@ -31,6 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer + self.blob_auditing_policy_name = "default" self.config = config @@ -1902,7 +1904,7 @@ def get_blob_auditing_policy( :type resource_group_name: str :param server_name: The name of the server. :type server_name: str - :param database_name: The name of the database for which database blob + :param database_name: The name of the database for which the blob audit policy is defined. :type database_name: str :param dict custom_headers: headers that will be added to the request @@ -1919,12 +1921,13 @@ def get_blob_auditing_policy( api_version = "2015-05-01-preview" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/default' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}' path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str') + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -1972,8 +1975,8 @@ def create_or_update_blob_auditing_policy( :type resource_group_name: str :param server_name: The name of the server. :type server_name: str - :param database_name: The name of the database for which database blob - audit policy will be defined. + :param database_name: The name of the database for which the blob + auditing policy will be defined. :type database_name: str :param parameters: The database blob auditing policy. :type parameters: :class:`DatabaseBlobAuditingPolicy @@ -1992,12 +1995,13 @@ def create_or_update_blob_auditing_policy( api_version = "2015-05-01-preview" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/default' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}' path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str') + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/failover_groups_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/failover_groups_operations.py new file mode 100755 index 000000000000..a1bbbda8bf8b --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/failover_groups_operations.py @@ -0,0 +1,640 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrestazure.azure_operation import AzureOperationPoller +import uuid + +from .. import models + + +class FailoverGroupsOperations(object): + """FailoverGroupsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2015-05-01-preview". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-05-01-preview" + + self.config = config + + def get( + self, resource_group_name, server_name, failover_group_name, custom_headers=None, raw=False, **operation_config): + """Gets a failover group. + + :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 server_name: The name of the server containing the failover + group. + :type server_name: str + :param failover_group_name: The name of the failover group. + :type failover_group_name: str + :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`. + :rtype: :class:`FailoverGroup ` + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'failoverGroupName': self._serialize.url("failover_group_name", failover_group_name, 'str'), + '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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **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('FailoverGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, server_name, failover_group_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a failover group. + + :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 server_name: The name of the server containing the failover + group. + :type server_name: str + :param failover_group_name: The name of the failover group. + :type failover_group_name: str + :param parameters: The failover group parameters. + :type parameters: :class:`FailoverGroup + ` + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :rtype: + :class:`AzureOperationPoller` + instance that returns :class:`FailoverGroup + ` + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'failoverGroupName': self._serialize.url("failover_group_name", failover_group_name, 'str'), + '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['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, 'FailoverGroup') + + # Construct and send request + def long_running_send(): + + request = self._client.put(url, query_parameters) + return self._client.send( + request, header_parameters, body_content, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200, 202, 201]: + 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('FailoverGroup', response) + if response.status_code == 201: + deserialized = self._deserialize('FailoverGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + def delete( + self, resource_group_name, server_name, failover_group_name, custom_headers=None, raw=False, **operation_config): + """Deletes a failover group. + + :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 server_name: The name of the server containing the failover + group. + :type server_name: str + :param failover_group_name: The name of the failover group. + :type failover_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :rtype: + :class:`AzureOperationPoller` + instance that returns None + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'failoverGroupName': self._serialize.url("failover_group_name", failover_group_name, 'str'), + '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['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 and send request + def long_running_send(): + + request = self._client.delete(url, query_parameters) + return self._client.send(request, header_parameters, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200, 202, 204]: + 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 + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + def update( + self, resource_group_name, server_name, failover_group_name, parameters, custom_headers=None, raw=False, **operation_config): + """Updates a failover group. + + :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 server_name: The name of the server containing the failover + group. + :type server_name: str + :param failover_group_name: The name of the failover group. + :type failover_group_name: str + :param parameters: The failover group parameters. + :type parameters: :class:`FailoverGroup + ` + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :rtype: + :class:`AzureOperationPoller` + instance that returns :class:`FailoverGroup + ` + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'failoverGroupName': self._serialize.url("failover_group_name", failover_group_name, 'str'), + '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['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, 'FailoverGroup') + + # Construct and send request + def long_running_send(): + + request = self._client.patch(url, query_parameters) + return self._client.send( + request, header_parameters, body_content, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200, 202]: + 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('FailoverGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + def list_by_server( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Lists the failover groups in a server. + + :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 server_name: The name of the server containing the failover + group. + :type server_name: str + :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`. + :rtype: :class:`FailoverGroupPaged + ` + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + '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') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + 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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.FailoverGroupPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.FailoverGroupPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + + def failover( + self, resource_group_name, server_name, failover_group_name, custom_headers=None, raw=False, **operation_config): + """Fails over from the current primary server to this server. + + :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 server_name: The name of the server containing the failover + group. + :type server_name: str + :param failover_group_name: The name of the failover group. + :type failover_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :rtype: + :class:`AzureOperationPoller` + instance that returns :class:`FailoverGroup + ` + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/failover' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'failoverGroupName': self._serialize.url("failover_group_name", failover_group_name, 'str'), + '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['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 and send request + def long_running_send(): + + request = self._client.post(url, query_parameters) + return self._client.send(request, header_parameters, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200, 202]: + 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('FailoverGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + def force_failover_allow_data_loss( + self, resource_group_name, server_name, failover_group_name, custom_headers=None, raw=False, **operation_config): + """Fails over from the current primary server to this server. This + operation might result in data loss. + + :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 server_name: The name of the server containing the failover + group. + :type server_name: str + :param failover_group_name: The name of the failover group. + :type failover_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :rtype: + :class:`AzureOperationPoller` + instance that returns :class:`FailoverGroup + ` + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'failoverGroupName': self._serialize.url("failover_group_name", failover_group_name, 'str'), + '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['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 and send request + def long_running_send(): + + request = self._client.post(url, query_parameters) + return self._client.send(request, header_parameters, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200, 202]: + 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('FailoverGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_azure_ad_administrators_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_azure_ad_administrators_operations.py new file mode 100755 index 000000000000..2ec5255b1d35 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_azure_ad_administrators_operations.py @@ -0,0 +1,363 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrestazure.azure_operation import AzureOperationPoller +import uuid + +from .. import models + + +class ServerAzureADAdministratorsOperations(object): + """ServerAzureADAdministratorsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2014-04-01" + + self.config = config + + def create_or_update( + self, resource_group_name, server_name, properties, custom_headers=None, raw=False, **operation_config): + """Creates a new Server Active Directory Administrator or updates an + existing server Active Directory Administrator. + + :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 server_name: The name of the server. + :type server_name: str + :param properties: The required parameters for creating or updating an + Active Directory Administrator. + :type properties: :class:`ServerAzureADAdministrator + ` + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :rtype: + :class:`AzureOperationPoller` + instance that returns :class:`ServerAzureADAdministrator + ` + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/activedirectory' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, '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['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(properties, 'ServerAzureADAdministrator') + + # Construct and send request + def long_running_send(): + + request = self._client.put(url, query_parameters) + return self._client.send( + request, header_parameters, body_content, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200, 201, 202]: + 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('ServerAzureADAdministrator', response) + if response.status_code == 201: + deserialized = self._deserialize('ServerAzureADAdministrator', response) + if response.status_code == 202: + deserialized = self._deserialize('ServerAzureADAdministrator', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + def delete( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Deletes an existing server Active Directory Administrator. + + :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 server_name: The name of the server. + :type server_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :rtype: + :class:`AzureOperationPoller` + instance that returns :class:`ServerAzureADAdministrator + ` + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/activedirectory' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, '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['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 and send request + def long_running_send(): + + request = self._client.delete(url, query_parameters) + return self._client.send(request, header_parameters, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [202, 204, 200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 202: + deserialized = self._deserialize('ServerAzureADAdministrator', response) + if response.status_code == 204: + deserialized = self._deserialize('ServerAzureADAdministrator', response) + if response.status_code == 200: + deserialized = self._deserialize('ServerAzureADAdministrator', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + def get( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Returns an server Administrator. + + :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 server_name: The name of the server. + :type server_name: str + :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`. + :rtype: :class:`ServerAzureADAdministrator + ` + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/activedirectory' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, '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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **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('ServerAzureADAdministrator', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Returns a list of server Administrators. + + :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 server_name: The name of the server. + :type server_name: str + :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`. + :rtype: :class:`ServerAzureADAdministratorPaged + ` + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, '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') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + 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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.ServerAzureADAdministratorPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ServerAzureADAdministratorPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/vnet_firewall_rules_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/vnet_firewall_rules_operations.py new file mode 100755 index 000000000000..94dbdd373cd1 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/vnet_firewall_rules_operations.py @@ -0,0 +1,357 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrestazure.azure_operation import AzureOperationPoller +import uuid + +from .. import models + + +class VnetFirewallRulesOperations(object): + """VnetFirewallRulesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2015-05-01-preview". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-05-01-preview" + + self.config = config + + def get( + self, resource_group_name, server_name, vnet_firewall_rule_name, custom_headers=None, raw=False, **operation_config): + """Gets a virtual network rule. + + :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 server_name: The name of the server. + :type server_name: str + :param vnet_firewall_rule_name: The name of the virtual network rule. + :type vnet_firewall_rule_name: str + :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`. + :rtype: :class:`VnetFirewallRule + ` + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{vnetFirewallRuleName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'vnetFirewallRuleName': self._serialize.url("vnet_firewall_rule_name", vnet_firewall_rule_name, '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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **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('VnetFirewallRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, server_name, vnet_firewall_rule_name, virtual_network_subnet_id=None, custom_headers=None, raw=False, **operation_config): + """Creates or updates an existing virtual network rule. + + :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 server_name: The name of the server. + :type server_name: str + :param vnet_firewall_rule_name: The name of the virtual network rule. + :type vnet_firewall_rule_name: str + :param virtual_network_subnet_id: The VnetSubnetId + :type virtual_network_subnet_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :rtype: + :class:`AzureOperationPoller` + instance that returns :class:`VnetFirewallRule + ` + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + parameters = models.VnetFirewallRule(virtual_network_subnet_id=virtual_network_subnet_id) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{vnetFirewallRuleName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'vnetFirewallRuleName': self._serialize.url("vnet_firewall_rule_name", vnet_firewall_rule_name, '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['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, 'VnetFirewallRule') + + # Construct and send request + def long_running_send(): + + request = self._client.put(url, query_parameters) + return self._client.send( + request, header_parameters, body_content, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200, 202, 201]: + 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('VnetFirewallRule', response) + if response.status_code == 201: + deserialized = self._deserialize('VnetFirewallRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + def delete( + self, resource_group_name, server_name, vnet_firewall_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes the virtual network rule with the given name. + + :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 server_name: The name of the server. + :type server_name: str + :param vnet_firewall_rule_name: The name of the virtual network rule. + :type vnet_firewall_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :rtype: + :class:`AzureOperationPoller` + instance that returns None + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{vnetFirewallRuleName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'vnetFirewallRuleName': self._serialize.url("vnet_firewall_rule_name", vnet_firewall_rule_name, '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['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 and send request + def long_running_send(): + + request = self._client.delete(url, query_parameters) + return self._client.send(request, header_parameters, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200, 202, 204]: + 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 + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + def list_by_server( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of virtual network rules in a server. + + :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 server_name: The name of the server. + :type server_name: str + :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`. + :rtype: :class:`VnetFirewallRulePaged + ` + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, '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') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + 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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.VnetFirewallRulePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.VnetFirewallRulePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py index ddea0bf519ce..6a64251eccaf 100755 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -20,6 +20,9 @@ from .operations.servers_operations import ServersOperations from .operations.elastic_pools_operations import ElasticPoolsOperations from .operations.recommended_elastic_pools_operations import RecommendedElasticPoolsOperations +from .operations.server_azure_ad_administrators_operations import ServerAzureADAdministratorsOperations +from .operations.failover_groups_operations import FailoverGroupsOperations +from .operations.vnet_firewall_rules_operations import VnetFirewallRulesOperations from . import models @@ -65,19 +68,25 @@ class SqlManagementClient(object): :vartype config: SqlManagementClientConfiguration :ivar databases: Databases operations - :vartype databases: .operations.DatabasesOperations + :vartype databases: azure.mgmt.sql.operations.DatabasesOperations :ivar capabilities: Capabilities operations - :vartype capabilities: .operations.CapabilitiesOperations + :vartype capabilities: azure.mgmt.sql.operations.CapabilitiesOperations :ivar firewall_rules: FirewallRules operations - :vartype firewall_rules: .operations.FirewallRulesOperations + :vartype firewall_rules: azure.mgmt.sql.operations.FirewallRulesOperations :ivar operations: Operations operations - :vartype operations: .operations.Operations + :vartype operations: azure.mgmt.sql.operations.Operations :ivar servers: Servers operations - :vartype servers: .operations.ServersOperations + :vartype servers: azure.mgmt.sql.operations.ServersOperations :ivar elastic_pools: ElasticPools operations - :vartype elastic_pools: .operations.ElasticPoolsOperations + :vartype elastic_pools: azure.mgmt.sql.operations.ElasticPoolsOperations :ivar recommended_elastic_pools: RecommendedElasticPools operations - :vartype recommended_elastic_pools: .operations.RecommendedElasticPoolsOperations + :vartype recommended_elastic_pools: azure.mgmt.sql.operations.RecommendedElasticPoolsOperations + :ivar server_azure_ad_administrators: ServerAzureADAdministrators operations + :vartype server_azure_ad_administrators: azure.mgmt.sql.operations.ServerAzureADAdministratorsOperations + :ivar failover_groups: FailoverGroups operations + :vartype failover_groups: azure.mgmt.sql.operations.FailoverGroupsOperations + :ivar vnet_firewall_rules: VnetFirewallRules operations + :vartype vnet_firewall_rules: azure.mgmt.sql.operations.VnetFirewallRulesOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -112,3 +121,9 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.recommended_elastic_pools = RecommendedElasticPoolsOperations( self._client, self.config, self._serialize, self._deserialize) + self.server_azure_ad_administrators = ServerAzureADAdministratorsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.failover_groups = FailoverGroupsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.vnet_firewall_rules = VnetFirewallRulesOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-sql/azure/mgmt/sql/version.py b/azure-mgmt-sql/azure/mgmt/sql/version.py index c9fea7678df4..266f5a486d79 100755 --- a/azure-mgmt-sql/azure/mgmt/sql/version.py +++ b/azure-mgmt-sql/azure/mgmt/sql/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.5.1" +VERSION = "0.5.0"