-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Revert "Revert "[Spring] Support setting marketplace plan when creati… #5486
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
dbf2fbf
Revert "Revert "[Spring] Support setting marketplace plan when creati…
yuwzho 8930854
udpate history
yuwzho 8f4e115
Merge branch 'main' into yuwzho/support-marketplace
yuwzho 58ff47e
Merge branch 'main' into yuwzho/support-marketplace
yuwzho fc5c628
Merge branch 'main' into yuwzho/support-marketplace
yuwzho f88c576
Update src/spring/HISTORY.md
zhoxing-ms File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| # pylint: disable=wrong-import-order | ||
| # pylint: disable=unused-argument, logging-format-interpolation, protected-access, wrong-import-order, too-many-lines | ||
| from knack.log import get_logger | ||
| from ._constant import (MARKETPLACE_OFFER_ID, MARKETPLACE_PUBLISHER_ID) | ||
|
|
||
| logger = get_logger(__name__) | ||
|
|
||
|
|
||
| def _spring_list_marketplace_plan(cmd, client): | ||
| # return get_mgmt_service_client(cli_ctx, AppPlatformManagementClient_20220501preview) | ||
| from azure.cli.core.commands.client_factory import get_mgmt_service_client | ||
| from .vendored_sdks.marketplace.v2018_08_01_beta import MarketplaceRPService | ||
| from .vendored_sdks.marketplace.v2018_08_01_beta.models import Offer | ||
|
|
||
| logger.warning('To view the Azure Spring Apps Enterprise tier offering and read a detailed description, see https://aka.ms/ascmpoffer') | ||
| client = get_mgmt_service_client(cmd.cli_ctx, MarketplaceRPService) | ||
| offer = client.offer.get('{}.{}'.format(MARKETPLACE_PUBLISHER_ID, MARKETPLACE_OFFER_ID)) | ||
| offer.plans = [x for x in offer.plans if _is_valid_plan(x)] | ||
| return Offer.deserialize(offer).serialize(offer) | ||
|
|
||
|
|
||
| def _is_valid_plan(plan): | ||
| return plan.availabilities | ||
|
|
||
|
|
||
| def transform_marketplace_plan_output(result): | ||
| def _table_item_view(plan): | ||
| return { | ||
| 'publisher id': result['properties']['publisherId'], | ||
| 'product id': result['properties']['offerId'], | ||
| 'plan id': plan['planId'], | ||
| 'plan display name': plan['displayName'] | ||
| } | ||
|
|
||
| plans = result['properties']['plans'] | ||
| return [_table_item_view(plan) for plan in plans] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/spring/azext_spring/vendored_sdks/marketplace/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # coding=utf-8 | ||
| # -------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # Code generated by Microsoft (R) AutoRest Code Generator. | ||
| # Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
| # -------------------------------------------------------------------------- | ||
|
|
||
| from ._marketplace_rp_service import MarketplaceRPService | ||
| __all__ = ['MarketplaceRPService'] | ||
|
|
||
| try: | ||
| from ._patch import patch_sdk # type: ignore | ||
| patch_sdk() | ||
| except ImportError: | ||
| pass |
73 changes: 73 additions & 0 deletions
73
src/spring/azext_spring/vendored_sdks/marketplace/_configuration.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # coding=utf-8 | ||
| # -------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for | ||
| # license information. | ||
| # | ||
| # Code generated by Microsoft (R) AutoRest Code Generator. | ||
| # Changes may cause incorrect behavior and will be lost if the code is | ||
| # regenerated. | ||
| # -------------------------------------------------------------------------- | ||
| from typing import TYPE_CHECKING | ||
|
|
||
| from azure.core.configuration import Configuration | ||
| from azure.core.pipeline import policies | ||
| from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy | ||
|
|
||
| from ._version import VERSION | ||
|
|
||
| if TYPE_CHECKING: | ||
| # pylint: disable=unused-import,ungrouped-imports | ||
| from typing import Any, Optional | ||
|
|
||
| from azure.core.credentials import TokenCredential | ||
|
|
||
| class MarketplaceRPServiceConfiguration(Configuration): | ||
| """Configuration for MarketplaceRPService. | ||
|
|
||
| Note that all parameters used to create this instance are saved as instance | ||
| attributes. | ||
|
|
||
| :param credential: Credential needed for the client to connect to Azure. | ||
| :type credential: ~azure.core.credentials.TokenCredential | ||
| :param market: The Market to use for the request. Default value is "US". | ||
| :type market: str | ||
| :param include_stop_sold_plans: The Market to use for the request. Default value is "true". | ||
| :type include_stop_sold_plans: str | ||
| """ | ||
|
|
||
| def __init__( | ||
| self, | ||
| credential, # type: "TokenCredential" | ||
| market="US", # type: Optional[str] | ||
| include_stop_sold_plans="true", # type: Optional[str] | ||
| **kwargs # type: Any | ||
| ): | ||
| # type: (...) -> None | ||
| if credential is None: | ||
| raise ValueError("Parameter 'credential' must not be None.") | ||
| super(MarketplaceRPServiceConfiguration, self).__init__(**kwargs) | ||
|
|
||
| self.credential = credential | ||
| self.market = market | ||
| self.include_stop_sold_plans = include_stop_sold_plans | ||
| self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) | ||
| kwargs.setdefault('sdk_moniker', 'azure-mgmt-marketplace/{}'.format(VERSION)) | ||
| self._configure(**kwargs) | ||
|
|
||
| def _configure( | ||
| self, | ||
| **kwargs # type: Any | ||
| ): | ||
| # type: (...) -> None | ||
| self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) | ||
| self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) | ||
| self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) | ||
| self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) | ||
| self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) | ||
| self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) | ||
| self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) | ||
| self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) | ||
| self.authentication_policy = kwargs.get('authentication_policy') | ||
| if self.credential and not self.authentication_policy: | ||
| self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.