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

{Batch} Upgrade api to track2 v2024-02-01 #30501

Merged
merged 78 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from 60 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
deac9bf
removal of track1 adding track2 reference
wiboris Oct 30, 2024
ea02720
remove custom code to handle track2 models dictionary
wiboris Dec 9, 2024
2f67226
custom code
wiboris Dec 10, 2024
451d559
fixing task create
wiboris Dec 10, 2024
124eb80
Make json input more fault tollerant
wiboris Dec 10, 2024
ded52ec
updating test
wiboris Dec 11, 2024
d300894
fixing task reset
wiboris Dec 12, 2024
44ab37c
test fixes
wiboris Dec 12, 2024
deb5b23
Switch test region to eastus2
dpwatrous Dec 18, 2024
03f6c53
Fix custom commands
dpwatrous Dec 18, 2024
8eca8db
Fix app package format parameter name
dpwatrous Dec 19, 2024
56a3dc2
Revert "Fix app package format parameter name"
dpwatrous Dec 19, 2024
f963287
Fix data plane tests
dpwatrous Dec 19, 2024
3dd5a5e
Remove unused 'git' import
dpwatrous Dec 19, 2024
dd63dca
Rest name map shouldn't include _* properties
dpwatrous Dec 19, 2024
d29730f
wip transformers and exception handler
Dec 11, 2024
50bed59
Update exception handling
Dec 19, 2024
9d3234b
Fix resource_tags support
dpwatrous Dec 20, 2024
cb992b0
Fix pool test playback
dpwatrous Dec 20, 2024
35c9399
Update expected pool creation args
dpwatrous Dec 20, 2024
7127424
Fix exception handler and add tests
dpwatrous Dec 20, 2024
470a1ea
Re-add preparer cleanup
dpwatrous Dec 20, 2024
4e04413
List fix
dpwatrous Dec 20, 2024
4da05ae
Update test recordings
dpwatrous Dec 21, 2024
f4a96ad
Enable BYOS tests in playback mode
dpwatrous Dec 21, 2024
a9a0d4b
Fix exception handler and tests
dpwatrous Dec 29, 2024
14da15a
Transformers working with commands
Jan 1, 2025
4c9fd8f
assertEqual fix
Jan 3, 2025
944fdc2
Update transformers and add unit tests
Jan 4, 2025
f5fda9f
updating validator to not assume we always want to query for the acco…
wiboris Jan 6, 2025
b591107
adding licenese headers
wiboris Jan 6, 2025
ae3aa66
adding support for start and end-range for file download, adding down…
wiboris Jan 8, 2025
7aeca76
Fix missing command help
dpwatrous Jan 8, 2025
e756344
Fix many pylint errors/warnings
dpwatrous Jan 8, 2025
0f5b3da
Linting fixes
dpwatrous Jan 8, 2025
d35a646
Invalidate cached access key on Entra ID login
dpwatrous Jan 8, 2025
a6d080d
Fix remaining PyLint warnings
dpwatrous Jan 8, 2025
07c83b1
improve dataplane client code
wiboris Jan 8, 2025
2210086
Fix remaining style check errors
dpwatrous Jan 8, 2025
2f2c0d1
Transform pool show output and cleanup code
Jan 9, 2025
b3150f5
Pool reset now properly does a replace
dpwatrous Jan 9, 2025
fc0c7bb
Fix tests
dpwatrous Jan 9, 2025
8546e82
update formaters
wiboris Jan 9, 2025
8a06493
Add linter exclusions
dpwatrous Jan 9, 2025
8335c5c
More linting fixes
dpwatrous Jan 9, 2025
c699d0f
Normalize doc URLs
dpwatrous Jan 9, 2025
8f15111
Add help examples
dpwatrous Jan 9, 2025
fa9ea41
update tests for transform
Jan 10, 2025
836f234
fix expand param
wiboris Jan 10, 2025
709a781
Fix task reset
dpwatrous Jan 10, 2025
b56771f
Update job help examples
Jan 11, 2025
f8d103e
fixes for app package and if modified params
wiboris Jan 11, 2025
d8a0239
Merge branch 'batchtrack2' of https://github.com/wiboris/azure-cli in…
wiboris Jan 11, 2025
92d14e0
Update osdisk yaml file for updated tests
Jan 14, 2025
e043da3
Add help examples and tests
dpwatrous Jan 14, 2025
0ce0464
fixing failing tests , improving resize command and tests
wiboris Jan 14, 2025
09d1a84
Fix os-specific test
dpwatrous Jan 15, 2025
6a5bba4
Revert "Fix os-specific test"
dpwatrous Jan 15, 2025
12a1594
Fix azdev style error
dpwatrous Jan 15, 2025
8f0f086
Refactor exception handler
dpwatrous Jan 15, 2025
d4c8762
fixing task tests and cleaning up params
wiboris Jan 16, 2025
c4411e1
Fix os-specific test
dpwatrous Jan 15, 2025
a8cdf21
Fix error handler to handle non-Batch errors
dpwatrous Jan 16, 2025
ba3d584
Update test recordings
dpwatrous Jan 16, 2025
e1abae1
Remove sleep statement in playback mode
dpwatrous Jan 16, 2025
7e922ff
fix duration check, standardize match and range params
wiboris Jan 17, 2025
e4e1e90
fixing filter_args
wiboris Jan 17, 2025
0ab45ae
Update error type handling
Jan 17, 2025
761bd8b
Fix linting issues
Jan 17, 2025
ab32a6c
fix datetime check and unit test
wiboris Jan 17, 2025
de950d4
Merge branch 'batchtrack2' of https://github.com/wiboris/azure-cli in…
wiboris Jan 17, 2025
bae9909
style fix
wiboris Jan 17, 2025
8dc8dfc
Update for specific error codes
Jan 22, 2025
f0fbc49
Update more exception handler tests
Jan 22, 2025
2cb0206
Update transformer mapping
Jan 23, 2025
f04e068
Update exception handling to include validation error
Jan 23, 2025
5d4af49
Fix transformer errors
dpwatrous Jan 23, 2025
7927532
Throw specific CLI errors
dpwatrous Jan 23, 2025
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
1 change: 1 addition & 0 deletions src/azure-cli-core/azure/cli/core/profiles/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class ResourceType(Enum): # pylint: disable=too-few-public-methods
DATA_STORAGE_FILESHARE = ('azure.multiapi.storagev2.fileshare', None)
DATA_STORAGE_QUEUE = ('azure.multiapi.storagev2.queue', None)
DATA_STORAGE_TABLE = ('azure.data.tables', None)
DATA_BATCH = ('azure.batch', None)

