Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document marketplace #115

Merged
merged 4 commits into from
Jun 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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<EndpointPatternDTO> endpointPatterns = new HashSet<>();

@ApiModelProperty( "Application metrics linked to the application" )
@Valid
private List<UrlEntityDTO> applicationMetrics = new ArrayList<>();

@ApiModelProperty( "Application stack requirements" )
@Valid
private List<DependencyDTO> dependencies = new ArrayList<>();

@ApiModelProperty( "Whether the application is deployable" )
@NotNull
private Boolean installable = false;

@ApiModelProperty( "Product versions linked to the application" )
@Valid
private Set<UrlEntityDTO> configurations;

@ApiModelProperty( "Environment variables for the application" )
@Valid
private Set<ApplicationFileEnvironmentDTO> environment = new HashSet<>();

Expand Down
Original file line number Diff line number Diff line change
@@ -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
{
/**
Expand All @@ -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 )
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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<CloudProviderFeatureDTO> features = new ArrayList<>();

@ApiModelProperty( "Instance pricings for the cloud provider missing a configuration" )
@JsonInclude ( JsonInclude.Include.NON_EMPTY )
private List<String> missing = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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";
Expand All @@ -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 )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not readonly, not updatable

@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 )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not updatable

@Length( max = 36 )
private String code;

Expand All @@ -40,36 +46,46 @@ public class CouponDTO extends BaseEntityDTO
@Valid
private UrlEntityDTO product;

@ApiModelProperty( value = "Coupon type", allowableValues = "bundle, discount, extendedTrial, fixedPrice", readOnly = true )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not updatable

@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 )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not updatable

@JsonFormat( pattern = DATE_PATTERN )
private Date expirationDate;

@ApiModelProperty( value = "Fixed price", readOnly = true )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not updatable

@JsonInclude ( JsonInclude.Include.NON_NULL )
@Min ( 0 )
private BigDecimal newPrice;

@ApiModelProperty( value = "Discount percentage", readOnly = true )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not updatable

@JsonInclude ( JsonInclude.Include.NON_NULL )
@Min ( 0 )
@Max ( 100 )
private BigDecimal percentage;

@ApiModelProperty( value = "Days of extension", readOnly = true )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not updatable

@JsonInclude ( JsonInclude.Include.NON_NULL )
@Min ( 1 )
private Integer days;

@ApiModelProperty( value = "Maximum budget for an extended trial", readOnly = true )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updatable?

@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 )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not updatable

private boolean reusable;

@ApiModelProperty( value = "Whether the coupon applies to the license cost only", readOnly = true )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not updatable

private boolean licenseOnly = true;

public String getEmailCustomer()
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -8,38 +9,42 @@
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
@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;

@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<BillingItemResellingPriceDTO> billingItemResellingPrices;

@ApiModelProperty( "Reselling prices for the cloud pricings" )
@Valid
private Set<CloudPricingResellingPriceDTO> 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<BillingItemValueDTO> billingItemValues;

Expand Down
Loading