generated from microsoft/python-package-template
-
Notifications
You must be signed in to change notification settings - Fork 8
/
azpc_app.py
48 lines (40 loc) · 1.43 KB
/
azpc_app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
"""CLI Wrapper for Creating, Updating, or Deleting Azure Managed Applications"""
import sys
from azureiai.partner_center import run
from azureiai.partner_center.offers.application import ApplicationCLI
from azureiai.partner_center.offers.container import ContainerCLI
from azureiai.partner_center.offers.managed_app import ManagedAppCLI
from azureiai.partner_center.offers.solution_template import SolutionTemplateCLI
from azureiai.partner_center.offers.virtual_machine import VirtualMachineCLI
def main():
"""CLI Application"""
help_text = """
Group:
azpc : Manage Partner Center submissions.
Subgroups:
app : Application
ma : Managed Applications
st : Solution Templates
vm : Virtual Machine Images
co : Containers
"""
subgroup = sys.argv[1]
if subgroup in ["--help", "-h"]:
return help_text
commands = {
"app": ApplicationCLI,
"ma": ManagedAppCLI,
"vm": VirtualMachineCLI,
"st": SolutionTemplateCLI,
"co": ContainerCLI,
}
try:
print(run(commands[subgroup]()), file=sys.stdout)
except NameError as error:
print(error, file=sys.stderr)
sys.exit(1)
if __name__ == "__main__":
main()