def __init__(self, import_prefix, client_name):
"""Constructor.
Expand Down
80 changes: 23 additions & 57 deletions src/azure-cli/azure/cli/command_modules/batch/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,97 +5,63 @@


def mgmt_batch_account_client_factory(cli_ctx, _):
return batch_client_factory(cli_ctx).batch_account
return batch_mgmt_client_factory(cli_ctx).batch_account


def mgmt_pool_client_factory(cli_ctx, _):
return batch_client_factory(cli_ctx).pool
return batch_mgmt_client_factory(cli_ctx).pool


def mgmt_private_link_resource_client_factory(cli_ctx, _):
return batch_client_factory(cli_ctx).private_link_resource
return batch_mgmt_client_factory(cli_ctx).private_link_resource


def mgmt_private_endpoint_connection_client_factory(cli_ctx, _):
return batch_client_factory(cli_ctx).private_endpoint_connection
return batch_mgmt_client_factory(cli_ctx).private_endpoint_connection


def mgmt_application_client_factory(cli_ctx, _):
return batch_client_factory(cli_ctx).application
return batch_mgmt_client_factory(cli_ctx).application


def mgmt_application_package_client_factory(cli_ctx, _):
return batch_client_factory(cli_ctx).application_package
return batch_mgmt_client_factory(cli_ctx).application_package


def mgmt_location_client_factory(cli_ctx, _):
return batch_client_factory(cli_ctx).location
return batch_mgmt_client_factory(cli_ctx).location


def application_client_factory(cli_ctx, kwargs):
return batch_data_service_factory(cli_ctx, kwargs).application


def account_client_factory(cli_ctx, kwargs):
return batch_data_service_factory(cli_ctx, kwargs).account


def certificate_client_factory(cli_ctx, kwargs):
return batch_data_service_factory(cli_ctx, kwargs).certificate


def pool_client_factory(cli_ctx, kwargs):
return batch_data_service_factory(cli_ctx, kwargs).pool


def job_client_factory(cli_ctx, kwargs):
return batch_data_service_factory(cli_ctx, kwargs).job


def job_schedule_client_factory(cli_ctx, kwargs):
return batch_data_service_factory(cli_ctx, kwargs).job_schedule


def task_client_factory(cli_ctx, kwargs):
return batch_data_service_factory(cli_ctx, kwargs).task


def file_client_factory(cli_ctx, kwargs):
return batch_data_service_factory(cli_ctx, kwargs).file


def compute_node_client_factory(cli_ctx, kwargs):
return batch_data_service_factory(cli_ctx, kwargs).compute_node


def batch_client_factory(cli_ctx, **_):
def batch_mgmt_client_factory(cli_ctx, **_):
from azure.mgmt.batch import BatchManagementClient
from azure.cli.core.commands.client_factory import get_mgmt_service_client
return get_mgmt_service_client(cli_ctx, BatchManagementClient)


def batch_data_service_factory(cli_ctx, kwargs):
import azure.batch._batch_service_client as batch
import azure.batch.batch_auth as batchauth
def batch_data_client_factory(cli_ctx, kwargs):
from azure.batch import BatchClient

account_name = kwargs.pop('account_name', None)
account_key = kwargs.pop('account_key', None)
account_endpoint = kwargs.pop('account_endpoint', None)
kwargs.pop('yes', None)
token_credential = kwargs.pop('token_credential', None)

credential = None

credentials = None
if not account_key:
if not token_credential and not account_key:
from azure.cli.core._profile import Profile
profile = Profile(cli_ctx=cli_ctx)
resource = cli_ctx.cloud.endpoints.batch_resource_id
credentials, _, _ = profile.get_login_credentials(resource=resource)
token_credential, _, _ = profile.get_login_credentials(resource=resource)

if account_key:
from azure.core.credentials import AzureNamedKeyCredential
credential = AzureNamedKeyCredential(name=account_name, key=account_key)
else:
# Verify all values are populated and display readable error
if not all([account_name, account_key, account_endpoint]):
raise ValueError(
'usage error: --account-name NAME --account-key KEY --account-endpoint ENDPOINT')
credentials = batchauth.SharedKeyCredentials(account_name, account_key)
credential = token_credential

if not (account_endpoint.startswith('https://') or
account_endpoint.startswith('http://')):
account_endpoint = 'https://' + account_endpoint
return batch.BatchServiceClient(credentials, batch_url=account_endpoint.rstrip('/'))

return BatchClient(credential=credential, endpoint=account_endpoint.rstrip('/'))
Loading
Loading