You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jclouds.apache.org by Viktor Petersson <no...@github.com> on 2013/07/10 12:12:31 UTC

[jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

You can merge this Pull Request by running:

  git pull https://github.com/cloudsigma/jclouds-labs master

Or you can view, comment on it, or merge it online at:

  https://github.com/jclouds/jclouds-labs/pull/12

-- Commit Summary --

  * CloudSigma v2 API and Providers.
  * Merge pull request #1 from GreatFruitOmsk/cloudsigma2-api

-- File Changes --

    A cloudsigma2-lvs/pom.xml (125)
    A cloudsigma2-lvs/src/main/java/org/jclouds/cloudsigma2/CloudSigma2LasVegasProviderMetadata.java (83)
    A cloudsigma2-lvs/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata (1)
    A cloudsigma2-zrh/pom.xml (126)
    A cloudsigma2-zrh/src/main/java/org/jclouds/cloudsigma2/CloudSigma2ZurichProviderMetadata.java (83)
    A cloudsigma2-zrh/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata (1)
    A cloudsigma2/README.txt (6)
    A cloudsigma2/pom.xml (116)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2ApiMetadata.java (102)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2AsyncClient.java (602)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2Client.java (562)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/beans/RawAccountBalance.java (25)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/beans/RawCurrentUsage.java (47)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/beans/RawDiscount.java (25)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/beans/RawDrive.java (57)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/beans/RawFirewallPolicy.java (43)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/beans/RawIP.java (35)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/beans/RawLibraryDrive.java (34)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/beans/RawOwner.java (26)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/beans/RawPricing.java (54)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/beans/RawProfileInfo.java (72)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/beans/RawServer.java (51)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/beans/RawServerInfo.java (75)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/beans/RawSubscription.java (42)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/beans/RawTag.java (36)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/beans/RawTransaction.java (30)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/beans/RawVLAN.java (32)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequest.java (54)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequestList.java (60)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDriveToJson.java (54)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDrivesToJson.java (58)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindFirewallPoliciesListToJsonRequest.java (58)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindFirewallPolicyToJsonRequest.java (54)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindIPInfoToJsonRequest.java (54)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindLibraryDriveToJson.java (53)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindProfileInfoToJsonRequest.java (53)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindServerInfoListToJsonRequest.java (58)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindServerInfoToJsonRequest.java (53)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindTagListToJsonRequest.java (59)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindTagToJsonRequest.java (54)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindUuidStringsToJsonArray.java (49)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindVLANToJsonRequest.java (54)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/CloudSigmaComputeServiceAdapter.java (247)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/CloudSigmaTemplateBuilderImpl.java (46)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/config/CloudSigmaComputeServiceContextModule.java (125)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/ParseOsFamilyVersion64BitFromImageName.java (85)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/PreinstalledDiskToImage.java (67)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/ServerInfoToNodeMetadata.java (183)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/options/CloudSigmaTemplateOptions.java (291)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/config/CloudSigma2RestClientModule.java (78)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/AccountBalance.java (76)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/AccountUsage.java (225)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/AffinityType.java (49)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/BlockDevice.java (83)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/BurstLevel.java (222)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ClaimType.java (54)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/CreateSubscriptionRequest.java (100)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/CurrentUsage.java (86)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Device.java (105)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DeviceEmulationType.java (43)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Discount.java (73)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Drive.java (175)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveInfo.java (347)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveLicense.java (101)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveMetrics.java (136)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveStatus.java (45)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DriveType.java (45)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DrivesListRequestFieldsGroup.java (51)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallAction.java (43)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallDirection.java (43)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallIpProtocol.java (43)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallPolicy.java (211)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallRule.java (237)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IDEDevice.java (95)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IOStats.java (111)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IP.java (247)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IPConfiguration.java (94)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IPConfigurationType.java (43)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/IPInfo.java (246)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/InterfaceType.java (43)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Item.java (171)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/LibraryDrive.java (363)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/License.java (164)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/MediaType.java (47)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Model.java (44)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/NIC.java (215)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/NICStats.java (109)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Owner.java (161)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Price.java (216)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Pricing.java (105)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ProfileInfo.java (809)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ProfileType.java (44)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/SCSIDevice.java (91)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Server.java (173)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerAvailabilityGroup.java (52)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerDrive.java (162)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerInfo.java (420)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerMetrics.java (153)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerRuntime.java (89)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerStatus.java (44)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Subscription.java (448)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/SubscriptionResource.java (42)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Tag.java (157)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/TagResource.java (148)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/TagResourceType.java (43)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Transaction.java (187)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/Usage.java (103)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/VLANInfo.java (243)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/VNC.java (102)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/CreateSubscriptionRequestToJson.java (53)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/DriveInfoToJson.java (42)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/DriveToJson.java (62)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/FirewallPolicyToJson.java (91)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/IPInfoToJson.java (46)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/JsonToAccountBalance.java (38)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/JsonToCurrentUsage.java (123)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/JsonToDiscount.java (39)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/JsonToDrive.java (64)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/JsonToDriveInfo.java (133)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/JsonToFirewallPolicy.java (133)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/JsonToIPInfo.java (99)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/JsonToLibraryDrive.java (85)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/JsonToLicense.java (65)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/JsonToOwner.java (53)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/JsonToPricing.java (145)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/JsonToProfileInfo.java (238)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/JsonToServer.java (96)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/JsonToServerInfo.java (200)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/JsonToSubscription.java (126)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/JsonToTag.java (118)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/JsonToTransaction.java (70)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/JsonToVLANInfo.java (109)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/LibraryDriveToJson.java (56)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseAccountBalance.java (49)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseAvailabilityGroup.java (52)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseAvailabilityGroupList.java (54)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseCurrentUsage.java (49)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseDiscountsList.java (62)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseDriveInfo.java (54)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseDrivesInfoList.java (66)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseDrivesList.java (62)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseFirewallPoliciesList.java (64)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseFirewallPolicy.java (64)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseIPInfo.java (49)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseIPInfoList.java (61)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseLibraryDrive.java (47)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseLibraryDrivesList.java (65)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseLicenseList.java (60)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParsePricing.java (49)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseProfileInfo.java (49)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseServerInfo.java (63)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseServerInfoList.java (65)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseServerList.java (65)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseSubscription.java (63)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseSubscriptionsList.java (61)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseTag.java (65)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseTagList.java (61)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseTransactionList.java (61)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseVLANInfo.java (49)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseVLANInfoList.java (61)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ProfileInfoToJson.java (85)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ServerInfoToJson.java (146)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/TagToJson.java (55)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/VLANInfoToJson.java (46)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/handlers/CloudSigmaErrorHandler.java (105)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/predicates/DriveClaimed.java (64)
    A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/reference/CloudSigmaConstants.java (30)
    A cloudsigma2/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata (1)

-- Patch Links --

https://github.com/jclouds/jclouds-labs/pull/12.patch
https://github.com/jclouds/jclouds-labs/pull/12.diff


Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #207](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/207/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21244986

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #366](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/366/) FAILURE
Looks like there's a problem with this pull request
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-23623594

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Viktor Petersson <no...@github.com>.
@nacx 

> Does this PR mean that the existing CloudSigma api should be deprecated/removed?

Yes, please keep that around for now. We still have customers using it. Both versions are live simultaneously, but we'll deprecate it in a foreseeable future. 

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-22054015

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Vladimir Shevchenko <no...@github.com>.
@nacx , how properly to create auth request & auth response for requestsSendResponses method? I'm always getting the error that response is not configured:
```
org.jclouds.http.HttpResponseException: command: GET https://zrh.cloudsigma.com/api/2.0/drives/ HTTP/1.1 failed with response: HTTP/1.1 500 no response configured for request; content: [
the following request is not configured:
----------------------------------------
GET https://zrh.cloudsigma.com/api/2.0/drives/ HTTP/1.1
Accept: application/json
Authorization: Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==
----------------------------------------
configured requests:
----------------------------------------
POST https://zrh.cloudsigma.com/v1.1/auth HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 68
{"credentials":{"username":"user@jclouds.org","key":"Password1234"}}----------------------------------------
GET https://zrh.cloudsigma.com/api/2.0/drives/ HTTP/1.1
Accept: application/json
X-Auth-Token: 118fb907-0786-4799-88f0-9a5b7963d1ab
]
```

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21406536

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Vladimir Shevchenko <no...@github.com>.
@nacx Also, how to parse Enum objects? Thanks

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21917778

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Vladimir Shevchenko <no...@github.com>.
@nacx so I should use code like this ```Drive drive = new Gson().fromJson(json, Drive.class);``` in Parse*.class, am I right?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21655192

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
Thanks for the contribution @vpetersson !

It would be really nice to have this merged. There are a few generic things, though, that need to be addressed, to be aligned with the latest refactors done in jclouds 1.7.0-SNAPSHOT, regarding the removal of the asynchronous interfaces:

* We no longer have the asynchronous interface, so the `CloudSigma2AsyncClient` should be removed and all the annotations moved to the corresponding methods of the `CloudSigma2Client` class.
* The convention is that api classes should be named like: `CloudSigma2Api`, so `CloudSigma2Client` should be renamed accordingly.
* The `CloudSigma2ApiMetadata` should extend from [BaseHttpApiMetadata](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/rest/internal/BaseHttpApiMetadata.java), and its deprecated fields (the context token) should be removed as it is not used in 1.7.
* The `CloudSigma2RestClientModule` should be renamed to `CloudSigma2HttpApiModule` and should extend from the [HttpApiModule](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/rest/config/HttpApiModule.java). Its annotation should be replaced by `@ConfiguresHttpApi`.


Also, there are no tests in this API, and they should be added. We have two types of tests:

* Expect tests: Unit tests that use mocks to verify that the API properly generates the requests and properly parses the responses.
* Live tests: Integration tests that perform the real API calls to verify that the API works as expected.

Both tests should be added for each method in the API since we rely a lot on them to be confident that everything is working. You can take a look at the projects (for example) in the [jclouds-labs-openstack](https://github.com/jclouds/jclouds-labs-openstack) repo (openstack-trove could be a good example).

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-20735022

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #20](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/20/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21245072

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Vladimir Shevchenko <no...@github.com>.
@nacx 
> You managed to remove the custom response parsers (cool!), and I've seen that there are also many custom binders, used to map the domain objects to the request body. Since the domain objects are now following teh json structure and are properly annotated, would it be possible to use the existing BindToJsonPayload instead of the custom ones?

We bind not all objects' parameters, just only mutable , e.g. we don't changed owner & resource_uri, is there better way to do that?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-22067085

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ilya Kulakov <no...@github.com>.
> +
> +               @Override
> +               public boolean apply(Image input) {
> +                  String toParse = input.getUserMetadata().get("size");
> +                  return toParse != null && new Float(toParse) <= size;
> +               }
> +
> +               @Override
> +               public String toString() {
> +                  return "sizeLessThanOrEqual(" + size + ")";
> +               }
> +
> +            }).ids(id).ram(ram).processors(ImmutableList.of(new Processor(1, cpu))).hypervisor("kvm")
> +                  .volumes(ImmutableList.<Volume>of(new VolumeImpl(size, true, true))).build());
> +         }
> +      return hardware.build();

