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 customproviders/resource-manager] Add Swagger and Examples for custom resource provider to Azure #5000

Merged
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
18 changes: 18 additions & 0 deletions azure-mgmt/customproviders/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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 .customproviders_client import customprovidersClient
from .version import VERSION

__all__ = ['customprovidersClient']

__version__ = VERSION

88 changes: 88 additions & 0 deletions azure-mgmt/customproviders/customproviders_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# 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.service_client import SDKClient
from msrest import Serializer, Deserializer
from msrestazure import AzureConfiguration
from .version import VERSION
from .operations.operations import Operations
from .operations.custom_resource_provider_operations import CustomResourceProviderOperations
from . import models


class customprovidersClientConfiguration(AzureConfiguration):
"""Configuration for customprovidersClient
Note that all parameters used to create this instance are saved as instance
attributes.

:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: The Azure subscription ID. This is a
GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
:type subscription_id: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, base_url=None):

if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
if not base_url:
base_url = 'https://management.azure.com'

super(customprovidersClientConfiguration, self).__init__(base_url)

self.add_user_agent('customproviders/{}'.format(VERSION))
self.add_user_agent('Azure-SDK-For-Python')

self.credentials = credentials
self.subscription_id = subscription_id


class customprovidersClient(SDKClient):
"""Allows extension of ARM control plane with custom resource providers.

:ivar config: Configuration for client.
:vartype config: customprovidersClientConfiguration

:ivar operations: Operations operations
:vartype operations: microsoft.customproviders.operations.Operations
:ivar custom_resource_provider: CustomResourceProvider operations
:vartype custom_resource_provider: microsoft.customproviders.operations.CustomResourceProviderOperations

:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: The Azure subscription ID. This is a
GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
:type subscription_id: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, base_url=None):

