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

[Spring Cloud] Add application configuration service related implementation #4263

Merged

Conversation

ninpan-ms
Copy link
Contributor

@ninpan-ms ninpan-ms commented Dec 28, 2021


The pr is part of main...VSChina:enterprise.

Add implementation of Application Configuration Service show, clear, git add, git update, git remove, git list, bind and unbind.

General Guidelines

  • 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:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your PR is merged into master branch, a new PR will be created to update src/index.json automatically.
The precondition is to put your code inside this repo and upgrade the version in the PR but do not modify src/index.json.

@yonzhan
Copy link
Collaborator

yonzhan commented Dec 28, 2021

Spring Cloud

acs_resource = _get_or_default_acs_resource(client, resource_group, service)
repos = acs_resource.properties.settings.git_property.repositories
if next((r for r in repos if r.name == name), None) is not None:
raise CLIError("Repo '{}' already exists.".format(name))
Copy link
Contributor

@zhoxing-ms zhoxing-ms Dec 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the specific error type ValidationError instead of CLIError.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, thanks!

acs_settings = acs_resource.properties.settings

if not acs_settings or not acs_settings.git_property or not acs_settings.git_property.repositories:
raise CLIError("Repos not found.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the specific error type ResourceNotFoundError instead of CLIError.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, thanks for suggestion.

def _get_existing_repo(repos, name):
repo = next((r for r in repos if r.name == name), None)
if not repo:
raise CLIError("Repo '{}' not found.".format(name))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

try:
result = sdk_no_wait(False, client.configuration_services.begin_validate, resource_group, service, DEFAULT_NAME, acs_settings).result()
except Exception as err: # pylint: disable=broad-except
raise CLIError("{0}. You may raise a support ticket if needed by the following link: https://docs.microsoft.com/azure/spring-cloud/spring-cloud-faq?pivots=programming-language-java#how-can-i-provide-feedback-and-report-issues".format(err))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

if not git_result.is_valid:
validation_result = git_result.git_repos_validation_result
filter_result = [{'name': x.name, 'messages': x.messages} for x in validation_result if len(x.messages) > 0]
raise CLIError("Application Configuration Service settings contain errors.\n{}".format(json.dumps(filter_result, indent=2)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@ninpan-ms ninpan-ms requested a review from zhoxing-ms December 30, 2021 02:47
@zhoxing-ms zhoxing-ms merged commit e2292dc into Azure:main Dec 30, 2021
@ninpan-ms
Copy link
Contributor Author

#4294

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants