Skip to content

Commit

Permalink
Merge pull request #11018 from dashevchenko/swaggerImpr
Browse files Browse the repository at this point in the history
Updated TenantProfile swagger example
  • Loading branch information
ViacheslavKlimov committed Jun 19, 2024
2 parents fb47a95 + 3ea1e57 commit a6dcb8f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ public EntityInfo getDefaultTenantProfileInfo() throws ThingsboardException {
"Let's review the example of tenant profile data below: " +
"\n\n" + MARKDOWN_CODE_BLOCK_START +
"{\n" +
" \"name\": \"Default\",\n" +
" \"description\": \"Default tenant profile\",\n" +
" \"name\": \"Your name\",\n" +
" \"description\": \"Your description\",\n" +
" \"isolatedTbRuleEngine\": false,\n" +
" \"profileData\": {\n" +
" \"configuration\": {\n" +
Expand Down Expand Up @@ -162,7 +162,7 @@ public EntityInfo getDefaultTenantProfileInfo() throws ThingsboardException {
" \"warnThreshold\": 0\n" +
" }\n" +
" },\n" +
" \"default\": true\n" +
" \"default\": false\n" +
"}" +
MARKDOWN_CODE_BLOCK_END +
"Remove 'id', from the request body example (below) to create new Tenant Profile entity." +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.thingsboard.server.common.data;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.v3.oas.annotations.media.Schema;
Expand Down Expand Up @@ -51,10 +52,11 @@ public class TenantProfile extends BaseData<TenantProfileId> implements HasName
@NoXss
@Schema(description = "Description of the tenant profile", example = "Any text")
private String description;
@Schema(description = "Default Tenant profile to be used.", example = "true")
@Schema(description = "Default Tenant profile to be used.", example = "false")
@JsonProperty("default")
private boolean isDefault;
@Schema(description = "If enabled, will push all messages related to this tenant and processed by the rule engine into separate queue. " +
"Useful for complex microservices deployments, to isolate processing of the data for specific tenants", example = "true")
"Useful for complex microservices deployments, to isolate processing of the data for specific tenants", example = "false")
private boolean isolatedTbRuleEngine;
@Schema(description = "Complex JSON object that contains profile settings: queue configs, max devices, max assets, rate limits, etc.")
private transient TenantProfileData profileData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.thingsboard.server.common.data.tenant.profile;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand All @@ -23,6 +24,7 @@
import org.thingsboard.server.common.data.EntityType;
import org.thingsboard.server.common.data.TenantProfileType;

@Schema
@AllArgsConstructor
@NoArgsConstructor
@Builder
Expand All @@ -41,34 +43,61 @@ public class DefaultTenantProfileConfiguration implements TenantProfileConfigura
private long maxOtaPackagesInBytes;
private long maxResourceSize;

@Schema(example = "1000:1,20000:60")
private String transportTenantMsgRateLimit;
@Schema(example = "1000:1,20000:60")
private String transportTenantTelemetryMsgRateLimit;
@Schema(example = "1000:1,20000:60")
private String transportTenantTelemetryDataPointsRateLimit;
@Schema(example = "20:1,600:60")
private String transportDeviceMsgRateLimit;
@Schema(example = "20:1,600:60")
private String transportDeviceTelemetryMsgRateLimit;
@Schema(example = "20:1,600:60")
private String transportDeviceTelemetryDataPointsRateLimit;
@Schema(example = "20:1,600:60")
private String transportGatewayMsgRateLimit;
@Schema(example = "20:1,600:60")
private String transportGatewayTelemetryMsgRateLimit;
@Schema(example = "20:1,600:60")
private String transportGatewayTelemetryDataPointsRateLimit;
@Schema(example = "20:1,600:60")
private String transportGatewayDeviceMsgRateLimit;
@Schema(example = "20:1,600:60")
private String transportGatewayDeviceTelemetryMsgRateLimit;
@Schema(example = "20:1,600:60")
private String transportGatewayDeviceTelemetryDataPointsRateLimit;

@Schema(example = "20:1,600:60")
private String tenantEntityExportRateLimit;
@Schema(example = "20:1,600:60")
private String tenantEntityImportRateLimit;
@Schema(example = "20:1,600:60")
private String tenantNotificationRequestsRateLimit;
@Schema(example = "20:1,600:60")
private String tenantNotificationRequestsPerRuleRateLimit;

@Schema(example = "10000000")
private long maxTransportMessages;
@Schema(example = "10000000")
private long maxTransportDataPoints;
@Schema(example = "4000000")
private long maxREExecutions;
@Schema(example = "5000000")
private long maxJSExecutions;
@Schema(example = "5000000")
private long maxTbelExecutions;
@Schema(example = "0")
private long maxDPStorageDays;
@Schema(example = "50")
private int maxRuleNodeExecutionsPerMessage;
@Schema(example = "0")
private long maxEmails;
@Schema(example = "true")
private Boolean smsEnabled;
@Schema(example = "0")
private long maxSms;
@Schema(example = "1000")
private long maxCreatedAlarms;

private String tenantServerRestLimitsConfiguration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import io.swagger.v3.oas.annotations.media.DiscriminatorMapping;
import io.swagger.v3.oas.annotations.media.Schema;
import org.thingsboard.server.common.data.ApiUsageRecordKey;
import org.thingsboard.server.common.data.TenantProfileType;

Expand All @@ -31,6 +33,7 @@
property = "type")
@JsonSubTypes({
@JsonSubTypes.Type(value = DefaultTenantProfileConfiguration.class, name = "DEFAULT")})
@Schema(discriminatorProperty = "type", discriminatorMapping = {@DiscriminatorMapping(value = "DEFAULT", schema = DefaultTenantProfileConfiguration.class)})
public interface TenantProfileConfiguration extends Serializable {

@JsonIgnore
Expand Down

0 comments on commit a6dcb8f

Please sign in to comment.