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

Merge azure master back to fork. #41

Merged
merged 11 commits into from
Apr 18, 2019
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
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

/src/db-up/ @yugangw-msft

/src/dev-spaces-preview/ @amsoedal
/src/dev-spaces/ @amsoedal

/src/dms-preview/ @temandr

Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This checklist is used to make sure that common guidelines for a pull request ar

### General Guidelines

- [ ] Have you run `./scripts/ci/test_static.sh` locally? (`pip install pylint flake8` required)
- [ ] Have you run `azdev style <YOUR_EXT>` locally? (`pip install azdev` required)
- [ ] Have you run `python scripts/ci/test_index.py -q` locally?

For new extensions:
Expand Down
16 changes: 8 additions & 8 deletions azure-cli-extensions.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -750,10 +750,10 @@
<Compile Include="src\botservice\azext_bot\_params.py" />
<Compile Include="src\botservice\azext_bot\__init__.py" />
<Compile Include="src\botservice\setup.py" />
<Compile Include="src\dev-spaces-preview\azext_dev_spaces_preview\custom.py" />
<Compile Include="src\dev-spaces-preview\azext_dev_spaces_preview\_help.py" />
<Compile Include="src\dev-spaces-preview\azext_dev_spaces_preview\__init__.py" />
<Compile Include="src\dev-spaces-preview\setup.py" />
<Compile Include="src\dev-spaces\azext_dev_spaces\custom.py" />
<Compile Include="src\dev-spaces\azext_dev_spaces\_help.py" />
<Compile Include="src\dev-spaces\azext_dev_spaces\__init__.py" />
<Compile Include="src\dev-spaces\setup.py" />
<Compile Include="src\dms-preview\azext_dms\commands.py" />
<Compile Include="src\dms-preview\azext_dms\custom.py" />
<Compile Include="src\dms-preview\azext_dms\scenario_inputs.py" />
Expand Down Expand Up @@ -4760,8 +4760,8 @@
<Content Include="src\botservice\azext_bot\azext_metadata.json" />
<Content Include="src\botservice\HISTORY.rst" />
<Content Include="src\botservice\README.rst" />
<Content Include="src\dev-spaces-preview\azext_dev_spaces_preview\azext_metadata.json" />
<Content Include="src\dev-spaces-preview\readme.md" />
<Content Include="src\dev-spaces\azext_dev_spaces\azext_metadata.json" />
<Content Include="src\dev-spaces\readme.md" />
<Content Include="src\dms-preview\azext_dms\azext_metadata.json" />
<Content Include="src\dms-preview\README.rst" />
<Content Include="src\eventgrid\azext_eventgrid\azext_metadata.json" />
Expand Down Expand Up @@ -4822,8 +4822,8 @@
<Folder Include="src\azure-firewall\azext_firewall\vendored_sdks\v2018_08_01\operations" />
<Folder Include="src\botservice" />
<Folder Include="src\botservice\azext_bot" />
<Folder Include="src\dev-spaces-preview" />
<Folder Include="src\dev-spaces-preview\azext_dev_spaces_preview" />
<Folder Include="src\dev-spaces" />
<Folder Include="src\dev-spaces\azext_dev_spaces" />
<Folder Include="src\dms-preview" />
<Folder Include="src\dms-preview\azext_dms" />
<Folder Include="src\dms-preview\azext_dms\vendored_sdks" />
Expand Down
2 changes: 1 addition & 1 deletion scripts/avail-ext-doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Jinja2==2.10
Jinja2~=2.10.1
GitPython==2.1.8
PyGithub>=1.36
wheel==0.31.1
3 changes: 1 addition & 2 deletions src/aks-preview/azext_aks_preview/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ def load_command_table(self, args):
return self.command_table

def load_arguments(self, command):
# super(ContainerServiceCommandsLoader, self).load_arguments(command)
super().load_arguments(command)
super(ContainerServiceCommandsLoader, self).load_arguments(command)
from ._params import load_arguments
load_arguments(self, command)