Ok, we'll review it once we finish other required issues.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5289905

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #16](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/16/) FAILURE
Looks like there's a problem with this pull request

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21193621

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ilya Kulakov <no...@github.com>.
@nacx @demobox Sometimes the answer from the API cannot be parsed directly. E.g. it may contain an array with only one object instead of the object itself.

Concrete example:

    {
        "objects": [
            {
                "affinities": [
                    "ssd",
                    "sample"
                ],
                "allow_multimount": true,
                "jobs": [],
                "licenses": [],
                "media": "disk",
                "meta": {},
                "mounted_on": [
                ],
                "name": "test_drive_y",
                "owner": {
                    "resource_uri": "/api/2.0/user/5b4a69a3-8e78-4c45-a8ba-8b13f0895e23/",
                    "uuid": "5b4a69a3-8e78-4c45-a8ba-8b13f0895e23"
                },
                "resource_uri": "/api/2.0/drives/e96f3c63-6f50-47eb-9401-a56c5ccf6b32/",
                "size": 1024000000,
                "status": "unmounted",
                "tags": [],
                "uuid": "e96f3c63-6f50-47eb-9401-a56c5ccf6b32"
            }
        ]
    }

Right now we parse it using [custom class](https://github.com/GreatFruitOmsk/jclouds-labs/blob/cloudsigma2-api/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/ParseDriveInfo.java). How would we parse it with Gson?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21916322

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #267](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/267/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-22237418

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Andrew Phillips <no...@github.com>.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +package org.jclouds.cloudsigma2;
> +
> +import java.net.URI;
> +import java.util.Properties;
> +
> +import org.jclouds.providers.ProviderMetadata;
> +import org.jclouds.providers.internal.BaseProviderMetadata;
> +
> +/**
> + * Implementation of {@link org.jclouds.types.ProviderMetadata} for CloudSigma Las Vegas.
> +
> + * 
> + * @author Adrian Cole

Wrong author.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5112010

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ilya Kulakov <no...@github.com>.
@nacx It's a server-side bug. Full resource should be returned by API. Devs are aware of this issue.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24262478

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ilya Kulakov <no...@github.com>.
@nacx Done.

Note if tag tests will fail for you, this is probably due to bugs in previous implementation when tags were created but not deleted. You may need to delete those tags manually before starting live tests.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24182697

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ilya Kulakov <no...@github.com>.
@nacx You can find unsquashed version at https://github.com/GreatFruitOmsk/jclouds-labs/commits/cloudsigma2-api

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24069939

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Viktor Petersson <no...@github.com>.
@nacx I've opened a JIRA issue [here](https://issues.apache.org/jira/browse/JCLOUDS-236).

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-22237626

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #204](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/204/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21201411

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
@Kentzo I think my last comment was not addressed. The Live test classes for the LVS and ZRH providers are in a folder named `org.jclouds.cloudsigma2` instead of being in a nested directory structure such as `org/jclouds/cloudsigma2`. This means that the package name for those classes does not match the directory structure. Could you kindly fix that?

And just a tip :) When addressing review comments it would be nice if you could just add the new commits instead of squashing them. This helps a lot in focusing in just the revision changes (otherwise we have to find them in 148 changed files and 15,253 additions, which is quite hard :D). Once all comments are addressed and the PR is ok, then we can squash them all before merging.

Thanks!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24053807

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> +import javax.inject.Named;
> +import javax.inject.Provider;
> +import java.util.Set;
> +
> +/**
> + * @author Andrei Savu
> + */
> +public class CloudSigmaTemplateBuilderImpl extends TemplateBuilderImpl {
> +   @Inject
> +   public CloudSigmaTemplateBuilderImpl(@Memoized Supplier<Set<? extends Location>> locations,
> +                                        @Memoized Supplier<Set<? extends Image>> images, @Memoized Supplier<Set<? extends Hardware>> hardwares,
> +                                        Supplier<Location> defaultLocation2, @Named("DEFAULT") Provider<TemplateOptions> optionsProvider,
> +                                        @Named("DEFAULT") Provider<TemplateBuilder> defaultTemplateProvider) {
> +      super(locations, images, hardwares, defaultLocation2, optionsProvider, defaultTemplateProvider);
> +   }
> +}

Correct me if I am wrong, but I've not seen an integration with the `ComputeService` (there is no guice module that configures a specific CloudSigma2 compute service implementation). Could we then remove the `compute` package, and add it again later, if a compute service implementation is added?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r6054033

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
@shevchenator What is the difference between the `subscriptions` and the `groupedsubscriptions` resource? I mean, when would a user be interested in calling the second one? (perhaps we could just remove it).

A first approach that comes to my mind is to do something similar to what we do in jclouds-chef. The Chef API only returns the name and URI of the resources when requesting a list, and it is up to the user to fetch the entire details. For example, when [listing Clients](https://github.com/jclouds/jclouds-chef/blob/master/core/src/main/java/org/jclouds/chef/ChefApi.java#L282-L295) we are returning only the names, and have a [strategy](https://github.com/jclouds/jclouds-chef/blob/master/core/src/main/java/org/jclouds/chef/strategy/internal/ListClientsImpl.java) accessible from the [ChefService](https://github.com/jclouds/jclouds-chef/blob/master/core/src/main/java/org/jclouds/chef/ChefService.java#L158) that can be used to concurrently fetch the details of each Client. It is up to the user to get only the list of names or the entire details.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-22475069

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Andrew Phillips <no...@github.com>.
Closed #12.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> +
> +               @Override
> +               public boolean apply(Image input) {
> +                  String toParse = input.getUserMetadata().get("size");
> +                  return toParse != null && new Float(toParse) <= size;
> +               }
> +
> +               @Override
> +               public String toString() {
> +                  return "sizeLessThanOrEqual(" + size + ")";
> +               }
> +
> +            }).ids(id).ram(ram).processors(ImmutableList.of(new Processor(1, cpu))).hypervisor("kvm")
> +                  .volumes(ImmutableList.<Volume>of(new VolumeImpl(size, true, true))).build());
> +         }
> +      return hardware.build();

Since the list of hardware profiles is fixed, you could refactor it and extract to an enum, a class, or something like that. This will help users force a hardware profile using the `TemplateBuilder.fromHardware`. You can take a look at the EC2 hardware profiles to see what I mean.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5278486

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Andrew Phillips <no...@github.com>.
> demobox closed the pull request just now

Sorry, wrong button ;-) Please ignore!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21626477

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Andrew Phillips <no...@github.com>.
> if jclouds only had careful tutorial or overview of builtin features :)

