Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #371 from shawncx/xichen/FixUrlBoundFlag
Browse files Browse the repository at this point in the history
Fix url base flag and version bump
  • Loading branch information
shawncx authored May 26, 2020
2 parents 738882a + 86fbb9e commit a72d51c
Show file tree
Hide file tree
Showing 46 changed files with 751 additions and 692 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ See documentation [here](doc/00-overview.md)

python:
reason: 'make sure python flag exists to load config in python.md'
azure-arm: true

output-folder: $(az-output-folder)
debug-output-folder: $(az-output-folder)/_az_debug

use-extension:
"@autorest/python": "5.0.0-preview.3"
"@autorest/clicommon": "0.4.8"
"@autorest/python": "5.0.0-preview.7"
"@autorest/clicommon": "0.4.9"
#"@autorest/python": "latest"

cli:
Expand All @@ -36,6 +37,7 @@ require:
pipeline-model: v3

modelerfour:
lenient-model-deduplication: true
group-parameters: true
flatten-models: true
flatten-payloads: true
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
"autorest": "^3.0.6187",
"@azure-tools/async-io": "^3.0.209",
"@azure-tools/autorest-extension-base": "~3.1.235",
"@azure-tools/codegen": "^2.4.257",
"@azure-tools/codemodel": "3.3.295",
"@azure-tools/codegen": "^2.5.276",
"@azure-tools/codemodel": "4.13.325",
"@azure-tools/linq": "^3.1.232",
"await-exec": "^0.1.2",
"dir-compare": "^2.2.0",
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/azgenerator/CodeModelAzImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1141,8 +1141,8 @@ export class CodeModelCliImpl implements CodeModelAz {
}

