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] msi/resource-manager #3887

Merged
merged 7 commits into from
May 16, 2019
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
23 changes: 14 additions & 9 deletions azure-mgmt-hdinsight/test/test_mgmt_hdinsight.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,23 @@ def test_create_kafka_cluster_with_managed_disks(self, resource_group, location,
def test_create_kafka_cluster_with_disk_encryption(self, resource_group, location, storage_account, storage_account_key, vault):
# create managed identities for Azure resources.
msi_name = self.get_resource_name('hdipyuai')
msi = self.msi_client.user_assigned_identities.create_or_update(resource_group.name, msi_name, location)
msi_principal_id = "00000000-0000-0000-0000-000000000000"
msi_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/{}/providers/microsoft.managedidentity/userassignedidentities/{}".format(resource_group.name, msi_name)
if self.is_live:
msi = self.msi_client.user_assigned_identities.create_or_update(resource_group.name, msi_name, location)
msi_id = msi.id
msi_principal_id = msi.principal_id

# add managed identity to vault
required_permissions = Permissions(keys=[KeyPermissions.get, KeyPermissions.wrap_key, KeyPermissions.unwrap_key],
secrets=[SecretPermissions.get, SecretPermissions.set,SecretPermissions.delete])
vault.properties.access_policies.append(
AccessPolicyEntry(tenant_id=self.tenant_id,
object_id=msi.principal_id,
object_id=msi_principal_id,
permissions=required_permissions)
)
update_params = VaultCreateOrUpdateParameters(location=location,
properties=vault.properties)
properties=vault.properties)
vault = self.vault_mgmt_client.vaults.create_or_update(resource_group.name, vault.name, update_params).result()
self.assertIsNotNone(vault)

