From 70aea6a48b4587d7078fb32f1cfb9c774c5888a1 Mon Sep 17 00:00:00 2001 From: Ningting Pan Date: Fri, 16 Jun 2023 14:13:17 +0800 Subject: [PATCH 1/4] Add addon configs & allowedOriginPatterns & restart for Spring Cloud Gateway --- src/spring/azext_spring/_help.py | 8 +++ src/spring/azext_spring/_params.py | 3 + src/spring/azext_spring/commands.py | 1 + src/spring/azext_spring/gateway.py | 35 ++++++++++-- .../latest/files/gateway_addon_configs.json | 17 ++++++ .../tests/latest/recordings/test_gateway.yaml | 55 ++++++++++--------- .../tests/latest/test_asa_gateway.py | 9 ++- 7 files changed, 95 insertions(+), 33 deletions(-) create mode 100644 src/spring/azext_spring/tests/latest/files/gateway_addon_configs.json diff --git a/src/spring/azext_spring/_help.py b/src/spring/azext_spring/_help.py index 37312d43ed0..d7021015db9 100644 --- a/src/spring/azext_spring/_help.py +++ b/src/spring/azext_spring/_help.py @@ -1062,6 +1062,14 @@ text: az spring gateway update -s MyService -g MyResourceGroup --assign-endpoint true --https-only true """ +helps['spring gateway restart'] = """ + type: command + short-summary: Restart Spring Cloud Gateway. + examples: + - name: Restart Spring Cloud Gateway. + text: az spring gateway restart -s MyService -g MyResourceGroup +""" + helps['spring gateway sync-cert'] = """ type: command short-summary: Sync certificate of gateway. diff --git a/src/spring/azext_spring/_params.py b/src/spring/azext_spring/_params.py index 1be9b878940..fbf800ebdf3 100644 --- a/src/spring/azext_spring/_params.py +++ b/src/spring/azext_spring/_params.py @@ -861,6 +861,7 @@ def prepare_logs_argument(c): help='Sensitive properties for environment variables. Once put, it will be encrypted and not returned.' 'Format "key[=value]" and separated by space.') c.argument('allowed_origins', arg_group='Cross-origin Resource Sharing (CORS)', help="Comma-separated list of allowed origins to make cross-site requests. The special value `*` allows all domains.") + c.argument('allowed_origin_patterns', arg_group='Cross-origin Resource Sharing (CORS)', help="Comma-separated list of allowed origin patterns to make cross-site requests.") c.argument('allowed_methods', arg_group='Cross-origin Resource Sharing (CORS)', help="Comma-separated list of allowed HTTP methods on cross-site requests. The special value `*` allows all methods.") c.argument('allowed_headers', arg_group='Cross-origin Resource Sharing (CORS)', help="Comma-separated list of allowed headers in cross-site requests. The special value `*` allows actual requests to send any header.") c.argument('max_age', arg_group='Cross-origin Resource Sharing (CORS)', type=int, @@ -873,6 +874,8 @@ def prepare_logs_argument(c): options_list=['--enable-certificate-verification', '--enable-cert-verify'], help='If true, will verify certificate in TLS connection from gateway to app.') c.argument('certificate_names', arg_group='Client Certificate Authentication', help="Comma-separated list of certificate names in Azure Spring Apps.") + c.argument('addon_configs_json', arg_group='Add-on Configurations', help="JSON string of add-on configurations.") + c.argument('addon_configs_file', arg_group='Add-on Configurations', help="The file path of JSON string of add-on configurations.") for scope in ['spring gateway custom-domain', 'spring api-portal custom-domain']: diff --git a/src/spring/azext_spring/commands.py b/src/spring/azext_spring/commands.py index 01154c72038..c023fba8433 100644 --- a/src/spring/azext_spring/commands.py +++ b/src/spring/azext_spring/commands.py @@ -322,6 +322,7 @@ def load_command_table(self, _): g.custom_command('clear', 'gateway_clear', supports_no_wait=True) g.custom_command('create', 'gateway_create', table_transformer=transform_spring_cloud_gateway_output) g.custom_command('delete', 'gateway_delete', confirmation=True) + g.custom_command('restart', 'gateway_restart', confirmation='Are you sure you want to perform this operation?', supports_no_wait=True) g.custom_command('sync-cert', 'gateway_sync_cert', confirmation='Your gateway will be restarted to use the latest certificate.\n' + 'Are you sure you want to perform this operation?', supports_no_wait=True) diff --git a/src/spring/azext_spring/gateway.py b/src/spring/azext_spring/gateway.py index 5d1f445c5e4..f404c80d726 100644 --- a/src/spring/azext_spring/gateway.py +++ b/src/spring/azext_spring/gateway.py @@ -11,7 +11,7 @@ from knack.log import get_logger from .custom import LOG_RUNNING_PROMPT -from .vendored_sdks.appplatform.v2023_03_01_preview import models +from .vendored_sdks.appplatform.v2023_05_01_preview import models from ._utils import get_spring_sku logger = get_logger(__name__) @@ -49,6 +49,7 @@ def gateway_update(cmd, client, resource_group, service, properties=None, secrets=None, allowed_origins=None, + allowed_origin_patterns=None, allowed_methods=None, allowed_headers=None, max_age=None, @@ -56,6 +57,8 @@ def gateway_update(cmd, client, resource_group, service, exposed_headers=None, enable_certificate_verification=None, certificate_names=None, + addon_configs_json=None, + addon_configs_file=None, no_wait=False ): gateway = client.gateways.get(resource_group, service, DEFAULT_NAME) @@ -77,7 +80,7 @@ def gateway_update(cmd, client, resource_group, service, gateway.properties.api_metadata_properties, api_title, api_description, api_doc_location, api_version, server_url) cors_properties = _update_cors( - gateway.properties.cors_properties, allowed_origins, allowed_methods, allowed_headers, max_age, allow_credentials, exposed_headers) + gateway.properties.cors_properties, allowed_origins, allowed_origin_patterns, allowed_methods, allowed_headers, max_age, allow_credentials, exposed_headers) client_auth = _update_client_auth(client, resource_group, service, gateway.properties.client_auth, enable_certificate_verification, certificate_names) @@ -90,6 +93,8 @@ def gateway_update(cmd, client, resource_group, service, update_apm_types = apm_types if apm_types is not None else gateway.properties.apm_types environment_variables = _update_envs(gateway.properties.environment_variables, properties, secrets) + addon_configs = _update_addon_configs(gateway.properties.addon_configs, addon_configs_json, addon_configs_file) + model_properties = models.GatewayProperties( public=assign_endpoint if assign_endpoint is not None else gateway.properties.public, https_only=https_only if https_only is not None else gateway.properties.https_only, @@ -99,6 +104,7 @@ def gateway_update(cmd, client, resource_group, service, apm_types=update_apm_types, environment_variables=environment_variables, client_auth=client_auth, + addon_configs=addon_configs, resource_requests=resource_requests) sku = models.Sku(name=gateway.sku.name, tier=gateway.sku.tier, @@ -126,6 +132,10 @@ def gateway_clear(cmd, client, resource_group, service, no_wait=False): resource_group, service, DEFAULT_NAME, gateway_resource) +def gateway_restart(cmd, client, service, resource_group, no_wait=False): + return client.gateways.begin_restart(resource_group, service, DEFAULT_NAME) + + def gateway_sync_cert(cmd, client, service, resource_group, no_wait=False): return client.gateways.begin_restart(resource_group, service, DEFAULT_NAME) @@ -209,12 +219,14 @@ def _update_api_metadata(existing, api_title, api_description, api_documentation return api_metadata -def _update_cors(existing, allowed_origins, allowed_methods, allowed_headers, max_age, allow_credentials, exposed_headers): - if allowed_origins is None and allowed_methods is None and allowed_headers is None and max_age is None and allow_credentials is None and exposed_headers is None: +def _update_cors(existing, allowed_origins, allowed_origin_patterns, allowed_methods, allowed_headers, max_age, allow_credentials, exposed_headers): + if allowed_origins is None and allowed_origin_patterns is None and allowed_methods is None and allowed_headers is None and max_age is None and allow_credentials is None and exposed_headers is None: return existing cors = existing if existing is not None else models.GatewayCorsProperties() if allowed_origins is not None: cors.allowed_origins = allowed_origins.split(",") if allowed_origins else None + if allowed_origin_patterns is not None: + cors.allowed_origin_patterns = allowed_origin_patterns.split(",") if allowed_origin_patterns else None if allowed_methods is not None: cors.allowed_methods = allowed_methods.split(",") if allowed_methods else None if allowed_headers is not None: @@ -261,6 +273,21 @@ def _update_client_auth(client, resource_group, service, existing, enable_certif return client_auth +def _update_addon_configs(existing, addon_configs_json, addon_configs_file): + if addon_configs_file is None and addon_configs_json is None: + return existing + + raw_json = {} + if addon_configs_file is not None: + with open(addon_configs_file, 'r') as json_file: + raw_json = json.load(json_file) + + if addon_configs_json is not None: + raw_json = json.loads(addon_configs_json) + + return raw_json + + def _validate_route_config_not_exist(client, resource_group, service, name): route_configs = client.gateway_route_configs.list( resource_group, service, DEFAULT_NAME) diff --git a/src/spring/azext_spring/tests/latest/files/gateway_addon_configs.json b/src/spring/azext_spring/tests/latest/files/gateway_addon_configs.json new file mode 100644 index 00000000000..5f21a12168c --- /dev/null +++ b/src/spring/azext_spring/tests/latest/files/gateway_addon_configs.json @@ -0,0 +1,17 @@ +{ + "javaopts": "-Djava.awt.headless=true", + "sso": { + "rolesAttributeName": "role", + "inactiveSessionExpirationInMinutes": 1 + }, + "envs": [ + { + "name": "xxx", + "value": "yyy" + }, + { + "name": "xxx1", + "value": "yyy" + } + ] +} \ No newline at end of file diff --git a/src/spring/azext_spring/tests/latest/recordings/test_gateway.yaml b/src/spring/azext_spring/tests/latest/recordings/test_gateway.yaml index c661d43b4a0..b0c8a0734a5 100644 --- a/src/spring/azext_spring/tests/latest/recordings/test_gateway.yaml +++ b/src/spring/azext_spring/tests/latest/recordings/test_gateway.yaml @@ -14,17 +14,17 @@ interactions: - -g -s --assign-endpoint --https-only --cpu --memory --instance-count --api-title --api-description --api-doc-location --api-version --server-url --apm-types --properties --secrets --certificate-names --enable-cert-verify - --allowed-origins --allowed-methods --allowed-headers + --allowed-origins --allowed-origin-patterns --allowed-methods --allowed-headers --max-age --allow-credentials --exposed-headers --client-id --client-secret - --issuer-uri --scope + --issuer-uri --scope --addon-configs-file User-Agent: - AZURECLI/2.43.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.10.2 (Windows-10-10.0.22621-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/gateways/default?api-version=2023-05-01-preview response: body: - string: '{"properties":{"public":true,"url":"tx-enterprise-gateway-fd0c7.svc.asc-test.net","provisioningState":"Succeeded","httpsOnly":true,"clientAuth":{"certificateVerification":"Enabled","certificates":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/certificates/abc"]},"ssoProperties":{"scope":["openid","profile","email"],"clientId":"*","clientSecret":"*","issuerUri":"https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0"},"apiMetadataProperties":{"title":"Pet - clinic","description":"Demo for pet clinic","documentation":"doc","version":"v1","serverUrl":"https://tx-enterprise-gateway-fd0c7.svc.asc-test.net"},"corsProperties":{"allowedOrigins":["*"],"allowedMethods":["GET","PUT","DELETE"],"allowedHeaders":["X-TEST","X-STAGING"],"maxAge":10,"allowCredentials":true,"exposedHeaders":["Access-Control-Request-Method","Access-Control-Request-Headers"]},"resourceRequests":{"cpu":"1","memory":"2Gi"},"instances":[{"name":"asc-scg-default-0","status":"Running"},{"name":"asc-scg-default-1","status":"Running"},{"name":"asc-scg-default-2","status":"Running"}],"operatorProperties":{"resourceRequests":{"cpu":"1","memory":"2Gi","instanceCount":2},"instances":[{"name":"scg-operator-b788f7c7-djqgj","status":"Running"},{"name":"scg-operator-b788f7c7-r4gvw","status":"Running"}]},"apmTypes":["NewRelic","ElasticAPM"],"environmentVariables":{"properties":{"a":"b","c":"d"},"secrets":null}},"type":"Microsoft.AppPlatform/Spring/gateways","sku":{"name":"E0","tier":"Enterprise","capacity":3},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/gateways/default","name":"default","systemData":{"createdBy":"ninpan@microsoft.com","createdByType":"User","createdAt":"2023-01-09T09:01:20.4949677Z","lastModifiedBy":"ninpan@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2023-01-09T16:30:12.4479705Z"}}' + string: '{"properties":{"public":true,"url":"tx-enterprise-gateway-fd0c7.svc.asc-test.net","provisioningState":"Succeeded","httpsOnly":true,"clientAuth":{"certificateVerification":"Enabled","certificates":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/certificates/abc"]},"ssoProperties":{"scope":["openid","profile","email"],"clientId":"*","clientSecret":"*","issuerUri":"https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0"},"addonConfigs":{"javaOpts":"-Djava.awt.headless=true","sso":{"rolesAttributeName":"role","inactiveSessionExpirationInMinutes":1},"envs":[{"name":"xxx","value":"yyy"},{"name":"xxx1","value":"yyy"}]},"apiMetadataProperties":{"title":"Pet + clinic","description":"Demo for pet clinic","documentation":"doc","version":"v1","serverUrl":"https://tx-enterprise-gateway-fd0c7.svc.asc-test.net"},"corsProperties":{"allowedOrigins":["*"],"allowedOriginPatterns":["example*"],"allowedMethods":["GET","PUT","DELETE"],"allowedHeaders":["X-TEST","X-STAGING"],"maxAge":10,"allowCredentials":true,"exposedHeaders":["Access-Control-Request-Method","Access-Control-Request-Headers"]},"resourceRequests":{"cpu":"1","memory":"2Gi"},"instances":[{"name":"asc-scg-default-0","status":"Running"},{"name":"asc-scg-default-1","status":"Running"},{"name":"asc-scg-default-2","status":"Running"}],"operatorProperties":{"resourceRequests":{"cpu":"1","memory":"2Gi","instanceCount":2},"instances":[{"name":"scg-operator-b788f7c7-djqgj","status":"Running"},{"name":"scg-operator-b788f7c7-r4gvw","status":"Running"}]},"apmTypes":["NewRelic","ElasticAPM"],"environmentVariables":{"properties":{"a":"b","c":"d"},"secrets":null}},"type":"Microsoft.AppPlatform/Spring/gateways","sku":{"name":"E0","tier":"Enterprise","capacity":3},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/gateways/default","name":"default","systemData":{"createdBy":"ninpan@microsoft.com","createdByType":"User","createdAt":"2023-01-09T09:01:20.4949677Z","lastModifiedBy":"ninpan@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2023-01-09T16:30:12.4479705Z"}}' headers: cache-control: - no-cache @@ -58,9 +58,10 @@ interactions: ["openid", "profile", "email"], "clientId": "*", "clientSecret": "*", "issuerUri": "https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0"}, "clientAuth":{"certificateVerification":"Enabled","certificates":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/certificates/abc"]}, + "addonConfigs":{"javaOpts":"-Djava.awt.headless=true","sso":{"rolesAttributeName":"role","inactiveSessionExpirationInMinutes":1},"envs":[{"name":"xxx","value":"yyy"},{"name":"xxx1","value":"yyy"}]}, "apiMetadataProperties": {"title": "Pet clinic", "description": "Demo for pet clinic", "documentation": "doc", "version": "v1", "serverUrl": "https://tx-enterprise-gateway-fd0c7.svc.asc-test.net"}, - "corsProperties": {"allowedOrigins": ["*"], "allowedMethods": ["GET", "PUT", + "corsProperties": {"allowedOrigins": ["*"], "allowedOriginPatterns":["example*"], "allowedMethods": ["GET", "PUT", "DELETE"], "allowedHeaders": ["X-TEST", "X-STAGING"], "maxAge": 10, "allowCredentials": true, "exposedHeaders": ["Access-Control-Request-Method", "Access-Control-Request-Headers"]}, "apmTypes": ["NewRelic", "ElasticAPM"], "environmentVariables": {"properties": @@ -84,17 +85,17 @@ interactions: - -g -s --assign-endpoint --https-only --cpu --memory --instance-count --api-title --api-description --api-doc-location --api-version --server-url --apm-types --properties --secrets --certificate-names --enable-cert-verify - --allowed-origins --allowed-methods --allowed-headers + --allowed-origins --allowed-origin-patterns --allowed-methods --allowed-headers --max-age --allow-credentials --exposed-headers --client-id --client-secret - --issuer-uri --scope + --issuer-uri --scope --addon-configs-file User-Agent: - AZURECLI/2.43.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.10.2 (Windows-10-10.0.22621-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/gateways/default?api-version=2023-05-01-preview response: body: - string: '{"properties":{"public":true,"url":"tx-enterprise-gateway-fd0c7.svc.asc-test.net","provisioningState":"Updating","httpsOnly":true,"clientAuth":{"certificateVerification":"Enabled","certificates":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/certificates/abc"]},"ssoProperties":{"scope":["openid","profile","email"],"clientId":"*","clientSecret":"*","issuerUri":"https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0"},"apiMetadataProperties":{"title":"Pet - clinic","description":"Demo for pet clinic","documentation":"doc","version":"v1","serverUrl":"https://tx-enterprise-gateway-fd0c7.svc.asc-test.net"},"corsProperties":{"allowedOrigins":["*"],"allowedMethods":["GET","PUT","DELETE"],"allowedHeaders":["X-TEST","X-STAGING"],"maxAge":10,"allowCredentials":true,"exposedHeaders":["Access-Control-Request-Method","Access-Control-Request-Headers"]},"resourceRequests":{"cpu":"1","memory":"2Gi"},"instances":[{"name":"asc-scg-default-0","status":"Running"},{"name":"asc-scg-default-1","status":"Running"},{"name":"asc-scg-default-2","status":"Running"}],"operatorProperties":{"resourceRequests":{"cpu":"1","memory":"2Gi","instanceCount":2},"instances":[{"name":"scg-operator-b788f7c7-djqgj","status":"Running"},{"name":"scg-operator-b788f7c7-r4gvw","status":"Running"}]},"apmTypes":["NewRelic","ElasticAPM"],"environmentVariables":{"properties":{"a":"b","c":"d"},"secrets":null}},"type":"Microsoft.AppPlatform/Spring/gateways","sku":{"name":"E0","tier":"Enterprise","capacity":3},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/gateways/default","name":"default","systemData":{"createdBy":"ninpan@microsoft.com","createdByType":"User","createdAt":"2023-01-09T09:01:20.4949677Z","lastModifiedBy":"ninpan@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2023-01-09T16:36:52.520067Z"}}' + string: '{"properties":{"public":true,"url":"tx-enterprise-gateway-fd0c7.svc.asc-test.net","provisioningState":"Updating","httpsOnly":true,"clientAuth":{"certificateVerification":"Enabled","certificates":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/certificates/abc"]},"ssoProperties":{"scope":["openid","profile","email"],"clientId":"*","clientSecret":"*","issuerUri":"https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0"},"addonConfigs":{"javaOpts":"-Djava.awt.headless=true","sso":{"rolesAttributeName":"role","inactiveSessionExpirationInMinutes":1},"envs":[{"name":"xxx","value":"yyy"},{"name":"xxx1","value":"yyy"}]},"apiMetadataProperties":{"title":"Pet + clinic","description":"Demo for pet clinic","documentation":"doc","version":"v1","serverUrl":"https://tx-enterprise-gateway-fd0c7.svc.asc-test.net"},"corsProperties":{"allowedOrigins":["*"],"allowedOriginPatterns":["example*"],"allowedOriginPatterns":["example*"],"allowedMethods":["GET","PUT","DELETE"],"allowedHeaders":["X-TEST","X-STAGING"],"maxAge":10,"allowCredentials":true,"exposedHeaders":["Access-Control-Request-Method","Access-Control-Request-Headers"]},"resourceRequests":{"cpu":"1","memory":"2Gi"},"instances":[{"name":"asc-scg-default-0","status":"Running"},{"name":"asc-scg-default-1","status":"Running"},{"name":"asc-scg-default-2","status":"Running"}],"operatorProperties":{"resourceRequests":{"cpu":"1","memory":"2Gi","instanceCount":2},"instances":[{"name":"scg-operator-b788f7c7-djqgj","status":"Running"},{"name":"scg-operator-b788f7c7-r4gvw","status":"Running"}]},"apmTypes":["NewRelic","ElasticAPM"],"environmentVariables":{"properties":{"a":"b","c":"d"},"secrets":null}},"type":"Microsoft.AppPlatform/Spring/gateways","sku":{"name":"E0","tier":"Enterprise","capacity":3},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/gateways/default","name":"default","systemData":{"createdBy":"ninpan@microsoft.com","createdByType":"User","createdAt":"2023-01-09T09:01:20.4949677Z","lastModifiedBy":"ninpan@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2023-01-09T16:36:52.520067Z"}}' headers: azure-asyncoperation: - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/tx-enterprise/operationId/f5588c0c-ed3d-415f-a3c0-fe71e594982e?api-version=2023-05-01-preview @@ -140,9 +141,9 @@ interactions: - -g -s --assign-endpoint --https-only --cpu --memory --instance-count --api-title --api-description --api-doc-location --api-version --server-url --apm-types --properties --secrets --certificate-names --enable-cert-verify - --allowed-origins --allowed-methods --allowed-headers + --allowed-origins --allowed-origin-patterns --allowed-methods --allowed-headers --max-age --allow-credentials --exposed-headers --client-id --client-secret - --issuer-uri --scope + --issuer-uri --scope --addon-configs-file User-Agent: - AZURECLI/2.43.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.10.2 (Windows-10-10.0.22621-SP0) method: GET @@ -193,9 +194,9 @@ interactions: - -g -s --assign-endpoint --https-only --cpu --memory --instance-count --api-title --api-description --api-doc-location --api-version --server-url --apm-types --properties --secrets --certificate-names --enable-cert-verify - --allowed-origins --allowed-methods --allowed-headers + --allowed-origins --allowed-origin-patterns --allowed-methods --allowed-headers --max-age --allow-credentials --exposed-headers --client-id --client-secret - --issuer-uri --scope + --issuer-uri --scope --addon-configs-file User-Agent: - AZURECLI/2.43.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.10.2 (Windows-10-10.0.22621-SP0) method: GET @@ -246,9 +247,9 @@ interactions: - -g -s --assign-endpoint --https-only --cpu --memory --instance-count --api-title --api-description --api-doc-location --api-version --server-url --apm-types --properties --secrets --certificate-names --enable-cert-verify - --allowed-origins --allowed-methods --allowed-headers + --allowed-origins --allowed-origin-patterns --allowed-methods --allowed-headers --max-age --allow-credentials --exposed-headers --client-id --client-secret - --issuer-uri --scope + --issuer-uri --scope --addon-configs-file User-Agent: - AZURECLI/2.43.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.10.2 (Windows-10-10.0.22621-SP0) method: GET @@ -299,9 +300,9 @@ interactions: - -g -s --assign-endpoint --https-only --cpu --memory --instance-count --api-title --api-description --api-doc-location --api-version --server-url --apm-types --properties --secrets --certificate-names --enable-cert-verify - --allowed-origins --allowed-methods --allowed-headers + --allowed-origins --allowed-origin-patterns --allowed-methods --allowed-headers --max-age --allow-credentials --exposed-headers --client-id --client-secret - --issuer-uri --scope + --issuer-uri --scope --addon-configs-file User-Agent: - AZURECLI/2.43.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.10.2 (Windows-10-10.0.22621-SP0) method: GET @@ -352,17 +353,17 @@ interactions: - -g -s --assign-endpoint --https-only --cpu --memory --instance-count --api-title --api-description --api-doc-location --api-version --server-url --apm-types --properties --secrets --certificate-names --enable-cert-verify - --allowed-origins --allowed-methods --allowed-headers + --allowed-origins --allowed-origin-patterns --allowed-methods --allowed-headers --max-age --allow-credentials --exposed-headers --client-id --client-secret - --issuer-uri --scope + --issuer-uri --scope --addon-configs-file User-Agent: - AZURECLI/2.43.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.10.2 (Windows-10-10.0.22621-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/gateways/default?api-version=2023-05-01-preview response: body: - string: '{"properties":{"public":true,"url":"tx-enterprise-gateway-fd0c7.svc.asc-test.net","provisioningState":"Succeeded","httpsOnly":true,"clientAuth":{"certificateVerification":"Enabled","certificates":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/certificates/abc"]},"ssoProperties":{"scope":["openid","profile","email"],"clientId":"*","clientSecret":"*","issuerUri":"https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0"},"apiMetadataProperties":{"title":"Pet - clinic","description":"Demo for pet clinic","documentation":"doc","version":"v1","serverUrl":"https://tx-enterprise-gateway-fd0c7.svc.asc-test.net"},"corsProperties":{"allowedOrigins":["*"],"allowedMethods":["GET","PUT","DELETE"],"allowedHeaders":["X-TEST","X-STAGING"],"maxAge":10,"allowCredentials":true,"exposedHeaders":["Access-Control-Request-Method","Access-Control-Request-Headers"]},"resourceRequests":{"cpu":"1","memory":"2Gi"},"instances":[{"name":"asc-scg-default-0","status":"Running"},{"name":"asc-scg-default-1","status":"Running"},{"name":"asc-scg-default-2","status":"Running"}],"operatorProperties":{"resourceRequests":{"cpu":"1","memory":"2Gi","instanceCount":2},"instances":[{"name":"scg-operator-b788f7c7-djqgj","status":"Running"},{"name":"scg-operator-b788f7c7-r4gvw","status":"Running"}]},"apmTypes":["NewRelic","ElasticAPM"],"environmentVariables":{"properties":{"a":"b","c":"d"},"secrets":null}},"type":"Microsoft.AppPlatform/Spring/gateways","sku":{"name":"E0","tier":"Enterprise","capacity":3},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/gateways/default","name":"default","systemData":{"createdBy":"ninpan@microsoft.com","createdByType":"User","createdAt":"2023-01-09T09:01:20.4949677Z","lastModifiedBy":"ninpan@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2023-01-09T16:36:52.520067Z"}}' + string: '{"properties":{"public":true,"url":"tx-enterprise-gateway-fd0c7.svc.asc-test.net","provisioningState":"Succeeded","httpsOnly":true,"clientAuth":{"certificateVerification":"Enabled","certificates":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/certificates/abc"]},"ssoProperties":{"scope":["openid","profile","email"],"clientId":"*","clientSecret":"*","issuerUri":"https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0"},"addonConfigs":{"javaOpts":"-Djava.awt.headless=true","sso":{"rolesAttributeName":"role","inactiveSessionExpirationInMinutes":1},"envs":[{"name":"xxx","value":"yyy"},{"name":"xxx1","value":"yyy"}]},"apiMetadataProperties":{"title":"Pet + clinic","description":"Demo for pet clinic","documentation":"doc","version":"v1","serverUrl":"https://tx-enterprise-gateway-fd0c7.svc.asc-test.net"},"corsProperties":{"allowedOrigins":["*"],"allowedOriginPatterns":["example*"],"allowedMethods":["GET","PUT","DELETE"],"allowedHeaders":["X-TEST","X-STAGING"],"maxAge":10,"allowCredentials":true,"exposedHeaders":["Access-Control-Request-Method","Access-Control-Request-Headers"]},"resourceRequests":{"cpu":"1","memory":"2Gi"},"instances":[{"name":"asc-scg-default-0","status":"Running"},{"name":"asc-scg-default-1","status":"Running"},{"name":"asc-scg-default-2","status":"Running"}],"operatorProperties":{"resourceRequests":{"cpu":"1","memory":"2Gi","instanceCount":2},"instances":[{"name":"scg-operator-b788f7c7-djqgj","status":"Running"},{"name":"scg-operator-b788f7c7-r4gvw","status":"Running"}]},"apmTypes":["NewRelic","ElasticAPM"],"environmentVariables":{"properties":{"a":"b","c":"d"},"secrets":null}},"type":"Microsoft.AppPlatform/Spring/gateways","sku":{"name":"E0","tier":"Enterprise","capacity":3},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/gateways/default","name":"default","systemData":{"createdBy":"ninpan@microsoft.com","createdByType":"User","createdAt":"2023-01-09T09:01:20.4949677Z","lastModifiedBy":"ninpan@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2023-01-09T16:36:52.520067Z"}}' headers: cache-control: - no-cache @@ -406,9 +407,9 @@ interactions: - -g -s --assign-endpoint --https-only --cpu --memory --instance-count --api-title --api-description --api-doc-location --api-version --server-url --apm-types --properties --secrets --certificate-names --enable-cert-verify - --allowed-origins --allowed-methods --allowed-headers + --allowed-origins --allowed-origin-patterns --allowed-methods --allowed-headers --max-age --allow-credentials --exposed-headers --client-id --client-secret - --issuer-uri --scope + --issuer-uri --scope --addon-configs-file User-Agent: - AZURECLI/2.43.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.10.2 (Windows-10-10.0.22621-SP0) method: GET @@ -513,8 +514,8 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/gateways/default?api-version=2023-05-01-preview response: body: - string: '{"properties":{"public":true,"url":"tx-enterprise-gateway-fd0c7.svc.asc-test.net","provisioningState":"Succeeded","httpsOnly":true,"clientAuth":{"certificateVerification":"Enabled","certificates":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/certificates/abc"]},"ssoProperties":{"scope":["openid","profile","email"],"clientId":"*","clientSecret":"*","issuerUri":"https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0"},"apiMetadataProperties":{"title":"Pet - clinic","description":"Demo for pet clinic","documentation":"doc","version":"v1","serverUrl":"https://tx-enterprise-gateway-fd0c7.svc.asc-test.net"},"corsProperties":{"allowedOrigins":["*"],"allowedMethods":["GET","PUT","DELETE"],"allowedHeaders":["X-TEST","X-STAGING"],"maxAge":10,"allowCredentials":true,"exposedHeaders":["Access-Control-Request-Method","Access-Control-Request-Headers"]},"resourceRequests":{"cpu":"1","memory":"2Gi"},"instances":[{"name":"asc-scg-default-0","status":"Running"},{"name":"asc-scg-default-1","status":"Running"},{"name":"asc-scg-default-2","status":"Running"}],"operatorProperties":{"resourceRequests":{"cpu":"1","memory":"2Gi","instanceCount":2},"instances":[{"name":"scg-operator-b788f7c7-djqgj","status":"Running"},{"name":"scg-operator-b788f7c7-r4gvw","status":"Running"}]},"apmTypes":["NewRelic","ElasticAPM"],"environmentVariables":{"properties":{"a":"b","c":"d"},"secrets":null}},"type":"Microsoft.AppPlatform/Spring/gateways","sku":{"name":"E0","tier":"Enterprise","capacity":3},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/gateways/default","name":"default","systemData":{"createdBy":"ninpan@microsoft.com","createdByType":"User","createdAt":"2023-01-09T09:01:20.4949677Z","lastModifiedBy":"ninpan@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2023-01-09T16:36:52.520067Z"}}' + string: '{"properties":{"public":true,"url":"tx-enterprise-gateway-fd0c7.svc.asc-test.net","provisioningState":"Succeeded","httpsOnly":true,"clientAuth":{"certificateVerification":"Enabled","certificates":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/certificates/abc"]},"ssoProperties":{"scope":["openid","profile","email"],"clientId":"*","clientSecret":"*","issuerUri":"https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0"},"addonConfigs":{"javaOpts":"-Djava.awt.headless=true","sso":{"rolesAttributeName":"role","inactiveSessionExpirationInMinutes":1},"envs":[{"name":"xxx","value":"yyy"},{"name":"xxx1","value":"yyy"}]},"apiMetadataProperties":{"title":"Pet + clinic","description":"Demo for pet clinic","documentation":"doc","version":"v1","serverUrl":"https://tx-enterprise-gateway-fd0c7.svc.asc-test.net"},"corsProperties":{"allowedOrigins":["*"],"allowedOriginPatterns":["example*"],"allowedMethods":["GET","PUT","DELETE"],"allowedHeaders":["X-TEST","X-STAGING"],"maxAge":10,"allowCredentials":true,"exposedHeaders":["Access-Control-Request-Method","Access-Control-Request-Headers"]},"resourceRequests":{"cpu":"1","memory":"2Gi"},"instances":[{"name":"asc-scg-default-0","status":"Running"},{"name":"asc-scg-default-1","status":"Running"},{"name":"asc-scg-default-2","status":"Running"}],"operatorProperties":{"resourceRequests":{"cpu":"1","memory":"2Gi","instanceCount":2},"instances":[{"name":"scg-operator-b788f7c7-djqgj","status":"Running"},{"name":"scg-operator-b788f7c7-r4gvw","status":"Running"}]},"apmTypes":["NewRelic","ElasticAPM"],"environmentVariables":{"properties":{"a":"b","c":"d"},"secrets":null}},"type":"Microsoft.AppPlatform/Spring/gateways","sku":{"name":"E0","tier":"Enterprise","capacity":3},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/gateways/default","name":"default","systemData":{"createdBy":"ninpan@microsoft.com","createdByType":"User","createdAt":"2023-01-09T09:01:20.4949677Z","lastModifiedBy":"ninpan@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2023-01-09T16:36:52.520067Z"}}' headers: cache-control: - no-cache @@ -2218,8 +2219,8 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/gateways/default?api-version=2023-05-01-preview response: body: - string: '{"properties":{"public":true,"url":"tx-enterprise-gateway-fd0c7.svc.asc-test.net","provisioningState":"Succeeded","httpsOnly":true,"clientAuth":{"certificateVerification":"Enabled","certificates":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/certificates/abc"]},"ssoProperties":{"scope":["openid","profile","email"],"clientId":"*","clientSecret":"*","issuerUri":"https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0"},"apiMetadataProperties":{"title":"Pet - clinic","description":"Demo for pet clinic","documentation":"doc","version":"v1","serverUrl":"https://tx-enterprise-gateway-fd0c7.svc.asc-test.net"},"corsProperties":{"allowedOrigins":["*"],"allowedMethods":["GET","PUT","DELETE"],"allowedHeaders":["X-TEST","X-STAGING"],"maxAge":10,"allowCredentials":true,"exposedHeaders":["Access-Control-Request-Method","Access-Control-Request-Headers"]},"resourceRequests":{"cpu":"1","memory":"2Gi"},"instances":[{"name":"asc-scg-default-0","status":"Running"},{"name":"asc-scg-default-1","status":"Running"},{"name":"asc-scg-default-2","status":"Running"}],"operatorProperties":{"resourceRequests":{"cpu":"1","memory":"2Gi","instanceCount":2},"instances":[{"name":"scg-operator-b788f7c7-djqgj","status":"Running"},{"name":"scg-operator-b788f7c7-r4gvw","status":"Running"}]},"apmTypes":["NewRelic","ElasticAPM"],"environmentVariables":{"properties":{"a":"b","c":"d"},"secrets":null}},"type":"Microsoft.AppPlatform/Spring/gateways","sku":{"name":"E0","tier":"Enterprise","capacity":3},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/gateways/default","name":"default","systemData":{"createdBy":"ninpan@microsoft.com","createdByType":"User","createdAt":"2023-01-09T09:01:20.4949677Z","lastModifiedBy":"ninpan@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2023-01-09T16:36:52.520067Z"}}' + string: '{"properties":{"public":true,"url":"tx-enterprise-gateway-fd0c7.svc.asc-test.net","provisioningState":"Succeeded","httpsOnly":true,"clientAuth":{"certificateVerification":"Enabled","certificates":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/certificates/abc"]},"ssoProperties":{"scope":["openid","profile","email"],"clientId":"*","clientSecret":"*","issuerUri":"https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0"},"addonConfigs":{"javaOpts":"-Djava.awt.headless=true","sso":{"rolesAttributeName":"role","inactiveSessionExpirationInMinutes":1},"envs":[{"name":"xxx","value":"yyy"},{"name":"xxx1","value":"yyy"}]},"apiMetadataProperties":{"title":"Pet + clinic","description":"Demo for pet clinic","documentation":"doc","version":"v1","serverUrl":"https://tx-enterprise-gateway-fd0c7.svc.asc-test.net"},"corsProperties":{"allowedOrigins":["*"],"allowedOriginPatterns":["example*"],"allowedMethods":["GET","PUT","DELETE"],"allowedHeaders":["X-TEST","X-STAGING"],"maxAge":10,"allowCredentials":true,"exposedHeaders":["Access-Control-Request-Method","Access-Control-Request-Headers"]},"resourceRequests":{"cpu":"1","memory":"2Gi"},"instances":[{"name":"asc-scg-default-0","status":"Running"},{"name":"asc-scg-default-1","status":"Running"},{"name":"asc-scg-default-2","status":"Running"}],"operatorProperties":{"resourceRequests":{"cpu":"1","memory":"2Gi","instanceCount":2},"instances":[{"name":"scg-operator-b788f7c7-djqgj","status":"Running"},{"name":"scg-operator-b788f7c7-r4gvw","status":"Running"}]},"apmTypes":["NewRelic","ElasticAPM"],"environmentVariables":{"properties":{"a":"b","c":"d"},"secrets":null}},"type":"Microsoft.AppPlatform/Spring/gateways","sku":{"name":"E0","tier":"Enterprise","capacity":3},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tx/providers/Microsoft.AppPlatform/Spring/tx-enterprise/gateways/default","name":"default","systemData":{"createdBy":"ninpan@microsoft.com","createdByType":"User","createdAt":"2023-01-09T09:01:20.4949677Z","lastModifiedBy":"ninpan@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2023-01-09T16:36:52.520067Z"}}' headers: cache-control: - no-cache diff --git a/src/spring/azext_spring/tests/latest/test_asa_gateway.py b/src/spring/azext_spring/tests/latest/test_asa_gateway.py index 53991e14607..23407ee9804 100644 --- a/src/spring/azext_spring/tests/latest/test_asa_gateway.py +++ b/src/spring/azext_spring/tests/latest/test_asa_gateway.py @@ -17,6 +17,7 @@ def test_gateway(self): py_path = os.path.abspath(os.path.dirname(__file__)) routes_file = os.path.join(py_path, 'files/gateway_routes.json').replace("\\","/") routes_file_v2 = os.path.join(py_path, 'files/gateway_routes_v2.json').replace("\\","/") + addon_configs_file = os.path.join(py_path, 'files/gateway_addon_configs.json').replace("\\","/") self.kwargs.update({ 'serviceName': 'tx-enterprise', @@ -24,6 +25,7 @@ def test_gateway(self): 'routeName': 'cli-route', 'routeFile': routes_file, 'routesFileV2': routes_file_v2, + 'addonConfigsFile': addon_configs_file, 'cert': 'cli-unittest', 'domain': 'gateway-cli.azdmss-test.net', 'thumbprint': '6695512ed53e0c46817348b78411876a9a9c3396' @@ -35,8 +37,9 @@ def test_gateway(self): '--server-url https://tx-enterprise-gateway-fd0c7.svc.asc-test.net ' '--certificate-names abc --enable-cert-verify true ' '--apm-types NewRelic ElasticAPM --properties a=b c=d --secrets e=f g=h ' - '--allowed-origins "*" --allowed-methods "GET,PUT,DELETE" --allowed-headers "X-TEST,X-STAGING" --max-age 10 --allow-credentials true --exposed-headers "Access-Control-Request-Method,Access-Control-Request-Headers" ' - '--client-id * --client-secret * --issuer-uri https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0 --scope "openid,profile,email"', checks=[ + '--allowed-origins "*" --allowed-origin-patterns "example*" --allowed-methods "GET,PUT,DELETE" --allowed-headers "X-TEST,X-STAGING" --max-age 10 --allow-credentials true --exposed-headers "Access-Control-Request-Method,Access-Control-Request-Headers" ' + '--client-id * --client-secret * --issuer-uri https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0 --scope "openid,profile,email" ' + '--addon-configs-file {addonConfigsFile}', checks=[ self.check('properties.public', True), self.check('properties.httpsOnly', True), self.check('properties.resourceRequests.cpu', "1"), @@ -53,6 +56,7 @@ def test_gateway(self): self.check('properties.corsProperties.allowCredentials', True), self.check('properties.corsProperties.allowedHeaders', ["X-TEST", "X-STAGING"]), self.check('properties.corsProperties.allowedOrigins', ["*"]), + self.check('properties.corsProperties.allowedOriginPatterns', ["example*"]), self.check('properties.corsProperties.allowedMethods', ["GET", "PUT", "DELETE"]), self.check('properties.corsProperties.exposedHeaders', ["Access-Control-Request-Method", "Access-Control-Request-Headers"]), self.check('properties.ssoProperties.clientId', "*"), @@ -64,6 +68,7 @@ def test_gateway(self): self.check('properties.apmTypes', ["NewRelic", "ElasticAPM"]), self.check('properties.environmentVariables.properties', {'a': 'b', 'c': 'd'}), self.check('properties.environmentVariables.secrets', None), + self.check('properties.addonConfigs', {'javaOpts':'-Djava.awt.headless=true','sso':{'rolesAttributeName':'role','inactiveSessionExpirationInMinutes':1},'envs':[{'name':'xxx','value':'yyy'},{'name':'xxx1','value':'yyy'}]}), self.check('properties.provisioningState', "Succeeded") ]) From f9be4cd24e44168e381a73d9a7f986df557a32f4 Mon Sep 17 00:00:00 2001 From: Ningting Pan Date: Fri, 16 Jun 2023 14:32:20 +0800 Subject: [PATCH 2/4] update history --- src/spring/HISTORY.md | 5 +++++ src/spring/setup.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/spring/HISTORY.md b/src/spring/HISTORY.md index 706c18cd79a..bbeaabe65ec 100644 --- a/src/spring/HISTORY.md +++ b/src/spring/HISTORY.md @@ -1,5 +1,10 @@ Release History =============== +1.13.3 +--- +* Add arguments `--allowed-origin-patterns`, `--addon-configs-json` and `--addon-configs-file` in `az spring gateway update`. +* Add new command -- `az spring gateway restart` to restart Spring Cloud Gateway. + 1.13.2 --- * Add argument `--build-certificates` in `az spring app deploy`. diff --git a/src/spring/setup.py b/src/spring/setup.py index 741b61937ad..cbae8abe012 100644 --- a/src/spring/setup.py +++ b/src/spring/setup.py @@ -16,7 +16,7 @@ # TODO: Confirm this is the right version number you want and it matches your # HISTORY.rst entry. -VERSION = '1.13.2' +VERSION = '1.13.3' # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers From 3c9cad35e3169bde80dd928121af4b9cc015f72f Mon Sep 17 00:00:00 2001 From: Ningting Pan Date: Fri, 16 Jun 2023 15:04:27 +0800 Subject: [PATCH 3/4] lint --- src/spring/azext_spring/_params.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/spring/azext_spring/_params.py b/src/spring/azext_spring/_params.py index fbf800ebdf3..abe22e1a735 100644 --- a/src/spring/azext_spring/_params.py +++ b/src/spring/azext_spring/_params.py @@ -861,7 +861,10 @@ def prepare_logs_argument(c): help='Sensitive properties for environment variables. Once put, it will be encrypted and not returned.' 'Format "key[=value]" and separated by space.') c.argument('allowed_origins', arg_group='Cross-origin Resource Sharing (CORS)', help="Comma-separated list of allowed origins to make cross-site requests. The special value `*` allows all domains.") - c.argument('allowed_origin_patterns', arg_group='Cross-origin Resource Sharing (CORS)', help="Comma-separated list of allowed origin patterns to make cross-site requests.") + c.argument('allowed_origin_patterns', + arg_group='Cross-origin Resource Sharing (CORS)', + options_list=['--allowed-origin-patterns', '--allow-origin-patterns'], + help="Comma-separated list of allowed origin patterns to make cross-site requests.") c.argument('allowed_methods', arg_group='Cross-origin Resource Sharing (CORS)', help="Comma-separated list of allowed HTTP methods on cross-site requests. The special value `*` allows all methods.") c.argument('allowed_headers', arg_group='Cross-origin Resource Sharing (CORS)', help="Comma-separated list of allowed headers in cross-site requests. The special value `*` allows actual requests to send any header.") c.argument('max_age', arg_group='Cross-origin Resource Sharing (CORS)', type=int, From 71e307b37013c05c6b23f474ca8b3c7472cbcb4c Mon Sep 17 00:00:00 2001 From: ninpan-ms <71061174+ninpan-ms@users.noreply.github.com> Date: Fri, 16 Jun 2023 16:04:14 +0800 Subject: [PATCH 4/4] Update src/spring/HISTORY.md Co-authored-by: Xing Zhou --- src/spring/HISTORY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spring/HISTORY.md b/src/spring/HISTORY.md index bbeaabe65ec..e577ecef3b2 100644 --- a/src/spring/HISTORY.md +++ b/src/spring/HISTORY.md @@ -3,7 +3,7 @@ Release History 1.13.3 --- * Add arguments `--allowed-origin-patterns`, `--addon-configs-json` and `--addon-configs-file` in `az spring gateway update`. -* Add new command -- `az spring gateway restart` to restart Spring Cloud Gateway. +* Add new command `az spring gateway restart` to restart Spring Cloud Gateway. 1.13.2 ---