self.config = customprovidersClientConfiguration(credentials, subscription_id, base_url)
super(customprovidersClient, 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 = '2018-09-01-preview'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
self.custom_resource_provider = CustomResourceProviderOperations(
self._client, self.config, self._serialize, self._deserialize)
63 changes: 63 additions & 0 deletions azure-mgmt/customproviders/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 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.
# --------------------------------------------------------------------------

try:
from .custom_rp_action_route_definition_py3 import CustomRPActionRouteDefinition
from .custom_rp_resource_type_route_definition_py3 import CustomRPResourceTypeRouteDefinition
from .custom_rp_validations_py3 import CustomRPValidations
from .custom_rp_manifest_py3 import CustomRPManifest
from .custom_rp_route_definition_py3 import CustomRPRouteDefinition
from .resource_provider_operation_display_py3 import ResourceProviderOperationDisplay
from .resource_provider_operation_py3 import ResourceProviderOperation
from .resource_py3 import Resource
from .resource_providers_update_py3 import ResourceProvidersUpdate
from .error_definition_py3 import ErrorDefinition
from .error_response_py3 import ErrorResponse, ErrorResponseException
except (SyntaxError, ImportError):
from .custom_rp_action_route_definition import CustomRPActionRouteDefinition
from .custom_rp_resource_type_route_definition import CustomRPResourceTypeRouteDefinition
from .custom_rp_validations import CustomRPValidations
from .custom_rp_manifest import CustomRPManifest
from .custom_rp_route_definition import CustomRPRouteDefinition
from .resource_provider_operation_display import ResourceProviderOperationDisplay
from .resource_provider_operation import ResourceProviderOperation
from .resource import Resource
from .resource_providers_update import ResourceProvidersUpdate
from .error_definition import ErrorDefinition
from .error_response import ErrorResponse, ErrorResponseException
from .resource_provider_operation_paged import ResourceProviderOperationPaged
from .custom_rp_manifest_paged import CustomRPManifestPaged
from .customproviders_client_enums import (
ActionRouting,
ResourceTypeRouting,
ValidationType,
ProvisioningState,
)

__all__ = [
'CustomRPActionRouteDefinition',
'CustomRPResourceTypeRouteDefinition',
'CustomRPValidations',
'CustomRPManifest',
'CustomRPRouteDefinition',
'ResourceProviderOperationDisplay',
'ResourceProviderOperation',
'Resource',
'ResourceProvidersUpdate',
'ErrorDefinition',
'ErrorResponse', 'ErrorResponseException',
'ResourceProviderOperationPaged',
'CustomRPManifestPaged',
'ActionRouting',
'ResourceTypeRouting',
'ValidationType',
'ProvisioningState',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# 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 .custom_rp_route_definition import CustomRPRouteDefinition


class CustomRPActionRouteDefinition(CustomRPRouteDefinition):
"""The route definition for an action implemented by the custom resource
provider.

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

:param name: Required. The name of the route definition. This becomes the
name for the ARM extension (e.g.
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}/{name}')
:type name: str
:param endpoint: Required. The route definition endpoint URI that the
custom resource provider will proxy requests to. This can be in the form
of a flat URI (e.g. 'https://testendpoint/') or can specify to route via a
path (e.g. 'https://testendpoint/{requestPath}')
:type endpoint: str
:param routing_type: The routing types that are supported for action
requests. Possible values include: 'Proxy'
:type routing_type: str or ~microsoft.customproviders.models.ActionRouting
"""

_validation = {
'name': {'required': True},
'endpoint': {'required': True, 'pattern': r'^https://.+'},
}

_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'endpoint': {'key': 'endpoint', 'type': 'str'},
'routing_type': {'key': 'routingType', 'type': 'str'},
}

def __init__(self, **kwargs):
super(CustomRPActionRouteDefinition, self).__init__(**kwargs)
self.routing_type = kwargs.get('routing_type', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# 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 .custom_rp_route_definition_py3 import CustomRPRouteDefinition


class CustomRPActionRouteDefinition(CustomRPRouteDefinition):
"""The route definition for an action implemented by the custom resource
provider.

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

:param name: Required. The name of the route definition. This becomes the
name for the ARM extension (e.g.
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}/{name}')
:type name: str
:param endpoint: Required. The route definition endpoint URI that the
custom resource provider will proxy requests to. This can be in the form
of a flat URI (e.g. 'https://testendpoint/') or can specify to route via a
path (e.g. 'https://testendpoint/{requestPath}')
:type endpoint: str
:param routing_type: The routing types that are supported for action
requests. Possible values include: 'Proxy'
:type routing_type: str or ~microsoft.customproviders.models.ActionRouting
"""

_validation = {
'name': {'required': True},
'endpoint': {'required': True, 'pattern': r'^https://.+'},
}

_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'endpoint': {'key': 'endpoint', 'type': 'str'},
'routing_type': {'key': 'routingType', 'type': 'str'},
}

def __init__(self, *, name: str, endpoint: str, routing_type=None, **kwargs) -> None:
super(CustomRPActionRouteDefinition, self).__init__(name=name, endpoint=endpoint, **kwargs)
self.routing_type = routing_type
77 changes: 77 additions & 0 deletions azure-mgmt/customproviders/models/custom_rp_manifest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# 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 CustomRPManifest(Resource):
"""A manifest file that defines the custom resource provider resources.

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
:vartype type: str
:param location: Required. Resource location
:type location: str
:param tags: Resource tags
:type tags: dict[str, str]
:param actions: A list of actions that the custom resource provider
implements.
:type actions:
list[~microsoft.customproviders.models.CustomRPActionRouteDefinition]
:param resource_types: A list of resource types that the custom resource
provider implements.
:type resource_types:
list[~microsoft.customproviders.models.CustomRPResourceTypeRouteDefinition]
:param validations: A list of validations to run on the custom resource
provider's requests.
:type validations:
list[~microsoft.customproviders.models.CustomRPValidations]
:ivar provisioning_state: The provisioning state of the resource provider.
Possible values include: 'Accepted', 'Deleting', 'Running', 'Succeeded',
'Failed'
:vartype provisioning_state: str or
~microsoft.customproviders.models.ProvisioningState
"""

_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'location': {'required': True},
'provisioning_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}'},
'actions': {'key': 'properties.actions', 'type': '[CustomRPActionRouteDefinition]'},
'resource_types': {'key': 'properties.resourceTypes', 'type': '[CustomRPResourceTypeRouteDefinition]'},
'validations': {'key': 'properties.validations', 'type': '[CustomRPValidations]'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
}

def __init__(self, **kwargs):
super(CustomRPManifest, self).__init__(**kwargs)
self.actions = kwargs.get('actions', None)
self.resource_types = kwargs.get('resource_types', None)
self.validations = kwargs.get('validations', None)
self.provisioning_state = None
27 changes: 27 additions & 0 deletions azure-mgmt/customproviders/models/custom_rp_manifest_paged.py
Original file line number Diff line number Diff line change
@@ -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 CustomRPManifestPaged(Paged):
"""
A paging container for iterating over a list of :class:`CustomRPManifest <microsoft.customproviders.models.CustomRPManifest>` object
"""

_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[CustomRPManifest]'}
}

def __init__(self, *args, **kwargs):

super(CustomRPManifestPaged, self).__init__(*args, **kwargs)
Loading