Skip to content

Commit

Permalink
Generated from d160e35790ff315b0ce42a090244806f6510eb28
Browse files Browse the repository at this point in the history
update oprationId
  • Loading branch information
SDK Automation committed Apr 24, 2020
1 parent 122fe3c commit 59f9292
Show file tree
Hide file tree
Showing 11 changed files with 353 additions and 118 deletions.
6 changes: 4 additions & 2 deletions sdk/resourcegraph/mgmt-v2019_04_01/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
<parent>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-arm-parent</artifactId>
<version>1.2.0</version>
<version>1.1.0</version>
<relativePath>../../../pom.management.xml</relativePath>
</parent>
<artifactId>azure-mgmt-resourcegraph</artifactId>
<version>1.0.0-beta-1</version>
<version>1.0.0-beta</version>
<packaging>jar</packaging>
<name>Microsoft Azure SDK for ResourceGraph Management</name>
<description>This package contains Microsoft ResourceGraph Management SDK.</description>
Expand Down Expand Up @@ -71,6 +71,8 @@
<artifactId>azure-arm-client-runtime</artifactId>
<type>test-jar</type>
<scope>test</scope>
<!--Below version for test jar needs to be removed, this will be done as part of v1-runtime 1.6.7-->
<version>1.6.5</version>
</dependency>
</dependencies>
<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* A facet containing additional statistics on the response of a query. Can be
* either FacetResult or FacetError.
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "resultType")
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "resultType", defaultImpl = Facet.class)
@JsonTypeName("Facet")
@JsonSubTypes({
@JsonSubTypes.Type(name = "FacetResult", value = FacetResult.class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* A facet whose execution resulted in an error.
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "resultType")
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "resultType", defaultImpl = FacetError.class)
@JsonTypeName("FacetError")
public class FacetError extends Facet {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Successfully executed facet containing additional statistics on the response
* of a query.
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "resultType")
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "resultType", defaultImpl = FacetResult.class)
@JsonTypeName("FacetResult")
public class FacetResult extends Facet {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/

package com.microsoft.azure.management.resourcegraph.v2019_04_01;

import com.microsoft.azure.arm.model.HasInner;
import com.microsoft.azure.arm.resources.models.HasManager;
import com.microsoft.azure.management.resourcegraph.v2019_04_01.implementation.ResourceGraphManager;
import com.microsoft.azure.management.resourcegraph.v2019_04_01.implementation.QueryResponseInner;
import java.util.List;

/**
* Type representing QueryResponse.
*/
public interface QueryResponse extends HasInner<QueryResponseInner>, HasManager<ResourceGraphManager> {
/**
* @return the count value.
*/
long count();

/**
* @return the data value.
*/
Object data();

/**
* @return the facets value.
*/
List<Facet> facets();

/**
* @return the resultTruncated value.
*/
ResultTruncated resultTruncated();

/**
* @return the skipToken value.
*/
String skipToken();

/**
* @return the totalRecords value.
*/
long totalRecords();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/

package com.microsoft.azure.management.resourcegraph.v2019_04_01;

import rx.Observable;
import com.microsoft.azure.management.resourcegraph.v2019_04_01.implementation.QuerysInner;
import com.microsoft.azure.arm.model.HasInner;

/**
* Type representing Querys.
*/
public interface Querys extends HasInner<QuerysInner> {
/**
* Queries the resources managed by Azure Resource Manager for all subscriptions specified in the request.
*
* @param query Request specifying query and its options.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
Observable<QueryResponse> resourcesAsync(QueryRequest query);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/

package com.microsoft.azure.management.resourcegraph.v2019_04_01.implementation;

import com.microsoft.azure.management.resourcegraph.v2019_04_01.QueryResponse;
import com.microsoft.azure.arm.model.implementation.WrapperImpl;
import java.util.List;
import com.microsoft.azure.management.resourcegraph.v2019_04_01.Facet;
import com.microsoft.azure.management.resourcegraph.v2019_04_01.ResultTruncated;

class QueryResponseImpl extends WrapperImpl<QueryResponseInner> implements QueryResponse {
private final ResourceGraphManager manager;
QueryResponseImpl(QueryResponseInner inner, ResourceGraphManager manager) {
super(inner);
this.manager = manager;
}

@Override
public ResourceGraphManager manager() {
return this.manager;
}

@Override
public long count() {
return this.inner().count();
}

@Override
public Object data() {
return this.inner().data();
}

@Override
public List<Facet> facets() {
return this.inner().facets();
}

@Override
public ResultTruncated resultTruncated() {
return this.inner().resultTruncated();
}

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

@Override
public long totalRecords() {
return this.inner().totalRecords();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* abc
*/

package com.microsoft.azure.management.resourcegraph.v2019_04_01.implementation;

import com.microsoft.azure.arm.model.implementation.WrapperImpl;
import com.microsoft.azure.management.resourcegraph.v2019_04_01.Querys;
import rx.functions.Func1;
import rx.Observable;
import com.microsoft.azure.management.resourcegraph.v2019_04_01.QueryResponse;
import com.microsoft.azure.management.resourcegraph.v2019_04_01.QueryRequest;

class QuerysImpl extends WrapperImpl<QuerysInner> implements Querys {
private final ResourceGraphManager manager;

QuerysImpl(ResourceGraphManager manager) {
super(manager.inner().querys());
this.manager = manager;
}

public ResourceGraphManager manager() {
return this.manager;
}

@Override
public Observable<QueryResponse> resourcesAsync(QueryRequest query) {
QuerysInner client = this.inner();
return client.resourcesAsync(query)
.map(new Func1<QueryResponseInner, QueryResponse>() {
@Override
public QueryResponse call(QueryResponseInner inner) {
return new QueryResponseImpl(inner, manager());
}
});
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/

package com.microsoft.azure.management.resourcegraph.v2019_04_01.implementation;

import retrofit2.Retrofit;
import com.google.common.reflect.TypeToken;
import com.microsoft.azure.management.resourcegraph.v2019_04_01.ErrorResponseException;
import com.microsoft.azure.management.resourcegraph.v2019_04_01.QueryRequest;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.Validator;
import java.io.IOException;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.Response;
import rx.functions.Func1;
import rx.Observable;

/**
* An instance of this class provides access to all the operations defined
* in Querys.
*/
public class QuerysInner {
/** The Retrofit service to perform REST calls. */
private QuerysService service;
/** The service client containing this operation class. */
private ResourceGraphClientImpl client;

/**
* Initializes an instance of QuerysInner.
*
* @param retrofit the Retrofit instance built from a Retrofit Builder.
* @param client the instance of the service client containing this operation class.
*/
public QuerysInner(Retrofit retrofit, ResourceGraphClientImpl client) {
this.service = retrofit.create(QuerysService.class);
this.client = client;
}

/**
* The interface defining all the services for Querys to be
* used by Retrofit to perform actually REST calls.
*/
interface QuerysService {
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resourcegraph.v2019_04_01.Querys resources" })
@POST("providers/Microsoft.ResourceGraph/resources")
Observable<Response<ResponseBody>> resources(@Query("api-version") String apiVersion, @Body QueryRequest query, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

}

/**
* Queries the resources managed by Azure Resource Manager for all subscriptions specified in the request.
*
* @param query Request specifying query and its options.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws ErrorResponseException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the QueryResponseInner object if successful.
*/
public QueryResponseInner resources(QueryRequest query) {
return resourcesWithServiceResponseAsync(query).toBlocking().single().body();
}

/**
* Queries the resources managed by Azure Resource Manager for all subscriptions specified in the request.
*
* @param query Request specifying query and its options.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<QueryResponseInner> resourcesAsync(QueryRequest query, final ServiceCallback<QueryResponseInner> serviceCallback) {
return ServiceFuture.fromResponse(resourcesWithServiceResponseAsync(query), serviceCallback);
}

/**
* Queries the resources managed by Azure Resource Manager for all subscriptions specified in the request.
*
* @param query Request specifying query and its options.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the QueryResponseInner object
*/
public Observable<QueryResponseInner> resourcesAsync(QueryRequest query) {
return resourcesWithServiceResponseAsync(query).map(new Func1<ServiceResponse<QueryResponseInner>, QueryResponseInner>() {
@Override
public QueryResponseInner call(ServiceResponse<QueryResponseInner> response) {
return response.body();
}
});
}

/**
* Queries the resources managed by Azure Resource Manager for all subscriptions specified in the request.
*
* @param query Request specifying query and its options.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the QueryResponseInner object
*/
public Observable<ServiceResponse<QueryResponseInner>> resourcesWithServiceResponseAsync(QueryRequest query) {
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
if (query == null) {
throw new IllegalArgumentException("Parameter query is required and cannot be null.");
}
Validator.validate(query);
return service.resources(this.client.apiVersion(), query, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<QueryResponseInner>>>() {
@Override
public Observable<ServiceResponse<QueryResponseInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<QueryResponseInner> clientResponse = resourcesDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}

private ServiceResponse<QueryResponseInner> resourcesDelegate(Response<ResponseBody> response) throws ErrorResponseException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<QueryResponseInner, ErrorResponseException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<QueryResponseInner>() { }.getType())
.registerError(ErrorResponseException.class)
.build(response);
}

}
Loading

0 comments on commit 59f9292

Please sign in to comment.