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

Sdk track 2 #248

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
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
51 changes: 51 additions & 0 deletions .github/workflows/build-wheel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

name: SFCTL-build

on:
push:
pull_request:

jobs:
build_wheel:
name: build wheel
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Get versions
run: |
echo "pip version:"
pip -V
echo "python version:"
python -V
echo "git version:"
git --version
echo "bash version:"
bash --version
echo "os version:"
cat /proc/version
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --force-reinstall -e ./src
pip install --force-reinstall -r requirements.txt
- name: install wheel
run: |
pip install wheel==0.37.1
- name: Build Wheel
run: |
cd src
python setup.py bdist_wheel --universal
- name: upload wheel
uses: actions/upload-artifact@v2
if: always()
with:
name: wheel
path: /home/runner/work/service-fabric-cli/service-fabric-cli/src/dist*
1 change: 1 addition & 0 deletions customSDK/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
20 changes: 20 additions & 0 deletions customSDK/servicefabric/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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 ._client import ServiceFabricClientAPIs

try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = ['ServiceFabricClientAPIs']
__all__.extend([p for p in _patch_all if p not in __all__])

_patch_sdk()
137 changes: 137 additions & 0 deletions customSDK/servicefabric/_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# 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 copy import deepcopy
from typing import Any, TYPE_CHECKING

from msrest import Deserializer, Serializer

from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient

from ._configuration import ServiceFabricClientAPIsConfiguration
from .operations import MeshApplicationOperations, MeshCodePackageOperations, MeshGatewayOperations, MeshNetworkOperations, MeshSecretOperations, MeshSecretValueOperations, MeshServiceOperations, MeshServiceReplicaOperations, MeshVolumeOperations, ServiceFabricClientAPIsOperationsMixin

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

from azure.core.credentials import TokenCredential

class ServiceFabricClientAPIs(ServiceFabricClientAPIsOperationsMixin): # pylint: disable=too-many-instance-attributes
"""Service Fabric REST Client APIs allows management of Service Fabric clusters, applications and
services.

:ivar mesh_secret: MeshSecretOperations operations
:vartype mesh_secret: azure.servicefabric.operations.MeshSecretOperations
:ivar mesh_secret_value: MeshSecretValueOperations operations
:vartype mesh_secret_value: azure.servicefabric.operations.MeshSecretValueOperations
:ivar mesh_volume: MeshVolumeOperations operations
:vartype mesh_volume: azure.servicefabric.operations.MeshVolumeOperations
:ivar mesh_network: MeshNetworkOperations operations
:vartype mesh_network: azure.servicefabric.operations.MeshNetworkOperations
:ivar mesh_application: MeshApplicationOperations operations
:vartype mesh_application: azure.servicefabric.operations.MeshApplicationOperations
:ivar mesh_service: MeshServiceOperations operations
:vartype mesh_service: azure.servicefabric.operations.MeshServiceOperations
:ivar mesh_code_package: MeshCodePackageOperations operations
:vartype mesh_code_package: azure.servicefabric.operations.MeshCodePackageOperations
:ivar mesh_service_replica: MeshServiceReplicaOperations operations
:vartype mesh_service_replica: azure.servicefabric.operations.MeshServiceReplicaOperations
:ivar mesh_gateway: MeshGatewayOperations operations
:vartype mesh_gateway: azure.servicefabric.operations.MeshGatewayOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:keyword endpoint: Service URL. Default value is "http://localhost:19080/".
:paramtype endpoint: str
:keyword api_version: Api Version. Default value is "9.0.0.46". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(
self,
credential: "TokenCredential",
*,
endpoint: str = "http://localhost:19080/",
**kwargs: Any
) -> None:

self._config = ServiceFabricClientAPIsConfiguration(credential=credential, **kwargs)
self._client = ARMPipelineClient(base_url=endpoint, config=self._config, **kwargs)

self._serialize = Serializer()
self._deserialize = Deserializer()
self._serialize.client_side_validation = False
self.mesh_secret = MeshSecretOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.mesh_secret_value = MeshSecretValueOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.mesh_volume = MeshVolumeOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.mesh_network = MeshNetworkOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.mesh_application = MeshApplicationOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.mesh_service = MeshServiceOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.mesh_code_package = MeshCodePackageOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.mesh_service_replica = MeshServiceReplicaOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.mesh_gateway = MeshGatewayOperations(
self._client, self._config, self._serialize, self._deserialize
)


def send_request(
self,
request: HttpRequest,
**kwargs: Any
) -> HttpResponse:
"""Runs the network request through the client's chained policies.

>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client.send_request(request)
<HttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart

:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.rest.HttpResponse
"""

request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)

def close(self):
# type: () -> None
self._client.close()

def __enter__(self):
# type: () -> ServiceFabricClientAPIs
self._client.__enter__()
return self

def __exit__(self, *exc_details):
# type: (Any) -> None
self._client.__exit__(*exc_details)
66 changes: 66 additions & 0 deletions customSDK/servicefabric/_configuration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# 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 typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy

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

VERSION = "unknown"

class ServiceFabricClientAPIsConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for ServiceFabricClientAPIs.

Note that all parameters used to create this instance are saved as instance
attributes.

:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:keyword api_version: Api Version. Default value is "9.0.0.46". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(
self,
credential: "TokenCredential",
**kwargs: Any
) -> None:
super(ServiceFabricClientAPIsConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "9.0.0.46") # type: str

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")

self.credential = credential
self.api_version = api_version
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'servicefabric/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
self,
**kwargs # type: Any
):
# type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
19 changes: 19 additions & 0 deletions customSDK/servicefabric/_patch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""Customize generated code here.

Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import List

__all__: List[str] = [] # Add all objects you want publicly available to users at this package level

def patch_sdk():
"""Do not remove from this file.

`patch_sdk` is a last resort escape hatch that allows you to do customizations
you can't accomplish using the techniques described in
https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
37 changes: 37 additions & 0 deletions customSDK/servicefabric/_vendor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# --------------------------------------------------------------------------
# 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 abc import ABC
from typing import TYPE_CHECKING

from ._configuration import ServiceFabricClientAPIsConfiguration

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from msrest import Deserializer, Serializer

from azure.core import PipelineClient


def _format_url_section(template, **kwargs):
components = template.split("/")
while components:
try:
return template.format(**kwargs)
except KeyError as key:
formatted_components = template.split("/")
components = [
c for c in formatted_components if "{}".format(key.args[0]) not in c
]
template = "/".join(components)

class MixinABC(ABC):
"""DO NOT use this class. It is for internal typing use only."""
_client: "PipelineClient"
_config: ServiceFabricClientAPIsConfiguration
_serialize: "Serializer"
_deserialize: "Deserializer"
20 changes: 20 additions & 0 deletions customSDK/servicefabric/aio/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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 ._client import ServiceFabricClientAPIs

try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = ['ServiceFabricClientAPIs']
__all__.extend([p for p in _patch_all if p not in __all__])

_patch_sdk()
Loading