-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Cloud Quota Management API (#29)
Requests for work with `limits` and `quotas` are now sent to Cloud Quota Management API instead of Cloud Management API, as it was before. Commands for working with limits and quotas have been changed. Now the commands look like this: selvpc quota set --region VALUE [--zone VALUE] --resource VALUE --value VALUE <project_id> selvpc quota show --region VALUE <project_id> selvpc limit show --region VALUE <project_id> Cloud Quota Management API is a region service that works with X-Auth-Token, opposite the Cloud Management API that works with X-Token and is only in one region. RegionalHTTPClient is a Proxy of the HTTPClient class, it resolves the URL of the service in the requested region and adds X-Auth-Token to the headers. The functionality for issuing and caching the X-Auth-Token, as well as resolving the service URL is encapsulated in the IdentityManager class. OPENSTACK-12283
- Loading branch information
Showing
31 changed files
with
646 additions
and
959 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
sphinx_rtd_theme>=0.1.9 | ||
sphinx-pypi-upload-2>=0.2.2 | ||
sphinx_rtd_theme==1.1.1 | ||
sphinx-pypi-upload-2==0.2.2 |
This file contains 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 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 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 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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
:: Required variables | ||
set SEL_TOKEN=MNhA6zVcf7x892LqsQSc9vDN_9999 | ||
set SEL_URL=https://api.selectel.ru/vpc/resell | ||
set OS_AUTH_URL=https://api.selvpc.ru/identity/v3 | ||
|
||
:: Optional variables | ||
set SEL_API_VERSION=2 |
This file contains 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 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 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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
cliff>=2.2 | ||
pbr>=1.8 | ||
requests>=2.9.1 | ||
six>=1.9.0 | ||
PyYAML>=3.10 | ||
cliff==3.10.1 | ||
pbr==5.11.0 | ||
requests==2.28.1 | ||
six==1.16.0 | ||
PyYAML==6.0 | ||
python-keystoneclient==4.5.0 | ||
importlib-metadata==4.13.0 |
This file contains 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 |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "1.4" | ||
__version__ = "2.0" |
This file contains 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 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 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 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 |
---|---|---|
@@ -1,37 +1,37 @@ | ||
from selvpcclient.base import ListCommand | ||
from selvpcclient.formatters import join_by_key, reformat_quotas | ||
from selvpcclient.formatters import join_by_key, reformat_limits | ||
from selvpcclient.util import handle_http_error | ||
|
||
|
||
class List(ListCommand): | ||
"""Show domain quotas""" | ||
class Show(ListCommand): | ||
"""Show project limits""" | ||
|
||
columns = ["resource", "region", "zone", "value"] | ||
columns = ["resource", "zone", "value"] | ||
_formatters = { | ||
"region": join_by_key("region"), | ||
"zone": join_by_key("zone"), | ||
"value": join_by_key("value") | ||
} | ||
sorting_support = True | ||
|
||
@handle_http_error | ||
def take_action(self, parsed_args): | ||
result = self.app.context["client"].quotas.get_domain_quotas() | ||
return self.setup_columns(reformat_quotas(result._info), parsed_args) | ||
|
||
|
||
class Free(ListCommand): | ||
"""Show free domain quotas""" | ||
|
||
columns = ["resource", "region", "zone", "value"] | ||
_formatters = { | ||
"region": join_by_key("region"), | ||
"zone": join_by_key("zone"), | ||
"value": join_by_key("value") | ||
} | ||
sorting_support = True | ||
def get_parser(self, prog_name): | ||
parser = super(ListCommand, self).get_parser(prog_name) | ||
required = parser.add_argument_group('Required arguments') | ||
required.add_argument('-r', | ||
'--region', | ||
required=True, | ||
) | ||
required.add_argument('project_id', | ||
metavar='<project_id>', | ||
) | ||
return parser | ||
|
||
@handle_http_error | ||
def take_action(self, parsed_args): | ||
result = self.app.context["client"].quotas.get_free_domain_quotas() | ||
return self.setup_columns(reformat_quotas(result._info), parsed_args) | ||
result = self.app.context["client"].quotas.get_project_limits( | ||
project_id=parsed_args.project_id, | ||
region=parsed_args.region | ||
) | ||
|
||
return self.setup_columns( | ||
reformat_limits(result._info), parsed_args | ||
) |
This file contains 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
Oops, something went wrong.