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

[AutoPR sql/resource-manager] Sqldb serverless #3462

Merged
merged 1 commit into from
Apr 25, 2019
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
Expand Up @@ -25,6 +25,11 @@
* Type representing Database.
*/
public interface Database extends HasInner<DatabaseInner>, Indexable, Refreshable<Database>, Updatable<Database.Update>, HasManager<SqlManager> {
/**
* @return the autoPauseDelay value.
*/
Integer autoPauseDelay();

/**
* @return the catalogCollation value.
*/
Expand Down Expand Up @@ -120,6 +125,11 @@ public interface Database extends HasInner<DatabaseInner>, Indexable, Refreshabl
*/
Long maxSizeBytes();

/**
* @return the minCapacity value.
*/
Double minCapacity();

/**
* @return the name value.
*/
Expand Down Expand Up @@ -231,6 +241,16 @@ interface WithLocation {
WithCreate withLocation(String location);
}

/**
* The stage of the database definition allowing to specify AutoPauseDelay.
*/
interface WithAutoPauseDelay {
/**
* Specifies autoPauseDelay.
*/
WithCreate withAutoPauseDelay(Integer autoPauseDelay);
}

/**
* The stage of the database definition allowing to specify CatalogCollation.
*/
Expand Down Expand Up @@ -301,6 +321,16 @@ interface WithMaxSizeBytes {
WithCreate withMaxSizeBytes(Long maxSizeBytes);
}

/**
* The stage of the database definition allowing to specify MinCapacity.
*/
interface WithMinCapacity {
/**
* Specifies minCapacity.
*/
WithCreate withMinCapacity(Double minCapacity);
}

/**
* The stage of the database definition allowing to specify ReadScale.
*/
Expand Down Expand Up @@ -416,19 +446,29 @@ interface WithZoneRedundant {
* the resource to be created (via {@link WithCreate#create()}), but also allows
* for any other optional settings to be specified.
*/
interface WithCreate extends Creatable<Database>, DefinitionStages.WithCatalogCollation, DefinitionStages.WithCollation, DefinitionStages.WithCreateMode, DefinitionStages.WithElasticPoolId, DefinitionStages.WithLicenseType, DefinitionStages.WithLongTermRetentionBackupResourceId, DefinitionStages.WithMaxSizeBytes, DefinitionStages.WithReadScale, DefinitionStages.WithRecoverableDatabaseId, DefinitionStages.WithRecoveryServicesRecoveryPointId, DefinitionStages.WithRestorableDroppedDatabaseId, DefinitionStages.WithRestorePointInTime, DefinitionStages.WithSampleName, DefinitionStages.WithSku, DefinitionStages.WithSourceDatabaseDeletionDate, DefinitionStages.WithSourceDatabaseId, DefinitionStages.WithTags, DefinitionStages.WithZoneRedundant {
interface WithCreate extends Creatable<Database>, DefinitionStages.WithAutoPauseDelay, DefinitionStages.WithCatalogCollation, DefinitionStages.WithCollation, DefinitionStages.WithCreateMode, DefinitionStages.WithElasticPoolId, DefinitionStages.WithLicenseType, DefinitionStages.WithLongTermRetentionBackupResourceId, DefinitionStages.WithMaxSizeBytes, DefinitionStages.WithMinCapacity, DefinitionStages.WithReadScale, DefinitionStages.WithRecoverableDatabaseId, DefinitionStages.WithRecoveryServicesRecoveryPointId, DefinitionStages.WithRestorableDroppedDatabaseId, DefinitionStages.WithRestorePointInTime, DefinitionStages.WithSampleName, DefinitionStages.WithSku, DefinitionStages.WithSourceDatabaseDeletionDate, DefinitionStages.WithSourceDatabaseId, DefinitionStages.WithTags, DefinitionStages.WithZoneRedundant {
}
}
/**
* The template for a Database update operation, containing all the settings that can be modified.
*/
interface Update extends Appliable<Database>, UpdateStages.WithCatalogCollation, UpdateStages.WithCollation, UpdateStages.WithCreateMode, UpdateStages.WithElasticPoolId, UpdateStages.WithLicenseType, UpdateStages.WithLongTermRetentionBackupResourceId, UpdateStages.WithMaxSizeBytes, UpdateStages.WithReadScale, UpdateStages.WithRecoverableDatabaseId, UpdateStages.WithRecoveryServicesRecoveryPointId, UpdateStages.WithRestorableDroppedDatabaseId, UpdateStages.WithRestorePointInTime, UpdateStages.WithSampleName, UpdateStages.WithSku, UpdateStages.WithSourceDatabaseDeletionDate, UpdateStages.WithSourceDatabaseId, UpdateStages.WithTags, UpdateStages.WithZoneRedundant {
interface Update extends Appliable<Database>, UpdateStages.WithAutoPauseDelay, UpdateStages.WithCatalogCollation, UpdateStages.WithCollation, UpdateStages.WithCreateMode, UpdateStages.WithElasticPoolId, UpdateStages.WithLicenseType, UpdateStages.WithLongTermRetentionBackupResourceId, UpdateStages.WithMaxSizeBytes, UpdateStages.WithMinCapacity, UpdateStages.WithReadScale, UpdateStages.WithRecoverableDatabaseId, UpdateStages.WithRecoveryServicesRecoveryPointId, UpdateStages.WithRestorableDroppedDatabaseId, UpdateStages.WithRestorePointInTime, UpdateStages.WithSampleName, UpdateStages.WithSku, UpdateStages.WithSourceDatabaseDeletionDate, UpdateStages.WithSourceDatabaseId, UpdateStages.WithTags, UpdateStages.WithZoneRedundant {
}

/**
* Grouping of Database update stages.
*/
interface UpdateStages {
/**
* The stage of the database update allowing to specify AutoPauseDelay.
*/
interface WithAutoPauseDelay {
/**
* Specifies autoPauseDelay.
*/
Update withAutoPauseDelay(Integer autoPauseDelay);
}

/**
* The stage of the database update allowing to specify CatalogCollation.
*/
Expand Down Expand Up @@ -499,6 +539,16 @@ interface WithMaxSizeBytes {
Update withMaxSizeBytes(Long maxSizeBytes);
}

/**
* The stage of the database update allowing to specify MinCapacity.
*/
interface WithMinCapacity {
/**
* Specifies minCapacity.
*/
Update withMinCapacity(Double minCapacity);
}

/**
* The stage of the database update allowing to specify ReadScale.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,20 @@ public class DatabaseUpdate {
@JsonProperty(value = "properties.currentSku", access = JsonProperty.Access.WRITE_ONLY)
private Sku currentSku;

/**
* Time in minutes after which database is automatically paused. A value of
* -1 means that automatic pause is disabled.
*/
@JsonProperty(value = "properties.autoPauseDelay")
private Integer autoPauseDelay;

/**
* Minimal capacity that database will always have allocated, if not
* paused.
*/
@JsonProperty(value = "properties.minCapacity")
private Double minCapacity;

/**
* Resource tags.
*/
Expand Down Expand Up @@ -689,6 +703,46 @@ public Sku currentSku() {
return this.currentSku;
}

/**
* Get time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled.
*
* @return the autoPauseDelay value
*/
public Integer autoPauseDelay() {
return this.autoPauseDelay;
}

/**
* Set time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled.
*
* @param autoPauseDelay the autoPauseDelay value to set
* @return the DatabaseUpdate object itself.
*/
public DatabaseUpdate withAutoPauseDelay(Integer autoPauseDelay) {
this.autoPauseDelay = autoPauseDelay;
return this;
}

/**
* Get minimal capacity that database will always have allocated, if not paused.
*
* @return the minCapacity value
*/
public Double minCapacity() {
return this.minCapacity;
}

/**
* Set minimal capacity that database will always have allocated, if not paused.
*
* @param minCapacity the minCapacity value to set
* @return the DatabaseUpdate object itself.
*/
public DatabaseUpdate withMinCapacity(Double minCapacity) {
this.minCapacity = minCapacity;
return this;
}

/**
* Get resource tags.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ private void resetCreateUpdateParameters() {
this.updateParameter = new DatabaseUpdate();
}

@Override
public Integer autoPauseDelay() {
return this.inner().autoPauseDelay();
}

@Override
public CatalogCollationType catalogCollation() {
return this.inner().catalogCollation();
Expand Down Expand Up @@ -196,6 +201,11 @@ public Long maxSizeBytes() {
return this.inner().maxSizeBytes();
}

@Override
public Double minCapacity() {
return this.inner().minCapacity();
}

@Override
public String name() {
return this.inner().name();
Expand Down Expand Up @@ -284,6 +294,16 @@ public DatabaseImpl withLocation(String location) {
return this;
}

@Override
public DatabaseImpl withAutoPauseDelay(Integer autoPauseDelay) {
if (isInCreateMode()) {
this.inner().withAutoPauseDelay(autoPauseDelay);
} else {
this.updateParameter.withAutoPauseDelay(autoPauseDelay);
}
return this;
}

@Override
public DatabaseImpl withCatalogCollation(CatalogCollationType catalogCollation) {
if (isInCreateMode()) {
Expand Down Expand Up @@ -354,6 +374,16 @@ public DatabaseImpl withMaxSizeBytes(Long maxSizeBytes) {
return this;
}

@Override
public DatabaseImpl withMinCapacity(Double minCapacity) {
if (isInCreateMode()) {
this.inner().withMinCapacity(minCapacity);
} else {
this.updateParameter.withMinCapacity(minCapacity);
}
return this;
}

@Override
public DatabaseImpl withReadScale(DatabaseReadScale readScale) {
if (isInCreateMode()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,20 @@ public class DatabaseInner extends Resource {
@JsonProperty(value = "properties.currentSku", access = JsonProperty.Access.WRITE_ONLY)
private Sku currentSku;

/**
* Time in minutes after which database is automatically paused. A value of
* -1 means that automatic pause is disabled.
*/
@JsonProperty(value = "properties.autoPauseDelay")
private Integer autoPauseDelay;

/**
* Minimal capacity that database will always have allocated, if not
* paused.
*/
@JsonProperty(value = "properties.minCapacity")
private Double minCapacity;

/**
* Get the name and tier of the SKU.
*
Expand Down Expand Up @@ -720,4 +734,44 @@ public Sku currentSku() {
return this.currentSku;
}

/**
* Get time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled.
*
* @return the autoPauseDelay value
*/
public Integer autoPauseDelay() {
return this.autoPauseDelay;
}

/**
* Set time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled.
*
* @param autoPauseDelay the autoPauseDelay value to set
* @return the DatabaseInner object itself.
*/
public DatabaseInner withAutoPauseDelay(Integer autoPauseDelay) {
this.autoPauseDelay = autoPauseDelay;
return this;
}

/**
* Get minimal capacity that database will always have allocated, if not paused.
*
* @return the minCapacity value
*/
public Double minCapacity() {
return this.minCapacity;
}

/**
* Set minimal capacity that database will always have allocated, if not paused.
*
* @param minCapacity the minCapacity value to set
* @return the DatabaseInner object itself.
*/
public DatabaseInner withMinCapacity(Double minCapacity) {
this.minCapacity = minCapacity;
return this;
}

}