Skip to content

Commit

Permalink
Mgmt Appplatform: custom domain, certificate and samples (#13127)
Browse files Browse the repository at this point in the history
* add interface for left api

* add impl

* add test for custom domain

* update specs

* regen

* fix compile error

* add app platform sample

* add samples.json remaining wrong filepath

* fix checkstyle

* fix checkstyle

* disconnect in finally
  • Loading branch information
ChenTanyi authored Jul 16, 2020
1 parent de27b1b commit 921a204
Show file tree
Hide file tree
Showing 35 changed files with 1,705 additions and 83 deletions.
24 changes: 24 additions & 0 deletions sdk/appplatform/mgmt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,30 @@
<artifactId>azure-identity</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-security-keyvault-certificates</artifactId>
<version>4.0.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-keyvault</artifactId>
<version>2.0.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-dns</artifactId>
<version>2.0.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-appservice</artifactId>
<version>2.0.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
import com.azure.resourcemanager.appplatform.AppPlatformManagementClient;
import com.azure.resourcemanager.appplatform.fluent.inner.CustomDomainResourceCollectionInner;
import com.azure.resourcemanager.appplatform.fluent.inner.CustomDomainResourceInner;
import com.azure.resourcemanager.appplatform.fluent.inner.CustomDomainValidateResultInner;
import com.azure.resourcemanager.appplatform.models.CustomDomainProperties;
import com.azure.resourcemanager.appplatform.models.CustomDomainValidatePayload;
import com.azure.resourcemanager.appplatform.models.CustomDomainValidateResult;
import reactor.core.publisher.Mono;

/** An instance of this class provides access to all the operations defined in CustomDomains. */
Expand Down Expand Up @@ -153,7 +153,7 @@ Mono<Response<CustomDomainResourceCollectionInner>> list(
+ "/{serviceName}/apps/{appName}/domains/validate")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<CustomDomainValidateResultInner>> validate(
Mono<Response<CustomDomainValidateResult>> validate(
@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Expand Down Expand Up @@ -1273,7 +1273,7 @@ public PagedIterable<CustomDomainResourceInner> list(
* @return validation result for custom domain.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<CustomDomainValidateResultInner>> validateWithResponseAsync(
public Mono<Response<CustomDomainValidateResult>> validateWithResponseAsync(
String resourceGroupName, String serviceName, String appName, String name) {
if (this.client.getEndpoint() == null) {
return Mono
Expand Down Expand Up @@ -1333,7 +1333,7 @@ public Mono<Response<CustomDomainValidateResultInner>> validateWithResponseAsync
* @return validation result for custom domain.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<CustomDomainValidateResultInner>> validateWithResponseAsync(
public Mono<Response<CustomDomainValidateResult>> validateWithResponseAsync(
String resourceGroupName, String serviceName, String appName, String name, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
Expand Down Expand Up @@ -1388,11 +1388,11 @@ public Mono<Response<CustomDomainValidateResultInner>> validateWithResponseAsync
* @return validation result for custom domain.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<CustomDomainValidateResultInner> validateAsync(
public Mono<CustomDomainValidateResult> validateAsync(
String resourceGroupName, String serviceName, String appName, String name) {
return validateWithResponseAsync(resourceGroupName, serviceName, appName, name)
.flatMap(
(Response<CustomDomainValidateResultInner> res) -> {
(Response<CustomDomainValidateResult> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
Expand All @@ -1416,11 +1416,11 @@ public Mono<CustomDomainValidateResultInner> validateAsync(
* @return validation result for custom domain.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<CustomDomainValidateResultInner> validateAsync(
public Mono<CustomDomainValidateResult> validateAsync(
String resourceGroupName, String serviceName, String appName, String name, Context context) {
return validateWithResponseAsync(resourceGroupName, serviceName, appName, name, context)
.flatMap(
(Response<CustomDomainValidateResultInner> res) -> {
(Response<CustomDomainValidateResult> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
Expand All @@ -1443,7 +1443,7 @@ public Mono<CustomDomainValidateResultInner> validateAsync(
* @return validation result for custom domain.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public CustomDomainValidateResultInner validate(
public CustomDomainValidateResult validate(
String resourceGroupName, String serviceName, String appName, String name) {
return validateAsync(resourceGroupName, serviceName, appName, name).block();
}
Expand All @@ -1463,7 +1463,7 @@ public CustomDomainValidateResultInner validate(
* @return validation result for custom domain.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public CustomDomainValidateResultInner validate(
public CustomDomainValidateResult validate(
String resourceGroupName, String serviceName, String appName, String name, Context context) {
return validateAsync(resourceGroupName, serviceName, appName, name, context).block();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
import com.azure.core.util.polling.PollerFlux;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.appplatform.AppPlatformManagementClient;
import com.azure.resourcemanager.appplatform.fluent.inner.NameAvailabilityInner;
import com.azure.resourcemanager.appplatform.fluent.inner.ServiceResourceInner;
import com.azure.resourcemanager.appplatform.fluent.inner.ServiceResourceListInner;
import com.azure.resourcemanager.appplatform.models.NameAvailability;
import com.azure.resourcemanager.appplatform.models.NameAvailabilityParameters;
import com.azure.resourcemanager.appplatform.models.RegenerateTestKeyRequestPayload;
import com.azure.resourcemanager.appplatform.models.TestKeyType;
Expand Down Expand Up @@ -199,7 +199,7 @@ Mono<Response<TestKeys>> enableTestEndpoint(
+ "/checkNameAvailability")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<NameAvailabilityInner>> checkNameAvailability(
Mono<Response<NameAvailability>> checkNameAvailability(
@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Expand Down Expand Up @@ -1856,7 +1856,7 @@ public TestKeys enableTestEndpoint(String resourceGroupName, String serviceName,
* @return name availability result payload.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<NameAvailabilityInner>> checkNameAvailabilityWithResponseAsync(
public Mono<Response<NameAvailability>> checkNameAvailabilityWithResponseAsync(
String location, NameAvailabilityParameters availabilityParameters) {
if (this.client.getEndpoint() == null) {
return Mono
Expand Down Expand Up @@ -1906,7 +1906,7 @@ public Mono<Response<NameAvailabilityInner>> checkNameAvailabilityWithResponseAs
* @return name availability result payload.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<NameAvailabilityInner>> checkNameAvailabilityWithResponseAsync(
public Mono<Response<NameAvailability>> checkNameAvailabilityWithResponseAsync(
String location, NameAvailabilityParameters availabilityParameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
Expand Down Expand Up @@ -1951,11 +1951,11 @@ public Mono<Response<NameAvailabilityInner>> checkNameAvailabilityWithResponseAs
* @return name availability result payload.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<NameAvailabilityInner> checkNameAvailabilityAsync(
public Mono<NameAvailability> checkNameAvailabilityAsync(
String location, NameAvailabilityParameters availabilityParameters) {
return checkNameAvailabilityWithResponseAsync(location, availabilityParameters)
.flatMap(
(Response<NameAvailabilityInner> res) -> {
(Response<NameAvailability> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
Expand All @@ -1976,11 +1976,11 @@ public Mono<NameAvailabilityInner> checkNameAvailabilityAsync(
* @return name availability result payload.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<NameAvailabilityInner> checkNameAvailabilityAsync(
public Mono<NameAvailability> checkNameAvailabilityAsync(
String location, NameAvailabilityParameters availabilityParameters, Context context) {
return checkNameAvailabilityWithResponseAsync(location, availabilityParameters, context)
.flatMap(
(Response<NameAvailabilityInner> res) -> {
(Response<NameAvailability> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
Expand All @@ -2000,8 +2000,7 @@ public Mono<NameAvailabilityInner> checkNameAvailabilityAsync(
* @return name availability result payload.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public NameAvailabilityInner checkNameAvailability(
String location, NameAvailabilityParameters availabilityParameters) {
public NameAvailability checkNameAvailability(String location, NameAvailabilityParameters availabilityParameters) {
return checkNameAvailabilityAsync(location, availabilityParameters).block();
}

Expand All @@ -2017,7 +2016,7 @@ public NameAvailabilityInner checkNameAvailability(
* @return name availability result payload.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public NameAvailabilityInner checkNameAvailability(
public NameAvailability checkNameAvailability(
String location, NameAvailabilityParameters availabilityParameters, Context context) {
return checkNameAvailabilityAsync(location, availabilityParameters, context).block();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,42 @@ public List<DeploymentInstance> instances() {
return inner().properties().instances();
}

@Override
public void start() {
startAsync().block();
}

@Override
public Mono<Void> startAsync() {
return manager().inner().getDeployments().startAsync(
parent().parent().resourceGroupName(), parent().parent().name(), parent().name(), name()
);
}

@Override
public void stop() {
stopAsync().block();
}

@Override
public Mono<Void> stopAsync() {
return manager().inner().getDeployments().stopAsync(
parent().parent().resourceGroupName(), parent().parent().name(), parent().name(), name()
);
}

@Override
public void restart() {
restartAsync().block();
}

@Override
public Mono<Void> restartAsync() {
return manager().inner().getDeployments().restartAsync(
parent().parent().resourceGroupName(), parent().parent().name(), parent().name(), name()
);
}

@Override
public String getLogFileUrl() {
return getLogFileUrlAsync().block();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.resourcemanager.appplatform.implementation;

import com.azure.resourcemanager.appplatform.AppPlatformManager;
import com.azure.resourcemanager.appplatform.fluent.inner.CustomDomainResourceInner;
import com.azure.resourcemanager.appplatform.models.CustomDomainProperties;
import com.azure.resourcemanager.appplatform.models.SpringApp;
import com.azure.resourcemanager.appplatform.models.SpringAppDomain;
import com.azure.resourcemanager.resources.fluentcore.arm.models.implementation.ExternalChildResourceImpl;
import reactor.core.publisher.Mono;

public class SpringAppDomainImpl
extends ExternalChildResourceImpl<SpringAppDomain, CustomDomainResourceInner, SpringAppImpl, SpringApp>
implements SpringAppDomain {
SpringAppDomainImpl(String name, SpringAppImpl parent, CustomDomainResourceInner innerObject) {
super(name, parent, innerObject);
}

@Override
public Mono<SpringAppDomain> createResourceAsync() {
return manager().inner().getCustomDomains().createOrUpdateAsync(
parent().parent().resourceGroupName(), parent().parent().name(), parent().name(), name(), properties()
)
.map(inner -> {
setInner(inner);
return this;
});
}

@Override
public Mono<SpringAppDomain> updateResourceAsync() {
return createResourceAsync();
}

@Override
public Mono<Void> deleteResourceAsync() {
return manager().inner().getBindings().deleteAsync(
parent().parent().resourceGroupName(), parent().parent().name(), parent().name(), name()
);
}

@Override
protected Mono<CustomDomainResourceInner> getInnerAsync() {
return manager().inner().getCustomDomains().getAsync(
parent().parent().resourceGroupName(), parent().parent().name(), parent().name(), name()
);
}

@Override
public String id() {
return inner().id();
}

@Override
public CustomDomainProperties properties() {
return inner().properties();
}

private AppPlatformManager manager() {
return parent().manager();
}
}
Loading

0 comments on commit 921a204

Please sign in to comment.