public Parameter_IsPolyOfSimple(param: Parameter = this.MethodParameter): boolean {
if(!isNullOrUndefined(this.MethodParameter['isPolyOfSimple'])) {
return this.MethodParameter['isPolyOfSimple'];
if(!isNullOrUndefined(param['isPolyOfSimple'])) {
return param['isPolyOfSimple'];
}
if (param?.schema?.type == SchemaType.Object && !isNullOrUndefined(param.schema['children']) && !isNullOrUndefined(param.schema['discriminator'])) {
let isSimplePoly = true;
Expand All @@ -1154,9 +1154,9 @@ export class CodeModelCliImpl implements CodeModelAz {
break;
}
if (isSimplePoly) {
this.MethodParameter['isPolyOfSimple'] = true;
param['isPolyOfSimple'] = true;
} else {
this.MethodParameter['isPolyOfSimple'] = false;
param['isPolyOfSimple'] = false;
}
return isSimplePoly;
}
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/azgenerator/TemplateAzureCliClientFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import { CodeModelAz } from "./CodeModelAz"
import { HeaderGenerator } from "./Header";
import { isNullOrUndefined } from "util";

export function GenerateAzureCliClientFactory(model: CodeModelAz) : string[] {
let header: HeaderGenerator = new HeaderGenerator();
Expand All @@ -16,7 +17,7 @@ export function GenerateAzureCliClientFactory(model: CodeModelAz) : string[] {
output.push(" from azure.cli.core.commands.client_factory import get_mgmt_service_client");
output.push(" from ..vendored_sdks." + model.PythonOperationsName + " import " + model.PythonMgmtClient);

if (model.Extension_ClientSubscriptionBound || model.Extension_ClientBaseUrlBound)
if (!isNullOrUndefined(model.Extension_ClientSubscriptionBound) || !isNullOrUndefined(model.Extension_ClientBaseUrlBound))
{
output.push(" return get_mgmt_service_client(cli_ctx, " + model.PythonMgmtClient + ",");
output.push(" subscription_bound=" + (model.Extension_ClientSubscriptionBound ? "True" : "False") + ",");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
# --------------------------------------------------------------------------

from ._attestation_management_client import AttestationManagementClient
from ._version import VERSION

__version__ = VERSION
__all__ = ['AttestationManagementClient']

try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Optional

from azure.core.credentials import TokenCredential

from ._configuration import AttestationManagementClientConfiguration
from .operations import OperationOperations
from .operations import AttestationProviderOperations
Expand All @@ -25,9 +27,9 @@ class AttestationManagementClient(object):
"""Various APIs for managing resources in attestation service. This primarily encompasses per-tenant instance management.
:ivar operation: OperationOperations operations
:vartype operation: azure.mgmt.attestation.operations.OperationOperations
:vartype operation: attestation_management_client.operations.OperationOperations
:ivar attestation_provider: AttestationProviderOperations operations
:vartype attestation_provider: azure.mgmt.attestation.operations.AttestationProviderOperations
:vartype attestation_provider: attestation_management_client.operations.AttestationProviderOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@
from azure.core.configuration import Configuration
from azure.core.pipeline import policies

from ._version import VERSION

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

from azure.core.credentials import TokenCredential

VERSION = "unknown"

class AttestationManagementClientConfiguration(Configuration):
"""Configuration for AttestationManagementClient.
Expand Down Expand Up @@ -50,7 +49,7 @@ def __init__(
self.api_version = "2018-09-01-preview"
self.credential_scopes = ['https://management.azure.com/.default']
self.credential_scopes.extend(kwargs.pop('credential_scopes', []))
kwargs.setdefault('sdk_moniker', 'mgmt-attestation/{}'.format(VERSION))
kwargs.setdefault('sdk_moniker', 'attestationmanagementclient/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import Any, Optional
from typing import Any, Optional, TYPE_CHECKING

from azure.mgmt.core import AsyncARMPipelineClient
from msrest import Deserializer, Serializer

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential

from ._configuration_async import AttestationManagementClientConfiguration
from .operations_async import OperationOperations
from .operations_async import AttestationProviderOperations
Expand All @@ -21,9 +25,9 @@ class AttestationManagementClient(object):
"""Various APIs for managing resources in attestation service. This primarily encompasses per-tenant instance management.
:ivar operation: OperationOperations operations
:vartype operation: azure.mgmt.attestation.aio.operations_async.OperationOperations
:vartype operation: attestation_management_client.aio.operations_async.OperationOperations
:ivar attestation_provider: AttestationProviderOperations operations
:vartype attestation_provider: azure.mgmt.attestation.aio.operations_async.AttestationProviderOperations
:vartype attestation_provider: attestation_management_client.aio.operations_async.AttestationProviderOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The ID of the target subscription.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
from azure.core.configuration import Configuration
from azure.core.pipeline import policies

from .._version import VERSION

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
from azure.core.credentials_async import AsyncTokenCredential

VERSION = "unknown"

class AttestationManagementClientConfiguration(Configuration):
"""Configuration for AttestationManagementClient.
Expand Down Expand Up @@ -47,7 +46,7 @@ def __init__(
self.api_version = "2018-09-01-preview"
self.credential_scopes = ['https://management.azure.com/.default']
self.credential_scopes.extend(kwargs.pop('credential_scopes', []))
kwargs.setdefault('sdk_moniker', 'mgmt-attestation/{}'.format(VERSION))
kwargs.setdefault('sdk_moniker', 'attestationmanagementclient/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AttestationProviderOperations:
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~azure.mgmt.attestation.models
:type models: ~attestation_management_client.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
Expand Down Expand Up @@ -53,8 +53,8 @@ async def get(
:param provider_name: Name of the attestation service instance.
:type provider_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AttestationProvider or the result of cls(response)
:rtype: ~azure.mgmt.attestation.models.AttestationProvider
:return: AttestationProvider, or the result of cls(response)
:rtype: ~attestation_management_client.models.AttestationProvider
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.AttestationProvider"]
Expand Down Expand Up @@ -91,7 +91,7 @@ async def get(
deserialized = self._deserialize('AttestationProvider', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {})

return deserialized
get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}'} # type: ignore
Expand Down Expand Up @@ -124,10 +124,10 @@ async def create(
an order of preference among them, although applications of JWK Sets
can choose to assign a meaning to the order for their purposes, if
desired.
:type keys: list[~azure.mgmt.attestation.models.JsonWebKey]
:type keys: list[~attestation_management_client.models.JsonWebKey]
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AttestationProvider or the result of cls(response)
:rtype: ~azure.mgmt.attestation.models.AttestationProvider
:return: AttestationProvider, or the result of cls(response)
:rtype: ~attestation_management_client.models.AttestationProvider
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.AttestationProvider"]
Expand Down Expand Up @@ -177,7 +177,7 @@ async def create(
deserialized = self._deserialize('AttestationProvider', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {})

return deserialized
create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}'} # type: ignore
Expand All @@ -198,8 +198,8 @@ async def update(
:param tags: The tags that will be assigned to the attestation service instance.
:type tags: dict[str, str]
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AttestationProvider or the result of cls(response)
:rtype: ~azure.mgmt.attestation.models.AttestationProvider
:return: AttestationProvider, or the result of cls(response)
:rtype: ~attestation_management_client.models.AttestationProvider
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.AttestationProvider"]
Expand Down Expand Up @@ -244,7 +244,7 @@ async def update(
deserialized = self._deserialize('AttestationProvider', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {})

return deserialized
update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}'} # type: ignore
Expand All @@ -262,7 +262,7 @@ async def delete(
:param provider_name: Name of the attestation service.
:type provider_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
Expand Down Expand Up @@ -297,7 +297,7 @@ async def delete(
raise HttpResponseError(response=response, error_format=ARMErrorFormat)

if cls:
return cls(pipeline_response, None, {})
return cls(pipeline_response, None, {})

delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}'} # type: ignore

Expand All @@ -308,8 +308,8 @@ async def list(
"""Returns a list of attestation providers in a subscription.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AttestationProviderListResult or the result of cls(response)
:rtype: ~azure.mgmt.attestation.models.AttestationProviderListResult
:return: AttestationProviderListResult, or the result of cls(response)
:rtype: ~attestation_management_client.models.AttestationProviderListResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.AttestationProviderListResult"]
Expand Down Expand Up @@ -344,7 +344,7 @@ async def list(
deserialized = self._deserialize('AttestationProviderListResult', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {})

return deserialized
list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Attestation/attestationProviders'} # type: ignore
Expand All @@ -359,8 +359,8 @@ async def list_by_resource_group(
:param resource_group_name: The name of the resource group. The name is case insensitive.
:type resource_group_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AttestationProviderListResult or the result of cls(response)
:rtype: ~azure.mgmt.attestation.models.AttestationProviderListResult
:return: AttestationProviderListResult, or the result of cls(response)
:rtype: ~attestation_management_client.models.AttestationProviderListResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.AttestationProviderListResult"]
Expand Down Expand Up @@ -396,7 +396,7 @@ async def list_by_resource_group(
deserialized = self._deserialize('AttestationProviderListResult', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {})

return deserialized
list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders'} # type: ignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class OperationOperations:
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~azure.mgmt.attestation.models
:type models: ~attestation_management_client.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
Expand All @@ -47,8 +47,8 @@ async def list(
"""Lists all of the available Azure attestation operations.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationList or the result of cls(response)
:rtype: ~azure.mgmt.attestation.models.OperationList
:return: OperationList, or the result of cls(response)
:rtype: ~attestation_management_client.models.OperationList
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.OperationList"]
Expand Down Expand Up @@ -79,7 +79,7 @@ async def list(
deserialized = self._deserialize('OperationList', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})
return cls(pipeline_response, deserialized, {})

return deserialized
list.metadata = {'url': '/providers/Microsoft.Attestation/operations'} # type: ignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class AttestationProvider(TrackedResource):
:type trust_model: str
:param status: Required. Status of attestation service. Possible values include: "Ready",
"NotReady", "Error".
:type status: str or ~azure.mgmt.attestation.models.AttestationServiceStatus
:type status: str or ~attestation_management_client.models.AttestationServiceStatus
:param attest_uri: Gets the uri of attestation service.
:type attest_uri: str
"""
Expand Down Expand Up @@ -152,7 +152,7 @@ class AttestationProviderListResult(msrest.serialization.Model):
"""Attestation Providers List.
:param value: Attestation Provider array.
:type value: list[~azure.mgmt.attestation.models.AttestationProvider]
:type value: list[~attestation_management_client.models.AttestationProvider]
"""

_attribute_map = {
Expand Down Expand Up @@ -184,7 +184,7 @@ class AttestationServiceCreationParams(msrest.serialization.Model):
an order of preference among them, although applications of JWK Sets
can choose to assign a meaning to the order for their purposes, if
desired.
:type keys: list[~azure.mgmt.attestation.models.JsonWebKey]
:type keys: list[~attestation_management_client.models.JsonWebKey]
"""

_validation = {
Expand Down Expand Up @@ -374,7 +374,7 @@ class OperationList(msrest.serialization.Model):
"""List of supported operations.
:param value: List of supported operations.
:type value: list[~azure.mgmt.attestation.models.OperationsDefinition]
:type value: list[~attestation_management_client.models.OperationsDefinition]
"""

_attribute_map = {
Expand All @@ -395,7 +395,7 @@ class OperationsDefinition(msrest.serialization.Model):
:param name: Name of the operation.
:type name: str
:param display: Display object with properties of the operation.
:type display: ~azure.mgmt.attestation.models.OperationsDisplayDefinition
:type display: ~attestation_management_client.models.OperationsDisplayDefinition
"""

_attribute_map = {
Expand Down
Loading

0 comments on commit a72d51c

Please sign in to comment.