Valid point, indeed. My approach at present is to find a "similar" API (e.g. EC2 if it's XML, OpenStack if it uses optional components etc.), study the config and API/clients for those, and use that as a "template".

Plus the mailing lists and IRC, obviously ;-)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21682914

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Vladimir Shevchenko <no...@github.com>.
@nacx we are looking through to implement the pagination in cloudsigma. Can you explain what is the purpose and usage of [ToPagedIterable](https://github.com/jclouds/jclouds-labs-openstack/blob/master/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/functions/internal/ParseImages.java#L65-L93).
For listings cloudsigma always returns message like this
```
{
    "meta": {
        "limit": 20,
        "offset": 0,
        "total_count": 32
    },
    "objects": [<listing_objects>]
}
```
and it shows 20 items in ```objects``` property. How can we get next page for getting the rest of objects.

Thanks

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-22916892

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ilya Kulakov <no...@github.com>.
> +  <!-- TODO: when out of labs, switch to org.jclouds.provider -->
> +  <groupId>org.apache.jclouds.labs</groupId>
> +  <artifactId>cloudsigma2-lvs</artifactId>
> +  <version>1.7.0-SNAPSHOT</version>
> +  <name>jclouds CloudSigma 2 provider</name>
> +  <description>ComputeService binding to the CloudSigma datacenter in SuperNAP Las Vegas</description>
> +  <packaging>bundle</packaging>
> +
> +  <properties>
> +    <test.cloudsigma2-lvs.endpoint>https://lvs.cloudsigma.com/api/2.0/</test.cloudsigma2-lvs.endpoint>
> +    <test.cloudsigma2-lvs.api-version>1.0</test.cloudsigma2-lvs.api-version>
> +    <test.cloudsigma2-lvs.build-version />
> +    <test.cloudsigma2-lvs.identity>FIXME</test.cloudsigma2-lvs.identity>
> +    <test.cloudsigma2-lvs.credential>FIXME</test.cloudsigma2-lvs.credential>
> +    <test.cloudsigma2-lvs.template />
> +    <jclouds.osgi.export>org.jclouds.cloudsigma*;version="${project.version}"</jclouds.osgi.export>

Do you mean 'org.jclouds.cloudsigma*' -> 'org.jclouds.cloudsigma2*' ?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5286914

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
You can do what @demobox suggested or, if all dates returned by the CloudSigma API have the same iso8601 format, you can bind to the context a DateAdapter that parses dates taking that format into account. Jclouds already comes with a [Iso8601DateAdapter](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/json/config/GsonModule.java#L216-L239) to parse dates, so if you want to parse dates like this by default, you can then avoid writing a parser and just configure it in a Guice module. Something like:

```java
public class CloudSigmaParserModule extends AbstractModule {
   @Override
   protected void configure() {
      bind(DateAdapter.class).to(Iso8601DateAdapter.class);
   }
}
```

Then, add that module to the default modules in the CloudSigma ApiMetadata class, and you are done. jclouds-chef parses dates like this by default. You can take a look at the [ChefParserModule](https://github.com/jclouds/jclouds-chef/blob/master/core/src/main/java/org/jclouds/chef/config/ChefParserModule.java) (at the end) and to the [ChefApiMetadata](https://github.com/jclouds/jclouds-chef/blob/master/core/src/main/java/org/jclouds/chef/ChefApiMetadata.java) to see an example.

Either the approach suggested by @demobox and this one are good ways to handle that. It depends on your needs and how your API works!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21677597

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
Once this final bits have been addressed, make sure the following works:

* Run the live tests twice from the `cloudsigma2` directory, providing the endpoint, identity and credential parameters.
* Run the live tests twice from the `cloudsigma2-lvs` directory, providing the identity and credential parameters, but do not specify the endpoint.
* Run the live tests twice from the `cloudsigma2-zrh` directory, providing the identity and credential parameters, but do not specify the endpoint.

This should be enough to make sure the pull request is working and the provider metadata is properly configured. Once that works I'll merge this PR.

Thanks!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24077450

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Vladimir Shevchenko <no...@github.com>.
> +/**
> + * @author Vladimir Shevchenko
> + */
> +@Singleton
> +public class BindCreateSubscriptionRequestList implements Binder {
> +
> +    private final Function<CreateSubscriptionRequest, JsonObject> subscriptionRequestJsonObjectFunction;
> +
> +    @Inject
> +    public BindCreateSubscriptionRequestList(Function<CreateSubscriptionRequest, JsonObject> subscriptionRequestJsonObjectFunction) {
> +        this.subscriptionRequestJsonObjectFunction = subscriptionRequestJsonObjectFunction;
> +    }
> +
> +    @Override
> +    public <R extends HttpRequest> R bindToRequest(R request, Object input) {
> +        Iterable<CreateSubscriptionRequest> createSubscriptionRequests = (Iterable<CreateSubscriptionRequest>) input;

@nacx how properly to check instance of List<CreateSubscriptionRequest> without checking every element with cycle?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5287245

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Viktor Petersson <no...@github.com>.
@nacx we're looking into it, but I'm not sure how important this feature is.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-23368818

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> +         command.setException(exception);
> +      }
> +   }
> +
> +   public String parseMessage(HttpResponse response) {
> +      if (response.getPayload() == null)
> +         return null;
> +      try {
> +         return Strings2.toString(response.getPayload());
> +      } catch (IOException e) {
> +         throw new RuntimeException(e);
> +      } finally {
> +         try {
> +            response.getPayload().getInput().close();
> +         } catch (IOException e) {
> +            Throwables.propagate(e);

This will silently ignore the exception. Should be `throw Throwables.propagate(e);`.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5278961

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
The GET one is the request that is being generated when you invoke the method on the mocked API. That request is generated based on the annotations of that method.
Your mocked v, though, only has one request configured (the POST one), and since the mock has no mapping for the request that is actually been generated, it fails.

This error either means:

* The method in the API does not have the proper annotations and the requests are not being properly generated (which I doubt since you already have the live tests).
* You are creating the mocked API (using the `requestSendsResponses` method) but you are not configuring it with the request you expect when calling that API method.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21406779

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> + * limitations under the License.
> + */
> +package org.jclouds.cloudsigma2.reference;
> +
> +/**
> + *
> + * @author Adrian Cole
> + */
> +public class CloudSigmaConstants {
> +
> +    /**
> +     * default VNC password used on new machines
> +     */
> +    public static final String PROPERTY_VNC_PASSWORD = "jclouds.cloudsigma.vnc-password";
> +    
> +}

Could you move this class to the `config` package and rename it to `CloudSigma2Properties`? This is the convention (although all providers don't follow it yet).

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r6053979

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #385](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/385/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24070693

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #202](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/202/) FAILURE
Looks like there's a problem with this pull request
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21193442

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Andrew Phillips <no...@github.com>.
Reopened #12.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
Sure @Kentzo. As Zack says, Trove does not use mockwebserver; it uses the jclouds mock. If you take a look at the [DatabaseApiExpectTest](https://github.com/jclouds/jclouds-labs-openstack/blob/master/openstack-trove/src/test/java/org/jclouds/openstack/trove/v1/features/DatabaseApiExpectTest.java) class, for example,you'll see that the api to test is generated by calling the `requestsSendResponses` method. That method returns a mocked API that just returns the configured responses when the configured requests are made (otherwise ti fails).

The basic idea behind expect tests is to create a mock for each test/request to be tested, and then invoke the API method. If the request is properly generated, the mock will find and return the configured response for it. Then the test can assert the returned result. The first part, the request matching, is performed by the mock and helps us verify that the generated request is the expected one. The second part, manually checking the returned value, tests that the deserialization and response parsing is also working.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21373735

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ilya Kulakov <no...@github.com>.
@nacx Could review the project?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21617998

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Andrew Phillips <no...@github.com>.
I'm guessing it would be better to request a [`Json`](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/json/Json.java) object to be injected and then call that.

Jclouds isn't big on instantiating helper objects like `Gson` directly in your code - they're usually provided by the context.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21660216

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #19](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/19/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21216961

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> +
> +               @Override
> +               public boolean apply(Image input) {
> +                  String toParse = input.getUserMetadata().get("size");
> +                  return toParse != null && new Float(toParse) <= size;
> +               }
> +
> +               @Override
> +               public String toString() {
> +                  return "sizeLessThanOrEqual(" + size + ")";
> +               }
> +
> +            }).ids(id).ram(ram).processors(ImmutableList.of(new Processor(1, cpu))).hypervisor("kvm")
> +                  .volumes(ImmutableList.<Volume>of(new VolumeImpl(size, true, true))).build());
> +         }
> +      return hardware.build();

Sure. For example, hardware profiles are defined in the [EC2HardwareBuilder](https://github.com/jclouds/jclouds/blob/master/apis/ec2/src/main/java/org/jclouds/ec2/compute/domain/EC2HardwareBuilder.java), and then the [EC2HardwareSupplier](https://github.com/jclouds/jclouds/blob/master/apis/ec2/src/main/java/org/jclouds/ec2/compute/suppliers/EC2HardwareSupplier.java) is bound to the context and injected to the computeservice, so it can be used to list the existing hardware profiles.

This provides users a clean way to select a hardware profile. Something like:

```java
Template template = compute.templateBuilder()
    .fromHardware(EC2HardwareBuilder.t1_micro().build())
    .build();
```

It was just a suggestion, though. Having an object for each existing hardware profile (if they are fixed) is a good idea and can help.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5289204

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #245](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/245/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21991662

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> +                     logger.warn(e, "error finding drive %s: %s", input, e.getMessage());
> +                  }
> +                  return Futures.immediateFuture(null);
> +               }
> +
> +               @Override
> +               public String toString() {
> +                  return "seedDriveCache()";
> +               }
> +            }, userExecutor, null, logger, "drives")).filter(PREINSTALLED_DISK);
> +   }
> +
> +   @SuppressWarnings("unchecked")
> +   @Override
> +   public Iterable<ServerInfo> listNodes() {
> +      return (Iterable<ServerInfo>) client.listServersInfo();

Unnecessary cast (and warning suppression)? The method already returns a List, which is Iterable.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5278539

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
There was a [thread in the mailing list](http://markmail.org/thread/i46uasmenb5b53bm) to discuss the release cadence, but if I'm not wrong, there is no fixed date for 1.7. You can send a message to the mailing list and bring back the discussion again.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24734602

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Vladimir Shevchenko <no...@github.com>.
@demobox It depends on path we requesting, one request is always responded with objects array and others are always responded with strings array in the key. 

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-22364342

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ilya Kulakov <no...@github.com>.
@nacx We've pushed changes you requests. Please review.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21193148

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Andrew Phillips <no...@github.com>.
> +    Unless required by applicable law or agreed to in writing, software
> +    distributed under the License is distributed on an "AS IS" BASIS,
> +    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> +    See the License for the specific language governing permissions and
> +    limitations under the License.
> +
> +-->
> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> +  <modelVersion>4.0.0</modelVersion>
> +  <parent>
> +    <groupId>org.apache.jclouds</groupId>
> +    <artifactId>jclouds-project</artifactId>
> +    <version>1.7.0-SNAPSHOT</version>
> +    <relativePath>../../project/pom.xml</relativePath>
> +  </parent>
> +  <groupId>org.apache.jclouds.api</groupId>

Again, version and group ID as per the above comments

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5112097

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ilya Kulakov <no...@github.com>.
@nacx They are used to parse JSON response directly into some Java object.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21625014

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Andrew Phillips <no...@github.com>.
> +    Unless required by applicable law or agreed to in writing, software
> +    distributed under the License is distributed on an "AS IS" BASIS,
> +    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> +    See the License for the specific language governing permissions and
> +    limitations under the License.
> +
> +-->
> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> +  <modelVersion>4.0.0</modelVersion>
> +  <parent>
> +    <groupId>org.apache.jclouds</groupId>
> +    <artifactId>jclouds-project</artifactId>
> +    <version>1.7.0-SNAPSHOT</version>
> +    <relativePath>../../project/pom.xml</relativePath>
> +  </parent>
> +  <groupId>org.apache.jclouds.provider</groupId>

See comments above about group ID and having a separate `<version>` for this project.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5112045

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
Just commented on the IRC. Live tests classes should be renamed to *LiveTest.java so they are properly picked by the maven surefire plugin and TestNG.

If you rename the classes, then only unit tests will be executed and the build should (hopefully! :)) suceed.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21194668

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #252](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/252/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-22077418

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #177](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/177/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-20733361

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Vladimir Shevchenko <no...@github.com>.
@nacx @demobox Hi again guys! We want to avoid listing paginations & pass 'limit=0' query param. But we don't know how to do that without ```@QueryParam("limit")``` function parameter. The ```@Path()``` always replaces the '?' character with '%3F', so we get 404 error. Is there any way to add this '?limit=0' parameter without adding an additional function parameter?
Thanks 

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-22688806

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> +    <groupId>org.apache.jclouds.labs</groupId>
> +    <artifactId>jclouds-labs</artifactId>
> +    <version>1.7.0-SNAPSHOT</version>
> +  </parent>
> +
> +  <!-- TODO: when out of labs, switch to org.jclouds.provider -->
> +  <groupId>org.apache.jclouds.labs</groupId>
> +  <artifactId>cloudsigma2-lvs</artifactId>
> +  <version>1.7.0-SNAPSHOT</version>
> +  <name>jclouds CloudSigma v2 Provider</name>
> +  <description>ComputeService binding to the CloudSigma datacenter in SuperNAP Las Vegas</description>
> +  <packaging>bundle</packaging>
> +
> +  <properties>
> +    <test.cloudsigma2-lvs.endpoint>https://lvs.cloudsigma.com/api/2.0/</test.cloudsigma2-lvs.endpoint>
> +    <test.cloudsigma2-lvs.api-version>1.0</test.cloudsigma2-lvs.api-version>

Should this be `2.0`?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r6054059

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
I've executed the live tests again, and there are two failures:

    Failed tests:
    testCreateTag(org.jclouds.cloudsigma2.CloudSigma2ApiLiveTest):
    [{"error_point": null, "error_type": "validation", "error_message": "Tag with name \"Cloudsigma2 Test tag\" and owner \"nacx@apache.org\" already exists"}]
    testCreateTags(org.jclouds.cloudsigma2.CloudSigma2ApiLiveTest):
    [{"error_point": null, "error_type": "validation", "error_message": "Tag with name \"Cloudsigma2 New tag\" and owner \"nacx@apache.org\" already exists"}]

It seems that there is something that isn't been cleaned up in the tests?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-23471697

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
Hi @shevchenator,

I'm not sure if skipping the encoding in that annotation can be done. You can take a look at the [RestAnnotationProcessor](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/rest/internal/RestAnnotationProcessor.java) class to see how requests are generated based on the annotations to have an idea of what is going on (and perhaps improve it :)). If not possible and you don't want to add extra parameter to your methods, you can always add a second filter to the API, after the authentication one, and let it add the pagination parameter when required.

Anyway, the good approach to address this would be to take benefit of the jclouds pagination magic.

Once of the things that jclouds providers offer is transparent pagination. This means that even if the APIs return paginated results, jclouds returns "special" iterables that are able to fetch the next pages on demand when iterating. This makes all the pagination thing transparent to the user, and saves bandwith, etc.

If the CloudSigma API uses query parameters to configure which records/page you want to fetch, perhaps it could be good to implement that pagination in the provider. These are the steps to get this done:

* List methods methods provide a way to fetch a single page, and return an [IterableWithMarker](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/collect/IterableWithMarker.java). This iterable provides a method to get the marker to the next page. A simple example about this is the [ImageApi](https://github.com/jclouds/jclouds-labs-openstack/blob/master/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/features/ImageApi.java#L85-L91) in OpenStack Glance. The `ImageOptions` argument has the info (query parameters in your case) required to fetch a single page.
* There should also be a list method without query parameters, to fetch the entire list. This method must return a [PagedIterable](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/collect/PagedIterable.java). This is the "special" iterator that will fetch more pages as soon as they are needed when iterating it. Again, you can see a simple example in the [ImageApi](https://github.com/jclouds/jclouds-labs-openstack/blob/master/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/features/ImageApi.java#L76-L83).
* You will need a response parser function to parse the `HttpResponse` into an `IterableWithMarker`, and another function to generate the `Pagediterable`. Following the Glance ImageApi  example, you can take a look at the [ParseImages](https://github.com/jclouds/jclouds-labs-openstack/blob/master/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/functions/internal/ParseImages.java) class, that cointains the logic of both parsers.

With that, there won't be a need to manually handle pagination, as jclouds will take care of transparently fetching the pages as soon as the `PagedIterable` is iterated.

HTH!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-22689554

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Andrew Phillips <no...@github.com>.
> +    <relativePath>../../project/pom.xml</relativePath>
> +  </parent>
> +  <groupId>org.apache.jclouds.provider</groupId>
> +  <artifactId>cloudsigma2-zrh</artifactId>
> +  <name>jclouds CloudSigma 2 provider</name>
> +  <description>ComputeService binding to the CloudSigma datacenter in Zürich</description>
> +  <packaging>bundle</packaging>
> +
> +  <properties>
> +    <test.cloudsigma2-zrh.endpoint>https://zrh.cloudsigma.com/api/2.0/</test.cloudsigma2-zrh.endpoint>
> +    <test.cloudsigma2-zrh.api-version>2.0</test.cloudsigma2-zrh.api-version>
> +    <test.cloudsigma2-zrh.build-version />
> +    <test.cloudsigma2-zrh.identity>FIXME</test.cloudsigma2-zrh.identity>
> +    <test.cloudsigma2-zrh.credential>FIXME</test.cloudsigma2-zrh.credential>
> +    <test.cloudsigma2-zrh.template />
> +    <jclouds.osgi.export>org.jclouds.cloudsigma2*;version="${project.version}"</jclouds.osgi.export>

@iocanel Does the split package that could happen here (same export as above) cause problems?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5112068

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> +public class CloudSigma2HttpApiModule extends HttpApiModule<CloudSigma2Api> {
> +
> +    @Override
> +    protected void bindErrorHandlers() {
> +        bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(CloudSigmaErrorHandler.class);
> +        bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(CloudSigmaErrorHandler.class);
> +        bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(CloudSigmaErrorHandler.class);
> +    }
> +
> +    @Override
> +    protected void configure() {
> +        super.configure();
> +    }
> +
> +    @Override
> +    protected void bindRetryHandlers() {

Can we remove this method if there is nothing to override?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r6053987

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Andrew Phillips <no...@github.com>.
> one request is always responded with objects array and others are always responded with strings array in the key.

Ah, OK, thanks for clarifying. What should happen in the case where URIs are returned, i.e. what does the domain object look like to which the response should be mapped? Does it contain a collection of `String`s, or do we need the URIs to be fetched or resolved in some way?


---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-22383567

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
Thanks @Kentzo. Using the Raw* classes just for deserialization seems reduntant, and introduces the need for all those transformation functions. Would it be possible just remove them (and the transformation functions too) and let Gson (the default JSON library in jclouds) deserialize directly to the "non-raw" objects?

You can use the `@ConstructorArgs` annotation (see the [Instance](https://github.com/jclouds/jclouds-labs-openstack/blob/master/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/domain/Instance.java) object in openstack-trove for an example) and other Gson annotations to properly configure deserialization (see for example the [Node](https://github.com/jclouds/jclouds-chef/blob/master/core/src/main/java/org/jclouds/chef/domain/Node.java) class in jclouds-chef).

If it is possible to use them, that would pretty much simplify and clean up the provider (less code to maintain and to care about! :))

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21631148

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Andrew Phillips <no...@github.com>.
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +package org.jclouds.cloudsigma2;
> +
> +import java.net.URI;
> +import java.util.Properties;
> +
> +import org.jclouds.providers.ProviderMetadata;
> +import org.jclouds.providers.internal.BaseProviderMetadata;
> +
> +/**
> + * Implementation of {@link org.jclouds.types.ProviderMetadata} for CloudSigma Las Vegas.
> +

Remove extra line?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5112005

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Viktor Petersson <no...@github.com>.
Good news. Thank you, @nacx. 
Will this be included in the next build then?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24719839

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Viktor Petersson <no...@github.com>.
Excellent. Thanks @nacx. What's the ETA for 1.7? We'll do a press-push once it's out, so i'd like to prepare a bit.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24721683

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Viktor Petersson <no...@github.com>.
Thanks @nacx. We'll have someone look at it. 

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-20741539

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
Yes, jclouds 1.7 will include this.

I'll open a couple issues in JIRA, to complete the work:

* Implement the pagination with the PagedIterable and remote the `limit=0` from the api definition.
* Add the ComputeService integration. This should be only adapting all the ComputeService stuff that already exists in the v1 to the new API calls. Don't know how much effort would be required.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24719996

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #29](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/29/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21991712

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Andrew Phillips <no...@github.com>.
> The idea is that if the API method returns a Drive object, you don't even need that parser. That is what jclouds will 
> do by default.

Thanks for clarifying, @nacx !

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21665661

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> +      private final LoadingCache<String, DriveInfo> cache;
> +
> +      @Inject
> +      public DeviceToVolume(LoadingCache<String, DriveInfo> cache) {
> +         this.cache = checkNotNull(cache, "cache");
> +      }
> +
> +      @Override
> +      public Volume apply(Device input) {
> +         VolumeBuilder builder = new VolumeBuilder();
> +         builder.id(input.getId());
> +         try {
> +            DriveInfo drive = cache.getUnchecked(input.getDriveUuid());
> +            builder.size(drive.getSize().floatValue());
> +         } catch (NullPointerException e) {
> +            logger.debug("drive %s not found", input.getDriveUuid());

Is there a better way to handle drive absence than catching a NPE?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5278649

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> +      @Override
> +      public String apply(Server from) {
> +         String imageId = null;
> +//         String bootDeviceId = Iterables.get(from.getBootDeviceIds(), 0);
> +//         Device bootDevice = from.getDevices().get(bootDeviceId);
> +//         if (bootDevice != null) {
> +//            try {
> +//               DriveInfo drive = cache.getUnchecked(bootDevice.getDriveUuid());
> +//               imageId = drive.getName();
> +//            } catch (NullPointerException e) {
> +//               logger.debug("drive %s not found", bootDevice.getDriveUuid());
> +//            } catch (UncheckedExecutionException e) {
> +//               logger.warn(e, "error finding drive %s: %s", bootDevice.getDriveUuid(), e.getMessage());
> +//            }
> +//         }
> +         return imageId;

Always return `null`?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5278671

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> +        bind(new TypeLiteral<Function<ServerInfo, JsonObject>>() {
> +        }).to(ServerInfoToJson.class);
> +        bind(new TypeLiteral<Function<Tag, JsonObject>>() {
> +        }).to(TagToJson.class);
> +        bind(new TypeLiteral<Function<ProfileInfo, JsonObject>>() {
> +        }).to(ProfileInfoToJson.class);
> +        bind(new TypeLiteral<Function<LibraryDrive, JsonObject>>() {
> +        }).to(LibraryDriveToJson.class);
> +        bind(new TypeLiteral<Function<FirewallPolicy, JsonObject>>() {
> +        }).to(FirewallPolicyToJson.class);
> +        bind(new TypeLiteral<Function<IPInfo, JsonObject>>() {
> +        }).to(IPInfoToJson.class);
> +        bind(new TypeLiteral<Function<VLANInfo, JsonObject>>() {
> +        }).to(VLANInfoToJson.class);
> +        bind(new TypeLiteral<Function<CreateSubscriptionRequest, JsonObject>>() {
> +        }).to(CreateSubscriptionRequestToJson.class);

Are this explicit bindings needed? If there is only one implementation of each function of each type I think you could just remove this bindings.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5278744

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ilya Kulakov <no...@github.com>.
@nacx Could you point me to specific implementation of expect tests in openstack-trove? I've found tests that make requests, but don't see the mockserver that actually checks them.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21363474

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Andrew Phillips <no...@github.com>.
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +package org.jclouds.cloudsigma2;
> +
> +import org.jclouds.providers.ProviderMetadata;
> +import org.jclouds.providers.internal.BaseProviderMetadata;
> +
> +import java.net.URI;
> +import java.util.Properties;
> +
> +/**
> + * Implementation of {@link org.jclouds.types.ProviderMetadata} for CloudSigma Zurich.
> +

Remove this line?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5112072

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
Just for the record, I've opened the issues for the remaining features. Ping me if you want me to add you as a collaborator in JIRA and get them assigned to you!
https://issues.apache.org/jira/browse/JCLOUDS-291
https://issues.apache.org/jira/browse/JCLOUDS-292

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24734983

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Vladimir Shevchenko <no...@github.com>.
@nacx what if want to parse date from iso8601 string? should I write parser class or there are any easier solutions?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21675146

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #54](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/54/) FAILURE
Looks like there's a problem with this pull request

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-23623612

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> +        http://www.apache.org/licenses/LICENSE-2.0
> +
> +    Unless required by applicable law or agreed to in writing, software
> +    distributed under the License is distributed on an "AS IS" BASIS,
> +    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> +    See the License for the specific language governing permissions and
> +    limitations under the License.
> +
> +-->
> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> +  <modelVersion>4.0.0</modelVersion>
> +  <parent>
> +    <groupId>org.apache.jclouds</groupId>
> +    <artifactId>jclouds-project</artifactId>
> +    <version>1.7.0-SNAPSHOT</version>
> +    <relativePath>../../project/pom.xml</relativePath>

Here you assume that the jclouds main repo is also cloned, and this could not be always the case. Could you change all parents so they are aligned with the pom.xml in the other projects in jclouds-labs?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5277710

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> +import org.jclouds.cloudsigma2.reference.CloudSigmaConstants;
> +import org.jclouds.compute.ComputeServiceContext;
> +import org.jclouds.rest.internal.BaseHttpApiMetadata;
> +
> +import java.net.URI;
> +import java.util.Properties;
> +
> +import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
> +import static org.jclouds.reflect.Reflection2.typeToken;
> +
> +/**
> + * Implementation of {@link BaseHttpApiMetadata} for the Cloud Sigma API
> + * 
> + * @author Vladimir Shevchenko
> + */
> +public class CloudSigma2ApiMetadata extends BaseHttpApiMetadata {

Change to `extends BaseHttpApiMetadata<CloudSigma2Api>` to properly type the metadata.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r6053961

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
@Kentzo I've checked out the branch, executed all tests and live tests and all passed. Thanks!

As soon as you address the final (which are trivial) comments I'll merge this PR.

One final comment: It would be helpful if you could add to the `cloudsigma2-lvs` and `cloudsigma2-zrh` a live test class that extends the live test class from the base `cloudsigma2` project (just an empty class if no extra tests are needed will work). This way people will be able to run the live tests for a specific location, without having to write the endpoint or taking care of which is the appropriate template for that location.

Thanks for all the great work you've done!


---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-23471505

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #25](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/25/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21615562

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
Right. Removing the Raw* classes and the functions that transform from Raw to non-raw should be the first step. 

Once that is done, you can configure the domain classes so they have the same structure than the expected Json. Looking at the `drives-single.json` used in expect tests, I think (for example), the Drives class could have something like:

```java
public class Drives {
    private List<String> affinities;
    @SerializedName("allow_multimount")
    private boolean allowMultimount;
    private List<License> licenses;
    private Map<String, String> meta;
    ...
}
```

Gson will deserialize the returned JSON into that class. The `@SelectJson` annotation should be used if you want to deserialize a specific JSON field instead of starting from the root element (don't know if it is the case).

That is the idea. If you design your classes in a way that match the expected JSON, then you don't need to add custom response parsers. But that is up to you. Sometimes you may choose to have a more convenient domain object model and use some response parsers. Anyway, those Raw* classes seem to be duplicates of the non-raw ones, and if they could be removed (and the corresponding functions), that would be nice!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21652477

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ilya Kulakov <no...@github.com>.
@nacx We've used the approach you suggested. Please review.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-23397352

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
Sure,

For each method that returns paginated results, you will need two methods in the api: one without parameters that returns the entire list, and the other one, with the pagination parameters, that is able to return a single page. In jclouds:

* The first one, returning a single page, must return an `IterableWithMarker<T>`, which is just an Iterable with a marker that points to the next page.
* The second one, the entire list, must return a `PagedIterable<T>`, which is an Iterable that has a single page (an `IterableWithMarker<T>`) and knows how to get the next page given the next page marker.

Having this in mind, you need to figure out two things:

* How to build the `IterableWithMarker<T>` so it contains a marker with all the info required to fetch the next page.
* How to build the `PagedIterable<T>` to automatically fetch pages given a marker.

Building the first one should be pretty straightforward. You just need to create a class that extends the `IterableWithMarker<T>` abstract class and make sure the returned marker has all the info to fetch the next page. In your example, the "meta" fields could serve this purpose. Once you have your implementation, you just need to create a ResponseParser that builds your class given an HttpResponse. That's what the [ParseImages](https://github.com/jclouds/jclouds-labs-openstack/blob/master/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/functions/internal/ParseImages.java#L50) class in Glance does.

Next thing you have to do, is build a `PagedIterable<T>` given an `IterableWithMarker<T>`. Since the APIs always return a single page, in the end, the HttpResponses for the "listAll" and "listSinglePage" methods will be the same. That's why most "listAll" methods use the same response parser than above, and then use a transformation function to transform the resulting `IterableWithMarker<T>` into a `PagedIterable<T>` (see the [ImageApi annotations](https://github.com/jclouds/jclouds-labs-openstack/blob/master/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/features/ImageApi.java#L80-L81)).

So, that `ToPagedIterable` is just a function that transforms an `IterableWithMarker<T>` into a `PagedIterable<T>`. This can be done in many ways, depending on the API. This functions usually build the iterable using the helper methods in the [PagedIterables](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/collect/PagedIterables.java) class, such as the [advance](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/collect/PagedIterables.java#L69-L76) one. If you take a look at that method you'll see that the PagedIterable is build given an `IterableWithMarker<T>` and an advancing function. That advancing function transforms an `Object` to an `IterablewithMarker<T>` where the Object is the current marker to the next page, and the result should be the next page. That advancing function will only be invoked if the marker to the next page is present.

So, in the end, you just need to create a function to transform an `IterableWithMarker<T>` into a `Pagediterable<T>`. How you build it is up to you. Here are a few examples you can take a look at, to get the whole idea:

* In Abiquo, for example, each page returns a link to the next one, so there is a [generic function](https://github.com/nacx/jclouds-labs/blob/198-pagination/abiquo/src/main/java/org/jclouds/abiquo/domain/PaginatedCollection.java#L91-L124) that simply performs a GET call to fetch the next page, given the marker (the link).
* In Glance, there is the [ParseImages#ToPagedIterable](https://github.com/jclouds/jclouds-labs-openstack/blob/master/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/functions/internal/ParseImages.java#L65-L91) that extends an existing helper class to build a new API call. The class it extends populates the caller arguments to the function, but this might not be the best example in your case and could bring confusion.
* There is a helper class that you could also use (and perhaps this is what I'd recommend if there is no generic way to do pagination for all API calls). You could create a function that extends the existing [ArgsToPagedIterable](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/collect/internal/ArgsToPagedIterable.java#L60). That class already has the common logic and you only have to implement its abstract method. That method must return a function that returns the next page given an `IterableWithMarker<T>`, but also receives as a parameter the list of arguments (the arguments of the invoked java method) used in the previous API call, which can be useful to build the call to the next page. You can take the [ParseImages#ToPagedIterable](https://github.com/jclouds/jclouds-labs-openstack/blob/master/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/functions/internal/ParseImages.java#L65-L91) as an example to get the idea, but apply t
 hat to t
 he [ArgsToPagedIterable](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/collect/internal/ArgsToPagedIterable.java) class.

Hope this helps!

P.S. If you join the #jclouds IRC channel in Freenode you might get better help :)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-22927296

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> + * the License.  You may obtain a copy of the License at
> + *
> + *     http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +package org.jclouds.cloudsigma2;
> +
> +import org.jclouds.Fallbacks;
> +import org.jclouds.cloudsigma2.binders.*;
> +import org.jclouds.cloudsigma2.domain.*;
> +import org.jclouds.cloudsigma2.functions.*;

In general, we avoid using wildcards in imports (if you take a look at the checkstyle output in CloudBees you'll see it complains). Could you add the concrete imports?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5277974

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Andrew Phillips <no...@github.com>.
> +    Unless required by applicable law or agreed to in writing, software
> +    distributed under the License is distributed on an "AS IS" BASIS,
> +    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> +    See the License for the specific language governing permissions and
> +    limitations under the License.
> +
> +-->
> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> +  <modelVersion>4.0.0</modelVersion>
> +  <parent>
> +    <groupId>org.apache.jclouds</groupId>
> +    <artifactId>jclouds-project</artifactId>
> +    <version>1.7.0-SNAPSHOT</version>
> +    <relativePath>../../project/pom.xml</relativePath>
> +  </parent>
> +  <groupId>org.apache.jclouds.provider</groupId>

If this is for the labs repo, this should be:
```
<!-- TODO: when out of labs, switch to org.jclouds.provider -->
<groupId>org.apache.jclouds.labs</groupId>
```

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5111926

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> +     * @return list of drives or empty list if no drives are found
> +     */
> +    @GET
> +    @Path("/drives/")
> +    @ResponseParser(ParseDrivesList.class)
> +    List<Drive> listDrives();
> +
> +    /**
> +     * Gets the list of drives to which the authenticated user has access.
> +     *
> +     * @param fields A set of field names specifying the returned fields
> +     * @param limit number of drives to show
> +     * @return or empty set if no drives are found
> +     */
> +    @GET
> +    @Path("/drives/?fields={fields}&limit={limit}")

This should be just `@Path("/drives/")` and the method parameters should be annotated with `@QueryParam("name")`.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5278037

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> +  <!-- TODO: when out of labs, switch to org.jclouds.provider -->
> +  <groupId>org.apache.jclouds.labs</groupId>
> +  <artifactId>cloudsigma2-lvs</artifactId>
> +  <version>1.7.0-SNAPSHOT</version>
> +  <name>jclouds CloudSigma 2 provider</name>
> +  <description>ComputeService binding to the CloudSigma datacenter in SuperNAP Las Vegas</description>
> +  <packaging>bundle</packaging>
> +
> +  <properties>
> +    <test.cloudsigma2-lvs.endpoint>https://lvs.cloudsigma.com/api/2.0/</test.cloudsigma2-lvs.endpoint>
> +    <test.cloudsigma2-lvs.api-version>1.0</test.cloudsigma2-lvs.api-version>
> +    <test.cloudsigma2-lvs.build-version />
> +    <test.cloudsigma2-lvs.identity>FIXME</test.cloudsigma2-lvs.identity>
> +    <test.cloudsigma2-lvs.credential>FIXME</test.cloudsigma2-lvs.credential>
> +    <test.cloudsigma2-lvs.template />
> +    <jclouds.osgi.export>org.jclouds.cloudsigma*;version="${project.version}"</jclouds.osgi.export>

The wildcard already makes it work, but should the package better be `org.jclouds.cloudsigma2` to be aligned with the other cloudsigma2 projects?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5277938

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> +/**
> + * @author Vladimir Shevchenko
> + */
> +@Singleton
> +public class BindCreateSubscriptionRequestList implements Binder {
> +
> +    private final Function<CreateSubscriptionRequest, JsonObject> subscriptionRequestJsonObjectFunction;
> +
> +    @Inject
> +    public BindCreateSubscriptionRequestList(Function<CreateSubscriptionRequest, JsonObject> subscriptionRequestJsonObjectFunction) {
> +        this.subscriptionRequestJsonObjectFunction = subscriptionRequestJsonObjectFunction;
> +    }
> +
> +    @Override
> +    public <R extends HttpRequest> R bindToRequest(R request, Object input) {
> +        Iterable<CreateSubscriptionRequest> createSubscriptionRequests = (Iterable<CreateSubscriptionRequest>) input;

Also use `checkArgument` here?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5278238

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ilya Kulakov <no...@github.com>.
> +
> +               @Override
> +               public boolean apply(Image input) {
> +                  String toParse = input.getUserMetadata().get("size");
> +                  return toParse != null && new Float(toParse) <= size;
> +               }
> +
> +               @Override
> +               public String toString() {
> +                  return "sizeLessThanOrEqual(" + size + ")";
> +               }
> +
> +            }).ids(id).ram(ram).processors(ImmutableList.of(new Processor(1, cpu))).hypervisor("kvm")
> +                  .volumes(ImmutableList.<Volume>of(new VolumeImpl(size, true, true))).build());
> +         }
> +      return hardware.build();

Could you point to the specifics piece of code you're referring to?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5288823

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
@gcbirzan the issue appears when running the live tests against LVS (don't have an account in Zurich), in the `testCreateTag` and the `testCreateTags`.

As it is a server side issue, I think we can continue with this PR and merge it. Is there any public issue tracker so we can properly reference the issue in the code?




---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24277540

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> +            exception = new IllegalStateException(message, exception);
> +            break;
> +         }
> +      } finally {
> +         Closeables.closeQuietly(response.getPayload());
> +         command.setException(exception);
> +      }
> +   }
> +
> +   public String parseMessage(HttpResponse response) {
> +      if (response.getPayload() == null)
> +         return null;
> +      try {
> +         return Strings2.toString(response.getPayload());
> +      } catch (IOException e) {
> +         throw new RuntimeException(e);

Throwables.propagate?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5278941

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Vladimir Shevchenko <no...@github.com>.
@demobox ok, we are dealing with Subscription object's descendants field, if I request ```/groupedsubscriptions/``` I'll get: ```"descendants": [{"amount": "32212254720", "auto_renew": false, "descendants": [], "discount_amount": null, "discount_percent": null, "end_time": "2013-07-13T12:00:00+00:00", "id": "28552", "last_notification": "2013-07-08T18:03:24.494785+00:00", "period": "30 days, 0:17:49.695836", "price": "5.40000000000000000000", "remaining": "32212254720", "resource": "dssd", "resource_uri": "/api/2.0/groupedsubscriptions/28552/", "start_time": "2013-06-13T11:42:10.304164+00:00", "status": "expired", "subscribed_object": null, "uuid": "0feccfea-5c0b-497e-aa38-90e78d9f8da4"}, {"amount": "32212254720", "auto_renew": false, "descendants": [], "discount_amount": null, "discount_percent": null, "end_time": "2013-08-19T12:00:00+00:00", "id": "53000", "last_notification": "2013-07-08T18:03:24.494785+00:00", "period": "31 days, 23:57:33.464314", "price": "5.580000000000
 00000000", "remaining": "32212254720", "resource": "dssd", "resource_uri": "/api/2.0/groupedsubscriptions/53000/", "start_time": "2013-07-18T12:02:26.535686+00:00", "status": "active", "subscribed_object": null, "uuid": "8e9862bb-94e6-4e5e-9ea8-58880acab42a"}]```
Here are another Subscriptions objects. But if I call ```/subscriptions/``` I'll get:
```"descendants": ["/api/2.0/subscriptions/28552/", "/api/2.0/subscriptions/53000/"]```
This can happen with another objects in the future, so I don't want to duplicate Subscription.class with List<URI> in one & List<Subscription> in another.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-22414346

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #10](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/10/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-20733532

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by gcbirzan <no...@github.com>.
This is a server side bug. I think I even know which one, and if so, we're actively working to fix it, but in case it's not, can you please send me an email when you encounter this, so I can check?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24262709

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Andrew Phillips <no...@github.com>.
> jclouds-labs-pull-requests #54 FAILURE

Just to clarify @nacx 's comment: the misnamed packages are causing a license check failure:
```
/scratch/jenkins/workspace/jclouds-labs-pull-requests/cloudsigma2-lvs/src/test/java/org.jclouds.cloudsigma2/CloudSigma2LasVegasLiveTest.java
```

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-23628697

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
@Kentzo @shevchenator Just a follow up. Do you think it is worth implementing the pagination now, or do you prefer to pass the `limit=0`? I know implementing pagination may require some work (and you already did a great job). I just want to make sure we will be able to merge this PR soon or later! :)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-23368195

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
Thanks for the explanation @shevchenator. I don't see any other major changes required to this pull request, so if no one has a different opinion, I think we can prepare this one to be gracefully merged. In order to do that:

* Could you open a [JIRA issue](https://issues.apache.org/jira/browse/JCLOUDS) for this, targeting jclouds 1.7 version?
* Could you please squash the commits into a single one (with no merge commits) and then rebase to the latest `master` branch version, so we can properly generate a patch? Otherwise all commits would be spread along history and that would look weird.
* Could you paste somewhere (in a Gist or Pastie) the results of the live tests?

Thanks a lot for your contribution!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-22217281

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Andrew Phillips <no...@github.com>.
>  and let Gson (the default JSON library in jclouds) deserialize directly to the "non-raw" objects

@nacx Arrrgh...I had _almost_ finished my comment trying to say that, but you expressed it better. And found the examples for which I was still searching ;-)

Thanks!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21632856

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Vladimir Shevchenko <no...@github.com>.
@nacx @demobox Hey guys! Sometimes we have a problem: for a particular requests in one of server's response JSON key can be a list of objects or a list of objects' URIs(Strings). Is it possible to handle without a custom Parser to avoid this 'expected BEGIN_OBJECT but was STRING' exception & possible to handle both scenarios?
Thanks

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-22355627

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ilya Kulakov <no...@github.com>.
@demobox Could take a look at @shevchenator's question?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-22169664

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> +   protected CloudSigma2ApiMetadata(Builder builder) {
> +      super(builder);
> +   }
> +
> +   public static Properties defaultProperties() {
> +      Properties properties = BaseHttpApiMetadata.defaultProperties();
> +      properties.setProperty(CloudSigmaConstants.PROPERTY_VNC_PASSWORD, "IL9vs34d");
> +      // passwords are set post-boot, so auth failures are possible
> +      // from a race condition applying the password set script
> +      properties.setProperty("jclouds.ssh.max-retries", "7");
> +      properties.setProperty("jclouds.ssh.retry-auth", "true");
> +      properties.setProperty(TEMPLATE, "osFamily=UBUNTU,imageNameMatches=.*[Aa]utomated SSH Access.*,os64Bit=true");
> +      return properties;
> +   }
> +
> +   public static class Builder extends BaseHttpApiMetadata.Builder {

Change to `extends BaseHttpApiMetadata.Builder<CloudSigma2Api, Builder>` to properly type the builder.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r6053965

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
The idea is that if the API method returns a Drive object, you don't even
need that parser. That is what jclouds will do by default.

If your domain objects match the returned JSON, you don't need to manually
configure/code deserialization.
El 27/07/2013 07:55, "Andrew Phillips" <no...@github.com> escribió:

> I'm guessing it would be better to request a Json<https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/json/Json.java>object to be injected and then call that.
>
> Jclouds isn't big on instantiating helper objects like Gson directly in
> your code - they're usually provided by the context.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21660216>
> .
>

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21660904

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
Live tests are passing now, so I'm going to merge this one. Thanks for all the effort and keep us posted on the progress  of the issue!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24703336

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #203](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/203/) FAILURE
Looks like there's a problem with this pull request
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21197687

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #31](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/31/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-22077483

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Zack Shoylev <no...@github.com>.
The trove ones don't use a mockserver, they just use the jclouds provided request-response expect mechanism.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21365069

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
@Kentzo @gcbirzan Any update on the issue? Is there a public URL for the issue that we can put in a comment in the live test, just to explain why it fails?

As it is a server side issue that will be fixed and won't require changes in the jclouds code, I'm ok to merge this if we can add a proper reference in the affected live tests.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24585740

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Andrew Phillips <no...@github.com>.
>  for a particular requests in one of server's response JSON key can be a list of objects or a list of objects' 
> URIs(Strings).

For the _same_ request with the same parameters? Or what determines which output type is sent?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-22363910

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ilya Kulakov <no...@github.com>.
@nacx Thoughts? :)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24022823

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ilya Kulakov <no...@github.com>.
@nacx I've asked @vpetersson but would be better if you mail him personally.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24593523

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
@vpetersson One thing that came to my mind today is that you could use the `@SkipEncoding` annotation. I haven't tried it, but if you annotate the method with `@SkipEncoding({'?'})`, perhaps you can place the query parameter in the `@Path` annotation again.

This is no the standard way to define paths, and I don't know if it will work, but if it does, you can consider using this approach (as long as it works properly) and implement the pagination in another pull request, just to get things done.

WDTY? Up to you!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-23369692

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #57](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/57/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24183574

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #55](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/55/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24022544

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> +
> +      ServerInfo toCreate = new ServerInfo.Builder()
> +                                        .name(name)
> +                                        .vncPassword(defaultVncPassword)
> +                                        .cpu(1000)
> +                                        .memory(new BigInteger("512000000"))
> +                                        .drives(ImmutableList.of(drive.toServerDrive(1, "0:1", DeviceEmulationType.IDE)))
> +                                        .build();
> +
> +      logger.debug(">> creating server");
> +      ServerInfo from = client.createServer(toCreate);
> +      logger.debug("<< created server(%s)", from.getUuid());
> +      logger.debug(">> starting server(%s)", from.getUuid());
> +      client.startServer(from.getUuid());
> +      return new NodeAndInitialCredentials<ServerInfo>(from, from.getUuid(), LoginCredentials.builder()
> +            .password(defaultVncPassword).authenticateSudo(true).build());

Don't know the details about how the cloudsigma api works, so I just want to verify this :) The password in the LoginCredentials will be used by the compute service to log in to the guest, for example, when executing the `runScriptOnNode` methods. Is this password the ssh password of the deployed node?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5278380

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #205](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/205/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21216824

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
Hi @Kentzo, I've downloaded the latest version and run the live tests, but I'm getting intermittent errors when deserializing the response for the `createTag` and `createTags` calls. Those tests fail "sometimes" saying something like:

    testCreateTags(org.jclouds.cloudsigma2.CloudSigma2LasVegasLiveTest):
        Expected BEGIN_OBJECT but was STRING at line 1 column 318

I turned on jclouds wire logging to inspect the request and responses being generated, and here are the ones generated in the `testCreateTags`:

    2013-09-11 00:26:13,402 DEBUG [jclouds.wire] (TestNG) >> "{"objects":[{"name":"Cloudsigma2 New tag","meta":{}},{"name":"Cloudsigma2 tag with resource","meta":{},"resources":["5282fff1-049f-479d-b1fc-faf68341a82d"]}]}"
    2013-09-11 00:26:13,403 DEBUG [jclouds.headers] (TestNG) >> POST https://lvs.cloudsigma.com/api/2.0/tags/ HTTP/1.1
    2013-09-11 00:26:13,404 DEBUG [jclouds.headers] (TestNG) >> Accept: application/json
    2013-09-11 00:26:13,404 DEBUG [jclouds.headers] (TestNG) >> Authorization: Basic bmFjeEBhcGFjaGUub3JnOmpjbDB1ZHMhbDF2Mw==
    2013-09-11 00:26:13,405 DEBUG [jclouds.headers] (TestNG) >> Content-Type: application/json
    2013-09-11 00:26:13,405 DEBUG [jclouds.headers] (TestNG) >> Content-Length: 158
    2013-09-11 00:26:15,413 DEBUG [jclouds.headers] (TestNG) << HTTP/1.1 201 CREATED
    2013-09-11 00:26:15,413 DEBUG [jclouds.headers] (TestNG) << Transfer-Encoding: chunked
    2013-09-11 00:26:15,414 DEBUG [jclouds.headers] (TestNG) << Date: Tue, 10 Sep 2013 22:26:15 GMT
    2013-09-11 00:26:15,414 DEBUG [jclouds.headers] (TestNG) << CF-RAY: abf89e8427b00de
    2013-09-11 00:26:15,415 DEBUG [jclouds.headers] (TestNG) << Location: https://lvs.cloudsigma.com/api/2.0/tags/
    2013-09-11 00:26:15,416 DEBUG [jclouds.headers] (TestNG) << Set-Cookie: __cfduid=dec16a53d78655bb63249c0d874574f841378851974449; expires=Mon, 23-Dec-2019 23:50:00 GMT; path=/; domain=.cloudsigma.com
    2013-09-11 00:26:15,416 DEBUG [jclouds.headers] (TestNG) << Connection: keep-alive
    2013-09-11 00:26:15,417 DEBUG [jclouds.headers] (TestNG) << Server: cloudflare-nginx
    2013-09-11 00:26:15,417 DEBUG [jclouds.headers] (TestNG) << X-API-Version: Nitrogen.prod.1837e2d48570+
    2013-09-11 00:26:15,418 DEBUG [jclouds.headers] (TestNG) << Content-Type: application/json; charset=utf-8
    2013-09-11 00:26:15,420 DEBUG [jclouds.wire] (TestNG) << "{"objects": [{"meta": {}, "name": "Cloudsigma2 New tag", "resource_uri": "/api/2.0/tags/9e9697fc-3670-4ec9-8166-1c429f0d6b3c/", "uuid": "9e9697fc-3670-4ec9-8166-1c429f0d6b3c"}, {"meta": {}, "name": "Cloudsigma2 tag with resource", "resource_uri": "/api/2.0/tags/7825e6cb-3f4b-4894-9e90-18d26ee25a4c/", "resources": ["5282fff1-049f-479d-b1fc-faf68341a82d"], "uuid": "7825e6cb-3f4b-4894-9e90-18d26ee25a4c"}]}"

If you take a look at the returned json, it seems that the problem is in the `resources` list. When deserializing the list of `Tag` objects, jclouds expects it to have a list of `TagResource` objects, but the json returned by the api has instead a list of strings (just the uuid of the resource).

I don't quite understand why this only happens sometimes. Could it be a server-side issue, or is it something that should be fixed in the provider code?


---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24200766

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> +  <!-- TODO: when out of labs, switch to org.jclouds.provider -->
> +  <groupId>org.apache.jclouds.labs</groupId>
> +  <artifactId>cloudsigma2-lvs</artifactId>
> +  <version>1.7.0-SNAPSHOT</version>
> +  <name>jclouds CloudSigma 2 provider</name>
> +  <description>ComputeService binding to the CloudSigma datacenter in SuperNAP Las Vegas</description>
> +  <packaging>bundle</packaging>
> +
> +  <properties>
> +    <test.cloudsigma2-lvs.endpoint>https://lvs.cloudsigma.com/api/2.0/</test.cloudsigma2-lvs.endpoint>
> +    <test.cloudsigma2-lvs.api-version>1.0</test.cloudsigma2-lvs.api-version>
> +    <test.cloudsigma2-lvs.build-version />
> +    <test.cloudsigma2-lvs.identity>FIXME</test.cloudsigma2-lvs.identity>
> +    <test.cloudsigma2-lvs.credential>FIXME</test.cloudsigma2-lvs.credential>
> +    <test.cloudsigma2-lvs.template />
> +    <jclouds.osgi.export>org.jclouds.cloudsigma*;version="${project.version}"</jclouds.osgi.export>

Yes. Just to be consistent with the config in other poms and avoid confusion (and avoid including a possible cloudsigma old package by mistake if that existed).

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5287186

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #18](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/18/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21201606

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Vladimir Shevchenko <no...@github.com>.
@nacx @demobox As I understood we should remove all these JsonTo* and Parse* classes from functions package. And use @ConstructorProperties annotation for domain classes & @SelectJson("") one for api method. But how to declare the dependency for e.g @SelectJson("drive") to DriveInfo.class?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21651336

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #49](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/49/) UNSTABLE
Looks like there's a problem with this pull request

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-23397862

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Andrew Phillips <no...@github.com>.
> what if want to parse date from iso8601 string? should I write parser class

The pattern indeed seems to be to write a parser class, but that should be relatively easy:

1. Create a response parser such as [`ParseSystemAndUserMetadataFromHeaders`](https://github.com/jclouds/jclouds/blob/master/blobstore/src/main/java/org/jclouds/blobstore/functions/ParseSystemAndUserMetadataFromHeaders.java) that gets a [`DateService`](http://javadocs.jclouds.cloudbees.net/org/jclouds/date/DateService.html) injected. Use the `DateService` methods to parse the input. Please also add a unit test for the handler
2. Add a `@ResponseParser` to your API call, referring to your parser. See e.g. the current [`EventApi`](https://github.com/jclouds/jclouds/blob/master/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/EventApi.java#L56)

Hope that helps!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21675987

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #56](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/56/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24070934

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Andrew Phillips <no...@github.com>.
> +            <artifactId>maven-surefire-plugin</artifactId>
> +            <executions>
> +              <execution>
> +                <id>integration</id>
> +                <phase>integration-test</phase>
> +                <goals>
> +                  <goal>test</goal>
> +                </goals>
> +                <configuration>
> +                  <systemPropertyVariables>
> +                    <test.cloudsigma2-zrh.endpoint>${test.cloudsigma2-zrh.endpoint}</test.cloudsigma2-zrh.endpoint>
> +                    <test.cloudsigma2-zrh.api-version>${test.cloudsigma2-zrh.api-version}</test.cloudsigma2-zrh.api-version>
> +                    <test.cloudsigma2-zrh.build-version>${test.cloudsigma2-zrh.build-version}</test.cloudsigma2-zrh.build-version>
> +                    <test.cloudsigma2-zrh.identity>${test.cloudsigma2-zrh.identity}</test.cloudsigma2-zrh.identity>
> +                    <test.cloudsigma2-zrh.credential>${test.cloudsigma2-zrh.credential}</test.cloudsigma2-zrh.credential>
> +                    <test.cloudsigma2-zrh.template>${test.cloudsigma2-zrh.template}</test.cloudsigma2-zrh.template>

Do these need to be different variables from the ones for the API project? Or could you simply override those, e.g.
```
<test.cloudsigma2.endpoint>${test.cloudsigma2-zrh.endpoint}</test.cloudsigma2.endpoint>
```
instead of
```
<test.cloudsigma2-zrh.endpoint>${test.cloudsigma2-zrh.endpoint}</test.cloudsigma2-zrh.endpoint>
```
?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5112123

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #33](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/33/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-22237713

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ilya Kulakov <no...@github.com>.
@nacx commented in failing tests for now.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24660741

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
Forgot to say, all methods in the cloudsigma api class should ba also annotated with an `@Named` annotation so users can properly configure the timeouts for each method.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21215439

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #350](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/350/) UNSTABLE
Looks like there's a problem with this pull request
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-23397790

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Andrew Phillips <no...@github.com>.
> +    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> +    See the License for the specific language governing permissions and
> +    limitations under the License.
> +
> +-->
> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> +  <modelVersion>4.0.0</modelVersion>
> +  <parent>
> +    <groupId>org.apache.jclouds</groupId>
> +    <artifactId>jclouds-project</artifactId>
> +    <version>1.7.0-SNAPSHOT</version>
> +    <relativePath>../../project/pom.xml</relativePath>
> +  </parent>
> +  <groupId>org.apache.jclouds.provider</groupId>
> +  <artifactId>cloudsigma2-lvs</artifactId>
> +  <name>jclouds CloudSigma 2 provider</name>

I think this needs its own `<version>` in order to be released as a labs project. The jclouds core dependencies need to be referenced by `${parent.project.version}`, then. See the discussion at https://github.com/jclouds/jclouds-labs-openstack/pull/11 for details.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5111980

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #17](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/17/) FAILURE
Looks like there's a problem with this pull request

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21197906

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ilya Kulakov <no...@github.com>.
@nacx Ah, if jclouds only had careful tutorial or overview of builtin features :)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21678098

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #58](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/58/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24661479

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
This has been a nice cleanup and it is looking better now. We're almost there, thanks again!

A couple questions:

* Is there any reason why the fields in the domain classes are protected instead of private?
* Does this PR mean that the [existing CloudSigma](https://github.com/jclouds/jclouds/tree/master/apis/cloudsigma) api should be deprecated/removed?
* You managed to remove the custom response parsers (cool!), and I've seen that there are also many custom binders, used to map the domain objects to the request body. Since the domain objects are now following teh json structure and are properly annotated, would it be possible to use the existing `BindToJsonPayload` instead of the custom ones? For example:

```java
DriveInfo createDrive(@BinderParam(BindToJsonPayload.class) DriveInfo createDrive);
```

Sorry if I haven't seen this before, but this is quite an important amount of code and it is difficult to spot all things at once. You're doing a great job here, and I really don't want to make this a never-ending PR, so I hope these are the final major cleanups. I look forward to having this merged!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-22041977

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ilya Kulakov <no...@github.com>.
@nacx Interesting. Could you also attach detailed response for the situtation when it works, so we could compare?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-24213851

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
> +/**
> + * @author Vladimir Shevchenko
> + */
> +@Singleton
> +public class BindCreateSubscriptionRequestList implements Binder {
> +
> +    private final Function<CreateSubscriptionRequest, JsonObject> subscriptionRequestJsonObjectFunction;
> +
> +    @Inject
> +    public BindCreateSubscriptionRequestList(Function<CreateSubscriptionRequest, JsonObject> subscriptionRequestJsonObjectFunction) {
> +        this.subscriptionRequestJsonObjectFunction = subscriptionRequestJsonObjectFunction;
> +    }
> +
> +    @Override
> +    public <R extends HttpRequest> R bindToRequest(R request, Object input) {
> +        Iterable<CreateSubscriptionRequest> createSubscriptionRequests = (Iterable<CreateSubscriptionRequest>) input;

Yes, it does not seem worth checking this here as you will be already iterating the collection again immediatly after.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5289286

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
This is taking shape. Thanks for all the changes! There are a couple of general things, though:

* What are all those classes in the `beans` package? Are they really needed?
* I am missing the Expect tests. They are important because they test that the HTTP request generated when calling the methods of the api is the expected one. They use a mock to verifies that, so no real api calls are performed against the provider, and we can run them always. You can use [mockwevserver](http://code.google.com/p/mockwebserver/) for example, or just the mock provided in jclouds. You can take a look again at the openstack-trove (as you already took it as an example for live tests) and see how expect tests are configured.

Thx!


---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21214814

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
@Kentzo, then you could make your API method return directly a DriveInfo object, and annotate it with:

```java
@SelectJson("objects")
@OnlyElement
```

This will tell jclouds to return the value of the "objects" field, and extract the only element from the returned list. This way you shouldn't need a parser. If I am not wrong, CloudStack does something similar in their [VolumeApi](https://github.com/jclouds/jclouds/blob/master/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VolumeApi.java#L80-L81).

@shevchenator Gson by default supports serialization and deserialization of Enums, so you shouldn't need to do anything special.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21937995

Re: [jclouds-labs] Adds support for CloudSigma's 2.0 API (#12)

Posted by Ignasi Barrera <no...@github.com>.
Thanks for the work! Expect tests are important for us and we really appreciate you've added them! I'll have a look in a bit.

Meanwhile, could you explain what is the purpose of the classes in the `beans` package? All that `Raw*` classes with all properties being public, what are they needed for?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-21622559