[jira] [Closed] (LIBCLOUD-986) List / Iterate container with prefix for Azure Blob service (This support exists in the other drivers already)

2018-03-30 Thread Joshua Hawkinson (JIRA)

 [ 
https://issues.apache.org/jira/browse/LIBCLOUD-986?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Joshua Hawkinson closed LIBCLOUD-986.
-
Resolution: Fixed

Thanks for your help in getting this closed out

> List / Iterate container with prefix for Azure Blob service (This support 
> exists in the other drivers already)
> --
>
> Key: LIBCLOUD-986
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-986
> Project: Libcloud
>  Issue Type: Improvement
>  Components: Storage
>Reporter: Joshua Hawkinson
>Priority: Major
>
> While testing out the libcloud storage abstraction I've come across a curious 
> omission in driver support. It seems that for many drivers there is 
> additional support for the {{list_container_objects()}} and 
> {{iterate_container_objects()}} to support a prefix (or {{ex_prefix)}}. 
> This functionality is not present in the Azure driver for some reason.   I've 
> gone and checked the list_blobs API and it also supports this functionality 
> as seen here:
> [https://docs.microsoft.com/en-us/rest/api/storageservices/list-blobs]
>  
> I've attempted a quick and dirty patch that seems to work as well.
> {code}
> azure_blobs.py Line 384
> -def iterate_container_objects(self, container):
> +def iterate_container_objects(self, container, ex_prefix=None):
> """
> @inherits: :class:`StorageDriver.iterate_container_objects`
> """
> params = {'restype': 'container',
>   'comp': 'list',
> +  'prefix': ex_prefix,
>   'maxresults': RESPONSES_PER_REQUEST,
>   'include': 'metadata'}
> Line 419 (Add new function)
> def list_container_objects(self, container, ex_prefix=None):
> """
> Return a list of objects for the given container.
> 
> :param container: Container instance.
> :type container: :class:`Container`
> 
> :param ex_prefix: Only return objects starting with ex_prefix
> :type ex_prefix: ``str``
> 
> :return: A list of Object instances.
> :rtype: ``list`` of :class:`Object`
> """
> return list(self.iterate_container_objects(container,
>ex_prefix=ex_prefix))
> 
>  {code}
>  
> I've just worked around this at a higher level for now. There isn't any 
> urgency on my end,  but it would be nice if the abstraction was more 
> consistent so I could remove the workaround code.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (LIBCLOUD-985) GCE - Support network routingmode and subnet secondary/internal access options

2018-03-30 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/LIBCLOUD-985?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16420184#comment-16420184
 ] 

ASF GitHub Bot commented on LIBCLOUD-985:
-

Github user asfgit closed the pull request at:

https://github.com/apache/libcloud/pull/1181


> GCE - Support network routingmode and subnet secondary/internal access options
> --
>
> Key: LIBCLOUD-985
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-985
> Project: Libcloud
>  Issue Type: Improvement
>  Components: Compute
> Environment: N/A
>Reporter: Max L
>Priority: Minor
>
> As of 3/2018, Google Cloud APIs support a few more creation flags for 
> networks and subnetworks.
> Networks: BGP Routing mode regional/global
> Subnetworks: Secondary IP Ranges, Private IP access to GCP APIs.
> It would be good to add coverage for these.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[1/2] libcloud git commit: [LIBCLOUD-985] Add coverage for newer GCE network and subnet creation options.

2018-03-30 Thread quentinp
Repository: libcloud
Updated Branches:
  refs/heads/trunk ed0406043 -> 4faa332c7


[LIBCLOUD-985] Add coverage for newer GCE network and subnet creation options.

Signed-off-by: Quentin Pradet 


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/9702f72b
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/9702f72b
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/9702f72b

Branch: refs/heads/trunk
Commit: 9702f72b57f9b1372c289146a20cf201a0d6ea5d
Parents: ed04060
Author: Max 
Authored: Tue Mar 13 12:12:56 2018 -0700
Committer: Quentin Pradet 
Committed: Fri Mar 30 10:01:47 2018 +0400

--
 libcloud/compute/drivers/gce.py | 40 ++--
 .../fixtures/gce/global_networks_lcnetwork.json |  3 ++
 ...entral1_subnetworks_cf_972cf02e6ad49112.json | 28 +-
 libcloud/test/compute/test_gce.py   | 24 ++--
 4 files changed, 78 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/9702f72b/libcloud/compute/drivers/gce.py
--
diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py
index 311997f..80b6aa1 100644
--- a/libcloud/compute/drivers/gce.py
+++ b/libcloud/compute/drivers/gce.py
@@ -3770,7 +3770,8 @@ class GCENodeDriver(NodeDriver):
 return self.ex_get_sslcertificate(name)
 
 def ex_create_subnetwork(self, name, cidr=None, network=None, region=None,
- description=None):
+ description=None, privateipgoogleaccess=None,
+ secondaryipranges=None):
 """
 Create a subnetwork.
 
@@ -3789,6 +3790,17 @@ class GCENodeDriver(NodeDriver):
 :param  description: Custom description for the network.
 :type   description: ``str`` or ``None``
 
+:param  privateipgoogleaccess: Allow access to Google services without
+   assigned external IP addresses.
+:type   privateipgoogleaccess: ``bool` or ``None``
+
+:param  secondaryipranges: List of dicts of secondary or "alias" IP
+   ranges for this subnetwork in
+   [{"rangeName": "second1",
+   "ipCidrRange": "192.168.168.0/24"},
+   {k:v, k:v}] format.
+:type   secondaryipranges: ``list`` of ``dict`` or ``None``
+
 :return:  Subnetwork object
 :rtype:   :class:`GCESubnetwork`
 """
