From c74ceadd61573c2ed417045aac42c029a3fc53f8 Mon Sep 17 00:00:00 2001 From: Matteo Giordano Date: Thu, 14 Jun 2018 11:13:19 +0200 Subject: [PATCH 1/4] Document marketplace --- .../cmw/model/dto/BandwidthPricingDTO.java | 6 ++++++ .../cmw/model/dto/CloudProviderDTO.java | 10 ++++++++++ .../cloudesire/cmw/model/dto/CouponDTO.java | 16 ++++++++++++++++ .../cmw/model/dto/DiskSpacePricingDTO.java | 5 +++++ .../cmw/model/dto/InstancePricingDTO.java | 7 +++++++ .../cmw/model/dto/ResellerPricingDTO.java | 3 --- 6 files changed, 44 insertions(+), 3 deletions(-) diff --git a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/BandwidthPricingDTO.java b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/BandwidthPricingDTO.java index 3cf2eec81..622d1209e 100644 --- a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/BandwidthPricingDTO.java +++ b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/BandwidthPricingDTO.java @@ -1,20 +1,26 @@ package com.liberologico.cloudesire.cmw.model.dto; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import javax.validation.Valid; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; import java.math.BigDecimal; +@ApiModel( "Defines pricing of bandwidth used by a VM" ) public class BandwidthPricingDTO extends BaseEntityDTO { @NotNull @Valid private UrlEntityDTO cloudProvider; + @ApiModelProperty( "Chosen price" ) @Min ( 0 ) @NotNull private BigDecimal price; + @ApiModelProperty( "Bandwidth sizing" ) @Min ( 0 ) @NotNull private BigDecimal traffic; diff --git a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/CloudProviderDTO.java b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/CloudProviderDTO.java index 0dfd6fbd2..8e05a06f9 100644 --- a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/CloudProviderDTO.java +++ b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/CloudProviderDTO.java @@ -1,25 +1,35 @@ package com.liberologico.cloudesire.cmw.model.dto; import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; import java.util.Objects; +@ApiModel( "Definition of a cloud provider" ) public class CloudProviderDTO extends NamedEntityDTO { + @ApiModelProperty( "URL of a logo to display on the marketplace" ) private String logoUrl; + @ApiModelProperty( "An alias for the cloud provider" ) private String alias; + @ApiModelProperty( "Whether the cloud provider is enabled" ) private boolean enabled; + @ApiModelProperty( "Whether the cloud provider is private" ) private Boolean privateCloud = false; + @ApiModelProperty( "Weight order for displaying on the marketplace" ) private int weight; + @ApiModelProperty( "Enabled features of the cloud provider" ) private List features = new ArrayList<>(); + @ApiModelProperty( "Instance pricings for the cloud provider missing a configuration" ) @JsonInclude ( JsonInclude.Include.NON_EMPTY ) private List missing = new ArrayList<>(); diff --git a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/CouponDTO.java b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/CouponDTO.java index a3b7c99c7..e80454474 100644 --- a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/CouponDTO.java +++ b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/CouponDTO.java @@ -3,6 +3,8 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonInclude; import com.liberologico.cloudesire.common.Regexp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.apache.commons.lang3.ObjectUtils; import org.hibernate.validator.constraints.Email; import org.hibernate.validator.constraints.Length; @@ -17,6 +19,7 @@ import static com.liberologico.cloudesire.common.JsonFormatters.DATE_PATTERN; +@ApiModel( "A generated coupon" ) public class CouponDTO extends BaseEntityDTO { public static final String DISCOUNT = "discount"; @@ -25,12 +28,15 @@ public class CouponDTO extends BaseEntityDTO public static final String DISCOUNT_GENERATOR = "discountGenerator"; public static final String FIXED_PRICE_GENERATOR = "fixedPriceGenerator"; + @ApiModelProperty( value = "Email address to notify customer of the coupon", readOnly = true ) @Email( regexp = Regexp.INTERNET_EMAIL ) private String emailCustomer; + @ApiModelProperty( value = "Unique identifier of the coupon", readOnly = true ) @Length ( min = 48, max = 48 ) private String hash; + @ApiModelProperty( value = "Human readable code of the coupon", readOnly = true ) @Length( max = 36 ) private String code; @@ -40,36 +46,46 @@ public class CouponDTO extends BaseEntityDTO @Valid private UrlEntityDTO product; + @ApiModelProperty( value = "Coupon type", allowableValues = "bundle, discount, extendedTrial, fixedPrice", readOnly = true ) @NotNull private String type; + @ApiModelProperty( value = "When the coupon has been created", readOnly = true ) @NotNull @JsonFormat( pattern = DATE_PATTERN ) private Date creationDate = new Date(); + @ApiModelProperty( value = "When the coupon will expire", readOnly = true ) @JsonFormat( pattern = DATE_PATTERN ) private Date expirationDate; + @ApiModelProperty( value = "Fixed price", readOnly = true ) @JsonInclude ( JsonInclude.Include.NON_NULL ) @Min ( 0 ) private BigDecimal newPrice; + @ApiModelProperty( value = "Discount percentage", readOnly = true ) @JsonInclude ( JsonInclude.Include.NON_NULL ) @Min ( 0 ) @Max ( 100 ) private BigDecimal percentage; + @ApiModelProperty( value = "Days of extension", readOnly = true ) @JsonInclude ( JsonInclude.Include.NON_NULL ) @Min ( 1 ) private Integer days; + @ApiModelProperty( value = "Maximum budget for an extended trial", readOnly = true ) @JsonInclude ( JsonInclude.Include.NON_NULL ) private BigDecimal plafond; + @ApiModelProperty( value = "Coupon state", allowableValues = "NEW, SENT, EXPIRED, USED", readOnly = true ) private String state; + @ApiModelProperty( value = "Whether the coupon is reusable", readOnly = true ) private boolean reusable; + @ApiModelProperty( value = "Whether the coupon applies to the license cost only", readOnly = true ) private boolean licenseOnly = true; public String getEmailCustomer() diff --git a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/DiskSpacePricingDTO.java b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/DiskSpacePricingDTO.java index 79009e03d..304b2ef7a 100644 --- a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/DiskSpacePricingDTO.java +++ b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/DiskSpacePricingDTO.java @@ -1,15 +1,20 @@ package com.liberologico.cloudesire.cmw.model.dto; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import javax.validation.Valid; import javax.validation.constraints.NotNull; import java.math.BigDecimal; +@ApiModel( "Defines pricing of disk usage of a VM" ) public class DiskSpacePricingDTO extends BaseEntityDTO { @NotNull @Valid private UrlEntityDTO cloudProvider; + @ApiModelProperty( "Chosen price" ) @NotNull private BigDecimal price; diff --git a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/InstancePricingDTO.java b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/InstancePricingDTO.java index 61b648f5b..ef512c509 100644 --- a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/InstancePricingDTO.java +++ b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/InstancePricingDTO.java @@ -1,26 +1,33 @@ package com.liberologico.cloudesire.cmw.model.dto; import com.liberologico.cloudesire.common.enums.OsFamily; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import javax.validation.Valid; import javax.validation.constraints.NotNull; import java.math.BigDecimal; +@ApiModel( "Defines pricing of disk usage of a VM" ) public class InstancePricingDTO extends BaseEntityDTO { @NotNull @Valid private UrlEntityDTO cloudProvider; + @ApiModelProperty( "Chosen price" ) @NotNull private BigDecimal price; + @ApiModelProperty( "RAM quantity" ) @NotNull private Integer ram; + @ApiModelProperty( "CPU Cores" ) @NotNull private BigDecimal cpu; + @ApiModelProperty( "Operating system" ) @NotNull private OsFamily osFamily = OsFamily.LINUX; diff --git a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ResellerPricingDTO.java b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ResellerPricingDTO.java index dd92bdade..0932eaacc 100644 --- a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ResellerPricingDTO.java +++ b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ResellerPricingDTO.java @@ -12,18 +12,15 @@ public class ResellerPricingDTO extends BaseEntityDTO { @NotNull @Valid - @ApiModelProperty( "The version of this product's reselling pricing, editable by the distributor" ) private UrlEntityDTO productVersion; @ApiModelProperty( "If the invoices for this resold product are self billed" ) private boolean selfBilled; @Valid - @ApiModelProperty( "The reseller of this product, editable by the distributor" ) private UrlEntityDTO reseller; @Valid - @ApiModelProperty( "The distributor of this product, editable by the admin" ) private UrlEntityDTO distributor; @Valid From 61ca42d1814acc10b16e76a78489584695f708e5 Mon Sep 17 00:00:00 2001 From: Matteo Giordano Date: Thu, 14 Jun 2018 11:44:16 +0200 Subject: [PATCH 2/4] Document reseller pricings --- .../cloudesire/cmw/model/dto/ResellerPricingDTO.java | 8 ++++++++ .../cmw/model/dto/ResellerPricingPatchDTO.java | 12 +++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ResellerPricingDTO.java b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ResellerPricingDTO.java index 0932eaacc..a4313acd1 100644 --- a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ResellerPricingDTO.java +++ b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ResellerPricingDTO.java @@ -1,5 +1,6 @@ package com.liberologico.cloudesire.cmw.model.dto; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.Valid; @@ -8,6 +9,7 @@ import java.util.Objects; import java.util.Set; +@ApiModel( "Defines a pricing for a product version and a reseller" ) public class ResellerPricingDTO extends BaseEntityDTO { @NotNull @@ -23,20 +25,26 @@ public class ResellerPricingDTO extends BaseEntityDTO @Valid private UrlEntityDTO distributor; + @ApiModelProperty( "The price defined by the reseller" ) @Valid private ResellingPriceDTO price; + @ApiModelProperty( "The setup fee defined by the reseller" ) @Valid private ResellingPriceDTO setup; + @ApiModelProperty( "Reselling prices for the billing items" ) @Valid private Set billingItemResellingPrices; + @ApiModelProperty( "Reselling prices for the cloud pricings" ) @Valid private Set cloudPricingResellingPrices; + @ApiModelProperty( "Whether the pricing will not be altered by a mass update" ) private Boolean locked; + @ApiModelProperty( "Billing item ranges defined by the reseller" ) @Valid private List billingItemValues; diff --git a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ResellerPricingPatchDTO.java b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ResellerPricingPatchDTO.java index 12e459b27..80f0813e6 100644 --- a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ResellerPricingPatchDTO.java +++ b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ResellerPricingPatchDTO.java @@ -1,5 +1,8 @@ package com.liberologico.cloudesire.cmw.model.dto; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import javax.validation.constraints.AssertTrue; import javax.validation.constraints.NotNull; import java.math.BigDecimal; @@ -7,11 +10,14 @@ import static com.liberologico.cloudesire.cmw.model.dto.ResellerPricingPatchDTO.Action.MASS_UPDATE; import static com.liberologico.cloudesire.cmw.model.dto.ResellerPricingPatchDTO.Action.MASS_UPDATE_CLOUD_PRICINGS; +@ApiModel( "Mass actions for reseller pricings" ) public class ResellerPricingPatchDTO extends DTO { + @ApiModelProperty( "The defined action" ) @NotNull private Action action; + @ApiModelProperty( "Price change in percentage" ) private BigDecimal percentage; public ResellerPricingPatchDTO( Action action ) @@ -53,6 +59,10 @@ public void setPercentage( BigDecimal percentage ) public enum Action { - MASS_UPDATE, MASS_UPDATE_CLOUD_PRICINGS + @ApiModelProperty( "Update price and setup of every reseller pricing" ) + MASS_UPDATE, + + @ApiModelProperty( "Update price of every cloud pricing defined in the reseller pricings" ) + MASS_UPDATE_CLOUD_PRICINGS } } From dd40890e13e1b4799d4c9f73e5bf87e4b6850b25 Mon Sep 17 00:00:00 2001 From: Matteo Giordano Date: Thu, 14 Jun 2018 14:00:13 +0200 Subject: [PATCH 3/4] Document files --- .../cmw/model/dto/ApplicationFileDTO.java | 14 ++++++++++++++ .../model/dto/ApplicationFileEnvironmentDTO.java | 7 +++++++ .../cloudesire/cmw/model/dto/FileDTO.java | 16 ++++++++++++---- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ApplicationFileDTO.java b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ApplicationFileDTO.java index 9b89f72ae..bb72c98da 100644 --- a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ApplicationFileDTO.java +++ b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ApplicationFileDTO.java @@ -1,6 +1,8 @@ package com.liberologico.cloudesire.cmw.model.dto; import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.hibernate.validator.constraints.NotEmpty; import javax.validation.Valid; @@ -13,26 +15,38 @@ import java.util.Objects; import java.util.Set; +@ApiModel( "Application package" ) public class ApplicationFileDTO extends FileDTO implements INamedEntityDTO { + @ApiModelProperty( "Package version" ) @NotEmpty private String version; + + @ApiModelProperty( "Package name" ) @NotEmpty private String name; + @ApiModelProperty( "Endpoint patterns for the application" ) @Valid private Set endpointPatterns = new HashSet<>(); + + @ApiModelProperty( "Application metrics linked to the application" ) @Valid private List applicationMetrics = new ArrayList<>(); + + @ApiModelProperty( "Application stack requirements" ) @Valid private List dependencies = new ArrayList<>(); + @ApiModelProperty( "Whether the application is deployable" ) @NotNull private Boolean installable = false; + @ApiModelProperty( "Product versions linked to the application" ) @Valid private Set configurations; + @ApiModelProperty( "Environment variables for the application" ) @Valid private Set environment = new HashSet<>(); diff --git a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ApplicationFileEnvironmentDTO.java b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ApplicationFileEnvironmentDTO.java index 78140fae2..f566705de 100644 --- a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ApplicationFileEnvironmentDTO.java +++ b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ApplicationFileEnvironmentDTO.java @@ -1,9 +1,13 @@ package com.liberologico.cloudesire.cmw.model.dto; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import javax.validation.Valid; import javax.validation.constraints.NotNull; import java.util.Objects; +@ApiModel( "Environment variables for an application" ) public class ApplicationFileEnvironmentDTO extends BaseEntityDTO { /** @@ -12,12 +16,15 @@ public class ApplicationFileEnvironmentDTO extends BaseEntityDTO @Valid private UrlEntityDTO applicationFile; + @ApiModelProperty( "Variable name" ) @NotNull private String variable; + @ApiModelProperty( "Variable value" ) @NotNull private String value; + @ApiModelProperty( "Whether the value is editable by a customer" ) private boolean editableByCustomer = false; public ApplicationFileEnvironmentDTO( String applicationUrl, String variable, String value ) diff --git a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/FileDTO.java b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/FileDTO.java index d2537b670..8538679c4 100644 --- a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/FileDTO.java +++ b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/FileDTO.java @@ -2,6 +2,8 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.liberologico.cloudesire.common.validators.ApplicationFileURL; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import javax.validation.Valid; import javax.validation.constraints.Size; @@ -10,35 +12,41 @@ import static com.liberologico.cloudesire.cmw.model.utils.ConstraintKeys.INVALID_SIZE; -/** - * DTO for File. - */ +@ApiModel( "A managed file for the marketplace" ) public class FileDTO extends BaseEntityDTO { - // Link to the static resource + @ApiModelProperty( "Link to the static resource" ) @ApplicationFileURL private String objectUrl; + @ApiModelProperty( value = "SHA-512 of the uploaded file", readOnly = true ) private String sha512; + @ApiModelProperty( "alt property for an image" ) @Size( max = 125, message = INVALID_SIZE ) private String alt; + @ApiModelProperty( "title property for an image" ) @Size( max = 125, message = INVALID_SIZE ) private String title; + @ApiModelProperty( value = "Size of the uploaded file", readOnly = true ) private Integer size; + @ApiModelProperty( value = "When the file has been uploaded", readOnly = true ) private Date loadDate; @Valid private UrlEntityDTO ownerCompany; + @ApiModelProperty( value = "Original name of the uploaded file", readOnly = true ) private String originalFilename; + @ApiModelProperty( "Tag for a ProductFile" ) @JsonInclude ( JsonInclude.Include.NON_NULL ) private String tag; + @ApiModelProperty( "Weight order for displaying on the marketplace" ) @JsonInclude( JsonInclude.Include.NON_NULL ) private Integer weight; From 1432e32a1eb91fab7ee14d77d2a9aa4d3b734c07 Mon Sep 17 00:00:00 2001 From: Matteo Giordano Date: Thu, 14 Jun 2018 19:00:55 +0200 Subject: [PATCH 4/4] Reviewww --- .../cloudesire/cmw/model/dto/ResellerPricingPatchDTO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ResellerPricingPatchDTO.java b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ResellerPricingPatchDTO.java index 80f0813e6..7166d5e3c 100644 --- a/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ResellerPricingPatchDTO.java +++ b/cmw-dto/src/main/java/com/liberologico/cloudesire/cmw/model/dto/ResellerPricingPatchDTO.java @@ -13,7 +13,6 @@ @ApiModel( "Mass actions for reseller pricings" ) public class ResellerPricingPatchDTO extends DTO { - @ApiModelProperty( "The defined action" ) @NotNull private Action action; @@ -57,6 +56,7 @@ public void setPercentage( BigDecimal percentage ) this.percentage = percentage; } + @ApiModel( "The defined action" ) public enum Action { @ApiModelProperty( "Update price and setup of every reseller pricing" )