Skip to content

Commit

Permalink
sync tests (#3013)
Browse files Browse the repository at this point in the history
  • Loading branch information
weidongxu-microsoft authored Jan 16, 2025
1 parent b92616b commit 0077e4b
Show file tree
Hide file tree
Showing 76 changed files with 8,004 additions and 349 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
package azure.resourcemanager.operationtemplates;

import azure.resourcemanager.operationtemplates.fluent.OperationTemplatesClient;
import azure.resourcemanager.operationtemplates.implementation.CheckNameAvailabilitiesImpl;
import azure.resourcemanager.operationtemplates.implementation.LroesImpl;
import azure.resourcemanager.operationtemplates.implementation.OperationTemplatesClientBuilder;
import azure.resourcemanager.operationtemplates.implementation.OperationsImpl;
import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilities;
import azure.resourcemanager.operationtemplates.models.Lroes;
import azure.resourcemanager.operationtemplates.models.Operations;
import com.azure.core.credential.TokenCredential;
import com.azure.core.http.HttpClient;
import com.azure.core.http.HttpPipeline;
Expand Down Expand Up @@ -39,6 +43,10 @@
* Arm Resource Provider management API.
*/
public final class OperationTemplatesManager {
private Operations operations;

private CheckNameAvailabilities checkNameAvailabilities;

private Lroes lroes;

private final OperationTemplatesClient clientObject;
Expand Down Expand Up @@ -251,6 +259,31 @@ public OperationTemplatesManager authenticate(TokenCredential credential, AzureP
}
}

/**
* Gets the resource collection API of Operations.
*
* @return Resource collection API of Operations.
*/
public Operations operations() {
if (this.operations == null) {
this.operations = new OperationsImpl(clientObject.getOperations(), this);
}
return operations;
}

/**
* Gets the resource collection API of CheckNameAvailabilities.
*
* @return Resource collection API of CheckNameAvailabilities.
*/
public CheckNameAvailabilities checkNameAvailabilities() {
if (this.checkNameAvailabilities == null) {
this.checkNameAvailabilities
= new CheckNameAvailabilitiesImpl(clientObject.getCheckNameAvailabilities(), this);
}
return checkNameAvailabilities;
}

/**
* Gets the resource collection API of Lroes. It manages Order.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package azure.resourcemanager.operationtemplates.fluent;

import azure.resourcemanager.operationtemplates.fluent.models.CheckNameAvailabilityResponseInner;
import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityRequest;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;

/**
* An instance of this class provides access to all the operations defined in CheckNameAvailabilitiesClient.
*/
public interface CheckNameAvailabilitiesClient {
/**
* Implements global CheckNameAvailability operations.
*
* @param body The CheckAvailability request.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the check availability result along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<CheckNameAvailabilityResponseInner> checkGlobalWithResponse(CheckNameAvailabilityRequest body,
Context context);

/**
* Implements global CheckNameAvailability operations.
*
* @param body The CheckAvailability request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the check availability result.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
CheckNameAvailabilityResponseInner checkGlobal(CheckNameAvailabilityRequest body);

/**
* Implements local CheckNameAvailability operations.
*
* @param location The name of the Azure region.
* @param body The CheckAvailability request.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the check availability result along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<CheckNameAvailabilityResponseInner> checkLocalWithResponse(String location,
CheckNameAvailabilityRequest body, Context context);

/**
* Implements local CheckNameAvailability operations.
*
* @param location The name of the Azure region.
* @param body The CheckAvailability request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the check availability result.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
CheckNameAvailabilityResponseInner checkLocal(String location, CheckNameAvailabilityRequest body);
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,20 @@ public interface OperationTemplatesClient {
*/
Duration getDefaultPollInterval();

/**
* Gets the OperationsClient object to access its operations.
*
* @return the OperationsClient object.
*/
OperationsClient getOperations();

/**
* Gets the CheckNameAvailabilitiesClient object to access its operations.
*
* @return the CheckNameAvailabilitiesClient object.
*/
CheckNameAvailabilitiesClient getCheckNameAvailabilities();

/**
* Gets the LroesClient object to access its operations.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package azure.resourcemanager.operationtemplates.fluent;

import azure.resourcemanager.operationtemplates.fluent.models.OperationInner;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.util.Context;

/**
* An instance of this class provides access to all the operations defined in OperationsClient.
*/
public interface OperationsClient {
/**
* List the operations for the provider.
*
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of REST API operations supported by an Azure Resource Provider as paginated response with
* {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<OperationInner> list();

/**
* List the operations for the provider.
*
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of REST API operations supported by an Azure Resource Provider as paginated response with
* {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<OperationInner> list(Context context);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package azure.resourcemanager.operationtemplates.fluent.models;

import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityReason;
import com.azure.core.annotation.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
* The check availability result.
*/
@Immutable
public final class CheckNameAvailabilityResponseInner implements JsonSerializable<CheckNameAvailabilityResponseInner> {
/*
* Indicates if the resource name is available.
*/
private Boolean nameAvailable;

/*
* The reason why the given name is not available.
*/
private CheckNameAvailabilityReason reason;

/*
* Detailed reason why the given name is not available.
*/
private String message;

/**
* Creates an instance of CheckNameAvailabilityResponseInner class.
*/
private CheckNameAvailabilityResponseInner() {
}

/**
* Get the nameAvailable property: Indicates if the resource name is available.
*
* @return the nameAvailable value.
*/
public Boolean nameAvailable() {
return this.nameAvailable;
}

/**
* Get the reason property: The reason why the given name is not available.
*
* @return the reason value.
*/
public CheckNameAvailabilityReason reason() {
return this.reason;
}

/**
* Get the message property: Detailed reason why the given name is not available.
*
* @return the message value.
*/
public String message() {
return this.message;
}

/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
}

/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeBooleanField("nameAvailable", this.nameAvailable);
jsonWriter.writeStringField("reason", this.reason == null ? null : this.reason.toString());
jsonWriter.writeStringField("message", this.message);
return jsonWriter.writeEndObject();
}

/**
* Reads an instance of CheckNameAvailabilityResponseInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of CheckNameAvailabilityResponseInner if the JsonReader was pointing to an instance of it, or
* null if it was pointing to JSON null.
* @throws IOException If an error occurs while reading the CheckNameAvailabilityResponseInner.
*/
public static CheckNameAvailabilityResponseInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
CheckNameAvailabilityResponseInner deserializedCheckNameAvailabilityResponseInner
= new CheckNameAvailabilityResponseInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();

if ("nameAvailable".equals(fieldName)) {
deserializedCheckNameAvailabilityResponseInner.nameAvailable
= reader.getNullable(JsonReader::getBoolean);
} else if ("reason".equals(fieldName)) {
deserializedCheckNameAvailabilityResponseInner.reason
= CheckNameAvailabilityReason.fromString(reader.getString());
} else if ("message".equals(fieldName)) {
deserializedCheckNameAvailabilityResponseInner.message = reader.getString();
} else {
reader.skipChildren();
}
}

return deserializedCheckNameAvailabilityResponseInner;
});
}
}
Loading

0 comments on commit 0077e4b

Please sign in to comment.