You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2021/02/26 22:34:51 UTC
[libcloud] branch trunk updated (55fb3bc -> 51001b8)
This is an automated email from the ASF dual-hosted git repository.
tomaz pushed a change to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git.
from 55fb3bc Respect common HTTP headers when uploading Azure Storage blob via stream (#1553)
add 47b667b Ca Features working
new d9cb371 Add outscale's api access rule system.
new bbabe73 Remove default None value for required params.
new 39f1a55 Outscale: improve ex_create_api_access_rule.
new 2b4d4c6 Merge branch 'trunk' of https://github.com/outscale-dev/libcloud into outscale-dev-trunk1
new 51001b8 Add changelog entry.
The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
CHANGES.rst | 4 +
docs/compute/drivers/outscale.rst | 15 ++
libcloud/compute/drivers/outscale.py | 322 +++++++++++++++++++++++++++++++++++
3 files changed, 341 insertions(+)
[libcloud] 03/05: Outscale: improve ex_create_api_access_rule.
Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git
commit 39f1a551a41c1266623d0e3f33b21082c2121110
Author: François NOUAILLE DEGORCE <fr...@outscale.com>
AuthorDate: Thu Feb 25 08:06:36 2021 +0100
Outscale: improve ex_create_api_access_rule.
---
libcloud/compute/drivers/outscale.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libcloud/compute/drivers/outscale.py b/libcloud/compute/drivers/outscale.py
index 6cfddc7..5a59803 100644
--- a/libcloud/compute/drivers/outscale.py
+++ b/libcloud/compute/drivers/outscale.py
@@ -7870,6 +7870,11 @@ class OutscaleNodeDriver(NodeDriver):
:return: a dict containing the API access rule created.
:rtype: ``dict``
"""
+
+ if not ca_ids and not ip_ranges:
+ raise ValueError(
+ "Either ca_ids or ip_ranges argument must be provided.")
+
action = "CreateApiAccessRule"
data = {"DryRun": dry_run}
if description is not None:
[libcloud] 01/05: Add outscale's api access rule system.
Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git
commit d9cb371c1368f84ff8c15a87207bc44402231b87
Author: François NOUAILLE DEGORCE <fr...@outscale.com>
AuthorDate: Thu Jan 7 14:30:36 2021 +0100
Add outscale's api access rule system.
---
docs/compute/drivers/outscale.rst | 8 ++
libcloud/compute/drivers/outscale.py | 190 +++++++++++++++++++++++++++++++++++
2 files changed, 198 insertions(+)
diff --git a/docs/compute/drivers/outscale.rst b/docs/compute/drivers/outscale.rst
index 04d4567..9494db9 100644
--- a/docs/compute/drivers/outscale.rst
+++ b/docs/compute/drivers/outscale.rst
@@ -349,3 +349,11 @@ Certificate Authority
* ``ex_delete_certificate_authority`` - Returns a ``bool``
* ``ex_read_certificate_authorities`` - Returns a ``list`` of ``dict``
+API Access Rules
+----------------
+* ``ex_create_api_access_rule`` - Returns a ``dict``
+* ``ex_delete_api_access_rule`` - Returns a ``bool``
+* ``ex_read_api_access_rules`` - Returns a ``list`` of ``dict``
+* ``ex_update_api_access_rule`` - Returns a ``dict``
+
+
diff --git a/libcloud/compute/drivers/outscale.py b/libcloud/compute/drivers/outscale.py
index c468fd5..261acac 100644
--- a/libcloud/compute/drivers/outscale.py
+++ b/libcloud/compute/drivers/outscale.py
@@ -7831,6 +7831,196 @@ class OutscaleNodeDriver(NodeDriver):
return response.json()["Ca"]
return response.json()
+ def ex_create_api_access_rule(
+ self,
+ description: str = None,
+ ip_ranges: List[str] = None,
+ ca_ids: List[str] = None,
+ cns: List[str] = None,
+ dry_run: bool = False,
+ ):
+ """
+ Create an API access rule.
+ It is a rule to allow access to the API from your account.
+ You need to specify at least the CaIds or the IpRanges parameter.
+
+ :param description: The description of the new rule.
+ :type description: ``str``
+
+ :param ip_ranges: One or more IP ranges, in CIDR notation
+ (for example, 192.0.2.0/16).
+ :type ip_ranges: ``List`` of ``str``
+
+ :param ca_ids: One or more IDs of Client Certificate Authorities
+ (CAs).
+ :type ca_ids: ``List`` of ``str``
+
+ :param cns: One or more Client Certificate Common Names (CNs).
+ If this parameter is specified, you must also specify the ca_ids
+ parameter.
+ :type cns: ``List`` of ``str``
+
+ :param dry_run: If true, checks whether you have the required
+ permissions to perform the action.
+ :type dry_run: ``bool``
+
+ :return: a dict containing the API access rule created.
+ :rtype: ``dict``
+ """
+ action = "CreateApiAccessRule"
+ data = {"DryRun": dry_run}
+ if description is not None:
+ data["Description"] = description
+ if ip_ranges is not None:
+ data["IpRanges"] = ip_ranges
+ if ca_ids is not None:
+ data["CaIds"] = ca_ids
+ if cns is not None:
+ data["Cns"] = cns
+ response = self._call_api(action, json.dumps(data))
+ if response.status_code == 200:
+ return response.json()["ApiAccessRule"]
+ return response.json()
+
+ def ex_delete_api_access_rule(
+ self,
+ api_access_rule_id: str = None,
+ dry_run: bool = False,
+ ):
+ """
+ Delete an API access rule.
+ You cannot delete the last remaining API access rule.
+
+ :param api_access_rule_id: The id of the targeted rule.
+ :type api_access_rule_id: ``str``
+
+ :param dry_run: If true, checks whether you have the required
+ permissions to perform the action.
+ :type dry_run: ``bool``
+
+ :return: true if successfull.
+ :rtype: ``bool`` if successful or ``dict``
+ """
+ action = "DeleteApiAccessRule"
+ data = {"ApiAccessRuleId": api_access_rule_id, "DryRun": dry_run}
+ response = self._call_api(action, json.dumps(data))
+ if response.status_code == 200:
+ return True
+ return response.json()
+
+ def ex_read_api_access_rules(
+ self,
+ api_access_rules_ids: List[str] = None,
+ ca_ids: List[str] = None,
+ cns: List[str] = None,
+ descriptions: List[str] = None,
+ ip_ranges: List[str] = None,
+ dry_run: bool = False,
+ ):
+ """
+ Read API access rules.
+
+ :param api_access_rules_ids: The List containing rules ids to
+ filter the request.
+ :type api_access_rules_ids: ``List`` of ``str``
+
+ :param ca_ids: The List containing CA ids to filter the request.
+ :type ca_ids: ``List`` of ``str``
+
+ :param cns: The List containing cns to filter the request.
+ :type cns: ``List`` of ``str``
+
+ :param descriptions: The List containing descriptions to filter
+ the request.
+ :type descriptions: ``List`` of ``str``
+
+ :param ip_ranges: The List containing ip ranges in CIDR notation
+ (for example, 192.0.2.0/16) to filter the request.
+ :type ip_ranges: ``List`` of ``str``
+
+ :param dry_run: If true, checks whether you have the required
+ permissions to perform the action.
+ :type dry_run: ``bool``
+
+ :return: a List of API access rules.
+ :rtype: ``List`` of ``dict`` if successfull or ``dict``
+ """
+
+ action = "ReadApiAccessRules"
+ filters = {}
+ if api_access_rules_ids is not None:
+ filters["ApiAccessRulesIds"] = api_access_rules_ids
+ if ca_ids is not None:
+ filters["CaIds"] = ca_ids
+ if cns is not None:
+ filters["Cns"] = cns
+ if descriptions is not None:
+ filters["Descriptions"] = descriptions
+ if ip_ranges is not None:
+ filters["IpRanges"] = ip_ranges
+ data = {"Filters": filters, "DryRun": dry_run}
+ response = self._call_api(action, json.dumps(data))
+ if response.status_code == 200:
+ return response.json()["ApiAccessRules"]
+ return response.json()
+
+ def ex_update_api_access_rule(
+ self,
+ api_access_rule_id: str = None,
+ ca_ids: List[str] = None,
+ cns: List[str] = None,
+ description: str = None,
+ ip_ranges: List[str] = None,
+ dry_run: bool = False,
+ ):
+ """
+ Update an API access rules.
+ The new rule you specify fully replaces the old rule. Therefore,
+ for a parameter that is not specified, any previously set value
+ is deleted.
+
+ :param api_access_rule_id: The id of the rule we want to update.
+ :type api_access_rule_id: ``str``
+
+ :param ca_ids: One or more IDs of Client Certificate Authorities
+ (CAs).
+ :type ca_ids: ``List`` of ``str``
+
+ :param cns: One or more Client Certificate Common Names (CNs).
+ If this parameter is specified, you must also specify the ca_ids
+ parameter.
+ :type cns: ``List`` of ``str``
+
+ :param description: The description of the new rule.
+ :type description: ``str``
+
+ :param ip_ranges: One or more IP ranges, in CIDR notation
+ (for example, 192.0.2.0/16).
+ :type ip_ranges: ``List`` of ``str``
+
+ :param dry_run: If true, checks whether you have the required
+ permissions to perform the action.
+ :type dry_run: ``bool``
+
+ :return: a List of API access rules.
+ :rtype: ``List`` of ``dict`` if successfull or ``dict``
+ """
+
+ action = "UpdateApiAccessRule"
+ data = {"DryRun": dry_run, "ApiAccessRuleId": api_access_rule_id}
+ if description is not None:
+ data["Description"] = description
+ if ip_ranges is not None:
+ data["IpRanges"] = ip_ranges
+ if ca_ids is not None:
+ data["CaIds"] = ca_ids
+ if cns is not None:
+ data["Cns"] = cns
+ response = self._call_api(action, json.dumps(data))
+ if response.status_code == 200:
+ return response.json()["ApiAccessRules"]
+ return response.json()
+
def _get_outscale_endpoint(self, region: str, version: str, action: str):
return "https://api.{}.{}/api/{}/{}".format(
region,
[libcloud] 05/05: Add changelog entry.
Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git
commit 51001b8b5b6d814160f42a669e57c024355cdeb9
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Fri Feb 26 23:34:35 2021 +0100
Add changelog entry.
---
CHANGES.rst | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/CHANGES.rst b/CHANGES.rst
index 702327d..0dc62d8 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -33,6 +33,10 @@ Compute
(GITHUB-1543)
[Miguel Caballer - @micafer]
+- [Outscale] Various updates to the driver.
+ (GITHUB-1549)
+ [Tio Gobin - @tgn-outscale]
+
Changes in Apache Libcloud 3.3.1
--------------------------------
[libcloud] 02/05: Remove default None value for required params.
Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git
commit bbabe7316e6d5e02f46150bd6fb204e4c2588a67
Author: François NOUAILLE DEGORCE <fr...@outscale.com>
AuthorDate: Tue Feb 23 10:09:12 2021 +0100
Remove default None value for required params.
---
libcloud/compute/drivers/outscale.py | 37 ++++++++++++++++++++----------------
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/libcloud/compute/drivers/outscale.py b/libcloud/compute/drivers/outscale.py
index 261acac..6cfddc7 100644
--- a/libcloud/compute/drivers/outscale.py
+++ b/libcloud/compute/drivers/outscale.py
@@ -7711,7 +7711,7 @@ class OutscaleNodeDriver(NodeDriver):
def ex_create_certificate_authority(
self,
- ca_perm: str = None,
+ ca_perm: str,
description: str = None,
dry_run: bool = False
):
@@ -7727,11 +7727,12 @@ class OutscaleNodeDriver(NodeDriver):
:param dry_run: If true, checks whether you have the required
permissions to perform the action.
:type dry_run: ``bool``
+
+ :return: the created Ca.
+ :rtype: ``dict``
"""
action = "CreateCa"
- data = {"DryRun": dry_run}
- if ca_perm is not None:
- data.update({"CaPerm": ca_perm})
+ data = {"DryRun": dry_run, "CaPerm": ca_perm}
if description is not None:
data.update({"Description": description})
response = self._call_api(action, json.dumps(data))
@@ -7741,7 +7742,7 @@ class OutscaleNodeDriver(NodeDriver):
def ex_delete_certificate_authority(
self,
- ca_id: str = None,
+ ca_id: str,
dry_run: bool = False
):
"""
@@ -7755,9 +7756,7 @@ class OutscaleNodeDriver(NodeDriver):
:type dry_run: ``bool``
"""
action = "DeleteCa"
- data = {"DryRun": dry_run}
- if ca_id is not None:
- data.update({"CaId": ca_id})
+ data = {"DryRun": dry_run, "CaId": ca_id}
response = self._call_api(action, json.dumps(data))
if response.status_code == 200:
return True
@@ -7786,6 +7785,9 @@ class OutscaleNodeDriver(NodeDriver):
:param dry_run: If true, checks whether you have the required
permissions to perform the action.
:type dry_run: ``bool``
+
+ :return: a list of all Ca matching filled filters.
+ :rtype: ``list`` of ``dict``
"""
action = "ReadCas"
data = {"DryRun": dry_run, "Filters": {}}
@@ -7802,7 +7804,7 @@ class OutscaleNodeDriver(NodeDriver):
def ex_update_certificate_authority(
self,
- ca_id: str = None,
+ ca_id: str,
description: str = None,
dry_run: bool = False
):
@@ -7819,11 +7821,12 @@ class OutscaleNodeDriver(NodeDriver):
:param dry_run: If true, checks whether you have the required
permissions to perform the action.
:type dry_run: ``bool``
+
+ :return: a the created Ca or the request result.
+ :rtype: ``dict``
"""
action = "UpdateCa"
- data = {"DryRun": dry_run}
- if ca_id is not None:
- data.update({"CaId": ca_id})
+ data = {"DryRun": dry_run, "CaId": ca_id}
if description is not None:
data.update({"Description": description})
response = self._call_api(action, json.dumps(data))
@@ -7884,14 +7887,15 @@ class OutscaleNodeDriver(NodeDriver):
def ex_delete_api_access_rule(
self,
- api_access_rule_id: str = None,
+ api_access_rule_id: str,
dry_run: bool = False,
):
"""
Delete an API access rule.
You cannot delete the last remaining API access rule.
- :param api_access_rule_id: The id of the targeted rule.
+ :param api_access_rule_id: The id of the targeted rule
+ (required).
:type api_access_rule_id: ``str``
:param dry_run: If true, checks whether you have the required
@@ -7966,7 +7970,7 @@ class OutscaleNodeDriver(NodeDriver):
def ex_update_api_access_rule(
self,
- api_access_rule_id: str = None,
+ api_access_rule_id: str,
ca_ids: List[str] = None,
cns: List[str] = None,
description: str = None,
@@ -7979,7 +7983,8 @@ class OutscaleNodeDriver(NodeDriver):
for a parameter that is not specified, any previously set value
is deleted.
- :param api_access_rule_id: The id of the rule we want to update.
+ :param api_access_rule_id: The id of the rule we want to update
+ (required).
:type api_access_rule_id: ``str``
:param ca_ids: One or more IDs of Client Certificate Authorities
[libcloud] 04/05: Merge branch 'trunk' of
https://github.com/outscale-dev/libcloud into outscale-dev-trunk1
Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git
commit 2b4d4c6a2982967ca6338bcbebbc0ac2f785bd59
Merge: 55fb3bc 39f1a55
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Fri Feb 26 23:34:06 2021 +0100
Merge branch 'trunk' of https://github.com/outscale-dev/libcloud into outscale-dev-trunk1
docs/compute/drivers/outscale.rst | 15 ++
libcloud/compute/drivers/outscale.py | 322 +++++++++++++++++++++++++++++++++++
2 files changed, 337 insertions(+)