Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
from .sampling_settings_py3 import SamplingSettings
from .diagnostic_contract_py3 import DiagnosticContract
from .schema_contract_py3 import SchemaContract
from .schema_create_or_update_contract_py3 import SchemaCreateOrUpdateContract
from .policy_contract_py3 import PolicyContract
from .policy_collection_py3 import PolicyCollection
from .product_contract_py3 import ProductContract
Expand Down Expand Up @@ -200,6 +201,7 @@
from .sampling_settings import SamplingSettings
from .diagnostic_contract import DiagnosticContract
from .schema_contract import SchemaContract
from .schema_create_or_update_contract import SchemaCreateOrUpdateContract
from .policy_contract import PolicyContract
from .policy_collection import PolicyCollection
from .product_contract import ProductContract
Expand Down Expand Up @@ -428,6 +430,7 @@
'SamplingSettings',
'DiagnosticContract',
'SchemaContract',
'SchemaCreateOrUpdateContract',
'PolicyContract',
'PolicyCollection',
'ProductContract',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ class SchemaContract(Resource):
:vartype type: str
:param content_type: Required. Must be a valid a media type used in a
Content-Type header as defined in the RFC 2616. Media type of the schema
document (e.g. application/json, application/xml).
document (e.g. application/json, application/xml). </br> - `Swagger`
Schema use `application/vnd.ms-azure-apim.swagger.definitions+json` </br>
- `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml` </br> -
`OpenApi` Schema use `application/vnd.oai.openapi.components+json` </br> -
`WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml`.
:type content_type: str
:param value: Json escaped string defining the document representing the
Schema.
:type value: str
:param document: Properties of the Schema Document.
:type document: object
"""

_validation = {
Expand All @@ -47,10 +50,10 @@ class SchemaContract(Resource):
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'content_type': {'key': 'properties.contentType', 'type': 'str'},
'value': {'key': 'properties.document.value', 'type': 'str'},
'document': {'key': 'properties.document', 'type': 'object'},
}

def __init__(self, **kwargs):
super(SchemaContract, self).__init__(**kwargs)
self.content_type = kwargs.get('content_type', None)
self.value = kwargs.get('value', None)
self.document = kwargs.get('document', None)
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ class SchemaContract(Resource):
:vartype type: str
:param content_type: Required. Must be a valid a media type used in a
Content-Type header as defined in the RFC 2616. Media type of the schema
document (e.g. application/json, application/xml).
document (e.g. application/json, application/xml). </br> - `Swagger`
Schema use `application/vnd.ms-azure-apim.swagger.definitions+json` </br>
- `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml` </br> -
`OpenApi` Schema use `application/vnd.oai.openapi.components+json` </br> -
`WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml`.
:type content_type: str
:param value: Json escaped string defining the document representing the
Schema.
:type value: str
:param document: Properties of the Schema Document.
:type document: object
"""

_validation = {
Expand All @@ -47,10 +50,10 @@ class SchemaContract(Resource):
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'content_type': {'key': 'properties.contentType', 'type': 'str'},
'value': {'key': 'properties.document.value', 'type': 'str'},
'document': {'key': 'properties.document', 'type': 'object'},
}

def __init__(self, *, content_type: str, value: str=None, **kwargs) -> None:
def __init__(self, *, content_type: str, document=None, **kwargs) -> None:
super(SchemaContract, self).__init__(**kwargs)
self.content_type = content_type
self.value = value
self.document = document
Original file line number Diff line number Diff line change
@@ -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 .resource import Resource


class SchemaCreateOrUpdateContract(Resource):
"""Schema Contract details.

Variables are only populated by the server, and will be ignored when
sending a request.

All required parameters must be populated in order to send to Azure.

:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type for API Management resource.
:vartype type: str
:param content_type: Required. Must be a valid a media type used in a
Content-Type header as defined in the RFC 2616. Media type of the schema
document (e.g. application/json, application/xml). </br> - `Swagger`
Schema use `application/vnd.ms-azure-apim.swagger.definitions+json` </br>
- `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml` </br> -
`OpenApi` Schema use `application/vnd.oai.openapi.components+json` </br> -
`WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml`.
:type content_type: str
:param value: Json escaped string defining the document representing the
Schema.
:type value: str
"""

_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'content_type': {'required': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'content_type': {'key': 'properties.contentType', 'type': 'str'},
'value': {'key': 'properties.document.value', 'type': 'str'},
}

def __init__(self, **kwargs):
super(SchemaCreateOrUpdateContract, self).__init__(**kwargs)
self.content_type = kwargs.get('content_type', None)
self.value = kwargs.get('value', None)
Original file line number Diff line number Diff line change
@@ -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 .resource_py3 import Resource


class SchemaCreateOrUpdateContract(Resource):
"""Schema Contract details.

Variables are only populated by the server, and will be ignored when
sending a request.

All required parameters must be populated in order to send to Azure.

:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type for API Management resource.
:vartype type: str
:param content_type: Required. Must be a valid a media type used in a
Content-Type header as defined in the RFC 2616. Media type of the schema
document (e.g. application/json, application/xml). </br> - `Swagger`
Schema use `application/vnd.ms-azure-apim.swagger.definitions+json` </br>
- `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml` </br> -
`OpenApi` Schema use `application/vnd.oai.openapi.components+json` </br> -
`WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml`.
:type content_type: str
:param value: Json escaped string defining the document representing the
Schema.
:type value: str
"""

_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'content_type': {'required': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'content_type': {'key': 'properties.contentType', 'type': 'str'},
'value': {'key': 'properties.document.value', 'type': 'str'},
}

def __init__(self, *, content_type: str, value: str=None, **kwargs) -> None:
super(SchemaCreateOrUpdateContract, self).__init__(**kwargs)
self.content_type = content_type
self.value = value
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,13 @@ def create_or_update(
:type schema_id: str
:param content_type: Must be a valid a media type used in a
Content-Type header as defined in the RFC 2616. Media type of the
schema document (e.g. application/json, application/xml).
schema document (e.g. application/json, application/xml). </br> -
`Swagger` Schema use
`application/vnd.ms-azure-apim.swagger.definitions+json` </br> -
`WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml` </br> -
`OpenApi` Schema use `application/vnd.oai.openapi.components+json`
</br> - `WADL Schema` use
`application/vnd.ms-azure-apim.wadl.grammars+xml`.
:type content_type: str
:param if_match: ETag of the Entity. Not required when creating an
entity, but required when updating an entity.
Expand All @@ -302,7 +308,7 @@ def create_or_update(
:raises:
:class:`ErrorResponseException<azure.mgmt.apimanagement.models.ErrorResponseException>`
"""
parameters = models.SchemaContract(content_type=content_type, value=value)
parameters = models.SchemaCreateOrUpdateContract(content_type=content_type, value=value)

# Construct URL
url = self.create_or_update.metadata['url']
Expand Down Expand Up @@ -333,7 +339,7 @@ def create_or_update(
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

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

# Construct and send request
request = self._client.put(url, query_parameters, header_parameters, body_content)
Expand Down