Skip to content

Commit c329352

Browse files
authored
Mgmt Spring Cloud Deployment update (Azure#14423)
* add attach for deployment * update test * fix compile warning * format code * fix test * fix checkstyle * grouping all definition * rename spring cloud test * separate some playback test * cannot remove disk from app * update session-records * fix checkstyle * Add changelog
1 parent a5acccf commit c329352

File tree

18 files changed

+2925
-388
lines changed

18 files changed

+2925
-388
lines changed

sdk/resourcemanager/azure-resourcemanager-appplatform/CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@
22

33
## 2.0.0-beta.4 (Unreleased)
44

5-
- TODO
5+
- Updated `api-version` to `2020-07-01`
6+
- Add `defineActiveDeployment` and `getActiveDeployment` in SpringApp
7+
- Removed `withoutTemporaryDisk` and `withoutPersistentDisk` in SpringAppDeployment
8+
- Removed `withSettingsFromDeployment` in SpringAppDeployment
9+
- Removed `deployJar` and `deploySource` in SpringApp
10+
- Changed `serverProperties` to `getServerProperties` and `traceProperties` to `getMonitoringSetting` in SpringService

sdk/resourcemanager/azure-resourcemanager-appplatform/src/main/java/com/azure/resourcemanager/appplatform/AppPlatformManager.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
package com.azure.resourcemanager.appplatform;
55

6-
76
import com.azure.core.credential.TokenCredential;
87
import com.azure.core.http.HttpPipeline;
98
import com.azure.resourcemanager.appplatform.implementation.SpringServicesImpl;

sdk/resourcemanager/azure-resourcemanager-appplatform/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringAppDeploymentImpl.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@
3030

3131
public class SpringAppDeploymentImpl
3232
extends ExternalChildResourceImpl<SpringAppDeployment, DeploymentResourceInner, SpringAppImpl, SpringApp>
33-
implements SpringAppDeployment, SpringAppDeployment.Definition, SpringAppDeployment.Update {
33+
implements SpringAppDeployment,
34+
SpringAppDeployment.Definition<SpringAppImpl, SpringAppDeploymentImpl>,
35+
SpringAppDeployment.Update {
3436

35-
SpringAppDeploymentImpl(String name, SpringAppImpl parent,
36-
DeploymentResourceInner innerObject) {
37+
SpringAppDeploymentImpl(String name, SpringAppImpl parent, DeploymentResourceInner innerObject) {
3738
super(name, parent, innerObject);
3839
}
3940

@@ -190,7 +191,7 @@ private Mono<Void> uploadToStorage(File source, ResourceUploadDefinition option)
190191
ShareFileAsyncClient shareFileAsyncClient = createShareFileAsyncClient(option);
191192
return shareFileAsyncClient.create(source.length())
192193
.flatMap(fileInfo -> shareFileAsyncClient.uploadFromFile(source.getAbsolutePath()))
193-
.then(Mono.empty());
194+
.then(Mono.empty());
194195
} catch (Exception e) {
195196
return Mono.error(e);
196197
}
@@ -389,4 +390,9 @@ public SpringAppDeploymentImpl update() {
389390
private AppPlatformManager manager() {
390391
return parent().manager();
391392
}
393+
394+
@Override
395+
public SpringAppImpl attach() {
396+
return parent().addActiveDeployment(this);
397+
}
392398
}

sdk/resourcemanager/azure-resourcemanager-appplatform/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringAppDeploymentsImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
public class SpringAppDeploymentsImpl
1919
extends ExternalChildResourcesNonCachedImpl<
2020
SpringAppDeploymentImpl, SpringAppDeployment, DeploymentResourceInner, SpringAppImpl, SpringApp>
21-
implements SpringAppDeployments {
21+
implements SpringAppDeployments<SpringAppDeploymentImpl> {
2222

2323
SpringAppDeploymentsImpl(SpringAppImpl parent) {
2424
super(parent, parent.taskGroup(), "SpringAppDeployment");

sdk/resourcemanager/azure-resourcemanager-appplatform/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringAppDomainsImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
public class SpringAppDomainsImpl
2121
extends ExternalChildResourcesNonCachedImpl<
22-
SpringAppDomainImpl, SpringAppDomain, CustomDomainResourceInner, SpringAppImpl, SpringApp>
22+
SpringAppDomainImpl, SpringAppDomain, CustomDomainResourceInner, SpringAppImpl, SpringApp>
2323
implements SpringAppDomains {
2424
SpringAppDomainsImpl(SpringAppImpl parent) {
2525
super(parent, parent.taskGroup(), "SpringAppDomain");

sdk/resourcemanager/azure-resourcemanager-appplatform/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringAppImpl.java

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,9 @@ public Mono<SpringAppDeployment> getActiveDeploymentAsync() {
121121
}
122122

123123
@Override
124-
public SpringAppDeployments deployments() {
125-
return deployments;
124+
@SuppressWarnings("unchecked")
125+
public <T extends SpringAppDeployment.DefinitionStages.WithCreate<T>> SpringAppDeployments<T> deployments() {
126+
return (SpringAppDeployments<T>) deployments;
126127
}
127128

128129
@Override
@@ -205,27 +206,13 @@ public SpringAppImpl withTemporaryDisk(int sizeInGB, String mountPath) {
205206
return this;
206207
}
207208

208-
@Override
209-
public SpringAppImpl withoutTemporaryDisk() {
210-
ensureProperty();
211-
inner().properties().withTemporaryDisk(null);
212-
return this;
213-
}
214-
215209
@Override
216210
public SpringAppImpl withPersistentDisk(int sizeInGB, String mountPath) {
217211
ensureProperty();
218212
inner().properties().withPersistentDisk(new PersistentDisk().withSizeInGB(sizeInGB).withMountPath(mountPath));
219213
return this;
220214
}
221215

222-
@Override
223-
public SpringAppImpl withoutPersistentDisk() {
224-
ensureProperty();
225-
inner().properties().withPersistentDisk(null);
226-
return this;
227-
}
228-
229216
@Override
230217
public SpringAppImpl withActiveDeployment(String name) {
231218
ensureProperty();
@@ -291,10 +278,26 @@ public SpringAppImpl withoutServiceBinding(String name) {
291278
return this;
292279
}
293280

294-
public void withDefaultActiveDeployment() {
281+
@Override
282+
public SpringAppImpl withDefaultActiveDeployment() {
295283
String defaultDeploymentName = "default";
296284
withActiveDeployment(defaultDeploymentName);
297285
springAppDeploymentToCreate = deployments().define(defaultDeploymentName)
298286
.withExistingSource(UserSourceType.JAR, String.format("<%s>", defaultDeploymentName));
287+
return this;
288+
}
289+
290+
@Override
291+
@SuppressWarnings("unchecked")
292+
public <T extends
293+
SpringAppDeployment.DefinitionStages.WithAttach<? extends SpringApp.DefinitionStages.WithCreate, T>>
294+
SpringAppDeployment.DefinitionStages.Blank<T> defineActiveDeployment(String name) {
295+
return (SpringAppDeployment.DefinitionStages.Blank<T>) deployments.define(name);
296+
}
297+
298+
SpringAppImpl addActiveDeployment(SpringAppDeploymentImpl deployment) {
299+
withActiveDeployment(deployment.name());
300+
springAppDeploymentToCreate = deployment;
301+
return this;
299302
}
300303
}

sdk/resourcemanager/azure-resourcemanager-appplatform/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringServiceCertificateImpl.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313

1414
public class SpringServiceCertificateImpl
1515
extends ExternalChildResourceImpl<
16-
SpringServiceCertificate, CertificateResourceInner, SpringServiceImpl, SpringService>
16+
SpringServiceCertificate, CertificateResourceInner, SpringServiceImpl, SpringService>
1717
implements SpringServiceCertificate {
18-
SpringServiceCertificateImpl(String name, SpringServiceImpl parent,
19-
CertificateResourceInner innerObject) {
18+
SpringServiceCertificateImpl(String name, SpringServiceImpl parent, CertificateResourceInner innerObject) {
2019
super(name, parent, innerObject);
2120
}
2221

sdk/resourcemanager/azure-resourcemanager-appplatform/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringServiceImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public class SpringServiceImpl
3434
SpringServiceImpl(String name, ServiceResourceInner innerObject, AppPlatformManager manager) {
3535
super(name, innerObject, manager);
3636
}
37+
3738
@Override
3839
public Sku sku() {
3940
return inner().sku();

sdk/resourcemanager/azure-resourcemanager-appplatform/src/main/java/com/azure/resourcemanager/appplatform/implementation/SpringServicesImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class SpringServicesImpl
2222
SpringService, SpringServiceImpl, ServiceResourceInner, ServicesClient, AppPlatformManager>
2323
implements SpringServices {
2424
private static final String SPRING_TYPE = "Microsoft.AppPlatform/Spring";
25+
2526
public SpringServicesImpl(AppPlatformManager manager) {
2627
super(manager.inner().getServices(), manager);
2728
}

sdk/resourcemanager/azure-resourcemanager-appplatform/src/main/java/com/azure/resourcemanager/appplatform/models/SpringApp.java

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,11 @@ public interface SpringApp
5555
/** @return the active deployment */
5656
Mono<SpringAppDeployment> getActiveDeploymentAsync();
5757

58-
/** @return the entry point of the spring app deployment */
59-
SpringAppDeployments deployments();
58+
/**
59+
* @param <T> derived type of {@link SpringAppDeployment.DefinitionStages.WithCreate}
60+
* @return the entry point of the spring app deployment
61+
*/
62+
<T extends SpringAppDeployment.DefinitionStages.WithCreate<T>> SpringAppDeployments<T> deployments();
6063

6164
/** @return the entry point of the spring app service binding */
6265
SpringAppServiceBindings serviceBindings();
@@ -72,12 +75,34 @@ public interface SpringApp
7275

7376
/** Container interface for all the definitions that need to be implemented. */
7477
interface Definition
75-
extends DefinitionStages.Blank { }
78+
extends DefinitionStages.Blank,
79+
DefinitionStages.WithCreate { }
7680

7781
/** Grouping of all the spring app definition stages. */
7882
interface DefinitionStages {
7983
/** The first stage of the spring app definition. */
80-
interface Blank extends WithCreate { }
84+
interface Blank extends WithDeployment { }
85+
86+
/**
87+
* The stage of a spring app definition allowing to specify an active deployment.
88+
*/
89+
interface WithDeployment {
90+
/**
91+
* Deploys a default package for the spring app with default scale.
92+
* @return the next stage of spring app definition
93+
*/
94+
WithCreate withDefaultActiveDeployment();
95+
96+
/**
97+
* Starts the definition of the active deployment for the spring app.
98+
* @param name the name of the deployment
99+
* @param <T> derived type of {@link SpringAppDeployment.DefinitionStages.WithAttach}
100+
* @return the first stage of spring app deployment definition
101+
*/
102+
<T extends SpringAppDeployment.DefinitionStages.WithAttach
103+
<? extends SpringApp.DefinitionStages.WithCreate, T>>
104+
SpringAppDeployment.DefinitionStages.Blank<T> defineActiveDeployment(String name);
105+
}
81106

82107
/** The stage of a spring app definition allowing to specify the endpoint. */
83108
interface WithEndpoint {
@@ -128,13 +153,6 @@ interface WithDisk {
128153
WithCreate withPersistentDisk(int sizeInGB, String mountPath);
129154
}
130155

131-
/**
132-
* The stage of a spring app definition allowing to specify an simple active deployment.
133-
* for more operations, use {@link #deployments()}
134-
*/
135-
interface WithDeployment {
136-
}
137-
138156
/** The stage of a spring app update allowing to specify the service binding. */
139157
interface WithServiceBinding {
140158
/**
@@ -234,25 +252,13 @@ interface WithDisk {
234252
*/
235253
Update withTemporaryDisk(int sizeInGB, String mountPath);
236254

237-
/**
238-
* Removes the temporary disk for the spring app.
239-
* @return the next stage of spring app update
240-
*/
241-
Update withoutTemporaryDisk();
242-
243255
/**
244256
* Specifies the persistent disk for the spring app.
245257
* @param sizeInGB the size of the disk
246258
* @param mountPath the mount path of the disk
247259
* @return the next stage of spring app update
248260
*/
249261
Update withPersistentDisk(int sizeInGB, String mountPath);
250-
251-
/**
252-
* Removes the persistent disk for the spring app.
253-
* @return the next stage of spring app update
254-
*/
255-
Update withoutPersistentDisk();
256262
}
257263

258264
/**

0 commit comments

Comments
 (0)