@@ -3825,6 +3837,8 @@ class GCENodeDriver(NodeDriver):
 subnet_data['ipCidrRange'] = cidr
 subnet_data['network'] = network_url
 subnet_data['region'] = region_url
+subnet_data['privateIpGoogleAccess'] = privateipgoogleaccess
+subnet_data['secondaryIpRanges'] = secondaryipranges
 region_name = region_url.split('/')[-1]
 
 request = '/regions/%s/subnetworks' % (region_name)
@@ -3832,7 +3846,8 @@ class GCENodeDriver(NodeDriver):
 
 return self.ex_get_subnetwork(name, region_name)
 
-def ex_create_network(self, name, cidr, description=None, mode="legacy"):
+def ex_create_network(self, name, cidr, description=None,
+  mode="legacy", routing_mode=None):
 """
 Create a network. In November 2015, Google introduced Subnetworks and
 suggests using networks with 'auto' generated subnetworks. See, the
@@ -3853,6 +3868,11 @@ class GCENodeDriver(NodeDriver):
 :param  mode: Create a 'auto', 'custom', or 'legacy' network.
 :type   mode: ``str``
 
+:param  routing_mode: Create network with 'Global' or 'Regional'
+  routing mode for BGP advertisements.
+  Defaults to 'Regional'
+:type   routing_mode: ``str`` or ``None``
+
 :return:  Network object
 :rtype:   :class:`GCENetwork`
 """
@@ -3865,8 +3885,6 @@ class GCENodeDriver(NodeDriver):
 if cidr and mode in ['auto', 'custom']:
 raise ValueError("Can only specify IPv4Range with 'legacy' mode.")
 
-request = '/global/networks'
-
 if mode == 'legacy':
 if not cidr:
 raise ValueError("Must specify IPv4Range with 'legacy' mode.")
@@ -3874,6 +3892,16 @@ class GCENodeDriver(NodeDriver):
 else:
 network_data['autoCreateSubnetworks'] = (mode.lower() == 'auto')
 
+if routing_mode.lower() not in ['regional', 'global']:
+raise ValueError("Invalid Routing Mode: '%s'. Must be 'REGIONAL', "
+ "or 'GLOBAL'." % routing_mode)
+

[2/2] libcloud git commit: Add changes for #1181

2018-03-30 Thread quentinp
Add changes for #1181

Closes #1181


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4faa332c
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4faa332c
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4faa332c

Branch: refs/heads/trunk
Commit: 4faa332c7c1f9d80c93c0279ed55307cd9dcd7d7
Parents: 9702f72
Author: Quentin Pradet 
Authored: Fri Mar 30 10:02:59 2018 +0400
Committer: Quentin Pradet 
Committed: Fri Mar 30 10:03:27 2018 +0400

--
 CHANGES.rst | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/4faa332c/CHANGES.rst
--
diff --git a/CHANGES.rst b/CHANGES.rst
index 90554f6..0bc1277 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -23,7 +23,10 @@ Compute
 - [EC2] Add AWS eu-west-3 (Paris) region (GITHUB-1175)
   [Anthony Monthe]
 
-- [GCE] Expand GCE Firewall options coverage (LIBCLOUD-960, GITHUB-1144)
+- [GCE] Expand Firewall options coverage (LIBCLOUD-960, GITHUB-1144)
+  [maxlip]
+
+- [GCE] Expand network and subnetwork options coverage (LIBCLOUD-985, 
GITHUB-1181)
   [maxlip]
 
 - [GCE] Extend ex_create_address to allow internal ip creation (GITHUB-1174)



[GitHub] libcloud pull request #1181: [LIBCLOUD-985] Add coverage for newer GCE netwo...

2018-03-30 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/libcloud/pull/1181


---


[jira] [Commented] (LIBCLOUD-985) GCE - Support network routingmode and subnet secondary/internal access options

2018-03-30 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/LIBCLOUD-985?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16420183#comment-16420183
 ] 

ASF subversion and git services commented on LIBCLOUD-985:
--

Commit 9702f72b57f9b1372c289146a20cf201a0d6ea5d in libcloud's branch 
refs/heads/trunk from [~maxlip]
[ https://git-wip-us.apache.org/repos/asf?p=libcloud.git;h=9702f72 ]

[LIBCLOUD-985] Add coverage for newer GCE network and subnet creation options.

Signed-off-by: Quentin Pradet 


> GCE - Support network routingmode and subnet secondary/internal access options
> --
>
> Key: LIBCLOUD-985
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-985
> Project: Libcloud
>  Issue Type: Improvement
>  Components: Compute
> Environment: N/A
>Reporter: Max L
>Priority: Minor
>
> As of 3/2018, Google Cloud APIs support a few more creation flags for 
> networks and subnetworks.
> Networks: BGP Routing mode regional/global
> Subnetworks: Secondary IP Ranges, Private IP access to GCP APIs.
> It would be good to add coverage for these.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)