forked from Azure/azure-cli-extensions
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Azure Orbital CLI extension (Azure#5109)
* orbital extension * testcases 1 * testcases 2 * testcases 3 * code owner added * short alias added * service name added * metadata updated * short summary updated * review points implemented Co-authored-by: Devanshu Singh <devasingh@microsoft.com>
- Loading branch information
1 parent
c8cba36
commit 83df208
Showing
55 changed files
with
49,960 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.. :changelog: | ||
Release History | ||
=============== | ||
|
||
0.1.0 | ||
++++++ | ||
* Initial release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Azure CLI Orbital Extension # | ||
This is an extension to Azure CLI to manage Orbital resources. | ||
|
||
## How to use ## | ||
Please add commands usage here. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# 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 aaz-dev-tools | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
from azure.cli.core import AzCommandsLoader | ||
from azext_orbital._help import helps # pylint: disable=unused-import | ||
|
||
|
||
class OrbitalCommandsLoader(AzCommandsLoader): | ||
|
||
def __init__(self, cli_ctx=None): | ||
from azure.cli.core.commands import CliCommandType | ||
custom_command_type = CliCommandType( | ||
operations_tmpl='azext_orbital.custom#{}') | ||
super().__init__(cli_ctx=cli_ctx, | ||
custom_command_type=custom_command_type) | ||
|
||
def load_command_table(self, args): | ||
from azext_orbital.commands import load_command_table | ||
from azure.cli.core.aaz import load_aaz_command_table | ||
try: | ||
from . import aaz | ||
except ImportError: | ||
aaz = None | ||
if aaz: | ||
load_aaz_command_table( | ||
loader=self, | ||
aaz_pkg_name=aaz.__name__, | ||
args=args | ||
) | ||
load_command_table(self, args) | ||
return self.command_table | ||
|
||
def load_arguments(self, command): | ||
from azext_orbital._params import load_arguments | ||
load_arguments(self, command) | ||
|
||
|
||
COMMAND_LOADER_CLS = OrbitalCommandsLoader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# 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 aaz-dev-tools | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
# pylint: disable=line-too-long | ||
# pylint: disable=too-many-lines | ||
|
||
from knack.help_files import helps # pylint: disable=unused-import |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# 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 aaz-dev-tools | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
# pylint: disable=too-many-lines | ||
# pylint: disable=too-many-statements | ||
|
||
|
||
def load_arguments(self, _): # pylint: disable=unused-argument | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# 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 aaz-dev-tools | ||
# -------------------------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# 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 aaz-dev-tools | ||
# -------------------------------------------------------------------------------------------- |
23 changes: 23 additions & 0 deletions
23
src/orbital/azext_orbital/aaz/latest/orbital/__cmd_group.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# 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 aaz-dev-tools | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
# pylint: skip-file | ||
# flake8: noqa | ||
|
||
from azure.cli.core.aaz import * | ||
|
||
|
||
@register_command_group( | ||
"orbital", | ||
) | ||
class __CMDGroup(AAZCommandGroup): | ||
"""Azure Orbital Ground Station as-a-Service (GSaaS). | ||
""" | ||
pass | ||
|
||
|
||
__all__ = ["__CMDGroup"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# 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 aaz-dev-tools | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
# pylint: skip-file | ||
# flake8: noqa | ||
|
||
from .__cmd_group import * |
23 changes: 23 additions & 0 deletions
23
src/orbital/azext_orbital/aaz/latest/orbital/available_ground_station/__cmd_group.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# 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 aaz-dev-tools | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
# pylint: skip-file | ||
# flake8: noqa | ||
|
||
from azure.cli.core.aaz import * | ||
|
||
|
||
@register_command_group( | ||
"orbital available-ground-station", | ||
) | ||
class __CMDGroup(AAZCommandGroup): | ||
"""Ground stations available to schedule contacts. | ||
""" | ||
pass | ||
|
||
|
||
__all__ = ["__CMDGroup"] |
13 changes: 13 additions & 0 deletions
13
src/orbital/azext_orbital/aaz/latest/orbital/available_ground_station/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# 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 aaz-dev-tools | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
# pylint: skip-file | ||
# flake8: noqa | ||
|
||
from .__cmd_group import * | ||
from ._list import * | ||
from ._show import * |
185 changes: 185 additions & 0 deletions
185
src/orbital/azext_orbital/aaz/latest/orbital/available_ground_station/_list.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# 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 aaz-dev-tools | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
# pylint: skip-file | ||
# flake8: noqa | ||
|
||
from azure.cli.core.aaz import * | ||
|
||
|
||
@register_command( | ||
"orbital available-ground-station list", | ||
) | ||
class List(AAZCommand): | ||
"""List available ground stations. | ||
:example: List Available Ground Station by Capability | ||
az orbital available-ground-station list --capability "EarthObservation" | ||
""" | ||
|
||
_aaz_info = { | ||
"version": "2022-03-01", | ||
"resources": [ | ||
["mgmt-plane", "/subscriptions/{}/providers/microsoft.orbital/availablegroundstations", "2022-03-01"], | ||
] | ||
} | ||
|
||
def _handler(self, command_args): | ||
super()._handler(command_args) | ||
return self.build_paging(self._execute_operations, self._output) | ||
|
||
_args_schema = None | ||
|
||
@classmethod | ||
def _build_arguments_schema(cls, *args, **kwargs): | ||
if cls._args_schema is not None: | ||
return cls._args_schema | ||
cls._args_schema = super()._build_arguments_schema(*args, **kwargs) | ||
|
||
# define Arg Group "" | ||
|
||
_args_schema = cls._args_schema | ||
_args_schema.capability = AAZStrArg( | ||
options=["--capability"], | ||
help="Ground Station Capability.", | ||
required=True, | ||
default="EarthObservation", | ||
enum={"Communication": "Communication", "EarthObservation": "EarthObservation"}, | ||
) | ||
return cls._args_schema | ||
|
||
def _execute_operations(self): | ||
self.AvailableGroundStationsListByCapability(ctx=self.ctx)() | ||
|
||
def _output(self, *args, **kwargs): | ||
result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) | ||
next_link = self.deserialize_output(self.ctx.vars.instance.next_link) | ||
return result, next_link | ||
|
||
class AvailableGroundStationsListByCapability(AAZHttpOperation): | ||
CLIENT_TYPE = "MgmtClient" | ||
|
||
def __call__(self, *args, **kwargs): | ||
request = self.make_request() | ||
session = self.client.send_request(request=request, stream=False, **kwargs) | ||
if session.http_response.status_code in [200]: | ||
return self.on_200(session) | ||
|
||
return self.on_error(session.http_response) | ||
|
||
@property | ||
def url(self): | ||
return self.client.format_url( | ||
"/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/availableGroundStations", | ||
**self.url_parameters | ||
) | ||
|
||
@property | ||
def method(self): | ||
return "GET" | ||
|
||
@property | ||
def error_format(self): | ||
return "ODataV4Format" | ||
|
||
@property | ||
def url_parameters(self): | ||
parameters = { | ||
**self.serialize_url_param( | ||
"subscriptionId", self.ctx.subscription_id, | ||
required=True, | ||
), | ||
} | ||
return parameters | ||
|
||
@property | ||
def query_parameters(self): | ||
parameters = { | ||
**self.serialize_query_param( | ||
"capability", self.ctx.args.capability, | ||
required=True, | ||
), | ||
**self.serialize_query_param( | ||
"api-version", "2022-03-01", | ||
required=True, | ||
), | ||
} | ||
return parameters | ||
|
||
@property | ||
def header_parameters(self): | ||
parameters = { | ||
**self.serialize_header_param( | ||
"Accept", "application/json", | ||
), | ||
} | ||
return parameters | ||
|
||
def on_200(self, session): | ||
data = self.deserialize_http_content(session) | ||
self.ctx.set_var( | ||
"instance", | ||
data, | ||
schema_builder=self._build_schema_on_200 | ||
) | ||
|
||
_schema_on_200 = None | ||
|
||
@classmethod | ||
def _build_schema_on_200(cls): | ||
if cls._schema_on_200 is not None: | ||
return cls._schema_on_200 | ||
|
||
cls._schema_on_200 = AAZObjectType() | ||
|
||
_schema_on_200 = cls._schema_on_200 | ||
_schema_on_200.next_link = AAZStrType( | ||
serialized_name="nextLink", | ||
flags={"read_only": True}, | ||
) | ||
_schema_on_200.value = AAZListType() | ||
|
||
value = cls._schema_on_200.value | ||
value.Element = AAZObjectType() | ||
|
||
_element = cls._schema_on_200.value.Element | ||
_element.id = AAZStrType( | ||
flags={"read_only": True}, | ||
) | ||
_element.location = AAZStrType() | ||
_element.name = AAZStrType( | ||
flags={"read_only": True}, | ||
) | ||
_element.properties = AAZObjectType( | ||
flags={"client_flatten": True}, | ||
) | ||
_element.type = AAZStrType( | ||
flags={"read_only": True}, | ||
) | ||
|
||
properties = cls._schema_on_200.value.Element.properties | ||
properties.altitude_meters = AAZFloatType( | ||
serialized_name="altitudeMeters", | ||
) | ||
properties.city = AAZStrType() | ||
properties.latitude_degrees = AAZFloatType( | ||
serialized_name="latitudeDegrees", | ||
) | ||
properties.longitude_degrees = AAZFloatType( | ||
serialized_name="longitudeDegrees", | ||
) | ||
properties.provider_name = AAZStrType( | ||
serialized_name="providerName", | ||
) | ||
properties.release_mode = AAZStrType( | ||
serialized_name="releaseMode", | ||
) | ||
|
||
return cls._schema_on_200 | ||
|
||
|
||
__all__ = ["List"] |
Oops, something went wrong.