Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions src/spring/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Release History
===============
1.19.3
---
* Add arguments `--refresh-interval` in `spring application-configuration-service create` and `spring application-configuration-service update`.

1.19.2
---
Expand Down
8 changes: 7 additions & 1 deletion src/spring/azext_spring/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
validate_buildpack_binding_exist, validate_buildpack_binding_not_exist,
validate_buildpack_binding_properties, validate_buildpack_binding_secrets,
validate_build_env, validate_target_module, validate_runtime_version,
validate_acs_ssh_or_warn, validate_apm_properties, validate_apm_secrets,
validate_acs_ssh_or_warn, validate_refresh_interval,
validate_apm_properties, validate_apm_secrets,
validate_apm_not_exist, validate_apm_update, validate_apm_reference,
validate_apm_reference_and_enterprise_tier, validate_cert_reference,
validate_build_cert_reference, validate_acs_create, not_support_enterprise,
Expand Down Expand Up @@ -864,6 +865,11 @@ def prepare_logs_argument(c):
for scope in ['create', 'update']:
with self.argument_context('spring application-configuration-service {}'.format(scope)) as c:
c.argument('generation', arg_type=get_enum_type(ConfigurationServiceGeneration), help='Generation of Application Configuration Service.')
c.argument('refresh_interval', type=int,
validator=validate_refresh_interval,
help='Number of the repository refresh interval (in seconds). '
Comment thread
moarychan marked this conversation as resolved.
Outdated
'The minimum allowable value is 0, which disables automatic refresh. For optimal '
'performance, it is recommended to set this interval at a minimum of 60 seconds.')

for scope in ['add', 'update']:
with self.argument_context('spring application-configuration-service git repo {}'.format(scope)) as c:
Expand Down
6 changes: 6 additions & 0 deletions src/spring/azext_spring/_validators_enterprise.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,12 @@ def validate_acs_create(namespace):
raise ArgumentUsageError("--application-configuration-service-generation can only be set when enable application configuration service.")


def validate_refresh_interval(namespace):
if namespace.refresh_interval is not None:
if namespace.refresh_interval < 0:
Comment thread
moarychan marked this conversation as resolved.
Outdated
raise ArgumentUsageError("--refresh-interval must be greater than or equal to 0.")


def validate_gateway_update(cmd, namespace):
_validate_gateway_response_cache(namespace)
_validate_sso(namespace)
Expand Down
16 changes: 13 additions & 3 deletions src/spring/azext_spring/application_configuration_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,35 @@


def application_configuration_service_create(cmd, client, service, resource_group,
generation=None):
generation=None, refresh_interval=None):
if generation is None:
generation = ConfigurationServiceGeneration.GEN1

properties = models.ConfigurationServiceProperties(generation=generation)
if refresh_interval is not None and refresh_interval >= 0:
properties = models.ConfigurationServiceProperties(generation=generation,
settings={"refresh_interval_in_seconds": refresh_interval})
else:
properties = models.ConfigurationServiceProperties(generation=generation)
Comment thread
moarychan marked this conversation as resolved.
Outdated
acs_resource = models.ConfigurationServiceResource(properties=properties)
logger.warning("Create with generation {}".format(acs_resource.properties.generation))
return client.configuration_services.begin_create_or_update(resource_group, service, DEFAULT_NAME, acs_resource)


def application_configuration_service_update(cmd, client, service, resource_group,
generation=None):
generation=None, refresh_interval=None):
acs_resource = client.configuration_services.get(resource_group, service, DEFAULT_NAME)
if generation is not None:
acs_resource.properties.generation = generation
logger.warning("Updating with generation {}".format(generation))
else:
acs_resource.properties.generation = ConfigurationServiceGeneration.GEN1
logger.warning("Default generation will be Gen1")
if refresh_interval is not None and refresh_interval >= 0:
if acs_resource.properties.settings is None:
acs_resource.properties.settings = {"refresh_interval_in_seconds": refresh_interval}
else:
acs_resource.properties.settings.refresh_interval_in_seconds = refresh_interval
Comment thread
moarychan marked this conversation as resolved.
Outdated

logger.warning(acs_resource.properties.generation)
return client.configuration_services.begin_create_or_update(resource_group, service, DEFAULT_NAME, acs_resource)

Expand Down
Loading