Expand All @@ -173,13 +178,13 @@ def test_create_kafka_cluster_with_disk_encryption(self, resource_group, locatio
]
create_params.identity = ClusterIdentity(
type=ResourceIdentityType.user_assigned,
user_assigned_identities={msi.id: ClusterIdentityUserAssignedIdentitiesValue()}
user_assigned_identities={msi_id: ClusterIdentityUserAssignedIdentitiesValue()}
)
create_params.properties.disk_encryption_properties = DiskEncryptionProperties(
vault_uri=vault_key.vault,
key_name=vault_key.name,
key_version=vault_key.version,
msi_resource_id=msi.id
msi_resource_id=msi_id
)
cluster = self.hdinsight_client.clusters.create(resource_group.name, cluster_name, create_params).result()
self.validate_cluster(cluster_name, create_params, cluster)
Expand Down Expand Up @@ -208,7 +213,7 @@ def test_create_kafka_cluster_with_disk_encryption(self, resource_group, locatio
self.assertIsNotNone(cluster.properties.disk_encryption_properties)
self.assertEqual(rotate_params.vault_uri, cluster.properties.disk_encryption_properties.vault_uri)
self.assertEqual(rotate_params.key_name, cluster.properties.disk_encryption_properties.key_name)
self.assertEqual(msi.id.lower(), cluster.properties.disk_encryption_properties.msi_resource_id.lower())
self.assertEqual(msi_id.lower(), cluster.properties.disk_encryption_properties.msi_resource_id.lower())

@ResourceGroupPreparer(name_prefix='hdipy-', location=ADLS_LOCATION)
@StorageAccountPreparer(name_prefix='hdipy', location=ADLS_LOCATION)
Expand Down Expand Up @@ -452,7 +457,7 @@ def test_get_configurations(self, resource_group, location, storage_account, sto

gateway = self.hdinsight_client.configurations.get(rg_name, cluster_name, gateway)
self.assertEqual(len(gateway), 3)

core = self.hdinsight_client.configurations.get(rg_name, cluster_name, core_site)
self.assertEqual(len(core), 2)
self.assertTrue('fs.defaultFS' in core)
Expand All @@ -474,7 +479,7 @@ def test_http_extended(self, resource_group, location, storage_account, storage_
user_password = self.cluster_password
http_settings = self.hdinsight_client.configurations.get(rg_name, cluster_name, gateway)
self.validate_http_settings(http_settings, user_name, user_password)

new_password = 'NewPassword1!'
update_params = {
'restAuthCredential.isEnabled': 'true',
Expand Down Expand Up @@ -550,7 +555,7 @@ def test_script_actions_on_running_cluster(self, resource_group, location, stora

install_giraph = "https://hdiconfigactions.blob.core.windows.net/linuxgiraphconfigactionv01/giraph-installer-v01.sh"
script_name = "script1"

# Execute script actions, and persist on success.
script_action_params = self.get_execute_script_action_params(script_name, install_giraph)
self.hdinsight_client.clusters.execute_script_actions(rg_name, cluster_name, True, script_action_params).wait()
Expand Down
1 change: 0 additions & 1 deletion azure-mgmt-msi/MANIFEST.in

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
Release History
===============

1.0.0 (2019-05-16)
++++++++++++++++++

**Note**

This package is using the stable API version 2018-11-30 and doesn't expose any API changes compared to 0.2.0.

0.2.0 (2018-05-25)
++++++++++++++++++

Expand All @@ -28,7 +35,7 @@ This version uses a next-generation code generator that *might* introduce breaki

- Return type changes from `msrestazure.azure_operation.AzureOperationPoller` to `msrest.polling.LROPoller`. External API is the same.
- Return type is now **always** a `msrest.polling.LROPoller`, regardless of the optional parameters used.
- The behavior has changed when using `raw=True`. Instead of returning the initial call result as `ClientRawResponse`,
- The behavior has changed when using `raw=True`. Instead of returning the initial call result as `ClientRawResponse`,
without polling, now this returns an LROPoller. After polling, the final resource will be returned as a `ClientRawResponse`.
- New `polling` parameter. The default behavior is `Polling=True` which will poll using ARM algorithm. When `Polling=False`,
the response of the initial call will be returned without polling.
Expand Down
5 changes: 5 additions & 0 deletions sdk/resources/azure-mgmt-msi/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
recursive-include tests *.py *.yaml
include *.rst
include azure/__init__.py
include azure/mgmt/__init__.py

Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,6 @@ For the older Azure Service Management (ASM) libraries, see
For a more complete set of Azure libraries, see the `azure <https://pypi.python.org/pypi/azure>`__ bundle package.


Compatibility
=============

**IMPORTANT**: If you have an earlier version of the azure package
(version < 1.0), you should uninstall it before installing this package.

You can check the version using pip:

.. code:: shell

pip freeze

If you see azure==0.11.0 (or any version below 1.0), uninstall it first:

.. code:: shell

pip uninstall azure


Usage
=====

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(
super(ManagedServiceIdentityClient, self).__init__(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2015-08-31-preview'
self.api_version = '2018-11-30'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ class Identity(Model):
random generated UUID by MSI.
:vartype client_id: str
:ivar client_secret_url: The ManagedServiceIdentity DataPlane URL that
can be queried to obtain the identity credentials.
can be queried to obtain the identity credentials. If identity is user
assigned, then the clientSecretUrl will not be present in the response,
otherwise it will be present.
:vartype client_secret_url: str
:ivar type: The type of resource i.e.
Microsoft.ManagedIdentity/userAssignedIdentities. Possible values include:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ class Identity(Model):
random generated UUID by MSI.
:vartype client_id: str
:ivar client_secret_url: The ManagedServiceIdentity DataPlane URL that
can be queried to obtain the identity credentials.
can be queried to obtain the identity credentials. If identity is user
assigned, then the clientSecretUrl will not be present in the response,
otherwise it will be present.
:vartype client_secret_url: str
:ivar type: The type of resource i.e.
Microsoft.ManagedIdentity/userAssignedIdentities. Possible values include:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Operations(object):
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Version of API to invoke. Constant value: "2015-08-31-preview".
:ivar api_version: Version of API to invoke. Constant value: "2018-11-30".
"""

models = models
Expand All @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2015-08-31-preview"
self.api_version = "2018-11-30"

self.config = config

Expand Down Expand Up @@ -67,7 +67,7 @@ def internal_paging(next_link=None, raw=False):

# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
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:
Expand All @@ -76,9 +76,8 @@ def internal_paging(next_link=None, raw=False):
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, stream=False, **operation_config)
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class UserAssignedIdentitiesOperations(object):
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Version of API to invoke. Constant value: "2015-08-31-preview".
:ivar api_version: Version of API to invoke. Constant value: "2018-11-30".
"""

models = models
Expand All @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2015-08-31-preview"
self.api_version = "2018-11-30"

self.config = config

Expand Down Expand Up @@ -72,7 +72,7 @@ def internal_paging(next_link=None, raw=False):

# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
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:
Expand All @@ -81,9 +81,8 @@ def internal_paging(next_link=None, raw=False):
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, stream=False, **operation_config)
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)
Expand Down Expand Up @@ -142,7 +141,7 @@ def internal_paging(next_link=None, raw=False):

# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
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:
Expand All @@ -151,9 +150,8 @@ def internal_paging(next_link=None, raw=False):
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, stream=False, **operation_config)
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)
Expand Down Expand Up @@ -214,6 +212,7 @@ def create_or_update(

# 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())
Expand All @@ -226,9 +225,8 @@ def create_or_update(
body_content = self._serialize.body(parameters, 'Identity')

# Construct and send request
request = self._client.put(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, stream=False, **operation_config)
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, 201]:
exp = CloudError(response)
Expand Down Expand Up @@ -289,6 +287,7 @@ def update(

# 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())
Expand All @@ -301,9 +300,8 @@ def update(
body_content = self._serialize.body(parameters, 'Identity')

# Construct and send request
request = self._client.patch(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, stream=False, **operation_config)
request = self._client.patch(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)
Expand Down Expand Up @@ -356,7 +354,7 @@ def get(

# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
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:
Expand All @@ -365,8 +363,8 @@ def get(
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, stream=False, **operation_config)
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)
Expand Down Expand Up @@ -418,7 +416,6 @@ def delete(

# 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:
Expand All @@ -427,8 +424,8 @@ def delete(
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)
response = self._client.send(request, header_parameters, stream=False, **operation_config)
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, 204]:
exp = CloudError(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
# regenerated.
# --------------------------------------------------------------------------

VERSION = "0.2.0"
VERSION = "1.0.0"

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
version=version,
description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME),
long_description=readme + '\n\n' + history,
long_description_content_type='text/x-rst',
license='MIT License',
author='Microsoft Corporation',
author_email='azpysdkhelp@microsoft.com',
Expand Down