Skip to content

Commit

Permalink
Eg remove extra publishresult (#39923)
Browse files Browse the repository at this point in the history
* Remove extra unused files (and package)

* Roll forward to new tsp, pick up latest version change and some API removals.

* checkstyle fix
  • Loading branch information
billwert authored Apr 26, 2024
1 parent 71214ad commit c43c132
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 880 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,15 @@ public void customizeEventGridClientImplImports(LibraryCustomization customizati
PackageCustomization packageCustomization = customization.getPackage(p);
packageCustomization.listClasses().forEach(c -> {
c.customizeAst(comp -> {
logger.info("Got here");
comp.getImports().removeIf(i -> i.getNameAsString().equals("com.azure.messaging.eventgrid.namespaces.implementation.models.CloudEvent"));
comp.addImport("com.azure.core.models.CloudEvent");
if (comp.getImports().removeIf(i -> i.getNameAsString().equals("com.azure.messaging.eventgrid.namespaces.models.CloudEvent"))) {
logger.info("Removed CloudEvent import from " + c.getClassName());
comp.addImport("com.azure.core.models.CloudEvent");
}
});
});
});
customization.getRawEditor().removeFile("src/main/java/com/azure/messaging/eventgrid/namespaces/models/PublishResult.java");
customization.getRawEditor().removeFile("src/main/java/com/azure/messaging/eventgrid/namespaces/models/CloudEvent.java");

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@
import com.azure.messaging.eventgrid.namespaces.models.ReceiveResult;
import com.azure.messaging.eventgrid.namespaces.models.RejectOptions;
import com.azure.messaging.eventgrid.namespaces.models.RejectResult;
import com.azure.messaging.eventgrid.namespaces.models.ReleaseDelay;
import com.azure.messaging.eventgrid.namespaces.models.ReleaseOptions;
import com.azure.messaging.eventgrid.namespaces.models.ReleaseResult;
import com.azure.messaging.eventgrid.namespaces.models.RenewCloudEventLocksResult;
import com.azure.messaging.eventgrid.namespaces.models.RenewLockOptions;
import java.time.Duration;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import reactor.core.publisher.Mono;
import com.azure.core.models.CloudEvent;
import com.azure.messaging.eventgrid.namespaces.models.ReleaseDelay;
import com.azure.core.util.logging.ClientLogger;
import com.azure.core.util.serializer.SerializerEncoding;
import java.io.IOException;
Expand Down Expand Up @@ -278,14 +276,6 @@ public Mono<Response<BinaryData>> acknowledgeCloudEventsWithResponse(String topi
* Release batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully
* accepted. The response body will include the set of successfully released lockTokens, along with other failed
* lockTokens with their corresponding error information.
* <p><strong>Query Parameters</strong></p>
* <table border="1">
* <caption>Query Parameters</caption>
* <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
* <tr><td>releaseDelayInSeconds</td><td>String</td><td>No</td><td>Release cloud events with the specified delay in
* seconds. Allowed values: 0, 10, 60, 600, 3600.</td></tr>
* </table>
* You can add these to a request with {@link RequestOptions#addQueryParam}
* <p><strong>Request Body Schema</strong></p>
*
* <pre>{@code
Expand Down Expand Up @@ -400,66 +390,6 @@ public Mono<Response<BinaryData>> rejectCloudEventsWithResponse(String topicName
requestOptions);
}

/**
* Renew lock for batch of Cloud Events. The server responds with an HTTP 200 status code if the request is
* successfully accepted. The response body will include the set of successfully renewed lockTokens, along with
* other failed lockTokens with their corresponding error information.
* <p><strong>Request Body Schema</strong></p>
*
* <pre>{@code
* {
* lockTokens (Required): [
* String (Required)
* ]
* }
* }</pre>
*
* <p><strong>Response Body Schema</strong></p>
*
* <pre>{@code
* {
* failedLockTokens (Required): [
* (Required){
* lockToken: String (Required)
* error (Required): {
* code: String (Required)
* message: String (Required)
* target: String (Optional)
* details (Optional): [
* (recursive schema, see above)
* ]
* innererror (Optional): {
* code: String (Optional)
* innererror (Optional): (recursive schema, see innererror above)
* }
* }
* }
* ]
* succeededLockTokens (Required): [
* String (Required)
* ]
* }
* }</pre>
*
* @param topicName Topic Name.
* @param eventSubscriptionName Event Subscription Name.
* @param renewLockOptions RenewLockOptions.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return the result of the RenewLock operation along with {@link Response} on successful completion of
* {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<BinaryData>> renewCloudEventLocksWithResponse(String topicName, String eventSubscriptionName,
BinaryData renewLockOptions, RequestOptions requestOptions) {
return this.serviceClient.renewCloudEventLocksWithResponseAsync(topicName, eventSubscriptionName,
renewLockOptions, requestOptions);
}

/**
* Publish Single Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status
* code with an empty JSON object in response. Otherwise, the server can return various error codes. For example,
Expand Down Expand Up @@ -745,31 +675,4 @@ public Mono<RejectResult> rejectCloudEvents(String topicName, String eventSubscr
requestOptions).flatMap(FluxUtil::toMono)
.map(protocolMethodData -> protocolMethodData.toObject(RejectResult.class));
}

/**
* Renew lock for batch of Cloud Events. The server responds with an HTTP 200 status code if the request is
* successfully accepted. The response body will include the set of successfully renewed lockTokens, along with
* other failed lockTokens with their corresponding error information.
*
* @param topicName Topic Name.
* @param eventSubscriptionName Event Subscription Name.
* @param renewLockOptions RenewLockOptions.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the result of the RenewLock operation on successful completion of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<RenewCloudEventLocksResult> renewCloudEventLocks(String topicName, String eventSubscriptionName,
RenewLockOptions renewLockOptions) {
// Generated convenience method for renewCloudEventLocksWithResponse
RequestOptions requestOptions = new RequestOptions();
return renewCloudEventLocksWithResponse(topicName, eventSubscriptionName,
BinaryData.fromObject(renewLockOptions), requestOptions).flatMap(FluxUtil::toMono)
.map(protocolMethodData -> protocolMethodData.toObject(RenewCloudEventLocksResult.class));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@
import com.azure.messaging.eventgrid.namespaces.models.ReceiveResult;
import com.azure.messaging.eventgrid.namespaces.models.RejectOptions;
import com.azure.messaging.eventgrid.namespaces.models.RejectResult;
import com.azure.messaging.eventgrid.namespaces.models.ReleaseDelay;
import com.azure.messaging.eventgrid.namespaces.models.ReleaseOptions;
import com.azure.messaging.eventgrid.namespaces.models.ReleaseResult;
import com.azure.messaging.eventgrid.namespaces.models.RenewCloudEventLocksResult;
import com.azure.messaging.eventgrid.namespaces.models.RenewLockOptions;
import java.time.Duration;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import com.azure.core.models.CloudEvent;
import com.azure.messaging.eventgrid.namespaces.models.ReleaseDelay;
import com.azure.core.util.serializer.SerializerEncoding;
import java.io.IOException;
import java.io.UncheckedIOException;
Expand Down Expand Up @@ -274,14 +272,6 @@ public Response<BinaryData> acknowledgeCloudEventsWithResponse(String topicName,
* Release batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully
* accepted. The response body will include the set of successfully released lockTokens, along with other failed
* lockTokens with their corresponding error information.
* <p><strong>Query Parameters</strong></p>
* <table border="1">
* <caption>Query Parameters</caption>
* <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
* <tr><td>releaseDelayInSeconds</td><td>String</td><td>No</td><td>Release cloud events with the specified delay in
* seconds. Allowed values: 0, 10, 60, 600, 3600.</td></tr>
* </table>
* You can add these to a request with {@link RequestOptions#addQueryParam}
* <p><strong>Request Body Schema</strong></p>
*
* <pre>{@code
Expand Down Expand Up @@ -396,65 +386,6 @@ public Response<BinaryData> rejectCloudEventsWithResponse(String topicName, Stri
requestOptions);
}

/**
* Renew lock for batch of Cloud Events. The server responds with an HTTP 200 status code if the request is
* successfully accepted. The response body will include the set of successfully renewed lockTokens, along with
* other failed lockTokens with their corresponding error information.
* <p><strong>Request Body Schema</strong></p>
*
* <pre>{@code
* {
* lockTokens (Required): [
* String (Required)
* ]
* }
* }</pre>
*
* <p><strong>Response Body Schema</strong></p>
*
* <pre>{@code
* {
* failedLockTokens (Required): [
* (Required){
* lockToken: String (Required)
* error (Required): {
* code: String (Required)
* message: String (Required)
* target: String (Optional)
* details (Optional): [
* (recursive schema, see above)
* ]
* innererror (Optional): {
* code: String (Optional)
* innererror (Optional): (recursive schema, see innererror above)
* }
* }
* }
* ]
* succeededLockTokens (Required): [
* String (Required)
* ]
* }
* }</pre>
*
* @param topicName Topic Name.
* @param eventSubscriptionName Event Subscription Name.
* @param renewLockOptions RenewLockOptions.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return the result of the RenewLock operation along with {@link Response}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<BinaryData> renewCloudEventLocksWithResponse(String topicName, String eventSubscriptionName,
BinaryData renewLockOptions, RequestOptions requestOptions) {
return this.serviceClient.renewCloudEventLocksWithResponse(topicName, eventSubscriptionName, renewLockOptions,
requestOptions);
}

/**
* Publish Single Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status
* code with an empty JSON object in response. Otherwise, the server can return various error codes. For example,
Expand Down Expand Up @@ -731,31 +662,4 @@ public RejectResult rejectCloudEvents(String topicName, String eventSubscription
return rejectCloudEventsWithResponse(topicName, eventSubscriptionName, BinaryData.fromObject(rejectOptions),
requestOptions).getValue().toObject(RejectResult.class);
}

/**
* Renew lock for batch of Cloud Events. The server responds with an HTTP 200 status code if the request is
* successfully accepted. The response body will include the set of successfully renewed lockTokens, along with
* other failed lockTokens with their corresponding error information.
*
* @param topicName Topic Name.
* @param eventSubscriptionName Event Subscription Name.
* @param renewLockOptions RenewLockOptions.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the result of the RenewLock operation.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public RenewCloudEventLocksResult renewCloudEventLocks(String topicName, String eventSubscriptionName,
RenewLockOptions renewLockOptions) {
// Generated convenience method for renewCloudEventLocksWithResponse
RequestOptions requestOptions = new RequestOptions();
return renewCloudEventLocksWithResponse(topicName, eventSubscriptionName,
BinaryData.fromObject(renewLockOptions), requestOptions).getValue()
.toObject(RenewCloudEventLocksResult.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
*/
public enum EventGridServiceVersion implements ServiceVersion {

/**
* Enum value 2023-11-01.
*/
V2023_11_01("2023-11-01"),
/**
* Enum value 2023-06-01-preview.
*/
V2023_06_01_PREVIEW("2023-06-01-preview"),
/**
* Enum value 2023-10-01-preview.
*/
V2023_10_01_PREVIEW("2023-10-01-preview");
V2023_10_01_PREVIEW("2023-10-01-preview"),
/**
* Enum value 2023-11-01.
*/
V2023_11_01("2023-11-01");

private final String version;

Expand All @@ -43,6 +43,6 @@ public String getVersion() {
* @return The latest {@link EventGridServiceVersion}.
*/
public static EventGridServiceVersion getLatest() {
return V2023_10_01_PREVIEW;
return V2023_11_01;
}
}
Loading

0 comments on commit c43c132

Please sign in to comment.