Expand Down
8 changes: 7 additions & 1 deletion src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ def aks_agentpool_list(cmd, client, resource_group_name, cluster_name):
def aks_agentpool_add(cmd, client, resource_group_name, cluster_name, nodepool_name,
kubernetes_version=None,
node_zones=None,
node_vm_size="Standard_DS2_v2",
node_vm_size=None,
node_osdisk_size=0,
node_count=3,
vnet_subnet_id=None,
Expand All @@ -1018,6 +1018,12 @@ def aks_agentpool_add(cmd, client, resource_group_name, cluster_name, nodepool_n
raise CLIError("Node pool {} already exists, please try a different name, "
"use 'aks nodepool list' to get current list of node pool".format(nodepool_name))

if node_vm_size is None:
if os_type == "Windows":
node_vm_size = "Standard_D2s_v3"
else:
node_vm_size = "Standard_DS2_v2"

agent_pool = AgentPool(
name=nodepool_name,
count=int(node_count),
Expand Down
2 changes: 1 addition & 1 deletion src/aks-preview/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from codecs import open as open1
from setuptools import setup, find_packages

VERSION = "0.3.0"
VERSION = "0.3.1"
CLASSIFIERS = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,7 @@ def cf_events(cli_ctx, _, subscription=None):

def cf_components(cli_ctx, _, subscription=None):
return applicationinsights_mgmt_plane_client(cli_ctx, _, subscription=subscription).components


def cf_api_key(cli_ctx, _, subscription=None):
return applicationinsights_mgmt_plane_client(cli_ctx, _, subscription=subscription).api_keys
146 changes: 146 additions & 0 deletions src/application-insights/azext_applicationinsights/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,126 @@
provided, then --offset will be ignored.
"""

helps['monitor app-insights component'] = """
type: group
short-summary: Manage an Application Insights component or its subcomponents.
"""

helps['monitor app-insights component create'] = """
type: command
short-summary: Create a new Application Insights resource.
parameters:
- name: --application-type
type: string
short-summary: Type of application being monitored. Possible values include 'web', 'other'. Default value is'web' .
- name: --kind -k
type: string
short-summary: The kind of application that this component refers to, used to customize UI. This value is a freeform string, values should typically be one of web, ios, other, store, java, phone.
examples:
- name: Create a component with kind web and location.
text: |
az monitor app-insights component create --app demoApp --location westus2 --kind web -g demoRg --application-type web
"""

helps['monitor app-insights component update'] = """
type: command
short-summary: Update properties on an existing Application Insights resource. The primary value which can be updated is kind, which customizes the UI experience.
parameters:
- name: --kind -k
type: string
short-summary: The kind of application that this component refers to, used to customize UI. This value is a freeform string, values should typically be one of web, ios, other, store, java, phone.
examples:
- name: Update a component with kind web.
text: |
az monitor app-insights component update --app demoApp -k web -g demoRg
"""

helps['monitor app-insights component update-tags'] = """
type: command
short-summary: Update tags on an existing Application Insights resource.
examples:
- name: Update the tag 'name' to equal 'value'.
text: |
az monitor app-insights component update-tags --app demoApp --tags name=value -g demoRg
"""

helps['monitor app-insights component show'] = """
type: command
short-summary: Get an Application Insights resource.
examples:
- name: Get a component by name.
text: |
az monitor app-insights component show --app demoApp -g demoRg
- name: List components in a resource group.
text: |
az monitor app-insights component show -g demoRg
- name: List components in the currently selected subscription.
text: |
az monitor app-insights component show
"""

helps['monitor app-insights component delete'] = """
type: command
short-summary: Create a new Application Insights resource.
examples:
- name: Create a component with kind web and location.
text: |
az monitor app-insights component delete --app demoApp -g demoRg
"""

helps['monitor app-insights api-key'] = """
type: group
short-summary: Operations on API keys associated with an Application Insights component.
"""

helps['monitor app-insights api-key show'] = """
type: command
short-summary: Get all keys or a specific API key associated with an Application Insights resource.
parameters:
- name: --api-key
type: string
short-summary: name of the API key to fetch. Can be found using `api-keys show`.
examples:
- name: Fetch API Key.
text: |
az monitor app-insights api-key show --app demoApp -g demoRg --api-key demo-key
- name: Fetch API Keys.
text: |
az monitor app-insights api-key show --app demoApp -g demoRg
"""

helps['monitor app-insights api-key delete'] = """
type: command
short-summary: Delete an API key from an Application Insights resource.
parameters:
- name: --api-key
type: string
short-summary: Name of the API key to delete. Can be found using `api-keys show`.
examples:
- name: Delete API Key.
text: |
az monitor app-insights api-key delete --app demoApp -g demoRg --api-key demo-key
"""

helps['monitor app-insights api-key create'] = """
type: command
short-summary: Create a new API key for use with an Application Insights resource.
parameters:
- name: --api-key
type: string
short-summary: Name of the API key to create.
- name: --read-properties
type: list
short-summary: A space seperated list of names of read Roles for this API key to inherit. Possible values include ReadTelemetry and AuthenticateSDKControlChannel.
- name: --write-properties
type: list
short-summary: A space seperated list of names of write Roles for this API key to inherit. Possible values include WriteAnnotations.
examples:
- name: Create a component with kind web and location.
text: |
az monitor app-insights api-key create --api-key cli-demo --read-properties ReadTelemetry -g demoRg --app testApp
"""

helps['monitor app-insights metrics'] = """
type: group
short-summary: Retrieve metrics from an application.
Expand All @@ -34,6 +154,15 @@
helps['monitor app-insights query'] = """
type: command
short-summary: Execute a query over data in your application.
parameters:
- name: --offset
short-summary: >
Time offset of the query range, in ##d##h format.
long-summary: >
Can be used with either --start-time or --end-time. If used with --start-time, then
the end time will be calculated by adding the offset. If used with --end-time (default), then
the start time will be calculated by subtracting the offset. If --start-time and --end-time are
provided, then --offset will be ignored.
examples:
- name: Execute a simple query over past 3.5 days.
text: |
Expand All @@ -47,6 +176,14 @@
- name: --interval
short-summary: >
The interval over which to aggregate metrics, in ##h##m format.
- name: --offset
short-summary: >
Time offset of the query range, in ##d##h format.
long-summary: >
Can be used with either --start-time or --end-time. If used with --start-time, then
the end time will be calculated by adding the offset. If used with --end-time (default), then
the start time will be calculated by subtracting the offset. If --start-time and --end-time are
provided, then --offset will be ignored.
examples:
- name: View the count of availabilityResults events.
text: |
Expand All @@ -65,6 +202,15 @@
helps['monitor app-insights events show'] = """
type: command
short-summary: List events by type or view a single event from an application, specified by type and ID.
parameters:
- name: --offset
short-summary: >
Time offset of the query range, in ##d##h format.
long-summary: >
Can be used with either --start-time or --end-time. If used with --start-time, then
the end time will be calculated by adding the offset. If used with --end-time (default), then
the start time will be calculated by subtracting the offset. If --start-time and --end-time are
provided, then --offset will be ignored.
examples:
- name: Get an availability result by ID.
text: |
Expand Down
36 changes: 32 additions & 4 deletions src/application-insights/azext_applicationinsights/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,36 @@
# --------------------------------------------------------------------------------------------

# pylint: disable=line-too-long
from azure.cli.core.commands.parameters import get_datetime_type
from azure.cli.core.commands.parameters import get_datetime_type, get_location_type, tags_type
from azure.cli.command_modules.monitor.actions import get_period_type
from ._validators import validate_applications


def load_arguments(self, _):
with self.argument_context('monitor app-insights') as c:
c.argument('application', options_list=['--app', '-a'], id_part='name', help='GUID, app name, or fully-qualified Azure resource name of Application Insights component. The application GUID may be acquired from the API Access menu item on any Application Insights resource in the Azure portal. If using an application name, please specify resource group.')
c.argument('start_time', arg_type=get_datetime_type(help='Start-time of time range for which to retrieve data.'))
c.argument('end_time', arg_type=get_datetime_type(help='End of time range for current operation. Defaults to the current time.'))
c.argument('offset', help='Filter results based on UTC hour offset.', type=get_period_type(as_timedelta=True))

with self.argument_context('monitor app-insights component create') as c:
c.argument('location', arg_type=get_location_type(self.cli_ctx))
c.argument('application-type', options_list=['application-type', '--type', '-t'], help="Type of application being monitored. Possible values include: 'web', 'other'. Default value: 'web' .")
c.argument('kind', options_list=['--kind', '-k'], help='The kind of application that this component refers to, used to customize UI. This value is a freeform string, values should typically be one of the following: web, ios, other, store, java, phone.')
c.argument('tags', tags_type)

with self.argument_context('monitor app-insights component update') as c:
c.argument('location', arg_type=get_location_type(self.cli_ctx))
c.argument('application-type', options_list=['application-type', '--type', '-t'], help="Type of application being monitored. Possible values include: 'web', 'other'. Default value: 'web' .")
c.argument('kind', options_list=['--kind', '-k'], help='The kind of application that this component refers to, used to customize UI. This value is a freeform string, values should typically be one of the following: web, ios, other, store, java, phone.')

with self.argument_context('monitor app-insights component update-tags') as c:
c.argument('tags', tags_type)

with self.argument_context('monitor app-insights api-key create') as c:
c.argument('api_key', help='The name of the API key to create.')
c.argument('read_properties', nargs='+', options_list=['--read-properties'])
c.argument('write_properties', nargs='+')

with self.argument_context('monitor app-insights api-key show') as c:
c.argument('api_key', help='The name of the API key to fetch.')

with self.argument_context('monitor app-insights metrics show') as c:
c.argument('metric', options_list=['--metrics', '-m'], help='The metric to retrieve. May be either a standard AI metric or an application-specific custom metric.')
Expand All @@ -24,11 +43,20 @@ def load_arguments(self, _):
c.argument('segment', help='The name of the dimension to segment the metric values by. This dimension must be applicable to the metric you are retrieving. To segment by more than one dimension at a time, separate them with a comma (,). In this case, the metric data will be segmented in the order the dimensions are listed in the parameter.')
c.argument('top', help='The number of segments to return. This value is only valid when segment is specified.')
c.argument('filter_arg', options_list=['--filter'], help=' An expression used to filter the results. This value should be a valid OData filter expression where the keys of each clause should be applicable dimensions for the metric you are retrieving.')
c.argument('start_time', arg_type=get_datetime_type(help='Start-time of time range for which to retrieve data.'))
c.argument('end_time', arg_type=get_datetime_type(help='End of time range for current operation. Defaults to the current time.'))
c.argument('offset', help='Filter results based on UTC hour offset.', type=get_period_type(as_timedelta=True))

with self.argument_context('monitor app-insights events show') as c:
c.argument('event_type', options_list=['--type'], help='The type of events to retrieve.')
c.argument('event', options_list=['--event'], help='GUID of the event to retrieve. This could be obtained by first listing and filtering events, then selecting an event of interest.')
c.argument('start_time', arg_type=get_datetime_type(help='Start-time of time range for which to retrieve data.'))
c.argument('end_time', arg_type=get_datetime_type(help='End of time range for current operation. Defaults to the current time.'))
c.argument('offset', help='Filter results based on UTC hour offset.', type=get_period_type(as_timedelta=True))

with self.argument_context('monitor app-insights query') as c:
c.argument('application', validator=validate_applications, options_list=['--apps', '-a'], nargs='+', id_part='name', help='GUID, app name, or fully-qualified Azure resource name of Application Insights component. The application GUID may be acquired from the API Access menu item on any Application Insights resource in the Azure portal. If using an application name, please specify resource group.')
c.argument('analytics_query', help='Query to execute over Application Insights data.')
c.argument('start_time', arg_type=get_datetime_type(help='Start-time of time range for which to retrieve data.'))
c.argument('end_time', arg_type=get_datetime_type(help='End of time range for current operation. Defaults to the current time.'))
c.argument('offset', help='Filter results based on UTC hour offset.', type=get_period_type(as_timedelta=True))
Loading